Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp2640961ybg; Sat, 19 Oct 2019 20:21:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqzgmIYyauBvmT1RPUAE+ia8+WAJxdeS4hZGOoYmRCWN8vtKetsqreLbZPhJHRR6JbN4nfKR X-Received: by 2002:a05:6402:8cf:: with SMTP id d15mr17376511edz.225.1571541719416; Sat, 19 Oct 2019 20:21:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571541719; cv=none; d=google.com; s=arc-20160816; b=rKwU0OFzGxopZqFVFnkyWDKvNb9Z4VCH05OmF+AQYEsA76IqQPq0Oj+IlaF9xKz8ud aLnrmmEO2dxEKTKzx1/7pg+657p0W9v2k/JGrcY0C3hMnpU+UcWfR0B5tx/uCWvACWkK 4Tyyw4HBDRgi00dpKJ6ZtEF8asyDLoFkMJA+oUgfk4TEexiEhxwYQVi89H+f+HmeAj86 tK4btCAXQHGb2cJGXUr6Z+oApNvWudSkhKYQ5E9L9r0PrYT3Jo6VOenbixHuSWFV5T/c 6hxPRMcEkReAxJ6DS0xDvwQEGdGA3TN4vU1QFTF14ag0O1ZWOvcU2N6hdTUm5Il32mme YtsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DiYXjj+rdzvH3hyjdoa4vh5vwNi7WALd3XOKliIHKPs=; b=wM8kEc8mgOETB9APn6oDPRxtuSrTwFCV2dnSNn0uW4J5VMD54XwoMTqpp8q3Nwr1sF Y1vU8BEyKPf/fNAqxoRICACSRb7+fnMfbAubTZ1XCKWy9ra7d2rhkB47QivWW7YM86BD 97zZfndaA+mgSGe9c8Fej6nmTuHJCGIJ5NAYW27paDE0UVcQ1kfSiYhIsZju8zWHfaWS 7olEdsdUeKcCK0CmT7IR/zwrq0x2uairJmohdqY54lCqgqe3bapf40NNNmwOiztm9qah pJWVgNy6plCvFybDKnjxCT5DKvxLSX0YdA4+dsbigdkSC1AJ8TSUYC2fLw44NQ+yVVog Gr8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tRxlI4u+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p14si6713291ejn.192.2019.10.19.20.21.36; Sat, 19 Oct 2019 20:21:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tRxlI4u+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726578AbfJTDUa (ORCPT + 99 others); Sat, 19 Oct 2019 23:20:30 -0400 Received: from mail-qt1-f193.google.com ([209.85.160.193]:43051 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726125AbfJTDUQ (ORCPT ); Sat, 19 Oct 2019 23:20:16 -0400 Received: by mail-qt1-f193.google.com with SMTP id t20so15223061qtr.10; Sat, 19 Oct 2019 20:20:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DiYXjj+rdzvH3hyjdoa4vh5vwNi7WALd3XOKliIHKPs=; b=tRxlI4u+B+ce24ynEdYm96Tq+1+uBH33HQVCvNlQI6nLlG76ooEBY3YdsbHx3F9QyT VFzm/T1H88s7uZafS4vsxM+sZ+4kgVGq7v5yDX4BbfefePA/ZDfyEe0LwrFW9B0zsuGw RwofGehWEiDTHrEwnyJeaIrHeiJl/TPmpq4kbTQKsZaWRwCbDqtfExJV00ACHjoYO/kL aq6G1k56Sz0GBdBXj+f90W5QLZTRN2nwHkQHiholkIjFTxv11kax2i9RmlsaAZ2IUmvF A29Dl+e2/HwtnNpMoMhXy1w28YJ1mi85CmKsX1D0i/J7X9XhnSQL4DcMOH8o9YNh9tS+ +mpg== 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:mime-version:content-transfer-encoding; bh=DiYXjj+rdzvH3hyjdoa4vh5vwNi7WALd3XOKliIHKPs=; b=tZnVWGjtcTRaHC7tG4Wbyiut8f+/ook5KuuU9kf07fX4CkMznJHSJYJcj+Gxa86lGS Pq0xlt7r1Mdeu+XqhLjyLHdKbOf7irak9uqDLdSHghv+uNmPYT5s6RN7H/vT6W1OMjtb Yz0l5LlSk4O96XlAqQEeu6zqk/sOPiYErZM5mhS3NANzoCCzsNI8XbZeVN9kTUkOxc5F TQ/kN+IFqwHpBf8zVe6b1p8Ksf5pXE7DFAEd5gRiU3+Yu7foBkz4FJynoYjbj/aphJNo GRZDSat2yEEPA/Tvo00bDHOF9urBrmf8lYqPJChx12dlt/uXSGwHB3rcdtPsClYZrfKi iX9g== X-Gm-Message-State: APjAAAXJrSBKKBLxEHLi+UMUIEQ11X0q+uEgbCQ1i8zOi9cBtFG0aqfi llj0yfTKGsgNvom71F7NAac= X-Received: by 2002:a0c:8964:: with SMTP id 33mr17992633qvq.241.1571541615655; Sat, 19 Oct 2019 20:20:15 -0700 (PDT) Received: from localhost (modemcable249.105-163-184.mc.videotron.ca. [184.163.105.249]) by smtp.gmail.com with ESMTPSA id q25sm4903902qtr.25.2019.10.19.20.20.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Oct 2019 20:20:15 -0700 (PDT) From: Vivien Didelot To: "David S. Miller" Cc: linux-kernel@vger.kernel.org, Vivien Didelot , Florian Fainelli , Andrew Lunn , netdev@vger.kernel.org Subject: [PATCH net-next 06/16] net: dsa: use ports list for routing table setup Date: Sat, 19 Oct 2019 23:19:31 -0400 Message-Id: <20191020031941.3805884-7-vivien.didelot@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191020031941.3805884-1-vivien.didelot@gmail.com> References: <20191020031941.3805884-1-vivien.didelot@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the new ports list instead of accessing the dsa_switch array of ports when iterating over DSA ports of a switch to set up the routing table. Signed-off-by: Vivien Didelot --- net/dsa/dsa2.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index fd2b7f157f97..84afeaeef141 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -157,6 +157,7 @@ static bool dsa_port_setup_routing_table(struct dsa_port *dp) static bool dsa_switch_setup_routing_table(struct dsa_switch *ds) { + struct dsa_switch_tree *dst = ds->dst; bool complete = true; struct dsa_port *dp; int i; @@ -164,10 +165,8 @@ static bool dsa_switch_setup_routing_table(struct dsa_switch *ds) for (i = 0; i < DSA_MAX_SWITCHES; i++) ds->rtable[i] = DSA_RTABLE_NONE; - for (i = 0; i < ds->num_ports; i++) { - dp = &ds->ports[i]; - - if (dsa_port_is_dsa(dp)) { + list_for_each_entry(dp, &dst->ports, list) { + if (dp->ds == ds && dsa_port_is_dsa(dp)) { complete = dsa_port_setup_routing_table(dp); if (!complete) break; -- 2.23.0