diff options
author | Veaceslav Falico <vfalico@redhat.com> | 2014-01-15 23:02:18 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-17 01:15:41 (GMT) |
commit | 1d486bfb66971ebacc2a46a23431ace9af70dc66 (patch) | |
tree | b280bfff1e11a8857f9a2e967e92e6442a9d043b /net | |
parent | 31cf344caf444ca7411d89c8ac907d886eeab1a7 (diff) | |
download | linux-1d486bfb66971ebacc2a46a23431ace9af70dc66.tar.xz |
net: add NETDEV_PRECHANGEMTU to notify before mtu change happens
Currently, if a device changes its mtu, first the change happens (invloving
all the side effects), and after that the NETDEV_CHANGEMTU is sent so that
other devices can catch up with the new mtu. However, if they return
NOTIFY_BAD, then the change is reverted and error returned.
This is a really long and costy operation (sometimes). To fix this, add
NETDEV_PRECHANGEMTU notification which is called prior to any change
actually happening, and if any callee returns NOTIFY_BAD - the change is
aborted. This way we're skipping all the playing with apply/revert the mtu.
CC: "David S. Miller" <davem@davemloft.net>
CC: Jiri Pirko <jiri@resnulli.us>
CC: Eric Dumazet <edumazet@google.com>
CC: Nicolas Dichtel <nicolas.dichtel@6wind.com>
CC: Cong Wang <amwang@redhat.com>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/dev.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index b2c1869..f87bedd 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -5392,6 +5392,11 @@ int dev_set_mtu(struct net_device *dev, int new_mtu) if (!netif_device_present(dev)) return -ENODEV; + err = call_netdevice_notifiers(NETDEV_PRECHANGEMTU, dev); + err = notifier_to_errno(err); + if (err) + return err; + orig_mtu = dev->mtu; err = __dev_set_mtu(dev, new_mtu); |