Skip to content

Commit

Permalink
net: dsa: Fix type was not set for devlink port
Browse files Browse the repository at this point in the history
If PHY is not available on DSA port (described at devicetree but absent or
failed to detect) then kernel prints warning after 3700 secs:

[ 3707.948771] ------------[ cut here ]------------
[ 3707.948784] Type was not set for devlink port.
[ 3707.948894] WARNING: CPU: 1 PID: 17 at net/core/devlink.c:8097 0xc083f9d8

We should unregister the devlink port as a user port and
re-register it as an unused port before executing "continue" in case of
dsa_port_setup error.

Fixes: 86f8b1c ("net: dsa: Do not make user port errors fatal")
Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Maxim Kochetkov authored and David S. Miller committed Mar 29, 2021
1 parent bff5b62 commit fb6ec87
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion net/dsa/dsa2.c
Original file line number Diff line number Diff line change
Expand Up @@ -795,8 +795,14 @@ static int dsa_tree_setup_switches(struct dsa_switch_tree *dst)

list_for_each_entry(dp, &dst->ports, list) {
err = dsa_port_setup(dp);
if (err)
if (err) {
dsa_port_devlink_teardown(dp);
dp->type = DSA_PORT_TYPE_UNUSED;
err = dsa_port_devlink_setup(dp);
if (err)
goto teardown;
continue;
}
}

return 0;
Expand Down

0 comments on commit fb6ec87

Please sign in to comment.