diff mbox series

[net-next,07/12] net/mlx5: HWS, Fix pool size optimization

Message ID 1744120856-341328-8-git-send-email-tariqt@nvidia.com (mailing list archive)
State Superseded
Headers show
Series net/mlx5: HWS, Refactor action STE handling | expand

Commit Message

Tariq Toukan April 8, 2025, 2 p.m. UTC
From: Vlad Dogaru <vdogaru@nvidia.com>

The optimization to create a size-one STE range for the unused direction
was broken. The hardware prevents us from creating RTCs over unallocated
STE space, so the only reason this has worked so far is because the
optimization was never used.

Signed-off-by: Vlad Dogaru <vdogaru@nvidia.com>
Reviewed-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pool.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Michal Kubiak April 10, 2025, 12:21 p.m. UTC | #1
On Tue, Apr 08, 2025 at 05:00:51PM +0300, Tariq Toukan wrote:
> From: Vlad Dogaru <vdogaru@nvidia.com>
> 
> The optimization to create a size-one STE range for the unused direction
> was broken. The hardware prevents us from creating RTCs over unallocated
> STE space, so the only reason this has worked so far is because the
> optimization was never used.
> 

Is there any chance that the optimization can be used (enabled) by
someone on previous kernels? If so, maybe the patch is a better candidate
for the "net" tree?

Thanks,
Michal


> Signed-off-by: Vlad Dogaru <vdogaru@nvidia.com>
> Reviewed-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
> Reviewed-by: Mark Bloch <mbloch@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pool.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pool.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pool.c
> index 26d85fe3c417..7e37d6e9eb83 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pool.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pool.c
> @@ -80,7 +80,7 @@ static int hws_pool_resource_alloc(struct mlx5hws_pool *pool)
>  	u32 fw_ft_type, opt_log_range;
>  
>  	fw_ft_type = mlx5hws_table_get_res_fw_ft_type(pool->tbl_type, false);
> -	opt_log_range = pool->opt_type == MLX5HWS_POOL_OPTIMIZE_ORIG ?
> +	opt_log_range = pool->opt_type == MLX5HWS_POOL_OPTIMIZE_MIRROR ?
>  				0 : pool->alloc_log_sz;
>  	resource = hws_pool_create_one_resource(pool, opt_log_range, fw_ft_type);
>  	if (!resource) {
> @@ -94,7 +94,7 @@ static int hws_pool_resource_alloc(struct mlx5hws_pool *pool)
>  		struct mlx5hws_pool_resource *mirror_resource;
>  
>  		fw_ft_type = mlx5hws_table_get_res_fw_ft_type(pool->tbl_type, true);
> -		opt_log_range = pool->opt_type == MLX5HWS_POOL_OPTIMIZE_MIRROR ?
> +		opt_log_range = pool->opt_type == MLX5HWS_POOL_OPTIMIZE_ORIG ?
>  					0 : pool->alloc_log_sz;
>  		mirror_resource = hws_pool_create_one_resource(pool, opt_log_range, fw_ft_type);
>  		if (!mirror_resource) {
> -- 
> 2.31.1
> 
>
Vlad Dogaru April 10, 2025, 3:45 p.m. UTC | #2
On Thu, Apr 10, 2025 at 02:21:21PM +0200, Michal Kubiak wrote:
> On Tue, Apr 08, 2025 at 05:00:51PM +0300, Tariq Toukan wrote:
> > From: Vlad Dogaru <vdogaru@nvidia.com>
> > 
> > The optimization to create a size-one STE range for the unused direction
> > was broken. The hardware prevents us from creating RTCs over unallocated
> > STE space, so the only reason this has worked so far is because the
> > optimization was never used.
> > 
> 
> Is there any chance that the optimization can be used (enabled) by
> someone on previous kernels? If so, maybe the patch is a better candidate
> for the "net" tree?

I strongly doubt it. Hardware steering has only been in the kernel since
6.14 and we are not aware of any users. The default is still to use the
older generation software steering, AFAIK.

Thanks,
Vlad
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pool.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pool.c
index 26d85fe3c417..7e37d6e9eb83 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pool.c
@@ -80,7 +80,7 @@  static int hws_pool_resource_alloc(struct mlx5hws_pool *pool)
 	u32 fw_ft_type, opt_log_range;
 
 	fw_ft_type = mlx5hws_table_get_res_fw_ft_type(pool->tbl_type, false);
-	opt_log_range = pool->opt_type == MLX5HWS_POOL_OPTIMIZE_ORIG ?
+	opt_log_range = pool->opt_type == MLX5HWS_POOL_OPTIMIZE_MIRROR ?
 				0 : pool->alloc_log_sz;
 	resource = hws_pool_create_one_resource(pool, opt_log_range, fw_ft_type);
 	if (!resource) {
@@ -94,7 +94,7 @@  static int hws_pool_resource_alloc(struct mlx5hws_pool *pool)
 		struct mlx5hws_pool_resource *mirror_resource;
 
 		fw_ft_type = mlx5hws_table_get_res_fw_ft_type(pool->tbl_type, true);
-		opt_log_range = pool->opt_type == MLX5HWS_POOL_OPTIMIZE_MIRROR ?
+		opt_log_range = pool->opt_type == MLX5HWS_POOL_OPTIMIZE_ORIG ?
 					0 : pool->alloc_log_sz;
 		mirror_resource = hws_pool_create_one_resource(pool, opt_log_range, fw_ft_type);
 		if (!mirror_resource) {