To notify switch driver of change in STP state of bridge port, add new .ndo op and provide switchdev wrapper func to call ndo op. Use it in bridge code then.
Showing the changes to net/switchdev/switchdev.c (1 of 4 files). Show all
Unified · Split
| @@ -31,3 +31,22 @@ int netdev_switch_parent_id_get(struct net_device *dev, · 30 unmodified lines | ||
| 31 | 31 | return ops->ndo_switch_parent_id_get(dev, psid); |
| 32 | 32 | } |
| 33 | 33 | EXPORT_SYMBOL(netdev_switch_parent_id_get); |
| 34 | + | |
| 35 | +/** | |
| 36 | + * netdev_switch_port_stp_update - Notify switch device port of STP | |
| 37 | + * state change | |
| 38 | + * @dev: port device | |
| 39 | + * @state: port STP state | |
| 40 | + * | |
| 41 | + * Notify switch device port of bridge port STP state change. | |
| 42 | + */ | |
| 43 | +int netdev_switch_port_stp_update(struct net_device *dev, u8 state) | |
| 44 | +{ | |
| 45 | + const struct net_device_ops *ops = dev->netdev_ops; | |
| 46 | + | |
| 47 | + if (!ops->ndo_switch_port_stp_update) | |
| 48 | + return -EOPNOTSUPP; | |
| 49 | + WARN_ON(!ops->ndo_switch_parent_id_get); | |
| 50 | + return ops->ndo_switch_port_stp_update(dev, state); | |
| 51 | +} | |
| 52 | +EXPORT_SYMBOL(netdev_switch_port_stp_update); | |