]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net/mlx5: Update pfnum retrieval for devlink port attributes
authorShay Drory <shayd@nvidia.com>
Wed, 19 Mar 2025 14:03:01 +0000 (16:03 +0200)
committerJakub Kicinski <kuba@kernel.org>
Tue, 25 Mar 2025 14:29:47 +0000 (07:29 -0700)
Align mlx5 driver usage of 'pfnum' with the documentation clarification
introduced in commit bb70b0d48d8e ("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>
drivers/net/ethernet/mellanox/mlx5/core/esw/devlink_port.c
drivers/net/ethernet/mellanox/mlx5/core/sf/devlink.c

index 982fe371468345b30a6f2f2bb21d315e8231527f..b7102e14d23d3b44fc41763d28907613d7d734d8 100644 (file)
@@ -32,7 +32,7 @@ static void mlx5_esw_offloads_pf_vf_devlink_port_attrs_set(struct mlx5_eswitch *
        u16 pfnum;
 
        mlx5_esw_get_port_parent_id(dev, &ppid);
-       pfnum = mlx5_get_dev_index(dev);
+       pfnum = PCI_FUNC(dev->pdev->devfn);
        external = mlx5_core_is_ecpf_esw_manager(dev);
        if (external)
                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
        struct netdev_phys_item_id ppid = {};
        u16 pfnum;
 
-       pfnum = mlx5_get_dev_index(dev);
+       pfnum = PCI_FUNC(dev->pdev->devfn);
        mlx5_esw_get_port_parent_id(dev, &ppid);
        memcpy(dl_port->attrs.switch_id.id, &ppid.id[0], ppid.id_len);
        dl_port->attrs.switch_id.id_len = ppid.id_len;
index b96909fbeb12de3336fd4c0a6f254aedef670c70..0864ba625c07d728938c719e4d1a6ad1d689f0a0 100644 (file)
@@ -285,7 +285,7 @@ mlx5_sf_new_check_attr(struct mlx5_core_dev *dev, const struct devlink_port_new_
                NL_SET_ERR_MSG_MOD(extack, "External controller is unsupported");
                return -EOPNOTSUPP;
        }
-       if (new_attr->pfnum != mlx5_get_dev_index(dev)) {
+       if (new_attr->pfnum != PCI_FUNC(dev->pdev->devfn)) {
                NL_SET_ERR_MSG_MOD(extack, "Invalid pfnum supplied");
                return -EOPNOTSUPP;
        }