aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorLoic Poulain2020-11-06 18:33:28 +0100
committerJakub Kicinski2020-11-11 15:29:34 -0800
commit0baa99ee353c20e5acce15c675773d6d1b0bda05 (patch)
tree832027a5d91db708060c9efde47d4d96fb726826 /net
parent87f547c108e4a12c3284ca8298d2d81a371f840e (diff)
net: qrtr: Allow non-immediate node routing
In order to reach non-immediate remote node services that are accessed through an intermediate node, the route to the remote node needs to be saved. E.g for a [node1 <=> node2 <=> node3] network - node2 forwards node3 service to node1 - node1 must save node2 as route for reaching node3 Signed-off-by: Loic Poulain <loic.poulain@linaro.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net')
-rw-r--r--net/qrtr/qrtr.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
index d7134c558993..5d9039cb9064 100644
--- a/net/qrtr/qrtr.c
+++ b/net/qrtr/qrtr.c
@@ -401,12 +401,13 @@ static void qrtr_node_assign(struct qrtr_node *node, unsigned int nid)
{
unsigned long flags;
- if (node->nid != QRTR_EP_NID_AUTO || nid == QRTR_EP_NID_AUTO)
+ if (nid == QRTR_EP_NID_AUTO)
return;
spin_lock_irqsave(&qrtr_nodes_lock, flags);
radix_tree_insert(&qrtr_nodes, nid, node);
- node->nid = nid;
+ if (node->nid == QRTR_EP_NID_AUTO)
+ node->nid = nid;
spin_unlock_irqrestore(&qrtr_nodes_lock, flags);
}
@@ -494,6 +495,13 @@ int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len)
qrtr_node_assign(node, cb->src_node);
+ if (cb->type == QRTR_TYPE_NEW_SERVER) {
+ /* Remote node endpoint can bridge other distant nodes */
+ const struct qrtr_ctrl_pkt *pkt = data + hdrlen;
+
+ qrtr_node_assign(node, le32_to_cpu(pkt->server.node));
+ }
+
if (cb->type == QRTR_TYPE_RESUME_TX) {
qrtr_tx_resume(node, skb);
} else {