quoted
quoted
quoted
ds = dsa_switch_alloc(&mdiodev->dev, DSA_MAX_PORTS);
It is allocating a switch with 12 ports. However only 4 of them have
names. So the core only creates slave devices for those 4.
This is a useful test. Real hardware often has unused ports. A WiFi AP
with a 7 port switch which only uses 6 ports is often seen.
The following patch should fix this:
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index adf50fbc4c13..a06c29ec91f0 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -262,13 +262,14 @@ static int dsa_port_setup(struct dsa_port *dp)
memset(&dp->devlink_port, 0, sizeof(dp->devlink_port));
+ if (dp->type == DSA_PORT_TYPE_UNUSED)
+ return 0;
+
err = devlink_port_register(ds->devlink, &dp->devlink_port,dp->index);
Hi Florian, Jiri
Maybe it is better to add a devlink port type unused?
The port does not exist on the switch, so it should not even be
registered IMHO.
Hi Florian
The ports do exist, when you called dsa_switch_alloc() you said the
switch has 12 ports.
Andrew