diff options
author | Vivien Didelot <vivien.didelot@savoirfairelinux.com> | 2016-02-12 12:09:39 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-02-23 14:52:46 -0500 |
commit | a6692754d61a6b3735803783f394880805675f99 (patch) | |
tree | 5f958180ec0406c7a5616386d36da97eacec5e2d /net/dsa | |
parent | d715fa6431a794e6a8cdb53d87acd3d03ed8a941 (diff) |
net: dsa: pass bridge down to drivers
Some DSA drivers may or may not support multiple software bridges on top
of an hardware switch.
It is more convenient for them to access the bridge's net_device for
finer configuration.
Removing the need to craft and access a bitmask also simplifies the
code.
This patch changes the signature of bridge related functions, update DSA
drivers, and removes dsa_slave_br_port_mask.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa')
-rw-r--r-- | net/dsa/slave.c | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index ab24521beb4d..ab515df5f493 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -385,31 +385,6 @@ static int dsa_slave_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) return -EOPNOTSUPP; } -/* Return a bitmask of all ports being currently bridged within a given bridge - * device. Note that on leave, the mask will still return the bitmask of ports - * currently bridged, prior to port removal, and this is exactly what we want. - */ -static u32 dsa_slave_br_port_mask(struct dsa_switch *ds, - struct net_device *bridge) -{ - struct dsa_slave_priv *p; - unsigned int port; - u32 mask = 0; - - for (port = 0; port < DSA_MAX_PORTS; port++) { - if (!dsa_is_port_initialized(ds, port)) - continue; - - p = netdev_priv(ds->ports[port]); - - if (ds->ports[port]->priv_flags & IFF_BRIDGE_PORT && - p->bridge_dev == bridge) - mask |= 1 << port; - } - - return mask; -} - static int dsa_slave_stp_update(struct net_device *dev, u8 state) { struct dsa_slave_priv *p = netdev_priv(dev); @@ -533,8 +508,7 @@ static int dsa_slave_bridge_port_join(struct net_device *dev, p->bridge_dev = br; if (ds->drv->port_join_bridge) - ret = ds->drv->port_join_bridge(ds, p->port, - dsa_slave_br_port_mask(ds, br)); + ret = ds->drv->port_join_bridge(ds, p->port, br); return ret; } @@ -547,8 +521,7 @@ static int dsa_slave_bridge_port_leave(struct net_device *dev) if (ds->drv->port_leave_bridge) - ret = ds->drv->port_leave_bridge(ds, p->port, - dsa_slave_br_port_mask(ds, p->bridge_dev)); + ret = ds->drv->port_leave_bridge(ds, p->port); p->bridge_dev = NULL; |