Skip to content

Commit 2de43f5

Browse files
PatrisiousHaddadrleon
authored andcommitted
RDMA/mlx5: Fix Q-counters query in LAG mode
Previously we used the core device associated to the IB device in order to do the Q-counters query to the FW, but in LAG mode it is possible that the core device isn't the one that created this VF. Hence instead of using the core device to query the Q-counters we use the ESW core device which is guaranteed to be that of the VF. Fixes: d22467a ("RDMA/mlx5: Expand switchdev Q-counters to expose representor statistics") Signed-off-by: Patrisious Haddad <phaddad@nvidia.com> Reviewed-by: Mark Zhang <markzhang@nvidia.com> Link: https://lore.kernel.org/r/778d7d7a24892348d0bdef17d2e5f9e044717e86.1685960567.git.leon@kernel.org Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent e80ef13 commit 2de43f5

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

drivers/infiniband/hw/mlx5/counters.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,19 +330,24 @@ static int mlx5_ib_query_q_counters_vport(struct mlx5_ib_dev *dev,
330330
{
331331
u32 out[MLX5_ST_SZ_DW(query_q_counter_out)] = {};
332332
u32 in[MLX5_ST_SZ_DW(query_q_counter_in)] = {};
333+
struct mlx5_core_dev *mdev;
333334
__be32 val;
334335
int ret, i;
335336

336337
if (!dev->port[port_num].rep ||
337338
dev->port[port_num].rep->vport == MLX5_VPORT_UPLINK)
338339
return 0;
339340

341+
mdev = mlx5_eswitch_get_core_dev(dev->port[port_num].rep->esw);
342+
if (!mdev)
343+
return -EOPNOTSUPP;
344+
340345
MLX5_SET(query_q_counter_in, in, opcode, MLX5_CMD_OP_QUERY_Q_COUNTER);
341346
MLX5_SET(query_q_counter_in, in, other_vport, 1);
342347
MLX5_SET(query_q_counter_in, in, vport_number,
343348
dev->port[port_num].rep->vport);
344349
MLX5_SET(query_q_counter_in, in, aggregate, 1);
345-
ret = mlx5_cmd_exec_inout(dev->mdev, query_q_counter, in, out);
350+
ret = mlx5_cmd_exec_inout(mdev, query_q_counter, in, out);
346351
if (ret)
347352
return ret;
348353

0 commit comments

Comments
 (0)