From mboxrd@z Thu Jan 1 00:00:00 1970 From: Florian Fainelli Subject: Re: [PATCH RFC 1/2] net: dsa: integrate with SWITCHDEV for HW bridging Date: Tue, 17 Feb 2015 12:24:26 -0800 Message-ID: <54E3A37A.50104@gmail.com> References: <1424201196-4901-1-git-send-email-f.fainelli@gmail.com> <1424201196-4901-2-git-send-email-f.fainelli@gmail.com> <54E3A0D5.5020801@roeck-us.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: davem@davemloft.net, vivien.didelot@savoirfairelinux.com, jerome.oufella@savoirfairelinux.com, andrew@lunn.ch, cphealy@gmail.com To: Guenter Roeck , netdev@vger.kernel.org Return-path: Received: from mail-pa0-f43.google.com ([209.85.220.43]:39168 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751522AbbBQUYj (ORCPT ); Tue, 17 Feb 2015 15:24:39 -0500 Received: by pablf10 with SMTP id lf10so8849961pab.6 for ; Tue, 17 Feb 2015 12:24:38 -0800 (PST) In-Reply-To: <54E3A0D5.5020801@roeck-us.net> Sender: netdev-owner@vger.kernel.org List-ID: On 17/02/15 12:13, Guenter Roeck wrote: > On 02/17/2015 11:26 AM, Florian Fainelli wrote: >> In order to support bridging offloads in DSA switch drivers, select >> NET_SWITCHDEV to get access to the port_stp_update and parent_get_id >> NDOs that we are required to implement. >> >> To facilitate the integratation at the DSA driver level, we implement 3 >> types of operations: >> >> - port_join_bridge >> - port_leave_bridge >> - port_stp_update >> >> DSA will resolve which switch ports that are currently bridge port >> members as some Switch hardware/drivers need to know about that to limit >> the register programming to just the relevant registers (especially for >> slow MDIO buses). >> >> Signed-off-by: Florian Fainelli >> --- >> include/net/dsa.h | 10 +++++ >> net/dsa/Kconfig | 1 + >> net/dsa/dsa.c | 7 ++++ >> net/dsa/dsa_priv.h | 2 + >> net/dsa/slave.c | 117 >> +++++++++++++++++++++++++++++++++++++++++++++++++++++ >> 5 files changed, 137 insertions(+) >> >> diff --git a/include/net/dsa.h b/include/net/dsa.h >> index ed3c34bbb67a..92be34791963 100644 >> --- a/include/net/dsa.h >> +++ b/include/net/dsa.h >> @@ -275,6 +275,16 @@ struct dsa_switch_driver { >> int (*get_regs_len)(struct dsa_switch *ds, int port); >> void (*get_regs)(struct dsa_switch *ds, int port, >> struct ethtool_regs *regs, void *p); >> + >> + /* >> + * Bridge integration >> + */ >> + int (*port_join_bridge)(struct dsa_switch *ds, int port, >> + u32 br_port_mask); >> + int (*port_leave_bridge)(struct dsa_switch *ds, int port, >> + u32 br_port_mask); >> + int (*port_stp_update)(struct dsa_switch *ds, int port, >> + u8 state); >> }; >> >> void register_switch_driver(struct dsa_switch_driver *type); >> diff --git a/net/dsa/Kconfig b/net/dsa/Kconfig >> index 5f8ac404535b..b45206e8dd3e 100644 >> --- a/net/dsa/Kconfig >> +++ b/net/dsa/Kconfig >> @@ -8,6 +8,7 @@ config NET_DSA >> tristate >> depends on HAVE_NET_DSA >> select PHYLIB >> + select NET_SWITCHDEV > > Should this be "select" or "depends on" ? > > Downside of depends is that we'll need some ifdefs in the code, > but on the other side it would let people disable it if it is > not needed. The code overhead is not huge, and I would think that by enforcing NET_SWITCHDEV we encourage better DSA driver practices and promote HW bridging, if you think this should be made conditional, I guess we can do that. -- Florian