swdevice: add new apis to set and del bridge port attributes
Subsystems (3)
PATCH v4 3/7 swdevice: add new apis to set and del bridge port attributes
From: Roopa Prabhu <[email protected]>
This patch adds two new api's netdev_switch_port_bridge_setlink and netdev_switch_port_bridge_dellink to offload bridge port attributes to switch port
(The names of the apis look odd with 'switch_port_bridge', but am more inclined to change the prefix of the api to something else. Will take any suggestions).
The api's look at the NETIF_F_HW_SWITCH_OFFLOAD feature flag to pass bridge port attributes to the port device.
Signed-off-by Roopa Prabhu <[email protected]>
--- include/net/switchdev.h | 37 ++++++++++++++- net/switchdev/switchdev.c | 110 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 146 insertions(+), 1 deletion(-)
include/net/switchdev.h +36 -1
@@ -43,7 +43,14 @@ int register_netdev_switch_notifier(struct notifier_block *nb);int unregister_netdev_switch_notifier (struct notifier_block *nb);int call_netdev_switch_notifiers (unsigned long val,struct net_device *dev,struct netdev_switch_notifier_info *info); - +int netdev_switch_port_bridge_setlink (struct net_device *dev, +struct nlmsghdr *nlh,u16 flags); +int netdev_switch_port_bridge_dellink (struct net_device *dev, +struct nlmsghdr *nlh,u16 flags); +int ndo_dflt_netdev_switch_port_bridge_dellink (struct net_device *dev, +struct nlmsghdr *nlh,u16 flags); +int ndo_dflt_netdev_switch_port_bridge_setlink (struct net_device *dev, +struct nlmsghdr *nlh,u16 flags);#else static inline int netdev_switch_parent_id_get(struct net_device *dev,
@@ -74,6 +81,34 @@ static inline int call_netdev_switch_notifiers(unsigned long val, struct net_devreturn NOTIFY_DONE ; } +static inline int netdev_switch_port_bridge_setlink (struct net_device *dev, +struct nlmsghdr *nlh, +u16 flags) +{ +return -EOPNOTSUPP ; +} + +static inline int netdev_switch_port_bridge_dellink (struct net_device *dev, +struct nlmsghdr *nlh, +u16 flags) +{ +return -EOPNOTSUPP ; +} + +static inline int ndo_dflt_netdev_switch_port_bridge_dellink (struct net_device *dev, +struct nlmsghdr *nlh, +u16 flags) +{ +return 0 ; +} + +static inline int ndo_dflt_netdev_switch_port_bridge_setlink (struct net_device *dev, +struct nlmsghdr *nlh, +u16 flags) +{ +return 0 ; +} +#endif #endif /* _LINUX_SWITCHDEV_H_ */
net/switchdev/switchdev.c +110 -0
113 lines not on this page · raw message
Signature · 1 line
1.7.10.4