Skip to content

Commit cfbc360

Browse files
Tariq ToukanSaeed Mahameed
authored andcommitted
net/mlx5: Fix query of sd_group field
The sd_group field moved in the HW spec from the MPIR register to the vport context. Align the query accordingly. Fixes: f5e9563 ("net/mlx5: Expose Management PCIe Index Register (MPIR)") Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
1 parent 25461ce commit cfbc360

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

drivers/net/ethernet/mellanox/mlx5/core/vport.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,27 @@ int mlx5_query_nic_vport_system_image_guid(struct mlx5_core_dev *mdev,
440440
}
441441
EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_system_image_guid);
442442

443+
int mlx5_query_nic_vport_sd_group(struct mlx5_core_dev *mdev, u8 *sd_group)
444+
{
445+
int outlen = MLX5_ST_SZ_BYTES(query_nic_vport_context_out);
446+
u32 *out;
447+
int err;
448+
449+
out = kvzalloc(outlen, GFP_KERNEL);
450+
if (!out)
451+
return -ENOMEM;
452+
453+
err = mlx5_query_nic_vport_context(mdev, 0, out);
454+
if (err)
455+
goto out;
456+
457+
*sd_group = MLX5_GET(query_nic_vport_context_out, out,
458+
nic_vport_context.sd_group);
459+
out:
460+
kvfree(out);
461+
return err;
462+
}
463+
443464
int mlx5_query_nic_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid)
444465
{
445466
u32 *out;

include/linux/mlx5/mlx5_ifc.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4036,8 +4036,13 @@ struct mlx5_ifc_nic_vport_context_bits {
40364036
u8 affiliation_criteria[0x4];
40374037
u8 affiliated_vhca_id[0x10];
40384038

4039-
u8 reserved_at_60[0xd0];
4039+
u8 reserved_at_60[0xa0];
40404040

4041+
u8 reserved_at_100[0x1];
4042+
u8 sd_group[0x3];
4043+
u8 reserved_at_104[0x1c];
4044+
4045+
u8 reserved_at_120[0x10];
40414046
u8 mtu[0x10];
40424047

40434048
u8 system_image_guid[0x40];
@@ -10122,8 +10127,7 @@ struct mlx5_ifc_mpir_reg_bits {
1012210127
u8 reserved_at_20[0x20];
1012310128

1012410129
u8 local_port[0x8];
10125-
u8 reserved_at_28[0x15];
10126-
u8 sd_group[0x3];
10130+
u8 reserved_at_28[0x18];
1012710131

1012810132
u8 reserved_at_60[0x20];
1012910133
};

include/linux/mlx5/vport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ int mlx5_query_nic_vport_mtu(struct mlx5_core_dev *mdev, u16 *mtu);
7272
int mlx5_modify_nic_vport_mtu(struct mlx5_core_dev *mdev, u16 mtu);
7373
int mlx5_query_nic_vport_system_image_guid(struct mlx5_core_dev *mdev,
7474
u64 *system_image_guid);
75+
int mlx5_query_nic_vport_sd_group(struct mlx5_core_dev *mdev, u8 *sd_group);
7576
int mlx5_query_nic_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid);
7677
int mlx5_modify_nic_vport_node_guid(struct mlx5_core_dev *mdev,
7778
u16 vport, u64 node_guid);

0 commit comments

Comments
 (0)