Thomas Gleixner | 2874c5f | 2019-05-27 08:55:01 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Jiri Pirko | 007f790 | 2014-11-28 14:34:17 +0100 | [diff] [blame] | 2 | /* |
| 3 | * include/net/switchdev.h - Switch device API |
Jiri Pirko | 7ea6eb3 | 2015-09-24 10:02:41 +0200 | [diff] [blame] | 4 | * Copyright (c) 2014-2015 Jiri Pirko <jiri@resnulli.us> |
Scott Feldman | f8f2147 | 2015-03-09 13:59:09 -0700 | [diff] [blame] | 5 | * Copyright (c) 2014-2015 Scott Feldman <sfeldma@gmail.com> |
Jiri Pirko | 007f790 | 2014-11-28 14:34:17 +0100 | [diff] [blame] | 6 | */ |
| 7 | #ifndef _LINUX_SWITCHDEV_H_ |
| 8 | #define _LINUX_SWITCHDEV_H_ |
| 9 | |
| 10 | #include <linux/netdevice.h> |
Jiri Pirko | 03bf0c2 | 2015-01-15 23:49:36 +0100 | [diff] [blame] | 11 | #include <linux/notifier.h> |
Jiri Pirko | 7ea6eb3 | 2015-09-24 10:02:41 +0200 | [diff] [blame] | 12 | #include <linux/list.h> |
Jiri Pirko | 850d0cb | 2015-10-14 19:40:51 +0200 | [diff] [blame] | 13 | #include <net/ip_fib.h> |
Jiri Pirko | 03bf0c2 | 2015-01-15 23:49:36 +0100 | [diff] [blame] | 14 | |
Scott Feldman | 3094333 | 2015-05-10 09:47:48 -0700 | [diff] [blame] | 15 | #define SWITCHDEV_F_NO_RECURSE BIT(0) |
Scott Feldman | 464314e | 2015-10-08 19:23:18 -0700 | [diff] [blame] | 16 | #define SWITCHDEV_F_SKIP_EOPNOTSUPP BIT(1) |
Jiri Pirko | 0bc05d5 | 2015-10-14 19:40:50 +0200 | [diff] [blame] | 17 | #define SWITCHDEV_F_DEFER BIT(2) |
Scott Feldman | 3094333 | 2015-05-10 09:47:48 -0700 | [diff] [blame] | 18 | |
Jiri Pirko | 7ea6eb3 | 2015-09-24 10:02:41 +0200 | [diff] [blame] | 19 | struct switchdev_trans { |
Jiri Pirko | f623ab7 | 2015-09-24 10:02:49 +0200 | [diff] [blame] | 20 | bool ph_prepare; |
Jiri Pirko | 7ea6eb3 | 2015-09-24 10:02:41 +0200 | [diff] [blame] | 21 | }; |
| 22 | |
Jiri Pirko | 8bdb427 | 2015-09-24 10:02:43 +0200 | [diff] [blame] | 23 | static inline bool switchdev_trans_ph_prepare(struct switchdev_trans *trans) |
| 24 | { |
Jiri Pirko | f623ab7 | 2015-09-24 10:02:49 +0200 | [diff] [blame] | 25 | return trans && trans->ph_prepare; |
Jiri Pirko | 8bdb427 | 2015-09-24 10:02:43 +0200 | [diff] [blame] | 26 | } |
| 27 | |
| 28 | static inline bool switchdev_trans_ph_commit(struct switchdev_trans *trans) |
| 29 | { |
Jiri Pirko | f623ab7 | 2015-09-24 10:02:49 +0200 | [diff] [blame] | 30 | return trans && !trans->ph_prepare; |
Jiri Pirko | 8bdb427 | 2015-09-24 10:02:43 +0200 | [diff] [blame] | 31 | } |
| 32 | |
Scott Feldman | 3094333 | 2015-05-10 09:47:48 -0700 | [diff] [blame] | 33 | enum switchdev_attr_id { |
Jiri Pirko | 1f86839 | 2015-10-01 11:03:42 +0200 | [diff] [blame] | 34 | SWITCHDEV_ATTR_ID_UNDEFINED, |
Jiri Pirko | 1f86839 | 2015-10-01 11:03:42 +0200 | [diff] [blame] | 35 | SWITCHDEV_ATTR_ID_PORT_STP_STATE, |
| 36 | SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS, |
Florian Fainelli | 746dc18 | 2019-02-20 16:58:19 -0800 | [diff] [blame] | 37 | SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS, |
Nogah Frankel | 6d54964 | 2017-02-09 14:54:42 +0100 | [diff] [blame] | 38 | SWITCHDEV_ATTR_ID_PORT_MROUTER, |
Scott Feldman | f55ac58 | 2015-10-08 19:23:17 -0700 | [diff] [blame] | 39 | SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME, |
Elad Raz | 81435c3 | 2016-01-06 13:01:05 +0100 | [diff] [blame] | 40 | SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING, |
Nogah Frankel | 147c1e9 | 2017-02-09 14:54:40 +0100 | [diff] [blame] | 41 | SWITCHDEV_ATTR_ID_BRIDGE_MC_DISABLED, |
Yotam Gigi | 7704142 | 2017-10-09 11:15:31 +0200 | [diff] [blame] | 42 | SWITCHDEV_ATTR_ID_BRIDGE_MROUTER, |
Scott Feldman | 3094333 | 2015-05-10 09:47:48 -0700 | [diff] [blame] | 43 | }; |
| 44 | |
| 45 | struct switchdev_attr { |
Ido Schimmel | 6ff64f6 | 2015-12-15 16:03:35 +0100 | [diff] [blame] | 46 | struct net_device *orig_dev; |
Scott Feldman | 3094333 | 2015-05-10 09:47:48 -0700 | [diff] [blame] | 47 | enum switchdev_attr_id id; |
Scott Feldman | 3094333 | 2015-05-10 09:47:48 -0700 | [diff] [blame] | 48 | u32 flags; |
Elad Raz | 7ceb2af | 2016-04-21 12:52:43 +0200 | [diff] [blame] | 49 | void *complete_priv; |
| 50 | void (*complete)(struct net_device *dev, int err, void *priv); |
Scott Feldman | f8e20a9 | 2015-05-10 09:47:49 -0700 | [diff] [blame] | 51 | union { |
Scott Feldman | 3563606 | 2015-05-10 09:47:51 -0700 | [diff] [blame] | 52 | u8 stp_state; /* PORT_STP_STATE */ |
Florian Fainelli | 746dc18 | 2019-02-20 16:58:19 -0800 | [diff] [blame] | 53 | unsigned long brport_flags; /* PORT_{PRE}_BRIDGE_FLAGS */ |
Nogah Frankel | 6d54964 | 2017-02-09 14:54:42 +0100 | [diff] [blame] | 54 | bool mrouter; /* PORT_MROUTER */ |
Vivien Didelot | eabfdda | 2016-07-18 15:02:06 -0400 | [diff] [blame] | 55 | clock_t ageing_time; /* BRIDGE_AGEING_TIME */ |
Elad Raz | 81435c3 | 2016-01-06 13:01:05 +0100 | [diff] [blame] | 56 | bool vlan_filtering; /* BRIDGE_VLAN_FILTERING */ |
Nogah Frankel | 147c1e9 | 2017-02-09 14:54:40 +0100 | [diff] [blame] | 57 | bool mc_disabled; /* MC_DISABLED */ |
Scott Feldman | 42275bd | 2015-05-13 11:16:50 -0700 | [diff] [blame] | 58 | } u; |
Scott Feldman | 3094333 | 2015-05-10 09:47:48 -0700 | [diff] [blame] | 59 | }; |
| 60 | |
Scott Feldman | 491d0f1 | 2015-05-10 09:47:52 -0700 | [diff] [blame] | 61 | enum switchdev_obj_id { |
Jiri Pirko | 57d8083 | 2015-10-01 11:03:41 +0200 | [diff] [blame] | 62 | SWITCHDEV_OBJ_ID_UNDEFINED, |
| 63 | SWITCHDEV_OBJ_ID_PORT_VLAN, |
Elad Raz | 4d41e125 | 2016-01-10 21:06:22 +0100 | [diff] [blame] | 64 | SWITCHDEV_OBJ_ID_PORT_MDB, |
Andrew Lunn | 47d5b6d | 2017-11-09 23:10:59 +0100 | [diff] [blame] | 65 | SWITCHDEV_OBJ_ID_HOST_MDB, |
Scott Feldman | 491d0f1 | 2015-05-10 09:47:52 -0700 | [diff] [blame] | 66 | }; |
| 67 | |
Jiri Pirko | 648b4a9 | 2015-10-01 11:03:45 +0200 | [diff] [blame] | 68 | struct switchdev_obj { |
Ido Schimmel | 6ff64f6 | 2015-12-15 16:03:35 +0100 | [diff] [blame] | 69 | struct net_device *orig_dev; |
Jiri Pirko | 9e8f4a5 | 2015-10-01 11:03:46 +0200 | [diff] [blame] | 70 | enum switchdev_obj_id id; |
Jiri Pirko | 4d429c5 | 2015-10-14 19:40:52 +0200 | [diff] [blame] | 71 | u32 flags; |
Elad Raz | 7ceb2af | 2016-04-21 12:52:43 +0200 | [diff] [blame] | 72 | void *complete_priv; |
| 73 | void (*complete)(struct net_device *dev, int err, void *priv); |
Jiri Pirko | 648b4a9 | 2015-10-01 11:03:45 +0200 | [diff] [blame] | 74 | }; |
| 75 | |
Jiri Pirko | 57d8083 | 2015-10-01 11:03:41 +0200 | [diff] [blame] | 76 | /* SWITCHDEV_OBJ_ID_PORT_VLAN */ |
Jiri Pirko | 8f24f30 | 2015-10-01 11:03:43 +0200 | [diff] [blame] | 77 | struct switchdev_obj_port_vlan { |
Jiri Pirko | 648b4a9 | 2015-10-01 11:03:45 +0200 | [diff] [blame] | 78 | struct switchdev_obj obj; |
Vivien Didelot | 44bbcf5 | 2015-09-29 12:07:18 -0400 | [diff] [blame] | 79 | u16 flags; |
| 80 | u16 vid_begin; |
| 81 | u16 vid_end; |
| 82 | }; |
| 83 | |
Petr Machata | ec394af | 2018-11-22 23:28:07 +0000 | [diff] [blame] | 84 | #define SWITCHDEV_OBJ_PORT_VLAN(OBJ) \ |
| 85 | container_of((OBJ), struct switchdev_obj_port_vlan, obj) |
Jiri Pirko | 648b4a9 | 2015-10-01 11:03:45 +0200 | [diff] [blame] | 86 | |
Elad Raz | 4d41e125 | 2016-01-10 21:06:22 +0100 | [diff] [blame] | 87 | /* SWITCHDEV_OBJ_ID_PORT_MDB */ |
| 88 | struct switchdev_obj_port_mdb { |
| 89 | struct switchdev_obj obj; |
| 90 | unsigned char addr[ETH_ALEN]; |
| 91 | u16 vid; |
| 92 | }; |
| 93 | |
Petr Machata | ec394af | 2018-11-22 23:28:07 +0000 | [diff] [blame] | 94 | #define SWITCHDEV_OBJ_PORT_MDB(OBJ) \ |
| 95 | container_of((OBJ), struct switchdev_obj_port_mdb, obj) |
Elad Raz | 4d41e125 | 2016-01-10 21:06:22 +0100 | [diff] [blame] | 96 | |
Jiri Pirko | 648b4a9 | 2015-10-01 11:03:45 +0200 | [diff] [blame] | 97 | typedef int switchdev_obj_dump_cb_t(struct switchdev_obj *obj); |
| 98 | |
Jiri Pirko | ebb9a03 | 2015-05-10 09:47:46 -0700 | [diff] [blame] | 99 | enum switchdev_notifier_type { |
Arkadi Sharshevsky | 6b26b51 | 2017-06-08 08:44:14 +0200 | [diff] [blame] | 100 | SWITCHDEV_FDB_ADD_TO_BRIDGE = 1, |
| 101 | SWITCHDEV_FDB_DEL_TO_BRIDGE, |
| 102 | SWITCHDEV_FDB_ADD_TO_DEVICE, |
| 103 | SWITCHDEV_FDB_DEL_TO_DEVICE, |
Arkadi Sharshevsky | 9fe8bce | 2017-06-08 08:44:15 +0200 | [diff] [blame] | 104 | SWITCHDEV_FDB_OFFLOADED, |
Petr Machata | 9a99735 | 2018-10-17 08:53:22 +0000 | [diff] [blame] | 105 | |
Petr Machata | aa4efe2 | 2018-11-22 23:28:38 +0000 | [diff] [blame] | 106 | SWITCHDEV_PORT_OBJ_ADD, /* Blocking. */ |
| 107 | SWITCHDEV_PORT_OBJ_DEL, /* Blocking. */ |
Florian Fainelli | 1cb33af | 2019-02-27 11:44:25 -0800 | [diff] [blame] | 108 | SWITCHDEV_PORT_ATTR_SET, /* May be blocking . */ |
Petr Machata | aa4efe2 | 2018-11-22 23:28:38 +0000 | [diff] [blame] | 109 | |
Petr Machata | 5728ae0 | 2018-11-21 08:02:39 +0000 | [diff] [blame] | 110 | SWITCHDEV_VXLAN_FDB_ADD_TO_BRIDGE, |
| 111 | SWITCHDEV_VXLAN_FDB_DEL_TO_BRIDGE, |
Petr Machata | 9a99735 | 2018-10-17 08:53:22 +0000 | [diff] [blame] | 112 | SWITCHDEV_VXLAN_FDB_ADD_TO_DEVICE, |
| 113 | SWITCHDEV_VXLAN_FDB_DEL_TO_DEVICE, |
Petr Machata | 0efe117 | 2018-10-17 08:53:26 +0000 | [diff] [blame] | 114 | SWITCHDEV_VXLAN_FDB_OFFLOADED, |
Jiri Pirko | 3aeb661 | 2015-01-15 23:49:37 +0100 | [diff] [blame] | 115 | }; |
| 116 | |
Jiri Pirko | ebb9a03 | 2015-05-10 09:47:46 -0700 | [diff] [blame] | 117 | struct switchdev_notifier_info { |
Jiri Pirko | 03bf0c2 | 2015-01-15 23:49:36 +0100 | [diff] [blame] | 118 | struct net_device *dev; |
Petr Machata | 479c86d | 2018-12-12 17:02:54 +0000 | [diff] [blame] | 119 | struct netlink_ext_ack *extack; |
Jiri Pirko | 03bf0c2 | 2015-01-15 23:49:36 +0100 | [diff] [blame] | 120 | }; |
| 121 | |
Jiri Pirko | ebb9a03 | 2015-05-10 09:47:46 -0700 | [diff] [blame] | 122 | struct switchdev_notifier_fdb_info { |
| 123 | struct switchdev_notifier_info info; /* must be first */ |
Jiri Pirko | 3aeb661 | 2015-01-15 23:49:37 +0100 | [diff] [blame] | 124 | const unsigned char *addr; |
| 125 | u16 vid; |
Ido Schimmel | e9ba0fb | 2018-10-17 08:53:29 +0000 | [diff] [blame] | 126 | u8 added_by_user:1, |
| 127 | offloaded:1; |
Jiri Pirko | 3aeb661 | 2015-01-15 23:49:37 +0100 | [diff] [blame] | 128 | }; |
| 129 | |
Petr Machata | aa4efe2 | 2018-11-22 23:28:38 +0000 | [diff] [blame] | 130 | struct switchdev_notifier_port_obj_info { |
| 131 | struct switchdev_notifier_info info; /* must be first */ |
| 132 | const struct switchdev_obj *obj; |
| 133 | struct switchdev_trans *trans; |
| 134 | bool handled; |
| 135 | }; |
| 136 | |
Florian Fainelli | 1cb33af | 2019-02-27 11:44:25 -0800 | [diff] [blame] | 137 | struct switchdev_notifier_port_attr_info { |
| 138 | struct switchdev_notifier_info info; /* must be first */ |
| 139 | const struct switchdev_attr *attr; |
| 140 | struct switchdev_trans *trans; |
| 141 | bool handled; |
| 142 | }; |
| 143 | |
Jiri Pirko | 03bf0c2 | 2015-01-15 23:49:36 +0100 | [diff] [blame] | 144 | static inline struct net_device * |
Jiri Pirko | ebb9a03 | 2015-05-10 09:47:46 -0700 | [diff] [blame] | 145 | switchdev_notifier_info_to_dev(const struct switchdev_notifier_info *info) |
Jiri Pirko | 03bf0c2 | 2015-01-15 23:49:36 +0100 | [diff] [blame] | 146 | { |
| 147 | return info->dev; |
| 148 | } |
Jiri Pirko | 007f790 | 2014-11-28 14:34:17 +0100 | [diff] [blame] | 149 | |
Petr Machata | 479c86d | 2018-12-12 17:02:54 +0000 | [diff] [blame] | 150 | static inline struct netlink_ext_ack * |
| 151 | switchdev_notifier_info_to_extack(const struct switchdev_notifier_info *info) |
| 152 | { |
| 153 | return info->extack; |
| 154 | } |
| 155 | |
Jiri Pirko | 007f790 | 2014-11-28 14:34:17 +0100 | [diff] [blame] | 156 | #ifdef CONFIG_NET_SWITCHDEV |
| 157 | |
Jiri Pirko | 793f401 | 2015-10-14 19:40:48 +0200 | [diff] [blame] | 158 | void switchdev_deferred_process(void); |
Scott Feldman | 3094333 | 2015-05-10 09:47:48 -0700 | [diff] [blame] | 159 | int switchdev_port_attr_set(struct net_device *dev, |
Jiri Pirko | f7fadf3 | 2015-10-14 19:40:49 +0200 | [diff] [blame] | 160 | const struct switchdev_attr *attr); |
Jiri Pirko | 9e8f4a5 | 2015-10-01 11:03:46 +0200 | [diff] [blame] | 161 | int switchdev_port_obj_add(struct net_device *dev, |
Petr Machata | 69b7320 | 2018-12-12 17:02:52 +0000 | [diff] [blame] | 162 | const struct switchdev_obj *obj, |
| 163 | struct netlink_ext_ack *extack); |
Jiri Pirko | 9e8f4a5 | 2015-10-01 11:03:46 +0200 | [diff] [blame] | 164 | int switchdev_port_obj_del(struct net_device *dev, |
Jiri Pirko | 648b4a9 | 2015-10-01 11:03:45 +0200 | [diff] [blame] | 165 | const struct switchdev_obj *obj); |
Petr Machata | a93e3b1 | 2018-11-22 23:28:25 +0000 | [diff] [blame] | 166 | |
Jiri Pirko | ebb9a03 | 2015-05-10 09:47:46 -0700 | [diff] [blame] | 167 | int register_switchdev_notifier(struct notifier_block *nb); |
| 168 | int unregister_switchdev_notifier(struct notifier_block *nb); |
| 169 | int call_switchdev_notifiers(unsigned long val, struct net_device *dev, |
Petr Machata | 6685987 | 2019-01-16 23:06:56 +0000 | [diff] [blame] | 170 | struct switchdev_notifier_info *info, |
| 171 | struct netlink_ext_ack *extack); |
Petr Machata | a93e3b1 | 2018-11-22 23:28:25 +0000 | [diff] [blame] | 172 | |
| 173 | int register_switchdev_blocking_notifier(struct notifier_block *nb); |
| 174 | int unregister_switchdev_blocking_notifier(struct notifier_block *nb); |
| 175 | int call_switchdev_blocking_notifiers(unsigned long val, struct net_device *dev, |
Petr Machata | 479c86d | 2018-12-12 17:02:54 +0000 | [diff] [blame] | 176 | struct switchdev_notifier_info *info, |
| 177 | struct netlink_ext_ack *extack); |
Petr Machata | a93e3b1 | 2018-11-22 23:28:25 +0000 | [diff] [blame] | 178 | |
Scott Feldman | 1a3b2ec | 2015-07-18 18:24:50 -0700 | [diff] [blame] | 179 | void switchdev_port_fwd_mark_set(struct net_device *dev, |
| 180 | struct net_device *group_dev, |
| 181 | bool joining); |
Scott Feldman | 5e8d904 | 2015-03-05 21:21:15 -0800 | [diff] [blame] | 182 | |
Petr Machata | f30f060 | 2018-11-22 23:29:44 +0000 | [diff] [blame] | 183 | int switchdev_handle_port_obj_add(struct net_device *dev, |
| 184 | struct switchdev_notifier_port_obj_info *port_obj_info, |
| 185 | bool (*check_cb)(const struct net_device *dev), |
| 186 | int (*add_cb)(struct net_device *dev, |
| 187 | const struct switchdev_obj *obj, |
Petr Machata | 6921351 | 2018-12-12 17:02:56 +0000 | [diff] [blame] | 188 | struct switchdev_trans *trans, |
| 189 | struct netlink_ext_ack *extack)); |
Petr Machata | f30f060 | 2018-11-22 23:29:44 +0000 | [diff] [blame] | 190 | int switchdev_handle_port_obj_del(struct net_device *dev, |
| 191 | struct switchdev_notifier_port_obj_info *port_obj_info, |
| 192 | bool (*check_cb)(const struct net_device *dev), |
| 193 | int (*del_cb)(struct net_device *dev, |
| 194 | const struct switchdev_obj *obj)); |
| 195 | |
Florian Fainelli | 1cb33af | 2019-02-27 11:44:25 -0800 | [diff] [blame] | 196 | int switchdev_handle_port_attr_set(struct net_device *dev, |
| 197 | struct switchdev_notifier_port_attr_info *port_attr_info, |
| 198 | bool (*check_cb)(const struct net_device *dev), |
| 199 | int (*set_cb)(struct net_device *dev, |
| 200 | const struct switchdev_attr *attr, |
| 201 | struct switchdev_trans *trans)); |
Jiri Pirko | 007f790 | 2014-11-28 14:34:17 +0100 | [diff] [blame] | 202 | #else |
| 203 | |
Jiri Pirko | 793f401 | 2015-10-14 19:40:48 +0200 | [diff] [blame] | 204 | static inline void switchdev_deferred_process(void) |
| 205 | { |
| 206 | } |
| 207 | |
Scott Feldman | 3094333 | 2015-05-10 09:47:48 -0700 | [diff] [blame] | 208 | static inline int switchdev_port_attr_set(struct net_device *dev, |
Jiri Pirko | f7fadf3 | 2015-10-14 19:40:49 +0200 | [diff] [blame] | 209 | const struct switchdev_attr *attr) |
Scott Feldman | 3094333 | 2015-05-10 09:47:48 -0700 | [diff] [blame] | 210 | { |
| 211 | return -EOPNOTSUPP; |
| 212 | } |
| 213 | |
Scott Feldman | 491d0f1 | 2015-05-10 09:47:52 -0700 | [diff] [blame] | 214 | static inline int switchdev_port_obj_add(struct net_device *dev, |
Petr Machata | 69b7320 | 2018-12-12 17:02:52 +0000 | [diff] [blame] | 215 | const struct switchdev_obj *obj, |
| 216 | struct netlink_ext_ack *extack) |
Scott Feldman | 491d0f1 | 2015-05-10 09:47:52 -0700 | [diff] [blame] | 217 | { |
| 218 | return -EOPNOTSUPP; |
| 219 | } |
| 220 | |
| 221 | static inline int switchdev_port_obj_del(struct net_device *dev, |
Jiri Pirko | 648b4a9 | 2015-10-01 11:03:45 +0200 | [diff] [blame] | 222 | const struct switchdev_obj *obj) |
Scott Feldman | 491d0f1 | 2015-05-10 09:47:52 -0700 | [diff] [blame] | 223 | { |
| 224 | return -EOPNOTSUPP; |
| 225 | } |
| 226 | |
Jiri Pirko | ebb9a03 | 2015-05-10 09:47:46 -0700 | [diff] [blame] | 227 | static inline int register_switchdev_notifier(struct notifier_block *nb) |
Jiri Pirko | 03bf0c2 | 2015-01-15 23:49:36 +0100 | [diff] [blame] | 228 | { |
| 229 | return 0; |
| 230 | } |
| 231 | |
Jiri Pirko | ebb9a03 | 2015-05-10 09:47:46 -0700 | [diff] [blame] | 232 | static inline int unregister_switchdev_notifier(struct notifier_block *nb) |
Jiri Pirko | 03bf0c2 | 2015-01-15 23:49:36 +0100 | [diff] [blame] | 233 | { |
| 234 | return 0; |
| 235 | } |
| 236 | |
Jiri Pirko | ebb9a03 | 2015-05-10 09:47:46 -0700 | [diff] [blame] | 237 | static inline int call_switchdev_notifiers(unsigned long val, |
| 238 | struct net_device *dev, |
Petr Machata | 6685987 | 2019-01-16 23:06:56 +0000 | [diff] [blame] | 239 | struct switchdev_notifier_info *info, |
| 240 | struct netlink_ext_ack *extack) |
Jiri Pirko | 03bf0c2 | 2015-01-15 23:49:36 +0100 | [diff] [blame] | 241 | { |
| 242 | return NOTIFY_DONE; |
| 243 | } |
| 244 | |
Petr Machata | a93e3b1 | 2018-11-22 23:28:25 +0000 | [diff] [blame] | 245 | static inline int |
| 246 | register_switchdev_blocking_notifier(struct notifier_block *nb) |
| 247 | { |
| 248 | return 0; |
| 249 | } |
| 250 | |
| 251 | static inline int |
| 252 | unregister_switchdev_blocking_notifier(struct notifier_block *nb) |
| 253 | { |
| 254 | return 0; |
| 255 | } |
| 256 | |
| 257 | static inline int |
| 258 | call_switchdev_blocking_notifiers(unsigned long val, |
| 259 | struct net_device *dev, |
Petr Machata | 479c86d | 2018-12-12 17:02:54 +0000 | [diff] [blame] | 260 | struct switchdev_notifier_info *info, |
| 261 | struct netlink_ext_ack *extack) |
Petr Machata | a93e3b1 | 2018-11-22 23:28:25 +0000 | [diff] [blame] | 262 | { |
| 263 | return NOTIFY_DONE; |
| 264 | } |
| 265 | |
Petr Machata | f30f060 | 2018-11-22 23:29:44 +0000 | [diff] [blame] | 266 | static inline int |
| 267 | switchdev_handle_port_obj_add(struct net_device *dev, |
| 268 | struct switchdev_notifier_port_obj_info *port_obj_info, |
| 269 | bool (*check_cb)(const struct net_device *dev), |
| 270 | int (*add_cb)(struct net_device *dev, |
| 271 | const struct switchdev_obj *obj, |
Petr Machata | 6921351 | 2018-12-12 17:02:56 +0000 | [diff] [blame] | 272 | struct switchdev_trans *trans, |
| 273 | struct netlink_ext_ack *extack)) |
Petr Machata | f30f060 | 2018-11-22 23:29:44 +0000 | [diff] [blame] | 274 | { |
| 275 | return 0; |
| 276 | } |
| 277 | |
| 278 | static inline int |
| 279 | switchdev_handle_port_obj_del(struct net_device *dev, |
| 280 | struct switchdev_notifier_port_obj_info *port_obj_info, |
| 281 | bool (*check_cb)(const struct net_device *dev), |
| 282 | int (*del_cb)(struct net_device *dev, |
| 283 | const struct switchdev_obj *obj)) |
| 284 | { |
| 285 | return 0; |
| 286 | } |
| 287 | |
Florian Fainelli | 1cb33af | 2019-02-27 11:44:25 -0800 | [diff] [blame] | 288 | static inline int |
| 289 | switchdev_handle_port_attr_set(struct net_device *dev, |
| 290 | struct switchdev_notifier_port_attr_info *port_attr_info, |
| 291 | bool (*check_cb)(const struct net_device *dev), |
| 292 | int (*set_cb)(struct net_device *dev, |
| 293 | const struct switchdev_attr *attr, |
| 294 | struct switchdev_trans *trans)) |
| 295 | { |
| 296 | return 0; |
| 297 | } |
Jiri Pirko | 007f790 | 2014-11-28 14:34:17 +0100 | [diff] [blame] | 298 | #endif |
| 299 | |
| 300 | #endif /* _LINUX_SWITCHDEV_H_ */ |