macvlan: Propagate lowerdev MTU changes
authordingtianhong <dingtianhong@huawei.com>
Tue, 13 May 2014 06:39:27 +0000 (14:39 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 14 May 2014 19:35:03 +0000 (15:35 -0400)
When the physical MTU changes we should ensure that all existing MACVLAN
dev MTU do not exceed the new lowerdev MTU. This patch adds that
propagation.

Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
Reviewed-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/macvlan.c

index f0118d1a3e4687573b6d59191842bf222cb5736e..e03707de1eeee4ea1b4efd31ab27e9f7e5c08f20 100644 (file)
@@ -1091,6 +1091,13 @@ static int macvlan_device_event(struct notifier_block *unused,
                        netdev_update_features(vlan->dev);
                }
                break;
+       case NETDEV_CHANGEMTU:
+               list_for_each_entry(vlan, &port->vlans, list) {
+                       if (vlan->dev->mtu <= dev->mtu)
+                               continue;
+                       dev_set_mtu(vlan->dev, dev->mtu);
+               }
+               break;
        case NETDEV_UNREGISTER:
                /* twiddle thumbs on netns device moves */
                if (dev->reg_state != NETREG_UNREGISTERING)