Netdev List
 help / color / mirror / Atom feed
* [PATCH] net/mlx5: Fix wrong register access in mlx5_query_mtppse()
@ 2026-06-13 15:36 lirongqing
  2026-06-15 12:02 ` Gal Pressman
  0 siblings, 1 reply; 3+ messages in thread
From: lirongqing @ 2026-06-13 15:36 UTC (permalink / raw)
  To: Saeed Mahameed, Leon Romanovsky, Tariq Toukan, Mark Bloch,
	Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, netdev, linux-rdma, linux-kernel
  Cc: Li RongQing

From: Li RongQing <lirongqing@baidu.com>

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@baidu.com>
---
 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;
 }
-- 
2.9.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net/mlx5: Fix wrong register access in mlx5_query_mtppse()
  2026-06-13 15:36 [PATCH] net/mlx5: Fix wrong register access in mlx5_query_mtppse() lirongqing
@ 2026-06-15 12:02 ` Gal Pressman
  2026-06-15 13:09   ` 答复: [外部邮件] " Li,Rongqing
  0 siblings, 1 reply; 3+ messages in thread
From: Gal Pressman @ 2026-06-15 12:02 UTC (permalink / raw)
  To: lirongqing, Saeed Mahameed, Leon Romanovsky, Tariq Toukan,
	Mark Bloch, Andrew Lunn, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev, linux-rdma, linux-kernel

Hello Li RongQing,

On 13/06/2026 18:36, lirongqing wrote:
> From: Li RongQing <lirongqing@baidu.com>
> 
> 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@baidu.com>
> ---
>  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?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* 答复: [外部邮件] Re: [PATCH] net/mlx5: Fix wrong register access in mlx5_query_mtppse()
  2026-06-15 12:02 ` Gal Pressman
@ 2026-06-15 13:09   ` Li,Rongqing
  0 siblings, 0 replies; 3+ messages in thread
From: Li,Rongqing @ 2026-06-15 13:09 UTC (permalink / raw)
  To: Gal Pressman, Saeed Mahameed, Leon Romanovsky, Tariq Toukan,
	Mark Bloch, Andrew Lunn, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev@vger.kernel.org,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org

> 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?

Ok, I will remove it  

[Li,Rongqing] 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-06-15 13:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-13 15:36 [PATCH] net/mlx5: Fix wrong register access in mlx5_query_mtppse() lirongqing
2026-06-15 12:02 ` Gal Pressman
2026-06-15 13:09   ` 答复: [外部邮件] " Li,Rongqing

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox