Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp2640228ybg; Sat, 19 Oct 2019 20:21:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqxp7sqa/eH1jL4D/JZT330MGji+IA0ZZFrrGcpGsPRNNDzWo8OSSjT2km6YhuD27w5rDgJf X-Received: by 2002:aa7:cd06:: with SMTP id b6mr18324709edw.58.1571541661348; Sat, 19 Oct 2019 20:21:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571541661; cv=none; d=google.com; s=arc-20160816; b=lh4dyXSyJPL2gSrXPEOpRuWHQd6AFBMMiE5CVPnvZkRhYITbtSislI3NLopRkVZjh5 shY5fdQVnyShB3UZzpqes0ZQmujhfDp6CD+flzxQzIU1M7tuaLwUTVeU6/4KbF6t3BKO e7Yn2/Y/5IWzGSrfJWiVXS2NOyRxDDt4BqxVe3j2f5TxtFwcurxoAt100P2BeQKqbmFA zcTQntAX6GFfLb/ierL/PAliDLau/GPp2rFYOauQUm0InRZOCT9ry0yULLZlVow/IXGE Bi+s8g5SxDw0fBQv51DlZDgznGQ5t5UtrNzJVJfZQvjdQ4Rg/jsod2e+GWi6Yl/7tmBb 7XUQ== 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=j9hDHfsSAKK+yajqRer2bUPE7TxRgMBzPOn+n08Gyj4=; b=gtSCjfMtHUJmtiRCVntZ2ljiU4Z4h0+ZIhiNwVGJge+jPNKNEB9MwEV0hxIMWahxAu Euz8dwzoEqrXWuohbNyJPgCuZ7n+RVg5z2kunh9GnDcZMu2UMw7ZbIlLn/QUwjT3ZCAd D+ozlklm5DAnUS5riYYPeJKfPdwjJPL/Vq1C6i0DkXCb4waNZ/NXyGVSliYOac/BhUUb +jswqXDrNewN353BE/5pfd6X1YCRXUnqafPT2aeZ+pvqsqEDWrAsIEfMNQXTGxTOpGxK OVxF9ZsAvkERcDOrjHzV0Xxg8w9Cn1pnk5ZF+9ellCrQjp9bHpu6tkyf8Wtve0UT07Xv 1OZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PjdrYfVG; 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 z1si6263420ejp.435.2019.10.19.20.20.37; Sat, 19 Oct 2019 20:21:01 -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=PjdrYfVG; 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 S1726472AbfJTDUV (ORCPT + 99 others); Sat, 19 Oct 2019 23:20:21 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:41394 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726436AbfJTDUT (ORCPT ); Sat, 19 Oct 2019 23:20:19 -0400 Received: by mail-qt1-f195.google.com with SMTP id c17so12253684qtn.8; Sat, 19 Oct 2019 20:20:18 -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=j9hDHfsSAKK+yajqRer2bUPE7TxRgMBzPOn+n08Gyj4=; b=PjdrYfVGdYPMFjrMWWt2SOPJ3ML/vTGkTbpPs1vepNzjDygt2q/VdB8doop4iLs2se h057Dv4X9HnXLC6TCa+UGQRJdbgyuCLw7bwK5psIc79YZvCdgWG6vfI3A4QENpj3w+4H dU9ETm6mqWYApWp1mlPqNcr17PRXjGFyg7WoZw18OYvMiOEnj96LO2toG77A+Q8ZhMs5 Xw2fYYSltHokvZwTBpKSgcr3qUayEjucUa/dKC8Exex4uqRa4r3fCw3btBpvDcOhYNR0 BQMSx7pKIIKpnp3hskq50pOEg7YuEnrEDThfSBHDNaSF7hJHoXgTmMR/JsWkurySZcPf Rkqg== 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=j9hDHfsSAKK+yajqRer2bUPE7TxRgMBzPOn+n08Gyj4=; b=RNnZEIBpDpiJuil8HJwij2HWxPMtZ3VXUVtORXjvBb0rXemv6kJB/rBDv+Zuhz7GB2 iNvn5ETz2sb0s8i+aeKcvI0IVtLaY8r0zd4b+Wx2yNeHThuhsjip1UK2n3vdcqZndWXI +J12tsW6otOUW0iC7fQ2EsC+GkvZ+YN82pcAMqWqtfWmAezhSfBeNpvverfVJhgw9hLn GwA78D7uT7AJMpNN3O6Ljr4YCySHe0/Qb/JWDeqFqJk4H2d9fhK5gmkWwnVfKxfRodha RUTinuLhvXhFhQc3j+wbYfzj6xFF+BflOMzzpTV5B3U/fAGvKnGySgErrNaFJ9+rE0vF vzMg== X-Gm-Message-State: APjAAAWXqhLN07ttOk6rFHqi9tKIgQQE3u7DGKpEg5RsQTJq3cZW0bro UHVbQEzakrW9Ud5t+j7c8O00MeI4 X-Received: by 2002:ac8:27b7:: with SMTP id w52mr18395725qtw.78.1571541618477; Sat, 19 Oct 2019 20:20:18 -0700 (PDT) Received: from localhost (modemcable249.105-163-184.mc.videotron.ca. [184.163.105.249]) by smtp.gmail.com with ESMTPSA id g10sm5507994qki.41.2019.10.19.20.20.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Oct 2019 20:20:17 -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 08/16] net: dsa: use ports list to setup multiple master devices Date: Sat, 19 Oct 2019 23:19:33 -0400 Message-Id: <20191020031941.3805884-9-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 Now that we have a potential list of CPU ports, make use of it instead of only configuring the master device of an unique CPU port. Signed-off-by: Vivien Didelot --- net/dsa/dsa2.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index 8b038cc56769..3b8de155bc0b 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -501,19 +501,27 @@ static void dsa_tree_teardown_switches(struct dsa_switch_tree *dst) static int dsa_tree_setup_master(struct dsa_switch_tree *dst) { - struct dsa_port *cpu_dp = dst->cpu_dp; - struct net_device *master = cpu_dp->master; + struct dsa_port *dp; + int err; - /* DSA currently supports a single pair of CPU port and master device */ - return dsa_master_setup(master, cpu_dp); + list_for_each_entry(dp, &dst->ports, list) { + if (dsa_port_is_cpu(dp)) { + err = dsa_master_setup(dp->master, dp); + if (err) + return err; + } + } + + return 0; } static void dsa_tree_teardown_master(struct dsa_switch_tree *dst) { - struct dsa_port *cpu_dp = dst->cpu_dp; - struct net_device *master = cpu_dp->master; + struct dsa_port *dp; - return dsa_master_teardown(master); + list_for_each_entry(dp, &dst->ports, list) + if (dsa_port_is_cpu(dp)) + dsa_master_teardown(dp->master); } static int dsa_tree_setup(struct dsa_switch_tree *dst) -- 2.23.0