Add support for QRTR to forward messages between network clusters. The
network subnet id's are attached to the QRTR subnodes in the MHI and
RPMSG/GLINK nodes.
The current forwarding decisions are done based on the net ids and are
wrapped in a single function for easier maintenance of forwarding
decisions later on. The function will return true once it determines
a subnet has no connection to another subnet.
The NEW_SERVER, DEL_SERVER, and DEL_CLIENT control messages should be
forwarded while the DATA and RESUME_TX commands should be passed along
to their destination node.
The nameservice is expected to send NEW_SERVER commands for it's entire
database instead of just the local service database with these changes.
This is to make sure new nodes get service notifications that came
earlier and were meant to be forwarded to the new node.
This change squashes the following commits from msm-4.14:
commit e5f6a6769ceb ("net: qrtr: Add forwarding support based on net id")
commit 4516ab18718d ("net: qrtr: avoid deadlock in case of recursive
lock for node list")
commit dc2d47cd12d3 ("net: qrtr: Only update pkts with broadcast node
ID")
commit 4277aebeff91 ("net: qrtr: Free skb if qrtr_node_lookup fails
during qrtr_fwd_pkt")
In addition fix minor format issues and update copyright.
Change-Id: Iaf01dd212b07dfbb13ec087ea0aae980cda7c2fd
Signed-off-by: Chris Lew <clew@codeaurora.org>
QRTR should support asynchronous sends even with the tx flow control
enabled. Add a timeout to the tx_wait and send a zero size packet to
nonblocking sockets after the remote port is no longer flow controlled.
This zero size packet will act as a notification for clients to start
sending again.
This change squashes the following commits from msm-4.14:
commit 5dff60d7bb53 ("net: qrtr: Add non blocking option for tx_resume")
commit aff4c897bcf5 ("net: qrtr: Fix missing resume_tx notification")
commit c969cce741fc ("net: qrtr: Rearrange tx wait and protect critical
section")
In addition fix minor format issues.
Change-Id: I4b2a145b9507aa18ff08ef58e5620b72952f7f5f
Signed-off-by: Chris Lew <clew@codeaurora.org>
There will be non-atomic work associated with receiving the tx resume
packet from the remote. Move the handling to work function context in
preparation for the non-blocking socket blocking improvement.
Change-Id: I2389bdcffba068258650bfbb579f8cb98a0ac928
Signed-off-by: Chris Lew <clew@codeaurora.org>
An ept can represent multiple nodes in a system. If an ept unregisters,
qrtr should send a BYE control message for all the nodes that it
represents. Iterate through the node tree to find all the nodes that
belong to the ept.
Change-Id: I641bba615e689f59acecc9ac87fec61c3eecc0d1
Signed-off-by: Chris Lew <clew@codeaurora.org>
The remote processor will not forward a hello packet for the other
processors that it is forwarding from. Discover nodes through
QRTR_TYPE_NEW_SERVER messages as well in order to find remote hosts
which require more than one hop to reach it.
Change-Id: Ia79df1fa2730250786d221fb847029046a53bea4
Signed-off-by: Gustavo Solaira <gustavos@codeaurora.org>
Signed-off-by: Chris Lew <clew@codeaurora.org>
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 <clew@codeaurora.org>
An ept can be associated with multiple node ids in network. The node
tree should keep track of how to send to a specific node id where as
the node list should keep track of all the adjacent nodes in the
network. Use the node list to broadcast control messages to adjacent
nodes.
Change-Id: If0f4828da149b6e590525518a8410f497f5e3894
Signed-off-by: Chris Lew <clew@codeaurora.org>
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.
This change squashes the following commits from msm-4.14:
commit 5121b211a5e6 ("net: qrtr: Use skb with fragments in memory
failure case")
commit bdc91a0dae07 ("net: qrtr: use alloc_skb_with_frag() in rx path")
In addition, fix minor format issues and update the copyright.
Change-Id: I46b7e0da0ed04c9222c975ee930f0f8d9b41453b
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
sk_error_report callback function called without validating cause the NULL
pointer dereference.
Validate function pointer before using for error report.
Change-Id: I19d04f85a5457f3857623088f8e0578514f0c395
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
The current implementation of the control port bind releases and
reacquires the port lock between allocating the port idr and resetting
the existing sockets. This creates a race condition where sockets
can send to the control port during the control port bind. Hold the
lock for the duration of the control port bind to prevent this.
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 <clew@codeaurora.org>
There is a race between releasing a socket and a sock structure. Skbs
still in flight may hold references to the sock structure, preventing
it from being freed when the socket is released. Detach the socket in
the release call to prevent references to that sockets resources.
Change-Id: I44ac553cf73b3a2148ce50d7552c39b08f5e0f91
Signed-off-by: Chris Lew <clew@codeaurora.org>
Because of removing endpoint delay when the stop channel failed case
observing some junk packets received on a pipe. To avoid junk packets,
add change to avoid endpoint delay if stopping GSI channel fails.
Change-Id: I4d3d8d9a0de823229d780fe31c8d7f1162e20668
Signed-off-by: Ashok Vuyyuru <avuyyuru@codeaurora.org>
Add api to write to mpm wakeup registers to configure a gpio
as wakeup capable.
Change-Id: Ia11a22160394e76969200691cfaf8fb1505bf5c1
Signed-off-by: Rishabh Bhatnagar <rishabhb@codeaurora.org>
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
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 this the lookup packets.
Change the idr_alloc to idr_alloc_cyclic so new idr's are allocated
instead of trying to reuse the freed idrs.
Change-Id: Ie1bda7a818309503f80542e739bac646327296f7
Signed-off-by: Chris Lew <clew@codeaurora.org>
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 <clew@codeaurora.org>
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.
This change squashes the following commits from msm-4.14:
commit 3373eb77cd6d ("net: qrtr: Add socket mode optimization")
commit d984a2d6f150 ("net: qrtr: Make servers multi state ports")
In addition, fix minor format issues.
Change-Id: I416742cff598bf7aa9da2baa2e86a53b18367870
Signed-off-by: Chris Lew <clew@codeaurora.org>
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.
This change squashes the following commits from msm-4.14:
commit abd3961d05be ("qrtr: Only broadcast to initialized nodes")
commit 90cb0e473226 ("net: qrtr: Do not send packets before Hello
negotiation")
commit 07abd1abe803 ("net: qrtr: Fix hello packet drop memory leak")
In addition, fix minor format issues.
Change-Id: I2a55e587f324e64e2bde4ea634de66008f190de1
Signed-off-by: Chris Lew <clew@codeaurora.org>
The for_each_[available]_child_of_node iterators implicitly
increment the reference count on the current OF node at the
start of the iteration, and decrements it at the end of the
iteration.
However, if the control flow is such that the loop
can be broken out of prior to finishing an iteration, then
the reference count must be decremented in the subsequent
code path.
Thus, fix the error path in the MSM ION code to decrement the
reference on the current OF node when prematurely exiting
an of_node loop.
Change-Id: I5c2ec02a57eff416c04b1fe63c80d6e573a692d4
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
Island IO can be assigned to Apps TLMM dynamically
if that island is not using the pin for any connectivity.
Add support for enabling EGPIO feature if the pin can
support it. EGPIO_PRESENT bit shows if EGPIO feature
is present or not for particular pin. Once EGPIO_ENABLE
bit is set the pin is now controlled by Apps TLMM.
When pinctrl properties are getting initialized by device
driver framework, pin functions select would call to
msm_pinmux_set_mux function to select pin function and
enable EGPIO.
Change-Id: I64514904096286f2a5df351880cd56d753f0658f
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
Signed-off-by: Rishabh Bhatnagar <rishabhb@codeaurora.org>
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
Lahaina uses different pipe endpoint mappings and group resources.
This change captures these configurations.
Change-Id: Ib45848bb52d9a6680b38b4305cbab38c0b00e7d2
Acked-by: Priyadarshini Rajagopal <prajagop@qti.qualcomm.com>
Signed-off-by: Bojun Pan <bojunp@codeaurora.org>
Remote IPC Router drivers expect the received packet to be aligned.
This case is only exposed using the MHI transport because it does not
ensure the packet will be received as one chunk like RPMSG GLINK.
Change-Id: I0e5c27e3c5896e6721c8bbbfcda29551f0968626
Signed-off-by: Chris Lew <clew@codeaurora.org>
Rather than enqueuing messages and scheduling a worker to deliver them
to the individual sockets we can now, thanks to the previous work, move
this directly into the endpoint callback.
This saves us a context switch per incoming message and removes the
possibility of an opportunistic suspend to happen between the message is
coming from the endpoint until it ends up in the socket's receive
buffer.
Change-Id: I7177fa36f9d7cc7e5de5f24975f15284ef1fcc80
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Patch-mainline: linux-arm-kernel @ 07/05/19, 23:06
Signed-off-by: Chris Lew <clew@codeaurora.org>
sk_user_data can be protected with RCU instead of calling the callback
rwlock. RCU will ensure the pointer obtained in qmi_data_ready is
formed properly and cleanup can synchronize before continuing in handle
release.
Change-Id: I6a687bd7b311fe169a89cb959ae755730b81a9f1
Signed-off-by: Chris Lew <clew@codeaurora.org>
Add a Kconfig flag to differentiate between a GKI and an Non GKI build.
CONFIG_QGKI is enabled if the build is a Non GKI variant (QGKI or debug).
This flag doesn't differentiate between QGKI and debug variants.
Change-Id: I6b53b1e0e4c071fc7d9b365ff374ffe4e8b3e8ba
Signed-off-by: Prakruthi Deepak Heragu <pheragu@codeaurora.org>
Add debugfs node for ion which prints out the debug_show
of all the heaps within ion.
Change-Id: I8499967c8f202b079b6ccbe1c31cb38ee6a51374
Signed-off-by: Sudarshan Rajagopalan <sudaraja@codeaurora.org>
[isaacm@codeaurora.org: Rework to move logic out of ION core]
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
Allow the system heap to expose debug information about the pools
through debugfs.
Change-Id: Id11706648b32260f19dff8d3f5cced1733a05978
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
Allow ION clients to be able to determine the VM information associated
with an ION buffer, such as the VMIDs it is assigned to as well as the
VM permissions.
Change-Id: Id0be0b505bc84beff373e4e2ae16b71ec4f09d43
Signed-off-by: Liam Mark <lmark@codeaurora.org>
[isaacm@codeaurora.org: Relocate changes to new header locations]
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
Remove support for passing parameters via platform_data now that
relevant targets use devicetree.
Change-Id: I2d8398163b5a4f358e257f416fd0e0c325664154
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
[isaacm@codeaurora.org: Relocated changes to correct file]
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>