Re: [PATCH net-next v2 0/3] switchdev: support stp updates on stacked netdevices
From: Scott Feldman <hidden>
Date: 2015-03-15 18:08:03
On Fri, Mar 13, 2015 at 9:31 AM, David Miller [off-list ref] wrote:
From: roopa <redacted> Date: Fri, 13 Mar 2015 06:25:24 -0700quoted
David, if you mean not touch bond and team but have the switchdev api do it transparently, yes, i had it that way initially. And i do liked it that way as well. But the feedback i received (during the initial introduction of this for setlink/dellink) was to make it explicit for each master.I think the concern is that we only want to do this for devices for which it is safe to "traverse" down like this. But frankly I cannot think of any layered device where we would not want to do this. Let's go back to the simple scheme where we unconditionally traverse and if we hit a problem case we'll figure out how to deal with it then, ok?
Here's a way to do it without touching team/bonding/vlan drivers, but
also giving us flexibility to down the road to intercept the call in
the team/bonding/vlan driver and change the behavior by implementing
swdev_port_stp_update in the middle driver.
I would prefer this approach not only for STP updates but also for
port attr set/get calls.
/**
* netdev_switch_port_stp_update - Notify switch device port of STP
* state change
* @dev: bridge port device
* @state: bridge port STP state
*
* Notify switch device port of bridge port STP state change.
*/
int netdev_switch_port_stp_update(struct net_device *dev, u8 state)
{
const struct swdev_ops *ops = dev->swdev_ops;
struct net_device *lower_dev;
struct list_head *iter;
int err = -EOPNOTSUPP;
if (ops && ops->swdev_port_stp_update)
return ops->swdev_port_stp_update(dev, state);
/* Bridged switch device port(s) may be stacked under
* bond/team/vlan dev, so recurse down to stp-update
* them one at a time.
*/
netdev_for_each_lower_dev(dev, lower_dev, iter) {
err = netdev_switch_port_stp_update(lower_dev, state);
if (err && err != -EOPNOTSUPP)
return err;
}
return err;
}
EXPORT_SYMBOL_GPL(netdev_switch_port_stp_update);