Skip to contentSkip to conversation

macvlan: Propagate lowerdev MTU changes

PATCH Applied Ding Tianhong 3 participants 3 messages May 13, 2014 – May 14, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 macvlan: Propagate lowerdev MTU changes

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.

---
 drivers/net/macvlan.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/net/macvlan.c +7 -0
index f0118d1..e03707d 100644
@@ -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)
Signature · 1 line
1.8.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 29 lines · Tue, May 13, 2014 at 08:39:27AM CEST, [email protected] wrote:

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.

---
drivers/net/macvlan.c | 7 +++++++

1 file changed, 7 insertions(+)
drivers/net/macvlan.c +7 -0
index f0118d1..e03707d 100644
@@ -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)
Signature · 1 line
1.8.0