Skip to contentSkip to conversation

FAILED: Patch "net: dsa: Fix type was not set for devlink port" failed to apply to 4.19-stable tree

PATCH Sasha Levin 1 participant 1 message Apr 12, 2021

Subsystems (3)
lore
Share & tools
lore

Sasha Levin

author maintainer
#0 lore raw

The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

Thanks,
Sasha

------------------ original commit in Linus's tree ------------------

From fb6ec87f7229b92baa81b35cbc76f2626d5bfadb Mon Sep 17 00:00:00 2001
From: Maxim Kochetkov <[email protected]>
Date: Mon, 29 Mar 2021 18:30:16 +0300
Subject: [PATCH] net: dsa: Fix type was not set for devlink port

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 86f8b1c01a0a ("net: dsa: Do not make user port errors fatal")
---
 net/dsa/dsa2.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
net/dsa/dsa2.c +7 -1
index d142eb2b288b..3c3e56a1f34d 100644
@@ -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;
Signature · 1 line
2.30.2