From: Jiri Pirko Date: Thu, 28 Mar 2019 12:56:44 +0000 (+0100) Subject: dsa: do not support ndo_get_phys_port_name for non-legacy ports X-Git-Tag: v5.2-rc1~133^2~289^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d484210bf745ee6d8269b7d747bc5b94c4416ff1;p=thirdparty%2Fkernel%2Flinux.git dsa: do not support ndo_get_phys_port_name for non-legacy ports Since each non-legacy slave has its own devlink port instance correctly set, rely on devlink core to generate correct phys port name. Signed-off-by: Jiri Pirko Reviewed-by: Florian Fainelli Signed-off-by: David S. Miller --- diff --git a/net/dsa/slave.c b/net/dsa/slave.c index d1a0a656b6b52..80be8e86c82df 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -736,6 +736,13 @@ static int dsa_slave_get_phys_port_name(struct net_device *dev, { struct dsa_port *dp = dsa_slave_to_port(dev); + /* For non-legacy ports, devlink is used and it takes + * care of the name generation. This ndo implementation + * should be removed with legacy support. + */ + if (dp->ds->devlink) + return -EOPNOTSUPP; + if (snprintf(name, len, "p%d", dp->index) >= len) return -EINVAL;