forked from Minki/linux
Revert "net: dsa: setup master before ports"
This reverts commit11fd667dac
. dsa_slave_change_mtu() updates the MTU of the DSA master and of the associated CPU port, but only if it detects a change to the master MTU. The blamed commit in the Fixes: tag below addressed a regression where dsa_slave_change_mtu() would return early and not do anything due to ds->ops->port_change_mtu() not being implemented. However, that commit also had the effect that the master MTU got set up to the correct value by dsa_master_setup(), but the associated CPU port's MTU did not get updated. This causes breakage for drivers that rely on the ->port_change_mtu() DSA call to account for the tagging overhead on the CPU port, and don't set up the initial MTU during the setup phase. Things actually worked before because they were in a fragile equilibrium where dsa_slave_change_mtu() was called before dsa_master_setup() was. So dsa_slave_change_mtu() could actually detect a change and update the CPU port MTU too. Restore the code to the way things used to work by reverting the reorder of dsa_tree_setup_master() and dsa_tree_setup_ports(). That change did not have a concrete motivation going for it anyway, it just looked better. Fixes:066dfc4290
("Revert "net: dsa: stop updating master MTU from master.c"") Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
e16b859872
commit
762c2998c9
@ -562,7 +562,6 @@ static void dsa_port_teardown(struct dsa_port *dp)
|
||||
{
|
||||
struct devlink_port *dlp = &dp->devlink_port;
|
||||
struct dsa_switch *ds = dp->ds;
|
||||
struct net_device *slave;
|
||||
|
||||
if (!dp->setup)
|
||||
return;
|
||||
@ -584,11 +583,9 @@ static void dsa_port_teardown(struct dsa_port *dp)
|
||||
dsa_port_link_unregister_of(dp);
|
||||
break;
|
||||
case DSA_PORT_TYPE_USER:
|
||||
slave = dp->slave;
|
||||
|
||||
if (slave) {
|
||||
if (dp->slave) {
|
||||
dsa_slave_destroy(dp->slave);
|
||||
dp->slave = NULL;
|
||||
dsa_slave_destroy(slave);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1147,17 +1144,17 @@ static int dsa_tree_setup(struct dsa_switch_tree *dst)
|
||||
if (err)
|
||||
goto teardown_cpu_ports;
|
||||
|
||||
err = dsa_tree_setup_master(dst);
|
||||
err = dsa_tree_setup_ports(dst);
|
||||
if (err)
|
||||
goto teardown_switches;
|
||||
|
||||
err = dsa_tree_setup_ports(dst);
|
||||
err = dsa_tree_setup_master(dst);
|
||||
if (err)
|
||||
goto teardown_master;
|
||||
goto teardown_ports;
|
||||
|
||||
err = dsa_tree_setup_lags(dst);
|
||||
if (err)
|
||||
goto teardown_ports;
|
||||
goto teardown_master;
|
||||
|
||||
dst->setup = true;
|
||||
|
||||
@ -1165,10 +1162,10 @@ static int dsa_tree_setup(struct dsa_switch_tree *dst)
|
||||
|
||||
return 0;
|
||||
|
||||
teardown_ports:
|
||||
dsa_tree_teardown_ports(dst);
|
||||
teardown_master:
|
||||
dsa_tree_teardown_master(dst);
|
||||
teardown_ports:
|
||||
dsa_tree_teardown_ports(dst);
|
||||
teardown_switches:
|
||||
dsa_tree_teardown_switches(dst);
|
||||
teardown_cpu_ports:
|
||||
@ -1186,10 +1183,10 @@ static void dsa_tree_teardown(struct dsa_switch_tree *dst)
|
||||
|
||||
dsa_tree_teardown_lags(dst);
|
||||
|
||||
dsa_tree_teardown_ports(dst);
|
||||
|
||||
dsa_tree_teardown_master(dst);
|
||||
|
||||
dsa_tree_teardown_ports(dst);
|
||||
|
||||
dsa_tree_teardown_switches(dst);
|
||||
|
||||
dsa_tree_teardown_cpu_ports(dst);
|
||||
|
Loading…
Reference in New Issue
Block a user