diff mbox series

[net-next,v4,10/12] dsa: do not support ndo_get_phys_port_name for non-legacy ports

Message ID 20190328125646.872-11-jiri@resnulli.us
State Accepted
Delegated to: David Miller
Headers show
Series net: call for phys_port_name into devlink directly if possible | expand

Commit Message

Jiri Pirko March 28, 2019, 12:56 p.m. UTC
From: Jiri Pirko <jiri@mellanox.com>

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>
---
v3->v4:
- changed to return -EOPNOTSUPP for non-legacy ports
v1->v2:
- new patch
---
 net/dsa/slave.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Florian Fainelli March 28, 2019, 5:18 p.m. UTC | #1
On 3/28/19 5:56 AM, Jiri Pirko wrote:
> From: Jiri Pirko <jiri@mellanox.com>
> 
> 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>
diff mbox series

Patch

diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index d1a0a656b6b5..80be8e86c82d 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;