From patchwork Fri Nov 6 17:33:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 320807 Delivered-To: patch@linaro.org Received: by 2002:a17:906:d156:0:0:0:0 with SMTP id br22csp634164ejb; Fri, 6 Nov 2020 09:27:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJzSFE1zKOb5u8+5zm+vkbjvtG6btQsS0hn4FARK0B7vuypFY/4lwjMoc+qeRlJ1D1JWvgqb X-Received: by 2002:a17:906:4e99:: with SMTP id v25mr3052248eju.242.1604683634913; Fri, 06 Nov 2020 09:27:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604683634; cv=none; d=google.com; s=arc-20160816; b=qeqxyKm17qOKz7htJ1E/lEAIwXkUnTExvdooStqQD3boDCOd9utHwl+5iWBXhHO965 a/zT9ER1bwcNS0D01gWkEa+KQD276aWwhaT++UH8K2Ec7yI+wkZzgm/hcSRHrh5a7ul0 lYjudoczRolaMroc/LZwyGI/kBKqBepAd7CUq1Pf/WNDo9wHbMqLD2PI7q1iwUwn+X8I GAWeOpd9L7K+XifFClOt75fxJgrNnoyE7sLIFG3Wabg198gaI5tt1vcjCiUa8LyuP53X d/PRuDtRUMG1r3IrSbCvXkiMw+RlYQ4pqU1FvPbT3QjFEiUF9PS2CoyBY4Q4fn5UHiHG MXwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=D/092xNhzoeqWVzgOt31RyKE4UUHqVbbhKniatrDYRo=; b=t4n+dIkkZcbRknnqemH77BcLYRHQ1RpL+TKwLUoeQ7+6q8mFQj5KViabVE2Tvj7J1C XOCMqCdEOp3sILyKUKD/wZS3zBFTI0eV5F+nrZlCcF2sQJ528XyFsAnAExsOiQglEs+K AsPs6H/Ym1T1PWw3D02FJkAWok1+NDEubT9EycHnlxF5nPVLbcLENuwQHuLRtPeWSGPg hRGM1OSo5bgDTAWQX1zKrIps/1HiOsBHOt5PaOKczEPT+rjpBiHw+oS5AO1HG98/spBL zqnkXCkNCsCy834RcC2XMdhDUpI+69xKEqXSx6PLluTXtCquY/Y/ETlgbR94UtXOQrhT 51/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zl24+w2P; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o17si1467882ejg.500.2020.11.06.09.27.14; Fri, 06 Nov 2020 09:27:14 -0800 (PST) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zl24+w2P; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727610AbgKFR1O (ORCPT + 8 others); Fri, 6 Nov 2020 12:27:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726075AbgKFR1L (ORCPT ); Fri, 6 Nov 2020 12:27:11 -0500 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0527C0613CF for ; Fri, 6 Nov 2020 09:27:10 -0800 (PST) Received: by mail-wr1-x444.google.com with SMTP id w1so2130467wrm.4 for ; Fri, 06 Nov 2020 09:27:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=D/092xNhzoeqWVzgOt31RyKE4UUHqVbbhKniatrDYRo=; b=zl24+w2P6aoxshLsh+1QU1x0CzQVDdjoH9oEaZ/ehcxJLK3hgvzHf61Swag23oCQ4k D9zvWGX2dMvIpQk1UiK28WQth1hiCyysURF0v7ooOu5IUCy03BGPmvpDrfECte1lW0JQ iplLJzx83969nmuJjVwz9aOlAeIkDVuGGR1wNP+6sBuBRzqJTYNoSLAU/FA9VcMwY0F3 k8lfy+5g3yXe9Wm7pRl0c9nQm81u4u99pIPAlMbCGMBxpRWjqJVQ5IsK0kc3xOPU0vLY B2oxihUKnLGlKUad+E/ZiWX6BX14MDpxna7M2J0T0ayzCFPxURODf2BKMS/2vdIY6eSD Vy+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=D/092xNhzoeqWVzgOt31RyKE4UUHqVbbhKniatrDYRo=; b=EHh2fyQ+KqFEHN9AsTZHS1iJR9Plf3FTWo1yq2mAq7L5qd+PpJ+gkPicpFjBDp6ndL dpKbrkA/Q4ctI+lTn2uzxqBRDqIDfhbWjdGWSYt2ZIvru6rI33fjsGcYSewEv4seHFwC UDJRPluqhiYkDU47G4AU2VvOuIWUYuO+ZXw+m/ZyYTb3QDOlIup9jqsto8313Uvl+Oh2 6I9/JE3XfbXoaIXNgUSqUO6aebnMYRsVn17cDnah54K9D5kzqqENEknLdjabMnQpwbdj nUHFY3Di96OVzrfE1M7OGGJ43PMO8e4rYB97fznp9rTcdZjcJ3ASwAOByUJvFadUr8Ld 3UYQ== X-Gm-Message-State: AOAM5305rDVwGBkupRaZClHWimEakJo4e6X2raA413bk3ZxpPFbdVi57 tkg1pIa2n8otB21O+zCF4pSDSJTSI88AjI/QcNM= X-Received: by 2002:adf:e388:: with SMTP id e8mr3829229wrm.65.1604683629693; Fri, 06 Nov 2020 09:27:09 -0800 (PST) Received: from localhost.localdomain ([88.122.66.28]) by smtp.gmail.com with ESMTPSA id z191sm3183266wme.30.2020.11.06.09.27.08 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Nov 2020 09:27:09 -0800 (PST) From: Loic Poulain To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, manivannan.sadhasivam@linaro.org, cjhuang@codeaurora.org, netdev@vger.kernel.org, Loic Poulain Subject: [PATCH v2 3/5] net: qrtr: Allow non-immediate node routing Date: Fri, 6 Nov 2020 18:33:28 +0100 Message-Id: <1604684010-24090-4-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1604684010-24090-1-git-send-email-loic.poulain@linaro.org> References: <1604684010-24090-1-git-send-email-loic.poulain@linaro.org> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 Reviewed-by: Bjorn Andersson --- net/qrtr/qrtr.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c index e09154b..1d12408 100644 --- a/net/qrtr/qrtr.c +++ b/net/qrtr/qrtr.c @@ -400,12 +400,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); } @@ -493,6 +494,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 {