dsa: do not support ndo_get_phys_port_name for non-legacy ports
authorJiri Pirko <jiri@mellanox.com>
Thu, 28 Mar 2019 12:56:44 +0000 (13:56 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 28 Mar 2019 19:55:31 +0000 (12:55 -0700)
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 <jiri@mellanox.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/slave.c

index d1a0a656b6b522f41dcdce0fa55f406094c3f8ab..80be8e86c82df5da1edd984cdbcde09d27cfe68d 100644 (file)
@@ -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;