summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorJiri Pirko <jiri@mellanox.com>2019-03-28 13:56:43 +0100
committerDavid S. Miller <davem@davemloft.net>2019-03-28 12:55:31 -0700
commit716efee200a7fcf4d1eedf9f6e71751d4ed8e806 (patch)
tree3c1e5f0df686b208f33895909cce383d3f21badd /net
parentab178b058c4354ea16a0b0be28914874f7e2972d (diff)
dsa: implement ndo_get_devlink_port
In order for devlink compat functions to work, implement ndo_get_devlink_port. Legacy slaves does not have devlink port instances created for themselves. 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>
Diffstat (limited to 'net')
-rw-r--r--net/dsa/slave.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 6a8418dfa64f..d1a0a656b6b5 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -1096,6 +1096,13 @@ int dsa_legacy_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
return dsa_port_fdb_del(dp, addr, vid);
}
+static struct devlink_port *dsa_slave_get_devlink_port(struct net_device *dev)
+{
+ struct dsa_port *dp = dsa_slave_to_port(dev);
+
+ return dp->ds->devlink ? &dp->devlink_port : NULL;
+}
+
static const struct net_device_ops dsa_slave_netdev_ops = {
.ndo_open = dsa_slave_open,
.ndo_stop = dsa_slave_close,
@@ -1119,6 +1126,7 @@ static const struct net_device_ops dsa_slave_netdev_ops = {
.ndo_get_port_parent_id = dsa_slave_get_port_parent_id,
.ndo_vlan_rx_add_vid = dsa_slave_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = dsa_slave_vlan_rx_kill_vid,
+ .ndo_get_devlink_port = dsa_slave_get_devlink_port,
};
static struct device_type dsa_type = {