Skip to content

Commit

Permalink
net/mlx5: Fix query of sd_group field
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tariq Toukan authored and Saeed Mahameed committed Dec 21, 2023
1 parent a7e7b40 commit e04984a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
21 changes: 21 additions & 0 deletions drivers/net/ethernet/mellanox/mlx5/core/vport.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,27 @@ int mlx5_query_nic_vport_system_image_guid(struct mlx5_core_dev *mdev,
}
EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_system_image_guid);

int mlx5_query_nic_vport_sd_group(struct mlx5_core_dev *mdev, u8 *sd_group)
{
int outlen = MLX5_ST_SZ_BYTES(query_nic_vport_context_out);
u32 *out;
int err;

out = kvzalloc(outlen, GFP_KERNEL);
if (!out)
return -ENOMEM;

err = mlx5_query_nic_vport_context(mdev, 0, out);
if (err)
goto out;

*sd_group = MLX5_GET(query_nic_vport_context_out, out,
nic_vport_context.sd_group);
out:
kvfree(out);
return err;
}

int mlx5_query_nic_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid)
{
u32 *out;
Expand Down
10 changes: 7 additions & 3 deletions include/linux/mlx5/mlx5_ifc.h
Original file line number Diff line number Diff line change
Expand Up @@ -4030,8 +4030,13 @@ struct mlx5_ifc_nic_vport_context_bits {
u8 affiliation_criteria[0x4];
u8 affiliated_vhca_id[0x10];

u8 reserved_at_60[0xd0];
u8 reserved_at_60[0xa0];

u8 reserved_at_100[0x1];
u8 sd_group[0x3];
u8 reserved_at_104[0x1c];

u8 reserved_at_120[0x10];
u8 mtu[0x10];

u8 system_image_guid[0x40];
Expand Down Expand Up @@ -10116,8 +10121,7 @@ struct mlx5_ifc_mpir_reg_bits {
u8 reserved_at_20[0x20];

u8 local_port[0x8];
u8 reserved_at_28[0x15];
u8 sd_group[0x3];
u8 reserved_at_28[0x18];

u8 reserved_at_60[0x20];
};
Expand Down
1 change: 1 addition & 0 deletions include/linux/mlx5/vport.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ int mlx5_query_nic_vport_mtu(struct mlx5_core_dev *mdev, u16 *mtu);
int mlx5_modify_nic_vport_mtu(struct mlx5_core_dev *mdev, u16 mtu);
int mlx5_query_nic_vport_system_image_guid(struct mlx5_core_dev *mdev,
u64 *system_image_guid);
int mlx5_query_nic_vport_sd_group(struct mlx5_core_dev *mdev, u8 *sd_group);
int mlx5_query_nic_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid);
int mlx5_modify_nic_vport_node_guid(struct mlx5_core_dev *mdev,
u16 vport, u64 node_guid);
Expand Down

0 comments on commit e04984a

Please sign in to comment.