Re: [PATCH] net/mlx5: Fix wrong register access in mlx5_query_mtppse()
From: Gal Pressman
Date: Mon Jun 15 2026 - 08:03:20 EST
Hello Li RongQing,
On 13/06/2026 18:36, lirongqing wrote:
> From: Li RongQing <lirongqing@xxxxxxxxx>
>
> In mlx5_query_mtppse(), the result of mtppse_reg query should be read
> from the output buffer 'out', not the input buffer 'in'. The function
> currently reads event_arm and event_generation_mode from 'in', which
> contains the uninitialized query parameters rather than the actual
> register values.
>
> Fix by reading from the correct buffer 'out'.
>
> Fixes: f9a1ef720e9e ("net/mlx5: Add MTPPS and MTPPSE registers infrastructure")
> Signed-off-by: Li RongQing <lirongqing@xxxxxxxxx>
> ---
> drivers/net/ethernet/mellanox/mlx5/core/port.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/port.c b/drivers/net/ethernet/mellanox/mlx5/core/port.c
> index ee8b976..2ab6a6a 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/port.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/port.c
> @@ -921,8 +921,8 @@ int mlx5_query_mtppse(struct mlx5_core_dev *mdev, u8 pin, u8 *arm, u8 *mode)
> if (err)
> return err;
>
> - *arm = MLX5_GET(mtppse_reg, in, event_arm);
> - *mode = MLX5_GET(mtppse_reg, in, event_generation_mode);
> + *arm = MLX5_GET(mtppse_reg, out, event_arm);
> + *mode = MLX5_GET(mtppse_reg, out, event_generation_mode);
>
> return err;
> }
This is clearly completely broken, which pointed me to the fact that
mlx5_query_mtppse() is not used anywhere.
Can you please submit a patch to remove it?