Commit 9c8e7434 authored by Parav Pandit's avatar Parav Pandit Committed by Saeed Mahameed

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: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 72d3fef1
...@@ -2056,26 +2056,22 @@ static int register_devlink_port(struct mlx5_core_dev *dev, ...@@ -2056,26 +2056,22 @@ static int register_devlink_port(struct mlx5_core_dev *dev,
return 0; return 0;
mlx5e_rep_get_port_parent_id(rpriv->netdev, &ppid); 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); 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_attrs_set(&rpriv->dl_port,
DEVLINK_PORT_FLAVOUR_PHYSICAL, DEVLINK_PORT_FLAVOUR_PHYSICAL,
pfnum, false, 0, pfnum, false, 0,
&ppid.id[0], ppid.id_len); &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, devlink_port_attrs_pci_pf_set(&rpriv->dl_port,
&ppid.id[0], ppid.id_len, &ppid.id[0], ppid.id_len,
pfnum); 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, devlink_port_attrs_pci_vf_set(&rpriv->dl_port,
&ppid.id[0], ppid.id_len, &ppid.id[0], ppid.id_len,
pfnum, rep->vport - 1); 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); return devlink_port_register(devlink, &rpriv->dl_port, dl_port_index);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment