diff options
Diffstat (limited to 'net/core/dev.c')
-rw-r--r-- | net/core/dev.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 0b2d777e5b9e..a4d39b87b4e5 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1752,6 +1752,28 @@ int call_netdevice_notifiers(unsigned long val, struct net_device *dev) | |||
1752 | } | 1752 | } |
1753 | EXPORT_SYMBOL(call_netdevice_notifiers); | 1753 | EXPORT_SYMBOL(call_netdevice_notifiers); |
1754 | 1754 | ||
1755 | /** | ||
1756 | * call_netdevice_notifiers_mtu - call all network notifier blocks | ||
1757 | * @val: value passed unmodified to notifier function | ||
1758 | * @dev: net_device pointer passed unmodified to notifier function | ||
1759 | * @arg: additional u32 argument passed to the notifier function | ||
1760 | * | ||
1761 | * Call all network notifier blocks. Parameters and return value | ||
1762 | * are as for raw_notifier_call_chain(). | ||
1763 | */ | ||
1764 | static int call_netdevice_notifiers_mtu(unsigned long val, | ||
1765 | struct net_device *dev, u32 arg) | ||
1766 | { | ||
1767 | struct netdev_notifier_info_ext info = { | ||
1768 | .info.dev = dev, | ||
1769 | .ext.mtu = arg, | ||
1770 | }; | ||
1771 | |||
1772 | BUILD_BUG_ON(offsetof(struct netdev_notifier_info_ext, info) != 0); | ||
1773 | |||
1774 | return call_netdevice_notifiers_info(val, &info.info); | ||
1775 | } | ||
1776 | |||
1755 | #ifdef CONFIG_NET_INGRESS | 1777 | #ifdef CONFIG_NET_INGRESS |
1756 | static DEFINE_STATIC_KEY_FALSE(ingress_needed_key); | 1778 | static DEFINE_STATIC_KEY_FALSE(ingress_needed_key); |
1757 | 1779 | ||
@@ -7575,14 +7597,16 @@ int dev_set_mtu_ext(struct net_device *dev, int new_mtu, | |||
7575 | err = __dev_set_mtu(dev, new_mtu); | 7597 | err = __dev_set_mtu(dev, new_mtu); |
7576 | 7598 | ||
7577 | if (!err) { | 7599 | if (!err) { |
7578 | err = call_netdevice_notifiers(NETDEV_CHANGEMTU, dev); | 7600 | err = call_netdevice_notifiers_mtu(NETDEV_CHANGEMTU, dev, |
7601 | orig_mtu); | ||
7579 | err = notifier_to_errno(err); | 7602 | err = notifier_to_errno(err); |
7580 | if (err) { | 7603 | if (err) { |
7581 | /* setting mtu back and notifying everyone again, | 7604 | /* setting mtu back and notifying everyone again, |
7582 | * so that they have a chance to revert changes. | 7605 | * so that they have a chance to revert changes. |
7583 | */ | 7606 | */ |
7584 | __dev_set_mtu(dev, orig_mtu); | 7607 | __dev_set_mtu(dev, orig_mtu); |
7585 | call_netdevice_notifiers(NETDEV_CHANGEMTU, dev); | 7608 | call_netdevice_notifiers_mtu(NETDEV_CHANGEMTU, dev, |
7609 | new_mtu); | ||
7586 | } | 7610 | } |
7587 | } | 7611 | } |
7588 | return err; | 7612 | return err; |