1 From 904e112ad431492b34f235f59738e8312802bbf9 Mon Sep 17 00:00:00 2001
2 From: Vladimir Oltean <vladimir.oltean@nxp.com>
3 Date: Thu, 6 Jan 2022 01:11:12 +0200
4 Subject: [PATCH 1/6] net: dsa: reorder PHY initialization with MTU setup in
7 In dsa_slave_create() there are 2 sections that take rtnl_lock():
8 MTU change and netdev registration. They are separated by PHY
11 There isn't any strict ordering requirement except for the fact that
12 netdev registration should be last. Therefore, we can perform the MTU
13 change a bit later, after the PHY setup. A future change will then be
14 able to merge the two rtnl_lock sections into one.
16 Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
17 Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
18 Signed-off-by: David S. Miller <davem@davemloft.net>
20 net/dsa/slave.c | 14 +++++++-------
21 1 file changed, 7 insertions(+), 7 deletions(-)
25 @@ -1977,13 +1977,6 @@ int dsa_slave_create(struct dsa_port *po
26 port->slave = slave_dev;
27 dsa_slave_setup_tagger(slave_dev);
30 - ret = dsa_slave_change_mtu(slave_dev, ETH_DATA_LEN);
32 - if (ret && ret != -EOPNOTSUPP)
33 - dev_warn(ds->dev, "nonfatal error %d setting MTU to %d on port %d\n",
34 - ret, ETH_DATA_LEN, port->index);
36 netif_carrier_off(slave_dev);
38 ret = dsa_slave_phy_setup(slave_dev);
39 @@ -1995,6 +1988,13 @@ int dsa_slave_create(struct dsa_port *po
43 + ret = dsa_slave_change_mtu(slave_dev, ETH_DATA_LEN);
45 + if (ret && ret != -EOPNOTSUPP)
46 + dev_warn(ds->dev, "nonfatal error %d setting MTU to %d on port %d\n",
47 + ret, ETH_DATA_LEN, port->index);
51 ret = register_netdevice(slave_dev);