mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-25 03:59:54 +07:00
net/mlx5e: Use helper API to get devlink port index for all port flavours
Use existing helper API to get unique devlink port index for all devlink port flavours. Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Parav Pandit <parav@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:
parent
72d3fef161
commit
9c8e7434e0
@ -2056,26 +2056,22 @@ static int register_devlink_port(struct mlx5_core_dev *dev,
|
||||
return 0;
|
||||
|
||||
mlx5e_rep_get_port_parent_id(rpriv->netdev, &ppid);
|
||||
dl_port_index = vport_to_devlink_port_index(dev, rep->vport);
|
||||
pfnum = PCI_FUNC(dev->pdev->devfn);
|
||||
|
||||
if (rep->vport == MLX5_VPORT_UPLINK) {
|
||||
if (rep->vport == MLX5_VPORT_UPLINK)
|
||||
devlink_port_attrs_set(&rpriv->dl_port,
|
||||
DEVLINK_PORT_FLAVOUR_PHYSICAL,
|
||||
pfnum, false, 0,
|
||||
&ppid.id[0], ppid.id_len);
|
||||
dl_port_index = vport_to_devlink_port_index(dev, rep->vport);
|
||||
} else if (rep->vport == MLX5_VPORT_PF) {
|
||||
else if (rep->vport == MLX5_VPORT_PF)
|
||||
devlink_port_attrs_pci_pf_set(&rpriv->dl_port,
|
||||
&ppid.id[0], ppid.id_len,
|
||||
pfnum);
|
||||
dl_port_index = rep->vport;
|
||||
} else if (mlx5_eswitch_is_vf_vport(dev->priv.eswitch,
|
||||
rpriv->rep->vport)) {
|
||||
else if (mlx5_eswitch_is_vf_vport(dev->priv.eswitch, rpriv->rep->vport))
|
||||
devlink_port_attrs_pci_vf_set(&rpriv->dl_port,
|
||||
&ppid.id[0], ppid.id_len,
|
||||
pfnum, rep->vport - 1);
|
||||
dl_port_index = vport_to_devlink_port_index(dev, rep->vport);
|
||||
}
|
||||
|
||||
return devlink_port_register(devlink, &rpriv->dl_port, dl_port_index);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user