All of lore.kernel.org
 help / color / mirror / Atom feed
* [net-next] net/mlx5e: Remove the unnecessary parameter
@ 2020-02-25 16:03 xiangxia.m.yue
  2020-02-25 22:50 ` Saeed Mahameed
  0 siblings, 1 reply; 4+ messages in thread
From: xiangxia.m.yue @ 2020-02-25 16:03 UTC (permalink / raw)
  To: gerlitz.or, roid, saeedm; +Cc: netdev, Tonghao Zhang

From: Tonghao Zhang <xiangxia.m.yue@gmail.com>

The parameter desired_size is always 0, and there is only one
function calling the mlx5_esw_chains_get_avail_sz_from_pool.
Deleting the parameter desired_size.

Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
---
 .../net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c
index c5a446e..ce5b7e1 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c
@@ -134,19 +134,14 @@ static unsigned int mlx5_esw_chains_get_level_range(struct mlx5_eswitch *esw)
 	return FDB_TC_LEVELS_PER_PRIO;
 }
 
-#define POOL_NEXT_SIZE 0
 static int
-mlx5_esw_chains_get_avail_sz_from_pool(struct mlx5_eswitch *esw,
-				       int desired_size)
+mlx5_esw_chains_get_avail_sz_from_pool(struct mlx5_eswitch *esw)
 {
 	int i, found_i = -1;
 
 	for (i = ARRAY_SIZE(ESW_POOLS) - 1; i >= 0; i--) {
-		if (fdb_pool_left(esw)[i] && ESW_POOLS[i] > desired_size) {
+		if (fdb_pool_left(esw)[i])
 			found_i = i;
-			if (desired_size != POOL_NEXT_SIZE)
-				break;
-		}
 	}
 
 	if (found_i != -1) {
@@ -198,7 +193,7 @@ static unsigned int mlx5_esw_chains_get_level_range(struct mlx5_eswitch *esw)
 		ft_attr.flags |= (MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT |
 				  MLX5_FLOW_TABLE_TUNNEL_EN_DECAP);
 
-	sz = mlx5_esw_chains_get_avail_sz_from_pool(esw, POOL_NEXT_SIZE);
+	sz = mlx5_esw_chains_get_avail_sz_from_pool(esw);
 	if (!sz)
 		return ERR_PTR(-ENOSPC);
 	ft_attr.max_fte = sz;
-- 
1.8.3.1


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

* Re: [net-next] net/mlx5e: Remove the unnecessary parameter
  2020-02-25 16:03 [net-next] net/mlx5e: Remove the unnecessary parameter xiangxia.m.yue
@ 2020-02-25 22:50 ` Saeed Mahameed
  2020-02-26  9:53   ` Paul Blakey
  0 siblings, 1 reply; 4+ messages in thread
From: Saeed Mahameed @ 2020-02-25 22:50 UTC (permalink / raw)
  To: Roi Dayan, saeedm, Paul Blakey, xiangxia.m.yue, gerlitz.or; +Cc: netdev

On Wed, 2020-02-26 at 00:03 +0800, xiangxia.m.yue@gmail.com wrote:
> From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> 
> The parameter desired_size is always 0, and there is only one
> function calling the mlx5_esw_chains_get_avail_sz_from_pool.
> Deleting the parameter desired_size.

Paul, what is the reasoning behind desired size, i confirm that it  is
not actually used right now, do we have a pending patch that needs it
? 
if this is not going to happen in the near future i vote to apply this
patch and bring it back when needed.


Thanks,
Saeed.

> 
> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> ---
>  .../net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c | 11
> +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git
> a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c
> b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c
> index c5a446e..ce5b7e1 100644
> ---
> a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c
> +++
> b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c
> @@ -134,19 +134,14 @@ static unsigned int
> mlx5_esw_chains_get_level_range(struct mlx5_eswitch *esw)
>  	return FDB_TC_LEVELS_PER_PRIO;
>  }
>  
> -#define POOL_NEXT_SIZE 0
>  static int
> -mlx5_esw_chains_get_avail_sz_from_pool(struct mlx5_eswitch *esw,
> -				       int desired_size)
> +mlx5_esw_chains_get_avail_sz_from_pool(struct mlx5_eswitch *esw)
>  {
>  	int i, found_i = -1;
>  
>  	for (i = ARRAY_SIZE(ESW_POOLS) - 1; i >= 0; i--) {
> -		if (fdb_pool_left(esw)[i] && ESW_POOLS[i] >
> desired_size) {
> +		if (fdb_pool_left(esw)[i])
>  			found_i = i;
> -			if (desired_size != POOL_NEXT_SIZE)
> -				break;
> -		}
>  	}
>  
>  	if (found_i != -1) {
> @@ -198,7 +193,7 @@ static unsigned int
> mlx5_esw_chains_get_level_range(struct mlx5_eswitch *esw)
>  		ft_attr.flags |= (MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT |
>  				  MLX5_FLOW_TABLE_TUNNEL_EN_DECAP);
>  
> -	sz = mlx5_esw_chains_get_avail_sz_from_pool(esw,
> POOL_NEXT_SIZE);
> +	sz = mlx5_esw_chains_get_avail_sz_from_pool(esw);
>  	if (!sz)
>  		return ERR_PTR(-ENOSPC);
>  	ft_attr.max_fte = sz;

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

* Re: [net-next] net/mlx5e: Remove the unnecessary parameter
  2020-02-25 22:50 ` Saeed Mahameed
@ 2020-02-26  9:53   ` Paul Blakey
  2020-02-27  2:02     ` Tonghao Zhang
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Blakey @ 2020-02-26  9:53 UTC (permalink / raw)
  To: Saeed Mahameed, Roi Dayan, saeedm, xiangxia.m.yue, gerlitz.or; +Cc: netdev


On 2/26/2020 12:50 AM, Saeed Mahameed wrote:
> On Wed, 2020-02-26 at 00:03 +0800, xiangxia.m.yue@gmail.com wrote:
>> From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
>>
>> The parameter desired_size is always 0, and there is only one
>> function calling the mlx5_esw_chains_get_avail_sz_from_pool.
>> Deleting the parameter desired_size.
> Paul, what is the reasoning behind desired size, i confirm that it  is
> not actually used right now, do we have a pending patch that needs it
> ? 
> if this is not going to happen in the near future i vote to apply this
> patch and bring it back when needed.

Right, it will be used in a following patch that reduces the size given for nft flow tables.

I planned on submitting it after connection tracking offload is complete, but it can be sent now.

This is the patch:

From 66d3cb9706ed09f00150a42f555a51404602bba4 Mon Sep 17 00:00:00 2001
From: Paul Blakey <paulb@mellanox.com>
Date: Wed, 8 Jan 2020 14:31:53 +0200
Subject: [PATCH] net/mlx5: Allocate smaller size tables for ft offload

Instead of giving ft tables one of the largest tables available - 4M,
give it a more reasonable size - 64k. Especially since it will
always be created as a miss hook in the following patch.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c
index 3990066..dabbc05 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c
@@ -39,6 +39,7 @@
                                          1 * 1024 * 1024,
                                          64 * 1024,
                                          128 };
+#define ESW_FT_TBL_SZ (64 * 1024)

 struct mlx5_esw_chains_priv {
        struct rhashtable chains_ht;
@@ -205,7 +206,9 @@ static unsigned int mlx5_esw_chains_get_level_range(struct mlx5_eswitch *esw)
                ft_attr.flags |= (MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT |
                                  MLX5_FLOW_TABLE_TUNNEL_EN_DECAP);

-       sz = mlx5_esw_chains_get_avail_sz_from_pool(esw, POOL_NEXT_SIZE);
+       sz = (chain == mlx5_esw_chains_get_ft_chain(esw)) ?
+            mlx5_esw_chains_get_avail_sz_from_pool(esw, ESW_FT_TBL_SZ) :
+            mlx5_esw_chains_get_avail_sz_from_pool(esw, POOL_NEXT_SIZE);
        if (!sz)
                return ERR_PTR(-ENOSPC);
        ft_attr.max_fte = sz;
--
1.8.3.1


>
> Thanks,
> Saeed.
>
>> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
>> ---
>>  .../net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c | 11
>> +++--------
>>  1 file changed, 3 insertions(+), 8 deletions(-)
>>
>> diff --git
>> a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c
>> b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c
>> index c5a446e..ce5b7e1 100644
>> ---
>> a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c
>> +++
>> b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c
>> @@ -134,19 +134,14 @@ static unsigned int
>> mlx5_esw_chains_get_level_range(struct mlx5_eswitch *esw)
>>  	return FDB_TC_LEVELS_PER_PRIO;
>>  }
>>  
>> -#define POOL_NEXT_SIZE 0
>>  static int
>> -mlx5_esw_chains_get_avail_sz_from_pool(struct mlx5_eswitch *esw,
>> -				       int desired_size)
>> +mlx5_esw_chains_get_avail_sz_from_pool(struct mlx5_eswitch *esw)
>>  {
>>  	int i, found_i = -1;
>>  
>>  	for (i = ARRAY_SIZE(ESW_POOLS) - 1; i >= 0; i--) {
>> -		if (fdb_pool_left(esw)[i] && ESW_POOLS[i] >
>> desired_size) {
>> +		if (fdb_pool_left(esw)[i])
>>  			found_i = i;
>> -			if (desired_size != POOL_NEXT_SIZE)
>> -				break;
>> -		}
>>  	}
>>  
>>  	if (found_i != -1) {
>> @@ -198,7 +193,7 @@ static unsigned int
>> mlx5_esw_chains_get_level_range(struct mlx5_eswitch *esw)
>>  		ft_attr.flags |= (MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT |
>>  				  MLX5_FLOW_TABLE_TUNNEL_EN_DECAP);
>>  
>> -	sz = mlx5_esw_chains_get_avail_sz_from_pool(esw,
>> POOL_NEXT_SIZE);
>> +	sz = mlx5_esw_chains_get_avail_sz_from_pool(esw);
>>  	if (!sz)
>>  		return ERR_PTR(-ENOSPC);
>>  	ft_attr.max_fte = sz;

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

* Re: [net-next] net/mlx5e: Remove the unnecessary parameter
  2020-02-26  9:53   ` Paul Blakey
@ 2020-02-27  2:02     ` Tonghao Zhang
  0 siblings, 0 replies; 4+ messages in thread
From: Tonghao Zhang @ 2020-02-27  2:02 UTC (permalink / raw)
  To: Paul Blakey; +Cc: Saeed Mahameed, Roi Dayan, saeedm, gerlitz.or, netdev

On Wed, Feb 26, 2020 at 5:53 PM Paul Blakey <paulb@mellanox.com> wrote:
>
>
> On 2/26/2020 12:50 AM, Saeed Mahameed wrote:
> > On Wed, 2020-02-26 at 00:03 +0800, xiangxia.m.yue@gmail.com wrote:
> >> From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> >>
> >> The parameter desired_size is always 0, and there is only one
> >> function calling the mlx5_esw_chains_get_avail_sz_from_pool.
> >> Deleting the parameter desired_size.
> > Paul, what is the reasoning behind desired size, i confirm that it  is
> > not actually used right now, do we have a pending patch that needs it
> > ?
> > if this is not going to happen in the near future i vote to apply this
> > patch and bring it back when needed.
>
> Right, it will be used in a following patch that reduces the size given for nft flow tables.
>
> I planned on submitting it after connection tracking offload is complete, but it can be sent now.
Hi, Paul, and Saeed
The function will be used, so my patch is unnecessary. Thanks for explaining.
> This is the patch:
>
> From 66d3cb9706ed09f00150a42f555a51404602bba4 Mon Sep 17 00:00:00 2001
> From: Paul Blakey <paulb@mellanox.com>
> Date: Wed, 8 Jan 2020 14:31:53 +0200
> Subject: [PATCH] net/mlx5: Allocate smaller size tables for ft offload
>
> Instead of giving ft tables one of the largest tables available - 4M,
> give it a more reasonable size - 64k. Especially since it will
> always be created as a miss hook in the following patch.
>
> Signed-off-by: Paul Blakey <paulb@mellanox.com>
> Reviewed-by: Mark Bloch <markb@mellanox.com>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c
> index 3990066..dabbc05 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c
> @@ -39,6 +39,7 @@
>                                           1 * 1024 * 1024,
>                                           64 * 1024,
>                                           128 };
> +#define ESW_FT_TBL_SZ (64 * 1024)
>
>  struct mlx5_esw_chains_priv {
>         struct rhashtable chains_ht;
> @@ -205,7 +206,9 @@ static unsigned int mlx5_esw_chains_get_level_range(struct mlx5_eswitch *esw)
>                 ft_attr.flags |= (MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT |
>                                   MLX5_FLOW_TABLE_TUNNEL_EN_DECAP);
>
> -       sz = mlx5_esw_chains_get_avail_sz_from_pool(esw, POOL_NEXT_SIZE);
> +       sz = (chain == mlx5_esw_chains_get_ft_chain(esw)) ?
> +            mlx5_esw_chains_get_avail_sz_from_pool(esw, ESW_FT_TBL_SZ) :
> +            mlx5_esw_chains_get_avail_sz_from_pool(esw, POOL_NEXT_SIZE);
>         if (!sz)
>                 return ERR_PTR(-ENOSPC);
>         ft_attr.max_fte = sz;
> --
> 1.8.3.1
>
>
> >
> > Thanks,
> > Saeed.
> >
> >> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> >> ---
> >>  .../net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c | 11
> >> +++--------
> >>  1 file changed, 3 insertions(+), 8 deletions(-)
> >>
> >> diff --git
> >> a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c
> >> b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c
> >> index c5a446e..ce5b7e1 100644
> >> ---
> >> a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c
> >> +++
> >> b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c
> >> @@ -134,19 +134,14 @@ static unsigned int
> >> mlx5_esw_chains_get_level_range(struct mlx5_eswitch *esw)
> >>      return FDB_TC_LEVELS_PER_PRIO;
> >>  }
> >>
> >> -#define POOL_NEXT_SIZE 0
> >>  static int
> >> -mlx5_esw_chains_get_avail_sz_from_pool(struct mlx5_eswitch *esw,
> >> -                                   int desired_size)
> >> +mlx5_esw_chains_get_avail_sz_from_pool(struct mlx5_eswitch *esw)
> >>  {
> >>      int i, found_i = -1;
> >>
> >>      for (i = ARRAY_SIZE(ESW_POOLS) - 1; i >= 0; i--) {
> >> -            if (fdb_pool_left(esw)[i] && ESW_POOLS[i] >
> >> desired_size) {
> >> +            if (fdb_pool_left(esw)[i])
> >>                      found_i = i;
> >> -                    if (desired_size != POOL_NEXT_SIZE)
> >> -                            break;
> >> -            }
> >>      }
> >>
> >>      if (found_i != -1) {
> >> @@ -198,7 +193,7 @@ static unsigned int
> >> mlx5_esw_chains_get_level_range(struct mlx5_eswitch *esw)
> >>              ft_attr.flags |= (MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT |
> >>                                MLX5_FLOW_TABLE_TUNNEL_EN_DECAP);
> >>
> >> -    sz = mlx5_esw_chains_get_avail_sz_from_pool(esw,
> >> POOL_NEXT_SIZE);
> >> +    sz = mlx5_esw_chains_get_avail_sz_from_pool(esw);
> >>      if (!sz)
> >>              return ERR_PTR(-ENOSPC);
> >>      ft_attr.max_fte = sz;

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

end of thread, other threads:[~2020-02-27  2:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-25 16:03 [net-next] net/mlx5e: Remove the unnecessary parameter xiangxia.m.yue
2020-02-25 22:50 ` Saeed Mahameed
2020-02-26  9:53   ` Paul Blakey
2020-02-27  2:02     ` Tonghao Zhang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.