diff options
author | Petr Machata <petrm@mellanox.com> | 2018-12-12 12:02:54 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-12-12 19:34:22 -0500 |
commit | 479c86dc551c9720765ed19433990eae6a1f899f (patch) | |
tree | ecd13ac6dcb54e24d367e781fd5c7bb600804ee7 | |
parent | 69b7320e14e6e8c7a77fa5803cecc86434a1162d (diff) |
net: switchdev: Add extack to struct switchdev_notifier_info
In order to pass extack to the drivers that need it, add an extack field
to struct switchdev_notifier_info, and an extack argument to the
function call_switchdev_blocking_notifiers(). Also add a helper function
switchdev_notifier_info_to_extack().
Signed-off-by: Petr Machata <petrm@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: Ivan Vecera <ivecera@redhat.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/vxlan.c | 1 | ||||
-rw-r--r-- | include/net/switchdev.h | 13 | ||||
-rw-r--r-- | net/switchdev/switchdev.c | 7 |
3 files changed, 17 insertions, 4 deletions
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index b56ef684ecac..49d4b5854c62 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -364,6 +364,7 @@ static void vxlan_fdb_switchdev_notifier_info(const struct vxlan_dev *vxlan, | |||
364 | struct switchdev_notifier_vxlan_fdb_info *fdb_info) | 364 | struct switchdev_notifier_vxlan_fdb_info *fdb_info) |
365 | { | 365 | { |
366 | fdb_info->info.dev = vxlan->dev; | 366 | fdb_info->info.dev = vxlan->dev; |
367 | fdb_info->info.extack = NULL; | ||
367 | fdb_info->remote_ip = rd->remote_ip; | 368 | fdb_info->remote_ip = rd->remote_ip; |
368 | fdb_info->remote_port = rd->remote_port; | 369 | fdb_info->remote_port = rd->remote_port; |
369 | fdb_info->remote_vni = rd->remote_vni; | 370 | fdb_info->remote_vni = rd->remote_vni; |
diff --git a/include/net/switchdev.h b/include/net/switchdev.h index 69016305ad58..4facfa6775e8 100644 --- a/include/net/switchdev.h +++ b/include/net/switchdev.h | |||
@@ -149,6 +149,7 @@ enum switchdev_notifier_type { | |||
149 | 149 | ||
150 | struct switchdev_notifier_info { | 150 | struct switchdev_notifier_info { |
151 | struct net_device *dev; | 151 | struct net_device *dev; |
152 | struct netlink_ext_ack *extack; | ||
152 | }; | 153 | }; |
153 | 154 | ||
154 | struct switchdev_notifier_fdb_info { | 155 | struct switchdev_notifier_fdb_info { |
@@ -172,6 +173,12 @@ switchdev_notifier_info_to_dev(const struct switchdev_notifier_info *info) | |||
172 | return info->dev; | 173 | return info->dev; |
173 | } | 174 | } |
174 | 175 | ||
176 | static inline struct netlink_ext_ack * | ||
177 | switchdev_notifier_info_to_extack(const struct switchdev_notifier_info *info) | ||
178 | { | ||
179 | return info->extack; | ||
180 | } | ||
181 | |||
175 | #ifdef CONFIG_NET_SWITCHDEV | 182 | #ifdef CONFIG_NET_SWITCHDEV |
176 | 183 | ||
177 | void switchdev_deferred_process(void); | 184 | void switchdev_deferred_process(void); |
@@ -193,7 +200,8 @@ int call_switchdev_notifiers(unsigned long val, struct net_device *dev, | |||
193 | int register_switchdev_blocking_notifier(struct notifier_block *nb); | 200 | int register_switchdev_blocking_notifier(struct notifier_block *nb); |
194 | int unregister_switchdev_blocking_notifier(struct notifier_block *nb); | 201 | int unregister_switchdev_blocking_notifier(struct notifier_block *nb); |
195 | int call_switchdev_blocking_notifiers(unsigned long val, struct net_device *dev, | 202 | int call_switchdev_blocking_notifiers(unsigned long val, struct net_device *dev, |
196 | struct switchdev_notifier_info *info); | 203 | struct switchdev_notifier_info *info, |
204 | struct netlink_ext_ack *extack); | ||
197 | 205 | ||
198 | void switchdev_port_fwd_mark_set(struct net_device *dev, | 206 | void switchdev_port_fwd_mark_set(struct net_device *dev, |
199 | struct net_device *group_dev, | 207 | struct net_device *group_dev, |
@@ -278,7 +286,8 @@ unregister_switchdev_blocking_notifier(struct notifier_block *nb) | |||
278 | static inline int | 286 | static inline int |
279 | call_switchdev_blocking_notifiers(unsigned long val, | 287 | call_switchdev_blocking_notifiers(unsigned long val, |
280 | struct net_device *dev, | 288 | struct net_device *dev, |
281 | struct switchdev_notifier_info *info) | 289 | struct switchdev_notifier_info *info, |
290 | struct netlink_ext_ack *extack) | ||
282 | { | 291 | { |
283 | return NOTIFY_DONE; | 292 | return NOTIFY_DONE; |
284 | } | 293 | } |
diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c index cb20669bf6ce..aa84acfb6632 100644 --- a/net/switchdev/switchdev.c +++ b/net/switchdev/switchdev.c | |||
@@ -368,7 +368,7 @@ static int switchdev_port_obj_notify(enum switchdev_notifier_type nt, | |||
368 | .handled = false, | 368 | .handled = false, |
369 | }; | 369 | }; |
370 | 370 | ||
371 | rc = call_switchdev_blocking_notifiers(nt, dev, &obj_info.info); | 371 | rc = call_switchdev_blocking_notifiers(nt, dev, &obj_info.info, extack); |
372 | err = notifier_to_errno(rc); | 372 | err = notifier_to_errno(rc); |
373 | if (err) { | 373 | if (err) { |
374 | WARN_ON(!obj_info.handled); | 374 | WARN_ON(!obj_info.handled); |
@@ -559,6 +559,7 @@ int call_switchdev_notifiers(unsigned long val, struct net_device *dev, | |||
559 | struct switchdev_notifier_info *info) | 559 | struct switchdev_notifier_info *info) |
560 | { | 560 | { |
561 | info->dev = dev; | 561 | info->dev = dev; |
562 | info->extack = NULL; | ||
562 | return atomic_notifier_call_chain(&switchdev_notif_chain, val, info); | 563 | return atomic_notifier_call_chain(&switchdev_notif_chain, val, info); |
563 | } | 564 | } |
564 | EXPORT_SYMBOL_GPL(call_switchdev_notifiers); | 565 | EXPORT_SYMBOL_GPL(call_switchdev_notifiers); |
@@ -580,9 +581,11 @@ int unregister_switchdev_blocking_notifier(struct notifier_block *nb) | |||
580 | EXPORT_SYMBOL_GPL(unregister_switchdev_blocking_notifier); | 581 | EXPORT_SYMBOL_GPL(unregister_switchdev_blocking_notifier); |
581 | 582 | ||
582 | int call_switchdev_blocking_notifiers(unsigned long val, struct net_device *dev, | 583 | int call_switchdev_blocking_notifiers(unsigned long val, struct net_device *dev, |
583 | struct switchdev_notifier_info *info) | 584 | struct switchdev_notifier_info *info, |
585 | struct netlink_ext_ack *extack) | ||
584 | { | 586 | { |
585 | info->dev = dev; | 587 | info->dev = dev; |
588 | info->extack = extack; | ||
586 | return blocking_notifier_call_chain(&switchdev_blocking_notif_chain, | 589 | return blocking_notifier_call_chain(&switchdev_blocking_notif_chain, |
587 | val, info); | 590 | val, info); |
588 | } | 591 | } |