]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
net: dsa: Restore MTU on master device on unload
authorAndrew Lunn <andrew@lunn.ch>
Sat, 8 Dec 2018 16:05:18 +0000 (17:05 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sun, 9 Dec 2018 05:39:07 +0000 (21:39 -0800)
A previous change tries to set the MTU on the master device to take
into account the DSA overheads. This patch tries to reset the master
device back to the default MTU.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/master.c

index 42f525bc68e2aef3b63f2ffaf94d4522778d4249..a25242e71fb2f3e485da8d43bc7a63db2977b991 100644 (file)
@@ -172,6 +172,18 @@ void dsa_master_set_mtu(struct net_device *dev, struct dsa_port *cpu_dp)
        rtnl_unlock();
 }
 
+static void dsa_master_reset_mtu(struct net_device *dev)
+{
+       int err;
+
+       rtnl_lock();
+       err = dev_set_mtu(dev, ETH_DATA_LEN);
+       if (err)
+               netdev_dbg(dev,
+                          "Unable to reset MTU to exclude DSA overheads\n");
+       rtnl_unlock();
+}
+
 int dsa_master_setup(struct net_device *dev, struct dsa_port *cpu_dp)
 {
        dsa_master_set_mtu(dev,  cpu_dp);
@@ -190,6 +202,7 @@ int dsa_master_setup(struct net_device *dev, struct dsa_port *cpu_dp)
 void dsa_master_teardown(struct net_device *dev)
 {
        dsa_master_ethtool_teardown(dev);
+       dsa_master_reset_mtu(dev);
 
        dev->dsa_ptr = NULL;