Skip to content

Commit 91e7398

Browse files
shayshyikuba-moo
authored andcommitted
net/mlx5: Update pfnum retrieval for devlink port attributes
Align mlx5 driver usage of 'pfnum' with the documentation clarification introduced in commit bb70b0d ("devlink: Improve the port attributes description"). Signed-off-by: Shay Drory <shayd@nvidia.com> Reviewed-by: Mark Bloch <mbloch@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Link: https://patch.msgid.link/1742392983-153050-4-git-send-email-tariqt@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent ade4794 commit 91e7398

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

drivers/net/ethernet/mellanox/mlx5/core/esw/devlink_port.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ static void mlx5_esw_offloads_pf_vf_devlink_port_attrs_set(struct mlx5_eswitch *
3232
u16 pfnum;
3333

3434
mlx5_esw_get_port_parent_id(dev, &ppid);
35-
pfnum = mlx5_get_dev_index(dev);
35+
pfnum = PCI_FUNC(dev->pdev->devfn);
3636
external = mlx5_core_is_ecpf_esw_manager(dev);
3737
if (external)
3838
controller_num = dev->priv.eswitch->offloads.host_number + 1;
@@ -110,7 +110,7 @@ static void mlx5_esw_offloads_sf_devlink_port_attrs_set(struct mlx5_eswitch *esw
110110
struct netdev_phys_item_id ppid = {};
111111
u16 pfnum;
112112

113-
pfnum = mlx5_get_dev_index(dev);
113+
pfnum = PCI_FUNC(dev->pdev->devfn);
114114
mlx5_esw_get_port_parent_id(dev, &ppid);
115115
memcpy(dl_port->attrs.switch_id.id, &ppid.id[0], ppid.id_len);
116116
dl_port->attrs.switch_id.id_len = ppid.id_len;

drivers/net/ethernet/mellanox/mlx5/core/sf/devlink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ mlx5_sf_new_check_attr(struct mlx5_core_dev *dev, const struct devlink_port_new_
285285
NL_SET_ERR_MSG_MOD(extack, "External controller is unsupported");
286286
return -EOPNOTSUPP;
287287
}
288-
if (new_attr->pfnum != mlx5_get_dev_index(dev)) {
288+
if (new_attr->pfnum != PCI_FUNC(dev->pdev->devfn)) {
289289
NL_SET_ERR_MSG_MOD(extack, "Invalid pfnum supplied");
290290
return -EOPNOTSUPP;
291291
}

0 commit comments

Comments
 (0)