diff options
author | Parav Pandit <parav@mellanox.com> | 2020-03-03 08:12:43 -0600 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-03-03 15:40:40 -0800 |
commit | 162add8cbae4635cf0598c640a24d5ed2849774f (patch) | |
tree | e97dc67c70453024cc25356c8e413af85d3b3b3e /drivers/net/ethernet/mellanox/mlx5/core/en | |
parent | acf1ee44ca5da39755d2aa9080392eae46a0eb34 (diff) |
net/mlx5e: Use devlink virtual flavour for VF devlink port
Use newly introduce 'virtual' port flavour for devlink
port of PCI VF devlink device in non-representors mode.
While at it, remove recently introduced empty lines at end of the file.
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx5/core/en')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en/devlink.c | 39 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en/devlink.h | 7 |
2 files changed, 26 insertions, 20 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/devlink.c b/drivers/net/ethernet/mellanox/mlx5/core/en/devlink.c index 1a87a3fc6b44..e38495e4aa42 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/devlink.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/devlink.c @@ -3,36 +3,43 @@ #include "en/devlink.h" -int mlx5e_devlink_phy_port_register(struct net_device *dev) +int mlx5e_devlink_port_register(struct net_device *netdev) { + struct mlx5_core_dev *dev; struct mlx5e_priv *priv; struct devlink *devlink; int err; - priv = netdev_priv(dev); - devlink = priv_to_devlink(priv->mdev); - - devlink_port_attrs_set(&priv->dl_phy_port, - DEVLINK_PORT_FLAVOUR_PHYSICAL, - PCI_FUNC(priv->mdev->pdev->devfn), - false, 0, - NULL, 0); - err = devlink_port_register(devlink, &priv->dl_phy_port, 1); + priv = netdev_priv(netdev); + dev = priv->mdev; + + if (mlx5_core_is_pf(dev)) + devlink_port_attrs_set(&priv->dl_port, + DEVLINK_PORT_FLAVOUR_PHYSICAL, + PCI_FUNC(dev->pdev->devfn), + false, 0, + NULL, 0); + else + devlink_port_attrs_set(&priv->dl_port, + DEVLINK_PORT_FLAVOUR_VIRTUAL, + 0, false, 0, NULL, 0); + + devlink = priv_to_devlink(dev); + err = devlink_port_register(devlink, &priv->dl_port, 1); if (err) return err; - devlink_port_type_eth_set(&priv->dl_phy_port, dev); + devlink_port_type_eth_set(&priv->dl_port, netdev); return 0; } -void mlx5e_devlink_phy_port_unregister(struct mlx5e_priv *priv) +void mlx5e_devlink_port_unregister(struct mlx5e_priv *priv) { - devlink_port_unregister(&priv->dl_phy_port); + devlink_port_unregister(&priv->dl_port); } -struct devlink_port *mlx5e_get_devlink_phy_port(struct net_device *dev) +struct devlink_port *mlx5e_get_devlink_port(struct net_device *dev) { struct mlx5e_priv *priv = netdev_priv(dev); - return &priv->dl_phy_port; + return &priv->dl_port; } - diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/devlink.h b/drivers/net/ethernet/mellanox/mlx5/core/en/devlink.h index b8cd63b88688..3e5393a0901f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/devlink.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/devlink.h @@ -7,9 +7,8 @@ #include <net/devlink.h> #include "en.h" -int mlx5e_devlink_phy_port_register(struct net_device *dev); -void mlx5e_devlink_phy_port_unregister(struct mlx5e_priv *priv); -struct devlink_port *mlx5e_get_devlink_phy_port(struct net_device *dev); +int mlx5e_devlink_port_register(struct net_device *dev); +void mlx5e_devlink_port_unregister(struct mlx5e_priv *priv); +struct devlink_port *mlx5e_get_devlink_port(struct net_device *dev); #endif - |