summaryrefslogtreecommitdiff
path: root/net/dsa
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2018-12-08 19:05:18 +0300
committerDavid S. Miller <davem@davemloft.net>2018-12-09 08:39:07 +0300
commit91ba479573792e1f375e6c2b587c6eab882baa20 (patch)
tree8fcf182cfe4787bedbdf8142cfde3ecec6502619 /net/dsa
parent120d633f199b264e0ad4c98eedc0564a89171c1d (diff)
downloadlinux-91ba479573792e1f375e6c2b587c6eab882baa20.tar.xz
net: dsa: Restore MTU on master device on unload
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>
Diffstat (limited to 'net/dsa')
-rw-r--r--net/dsa/master.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/net/dsa/master.c b/net/dsa/master.c
index 42f525bc68e2..a25242e71fb2 100644
--- a/net/dsa/master.c
+++ b/net/dsa/master.c
@@ -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;