Skip to content

Commit 2a4826f

Browse files
Eli Cohendledford
authored andcommitted
net/mlx5_core: Add VF param when querying vport counter
Add a vf parameter to mlx5_core_query_vport_counter so we can call it to query counters of virtual functions. Also update current users of the API. PFs may call mlx5_core_query_vport_counter with other_vport set to indicate that they are querying a virtual function. The virtual function to be queried is given by the vf parameter. Virtual function numbering is zero based so the first VF is 0 and so on. When a PF queries its own function, the other_vport parameter is cleared. Signed-off-by: Eli Cohen <eli@mellanox.com> Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
1 parent 9c3c5f8 commit 2a4826f

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

drivers/infiniband/hw/mlx5/mad.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ static int process_pma_cmd(struct ib_device *ibdev, u8 port_num,
208208
if (!out_cnt)
209209
return IB_MAD_RESULT_FAILURE;
210210

211-
err = mlx5_core_query_vport_counter(dev->mdev, 0,
211+
err = mlx5_core_query_vport_counter(dev->mdev, 0, 0,
212212
port_num, out_cnt, sz);
213213
if (!err)
214214
pma_cnt_ext_assign(pma_cnt_ext, out_cnt);

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,8 @@ int mlx5_nic_vport_disable_roce(struct mlx5_core_dev *mdev)
852852
EXPORT_SYMBOL_GPL(mlx5_nic_vport_disable_roce);
853853

854854
int mlx5_core_query_vport_counter(struct mlx5_core_dev *dev, u8 other_vport,
855-
u8 port_num, void *out, size_t out_sz)
855+
int vf, u8 port_num, void *out,
856+
size_t out_sz)
856857
{
857858
int in_sz = MLX5_ST_SZ_BYTES(query_vport_counter_in);
858859
int is_group_manager;
@@ -871,7 +872,7 @@ int mlx5_core_query_vport_counter(struct mlx5_core_dev *dev, u8 other_vport,
871872
if (other_vport) {
872873
if (is_group_manager) {
873874
MLX5_SET(query_vport_counter_in, in, other_vport, 1);
874-
MLX5_SET(query_vport_counter_in, in, vport_number, 0);
875+
MLX5_SET(query_vport_counter_in, in, vport_number, vf + 1);
875876
} else {
876877
err = -EPERM;
877878
goto free;

include/linux/mlx5/vport.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ int mlx5_modify_nic_vport_vlans(struct mlx5_core_dev *dev,
9393
int mlx5_nic_vport_enable_roce(struct mlx5_core_dev *mdev);
9494
int mlx5_nic_vport_disable_roce(struct mlx5_core_dev *mdev);
9595
int mlx5_core_query_vport_counter(struct mlx5_core_dev *dev, u8 other_vport,
96-
u8 port_num, void *out, size_t out_sz);
96+
int vf, u8 port_num, void *out,
97+
size_t out_sz);
9798

9899
#endif /* __MLX5_VPORT_H__ */

0 commit comments

Comments
 (0)