diff options
author | Jiri Pirko <jiri@mellanox.com> | 2019-03-28 13:56:38 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-03-28 12:55:30 -0700 |
commit | 011d32560242f8bd93a33b17bfcff310ab8d569b (patch) | |
tree | 5a144607164829a948988e4d8adfd33c2ce26f01 /drivers/net/ethernet/mellanox/mlxsw/switchx2.c | |
parent | af3836df9a59e7339d60c9c46729a7d9094d0582 (diff) | |
download | linux-stable-011d32560242f8bd93a33b17bfcff310ab8d569b.tar.gz linux-stable-011d32560242f8bd93a33b17bfcff310ab8d569b.tar.bz2 linux-stable-011d32560242f8bd93a33b17bfcff310ab8d569b.zip |
mlxsw: Implement ndo_get_devlink_port
In order for devlink compat functions to work, implement
ndo_get_devlink_port.
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlxsw/switchx2.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlxsw/switchx2.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c index 568883fc40df..696b8c8547bc 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c +++ b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c @@ -401,6 +401,16 @@ static int mlxsw_sx_port_get_port_parent_id(struct net_device *dev, return 0; } +static struct devlink_port * +mlxsw_sx_port_get_devlink_port(struct net_device *dev) +{ + struct mlxsw_sx_port *mlxsw_sx_port = netdev_priv(dev); + struct mlxsw_sx *mlxsw_sx = mlxsw_sx_port->mlxsw_sx; + + return mlxsw_core_port_devlink_port_get(mlxsw_sx->core, + mlxsw_sx_port->local_port); +} + static const struct net_device_ops mlxsw_sx_port_netdev_ops = { .ndo_open = mlxsw_sx_port_open, .ndo_stop = mlxsw_sx_port_stop, @@ -409,6 +419,7 @@ static const struct net_device_ops mlxsw_sx_port_netdev_ops = { .ndo_get_stats64 = mlxsw_sx_port_get_stats64, .ndo_get_phys_port_name = mlxsw_sx_port_get_phys_port_name, .ndo_get_port_parent_id = mlxsw_sx_port_get_port_parent_id, + .ndo_get_devlink_port = mlxsw_sx_port_get_devlink_port, }; static void mlxsw_sx_port_get_drvinfo(struct net_device *dev, |