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 diff --git a/net/dsa/master.c b/net/dsa/master.c
39 index e8e19857621b..f4efb244f91d 100644
40 --- a/net/dsa/master.c
41 +++ b/net/dsa/master.c
42 @@ -330,28 +330,13 @@ static const struct attribute_group dsa_group = {
43 .attrs = dsa_slave_attrs,
46 -static void dsa_master_reset_mtu(struct net_device *dev)
51 - err = dev_set_mtu(dev, ETH_DATA_LEN);
54 - "Unable to reset MTU to exclude DSA overheads\n");
58 static struct lock_class_key dsa_master_addr_list_lock_key;
60 int dsa_master_setup(struct net_device *dev, struct dsa_port *cpu_dp)
62 - const struct dsa_device_ops *tag_ops = cpu_dp->tag_ops;
63 struct dsa_switch *ds = cpu_dp->ds;
64 struct device_link *consumer_link;
67 - mtu = ETH_DATA_LEN + dsa_tag_protocol_overhead(tag_ops);
70 /* The DSA master must use SET_NETDEV_DEV for this to work. */
71 consumer_link = device_link_add(ds->dev, dev->dev.parent,
72 @@ -361,13 +346,6 @@ int dsa_master_setup(struct net_device *dev, struct dsa_port *cpu_dp)
73 "Failed to create a device link to DSA switch %s\n",
77 - ret = dev_set_mtu(dev, mtu);
80 - netdev_warn(dev, "error %d setting MTU to %d to include DSA overhead\n",
83 /* If we use a tagging format that doesn't have an ethertype
84 * field, make sure that all packets from this point on get
85 * sent to the tag format's receive function.
86 @@ -405,7 +383,6 @@ void dsa_master_teardown(struct net_device *dev)
87 sysfs_remove_group(&dev->dev.kobj, &dsa_group);
88 dsa_netdev_ops_set(dev, NULL);
89 dsa_master_ethtool_teardown(dev);
90 - dsa_master_reset_mtu(dev);
91 dsa_master_set_promiscuity(dev, -1);