netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeedm@mellanox.com>
To: Roi Dayan <roid@mellanox.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Paul Blakey <paulb@mellanox.com>, Oz Shlomo <ozsh@mellanox.com>,
	"pablo@netfilter.org" <pablo@netfilter.org>,
	Majd Dibbiny <majd@mellanox.com>
Cc: "netfilter-devel@vger.kernel.org" <netfilter-devel@vger.kernel.org>
Subject: Re: [PATCH net-next 3/3] net/mlx5: CT: Use rhashtable's ct entries instead of a seperate list
Date: Thu, 26 Mar 2020 03:53:43 +0000	[thread overview]
Message-ID: <b24b275716ffecbf1382d4ab063464e18ddf5073.camel@mellanox.com> (raw)
In-Reply-To: <1585055841-14256-4-git-send-email-paulb@mellanox.com>

On Tue, 2020-03-24 at 15:17 +0200, Paul Blakey wrote:
> CT entries list is only used while freeing a ct zone flow table to
> go over all the ct entries offloaded on that zone/table, and flush
> the table.
> 
> Rhashtable already provides an api to go over all the inserted
> entries.
> Use it instead, and remove the list.
> 
> Signed-off-by: Paul Blakey <paulb@mellanox.com>
> Reviewed-by: Oz Shlomo <ozsh@mellanox.com>

Acked-by: Saeed Mahameed <saeedm@mellanox.com>

> ---
>  drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c | 19 +++++++-----
> -------
>  1 file changed, 7 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
> b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
> index a22ad6b..afc8ac3 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
> @@ -67,11 +67,9 @@ struct mlx5_ct_ft {
>  	struct nf_flowtable *nf_ft;
>  	struct mlx5_tc_ct_priv *ct_priv;
>  	struct rhashtable ct_entries_ht;
> -	struct list_head ct_entries_list;
>  };
>  
>  struct mlx5_ct_entry {
> -	struct list_head list;
>  	u16 zone;
>  	struct rhash_head node;
>  	struct flow_rule *flow_rule;
> @@ -617,8 +615,6 @@ struct mlx5_ct_entry {
>  	if (err)
>  		goto err_insert;
>  
> -	list_add(&entry->list, &ft->ct_entries_list);
> -
>  	return 0;
>  
>  err_insert:
> @@ -646,7 +642,6 @@ struct mlx5_ct_entry {
>  	WARN_ON(rhashtable_remove_fast(&ft->ct_entries_ht,
>  				       &entry->node,
>  				       cts_ht_params));
> -	list_del(&entry->list);
>  	kfree(entry);
>  
>  	return 0;
> @@ -817,7 +812,6 @@ struct mlx5_ct_entry {
>  	ft->zone = zone;
>  	ft->nf_ft = nf_ft;
>  	ft->ct_priv = ct_priv;
> -	INIT_LIST_HEAD(&ft->ct_entries_list);
>  	refcount_set(&ft->refcount, 1);
>  
>  	err = rhashtable_init(&ft->ct_entries_ht, &cts_ht_params);
> @@ -846,12 +840,12 @@ struct mlx5_ct_entry {
>  }
>  
>  static void
> -mlx5_tc_ct_flush_ft(struct mlx5_tc_ct_priv *ct_priv, struct
> mlx5_ct_ft *ft)
> +mlx5_tc_ct_flush_ft_entry(void *ptr, void *arg)
>  {
> -	struct mlx5_ct_entry *entry;
> +	struct mlx5_tc_ct_priv *ct_priv = arg;
> +	struct mlx5_ct_entry *entry = ptr;
>  
> -	list_for_each_entry(entry, &ft->ct_entries_list, list)
> -		mlx5_tc_ct_entry_del_rules(ft->ct_priv, entry);
> +	mlx5_tc_ct_entry_del_rules(ct_priv, entry);
>  }
>  
>  static void
> @@ -862,9 +856,10 @@ struct mlx5_ct_entry {
>  
>  	nf_flow_table_offload_del_cb(ft->nf_ft,
>  				     mlx5_tc_ct_block_flow_offload,
> ft);
> -	mlx5_tc_ct_flush_ft(ct_priv, ft);
>  	rhashtable_remove_fast(&ct_priv->zone_ht, &ft->node,
> zone_params);
> -	rhashtable_destroy(&ft->ct_entries_ht);
> +	rhashtable_free_and_destroy(&ft->ct_entries_ht,
> +				    mlx5_tc_ct_flush_ft_entry,
> +				    ct_priv);
>  	kfree(ft);
>  }
>  

  reply	other threads:[~2020-03-26  3:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-24 13:17 [PATCH net-next 0/3] netfilter: flowtable: Support offload of tuples in parallel Paul Blakey
2020-03-24 13:17 ` [PATCH net-next 1/3] netfilter: flowtable: Use rw sem as flow block lock Paul Blakey
2020-03-25 20:17   ` Pablo Neira Ayuso
2020-03-24 13:17 ` [PATCH net-next 2/3] netfilter: flowtable: Use work entry per offload command Paul Blakey
2020-03-25 20:18   ` Pablo Neira Ayuso
2020-03-24 13:17 ` [PATCH net-next 3/3] net/mlx5: CT: Use rhashtable's ct entries instead of a seperate list Paul Blakey
2020-03-26  3:53   ` Saeed Mahameed [this message]
2020-03-27  3:10 ` [PATCH net-next 0/3] netfilter: flowtable: Support offload of tuples in parallel David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b24b275716ffecbf1382d4ab063464e18ddf5073.camel@mellanox.com \
    --to=saeedm@mellanox.com \
    --cc=majd@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=ozsh@mellanox.com \
    --cc=pablo@netfilter.org \
    --cc=paulb@mellanox.com \
    --cc=roid@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).