aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/switchdev.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/switchdev.h')
-rw-r--r--include/net/switchdev.h79
1 files changed, 78 insertions, 1 deletions
diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index 8a6d1641fd9b..cfcdac2e5d25 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -11,13 +11,46 @@
11#define _LINUX_SWITCHDEV_H_ 11#define _LINUX_SWITCHDEV_H_
12 12
13#include <linux/netdevice.h> 13#include <linux/netdevice.h>
14#include <linux/notifier.h>
15
16enum netdev_switch_notifier_type {
17 NETDEV_SWITCH_FDB_ADD = 1,
18 NETDEV_SWITCH_FDB_DEL,
19};
20
21struct netdev_switch_notifier_info {
22 struct net_device *dev;
23};
24
25struct netdev_switch_notifier_fdb_info {
26 struct netdev_switch_notifier_info info; /* must be first */
27 const unsigned char *addr;
28 u16 vid;
29};
30
31static inline struct net_device *
32netdev_switch_notifier_info_to_dev(const struct netdev_switch_notifier_info *info)
33{
34 return info->dev;
35}
14 36
15#ifdef CONFIG_NET_SWITCHDEV 37#ifdef CONFIG_NET_SWITCHDEV
16 38
17int netdev_switch_parent_id_get(struct net_device *dev, 39int netdev_switch_parent_id_get(struct net_device *dev,
18 struct netdev_phys_item_id *psid); 40 struct netdev_phys_item_id *psid);
19int netdev_switch_port_stp_update(struct net_device *dev, u8 state); 41int netdev_switch_port_stp_update(struct net_device *dev, u8 state);
20 42int register_netdev_switch_notifier(struct notifier_block *nb);
43int unregister_netdev_switch_notifier(struct notifier_block *nb);
44int call_netdev_switch_notifiers(unsigned long val, struct net_device *dev,
45 struct netdev_switch_notifier_info *info);
46int netdev_switch_port_bridge_setlink(struct net_device *dev,
47 struct nlmsghdr *nlh, u16 flags);
48int netdev_switch_port_bridge_dellink(struct net_device *dev,
49 struct nlmsghdr *nlh, u16 flags);
50int ndo_dflt_netdev_switch_port_bridge_dellink(struct net_device *dev,
51 struct nlmsghdr *nlh, u16 flags);
52int ndo_dflt_netdev_switch_port_bridge_setlink(struct net_device *dev,
53 struct nlmsghdr *nlh, u16 flags);
21#else 54#else
22 55
23static inline int netdev_switch_parent_id_get(struct net_device *dev, 56static inline int netdev_switch_parent_id_get(struct net_device *dev,
@@ -32,6 +65,50 @@ static inline int netdev_switch_port_stp_update(struct net_device *dev,
32 return -EOPNOTSUPP; 65 return -EOPNOTSUPP;
33} 66}
34 67
68static inline int register_netdev_switch_notifier(struct notifier_block *nb)
69{
70 return 0;
71}
72
73static inline int unregister_netdev_switch_notifier(struct notifier_block *nb)
74{
75 return 0;
76}
77
78static inline int call_netdev_switch_notifiers(unsigned long val, struct net_device *dev,
79 struct netdev_switch_notifier_info *info)
80{
81 return NOTIFY_DONE;
82}
83
84static inline int netdev_switch_port_bridge_setlink(struct net_device *dev,
85 struct nlmsghdr *nlh,
86 u16 flags)
87{
88 return -EOPNOTSUPP;
89}
90
91static inline int netdev_switch_port_bridge_dellink(struct net_device *dev,
92 struct nlmsghdr *nlh,
93 u16 flags)
94{
95 return -EOPNOTSUPP;
96}
97
98static inline int ndo_dflt_netdev_switch_port_bridge_dellink(struct net_device *dev,
99 struct nlmsghdr *nlh,
100 u16 flags)
101{
102 return 0;
103}
104
105static inline int ndo_dflt_netdev_switch_port_bridge_setlink(struct net_device *dev,
106 struct nlmsghdr *nlh,
107 u16 flags)
108{
109 return 0;
110}
111
35#endif 112#endif
36 113
37#endif /* _LINUX_SWITCHDEV_H_ */ 114#endif /* _LINUX_SWITCHDEV_H_ */