Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Andrew Lunn and committed by
David S. Miller
91ba4795 120d633f

+13
+13
net/dsa/master.c
··· 172 172 rtnl_unlock(); 173 173 } 174 174 175 + static void dsa_master_reset_mtu(struct net_device *dev) 176 + { 177 + int err; 178 + 179 + rtnl_lock(); 180 + err = dev_set_mtu(dev, ETH_DATA_LEN); 181 + if (err) 182 + netdev_dbg(dev, 183 + "Unable to reset MTU to exclude DSA overheads\n"); 184 + rtnl_unlock(); 185 + } 186 + 175 187 int dsa_master_setup(struct net_device *dev, struct dsa_port *cpu_dp) 176 188 { 177 189 dsa_master_set_mtu(dev, cpu_dp); ··· 202 190 void dsa_master_teardown(struct net_device *dev) 203 191 { 204 192 dsa_master_ethtool_teardown(dev); 193 + dsa_master_reset_mtu(dev); 205 194 206 195 dev->dsa_ptr = NULL; 207 196