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