Thread (65 messages) 65 messages, 8 authors, 2015-03-04

Re: [PATCH RFC 1/2] net: dsa: integrate with SWITCHDEV for HW bridging

From: Guenter Roeck <linux@roeck-us.net>
Date: 2015-02-17 20:28:54

On 02/17/2015 12:24 PM, Florian Fainelli wrote:
On 17/02/15 12:13, Guenter Roeck wrote:
quoted
On 02/17/2015 11:26 AM, Florian Fainelli wrote:
quoted
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 <f.fainelli@gmail.com>
---
   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.
For sure not me ... I am happy forcing it. In my use case it would
always be enabled. I just don't want to go too far along that route
just to have to add a bunch of ifdefs later on.

Guenter
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help