Increase the socket recvbuf for the ns so control packets are not
dropped in heavy traffic situations. This change will not
actually set the recvbuf to INT_MAX but to the system defined rmem_max
for sockets.
Change-Id: I860cc1052080cc6e683b44bef1dd9f8fc1899f31
Signed-off-by: Jay Jayanna <jayanna@codeaurora.org>
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
If worker is not processing packets on control port fast enough,
socket buffer may get full and result in drop of control packets.
Creating dedicated worker thread to process control packets.
CRs-Fixed: 2763561
Change-Id: I4585015cef2a507a9ba13014cd93f40e60f8a25a
Signed-off-by: Deepak Kumar Singh <deesin@codeaurora.org>
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
By enabling this flag init_boot.img will be generated if
the header version is 4.
Change-Id: I8a01d10cee8142ef900376d7e3d29f1b49e80d00
Signed-off-by: Gokul krishna Krishnakumar <quic_gokukris@quicinc.com>
Adding Bootconfig to kernel command line to support
the version change.
Change-Id: I24b667e494e5bbf14397f16d9ef7219634f3f17b
Signed-off-by: Gokul krishna Krishnakumar <quic_gokukris@quicinc.com>
sched_trace_rd_span is removed upstream. Restore the function locally.
Change-Id: I066be161e1da49b11de10f034e8f46a4c1510391
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
sched_switch tracehook has been changed upstream. Update functions
registered with tracehook accordingly.
Change-Id: Ifba53f905634b476c60a8c69cfd87c6ad0c9cff7
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
group_first_cpu() is removed upstream. Expand the function in all the
places that it is used.
Change-Id: I04f4f9e2b37fca897ee45165b1976e1bec83f5bd
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
The rq_relock() function is removed upstream. Replace all instances of it
by expanding the function.
Change-Id: I7b99d46d552695ae0afdf75f3a6033b80376fe01
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
Replace HK_FLAG_TIMER with HK_TYPE_TIMER because HK_FLAG_TIMER is
removed upstream.
Change-Id: I6432556b6148030c8c6621cd0790d8906e0c94ec
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
Due to reorganization of sched header files upstream, include missing
header files.
Change-Id: Iab3cda49a71b6a0f3f98194f975031716df47736
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
The Android Common Kernel has updated the enqueue,dequeue tracehooks.
Update the tracehooks accordingly.
Change-Id: Idb2efdb2f70288721c9100850e9cb344328a2c42
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
The Android Common Kernel has replaced the irq accounting tracehook.
Update the tracehook accordingly.
Change-Id: I4d0d2e7a4d5a6d567ac2c1edaae4d050b1c82ac0
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
Due to reorganization of tracehooks upstream, topology.h does not exist
anymore. Remove the associated header.
Change-Id: Ib4c7e630dfbefd6965524f91101784a57327af39
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
struct task_struct does not contain a member to store task cpu
information anymore. Instead, use task_thread_info() to obtain that
information.
Change-Id: I8fc9ef4ebf11f6fccd6ecbe68d768ac48d2928c5
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
Add a tracepoint to the whitelist to be used in the UBWC-P heap.
Change-Id: I333c00519101b45840a32f340824450ebc385d28
Signed-off-by: Chris Goldsworthy <quic_cgoldswo@quicinc.com>
Move sys heap allocation code into the system_qcom_sg_buffer_alloc()
function to allow core allocation code to be used from other modules.
Additionally, move the allocation of the struct qcom_sg_buffer
out of system_qcom_sg_buffer_alloc(), so that other modules can
allocate their own buffer structs with qcom_sg_buffer as an embedded
member.
Each other module will then have dmabuf->priv pointing to the
qcom_sg_buffer member of their custom buffer struct. This is needed
to allow the qcom_sg_ops.c functions to continue working as is.
Change-Id: Id11ca188163e5c3ceba28852c2cfe8f0acde4591
Signed-off-by: Chris Goldsworthy <quic_cgoldswo@quicinc.com>
Add the declarations needed for the DMA-BUF heap driver to call into
the UBWC-P driver.
Change-Id: Id1bb19410025b858a2154eae39ac0c28e4d6235c
Signed-off-by: Chris Goldsworthy <quic_cgoldswo@quicinc.com>
When lookup fails, print the service path along with the
service name since the service name might not be unique.
Change-Id: I614d6c0a8d6cb8a83b47795315811fbf47bb6e48
Signed-off-by: Siddharth Gupta <sidgup@codeaurora.org>
Signed-off-by: Gokul krishna Krishnakumar <quic_gokukris@quicinc.com>
When a del client message is received from remote, the corresponding
server port is deleted. And then, a del server message is announced
for this server. As part of handling this message, ns will try to
delete this server port again and returns a -ENOENT error. Return
value from server_del is returned back to qrtr_ns_worker and any
non-zero value is printed to the serial port. This is flooding the
serial port display. Returinng 0 in this case as this is not an error.
Change-Id: Icd2594875f55313baa6e3313b6aa0c62facc5b2d
Signed-off-by: Jay Jayanna <jayanna@codeaurora.org>
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
In external soc usecases, it is possible to receive control
messages for a node that is not the src node. The APPS on the
external soc will forward control messages from the modem.
Change-Id: Ibbf8f27fa64b18e387e40e655a13b5251190a00b
Signed-off-by: Tony Truong <truong@codeaurora.org>
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
There is a use after free scenario while iterating through the servers
radix tree despite the ns being a single threaded process. This can
happen when the radix tree APIs are not synchronized with the
rcu_read_lock() APIs.
Convert the radix tree for servers to xarray to take advantage of the
built in rcu lock usage provided by xarray.
Change-Id: I1d9b017da4efba9d8fc72e4666253060cc7b87e3
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
There is a use after free scenario while iterating through the servers
radix tree despite the ns being a single threaded process. This can
happen when the radix tree APIs are not synchronized with the
rcu_read_lock() APIs.
Convert the radix tree for nodes to xarray to take advantage of the
built in rcu lock usage provided by xarray.
Change-Id: If2f735abf911b7b47cd7cb07224751114a2bf943
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
The destination port value in the IPCR control buffer on older
targets is 0xFFFF. Handle the same by updating the dst_port to
QRTR_PORT_CTRL.
Change-Id: Ia70ce1c078ea84f0de47240f6fc3e764f4ae7a6f
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
Socket client's should be able to block on recv without blocking other
socket operations such as sending. The qrtr core logic should also be
able to operate on the sock while a client is blocked in recv. Remove
the sock lock from around the recv_datagram to allow execution to
continue while a client is blocked in recv.
Change-Id: I6adb09b8e44c5ff3542b88db87b376a3ae5cb5ba
Signed-off-by: Jay Jayanna <jayanna@codeaurora.org>
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
Post function is called from interrupt context. Returning same
error code in all cases rsults in excessive prints which can
cause irq throttling.
Return -ENODEV when port lookup fails in post function.
CRs-Fixed: 2790559
Change-Id: I75384b2116cb2fe1bbeaa2dac91157345f0bab54
Signed-off-by: Deepak Kumar Singh <deesin@codeaurora.org>
Signed-off-by: Jay Jayanna <jayanna@codeaurora.org>
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
Add missing node reference put when memory allocation fails for the
tx_resume packet. Without this there could be dangling references
to a node.
Change-Id: I5a5dfa437243a39d3da660251c0357ff6eb6cbff
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
The node list only respresents the adjacent nodes in the system. Rename
the list to qrtr_all_epts to better describe the list contents. Rename
qrtr_nodes_lock to qrtr_epts_lock to better describe lock.
Change-Id: I168ca597d5b9b30d6c064c2a56b6e8b2dffa387b
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
First check if the node is already assigned the requested nid, this
allows an early exit for the common case.
Do not allow later nodes to overwrite a node id. The first to claim a
node id should get priority.
Change-Id: Ie3da0c3b709de8c68f9918cd485492f9eaa41247
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
net_dev_alloc() fails for high order allocations in system where memory
is fragmented and cause communication stall due to packet drops.
Use alloc_skb_with_frags() to avoid packet drops in memory fragmented case.
Change-Id: I46b7e0da0ed04c9222c975ee930f0f8d9b41453b
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
In order to prevent messages from stale sockets being sent, check if
ENETRESET has been set on the socket and drop the packet.
Change-Id: Ie9abc6c51139e82d3c9ebd4d546d1acd7269875e
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
There is a race for clients that open sockets before the control port
is bound. If a client gets an idr that was allocated before the control
port is bound, there is a chance the previous address owner sent lookup
packets to the control port. The new address owner will get residual
responses to these lookup packets.
Change the xa_alloc to xa_alloc_cyclic so new ids are allocated
instead of trying to reuse the freed ids.
Change-Id: Ie1bda7a818309503f80542e739bac646327296f7
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
There is a chance for a remote processor to become unresponsive while
QRTR is trying to broadcast a control message. This results in the node
lock being held for an extended period of time and prevents node lookup
which is needed to send messages.
Change the mutex to a rw_semaphore to allow concurrency during node
lookups and broadcasts.
Change-Id: I2e3fdde22edaac64f164cf08900e9d09b16c380d
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
A remote endpoint should not need to know when a client socket is freed
if the socket never established commnication with the endpoint. Add a
mode to keep track of which endpoints a socket communicates with.
There are three modes a socket can be in:
INIT - Socket has not sent anything or only local messages,
only send client close to local services.
SINGLE - Socket has sent messages to a single ept, send event
to this single ept.
MULTI - Socket has sent messages to multiple epts, broadcast
release of this socket.
Server state changes should be broadcast throughout the system. Change
the ipc state of a port when it sends a NEW SERVER control packet. This
ensures the DEL CLIENT control packet is propagated correctly for
servers.
Change-Id: I416742cff598bf7aa9da2baa2e86a53b18367870
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
There is a race where broadcast packets can be sent to a node that has
not sent the hello message to the remote processor. This breaks the
protocol expectation. Add a status variable to track when the hello
packet has been sent.
An alternative solution attempted was to remove the nodes from the
broadcast list until the hello packet is sent. This is not a valid
solution because hello messages are broadcasted if the ns is restarted
or started late. There needs to be a status variable separate from the
broadcast list.
Change-Id: I2a55e587f324e64e2bde4ea634de66008f190de1
Signed-off-by: Chris Lew <quic_clew@quicinc.com>