1 From a1ff94c2973c43bc1e2677ac63ebb15b1d1ff846 Mon Sep 17 00:00:00 2001
2 From: Vladimir Oltean <vladimir.oltean@nxp.com>
3 Date: Thu, 6 Jan 2022 01:11:14 +0200
4 Subject: [PATCH 3/6] net: dsa: stop updating master MTU from master.c
6 At present there are two paths for changing the MTU of the DSA master.
11 -> dsa_tree_setup_ports
14 -> dsa_slave_change_mtu
15 -> dev_set_mtu(master)
20 -> dsa_tree_setup_master
24 So the dev_set_mtu() call from dsa_master_setup() has been effectively
25 superseded by the dsa_slave_change_mtu(slave_dev, ETH_DATA_LEN) that is
26 done from dsa_slave_create() for each user port. The later function also
27 updates the master MTU according to the largest user port MTU from the
28 tree. Therefore, updating the master MTU through a separate code path
31 Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
32 Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
33 Signed-off-by: David S. Miller <davem@davemloft.net>
35 net/dsa/master.c | 25 +------------------------
36 1 file changed, 1 insertion(+), 24 deletions(-)
38 --- a/net/dsa/master.c
39 +++ b/net/dsa/master.c
40 @@ -330,28 +330,13 @@ static const struct attribute_group dsa_
41 .attrs = dsa_slave_attrs,
44 -static void dsa_master_reset_mtu(struct net_device *dev)
49 - err = dev_set_mtu(dev, ETH_DATA_LEN);
52 - "Unable to reset MTU to exclude DSA overheads\n");
56 static struct lock_class_key dsa_master_addr_list_lock_key;
58 int dsa_master_setup(struct net_device *dev, struct dsa_port *cpu_dp)
60 - const struct dsa_device_ops *tag_ops = cpu_dp->tag_ops;
61 struct dsa_switch *ds = cpu_dp->ds;
62 struct device_link *consumer_link;
65 - mtu = ETH_DATA_LEN + dsa_tag_protocol_overhead(tag_ops);
68 /* The DSA master must use SET_NETDEV_DEV for this to work. */
69 consumer_link = device_link_add(ds->dev, dev->dev.parent,
70 @@ -361,13 +346,6 @@ int dsa_master_setup(struct net_device *
71 "Failed to create a device link to DSA switch %s\n",
75 - ret = dev_set_mtu(dev, mtu);
78 - netdev_warn(dev, "error %d setting MTU to %d to include DSA overhead\n",
81 /* If we use a tagging format that doesn't have an ethertype
82 * field, make sure that all packets from this point on get
83 * sent to the tag format's receive function.
84 @@ -405,7 +383,6 @@ void dsa_master_teardown(struct net_devi
85 sysfs_remove_group(&dev->dev.kobj, &dsa_group);
86 dsa_netdev_ops_set(dev, NULL);
87 dsa_master_ethtool_teardown(dev);
88 - dsa_master_reset_mtu(dev);
89 dsa_master_set_promiscuity(dev, -1);