Re: [patch net-next RFC 04/12] dsa: set devlink port attrs for dsa ports
flat view
From: Jiri Pirko <jiri@resnulli.us>
Date: 2018-05-18 06:37:37
Fri, May 18, 2018 at 03:41:37AM CEST, andrew@lunn.ch wrote:
quoted
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.
What benefit does it have to register unused ports? What is a usecase for them. Like Florian, I also think they should not be registered.
Andrew