From: Pablo Neira Ayuso <pablo@netfilter.org>
To: wenxu@ucloud.cn
Cc: jakub.kicinski@netronome.com, jiri@resnulli.us,
netfilter-devel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH net-next v6 5/6] flow_offload: support get multi-subsystem block
Date: Tue, 6 Aug 2019 18:10:00 +0200 [thread overview]
Message-ID: <20190806161000.3csoy3jlpq6cletq@salvia> (raw)
In-Reply-To: <1564925041-23530-6-git-send-email-wenxu@ucloud.cn>
On Sun, Aug 04, 2019 at 09:24:00PM +0800, wenxu@ucloud.cn wrote:
> diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h
> index 8f1a7b8..6022dd0 100644
> --- a/include/net/flow_offload.h
> +++ b/include/net/flow_offload.h
[...]
> @@ -282,6 +282,8 @@ int flow_block_cb_setup_simple(struct flow_block_offload *f,
> }
> EXPORT_SYMBOL(flow_block_cb_setup_simple);
>
> +static LIST_HEAD(block_ing_cb_list);
> +
> static struct rhashtable indr_setup_block_ht;
>
> struct flow_indr_block_cb {
> @@ -295,7 +297,6 @@ struct flow_indr_block_dev {
> struct rhash_head ht_node;
> struct net_device *dev;
> unsigned int refcnt;
> - flow_indr_block_ing_cmd_t *block_ing_cmd_cb;
> struct list_head cb_list;
> };
>
> @@ -389,6 +390,22 @@ static void flow_indr_block_cb_del(struct flow_indr_block_cb *indr_block_cb)
> kfree(indr_block_cb);
> }
>
> +static void flow_block_ing_cmd(struct net_device *dev,
> + flow_indr_block_bind_cb_t *cb,
> + void *cb_priv,
> + enum flow_block_command command)
> +{
> + struct flow_indr_block_ing_entry *entry;
> +
> + rcu_read_lock();
> +
unnecessary empty line.
> + list_for_each_entry_rcu(entry, &block_ing_cb_list, list) {
> + entry->cb(dev, cb, cb_priv, command);
> + }
> +
> + rcu_read_unlock();
OK, there's rcu_read_lock here...
> +}
> +
> int __flow_indr_block_cb_register(struct net_device *dev, void *cb_priv,
> flow_indr_block_bind_cb_t *cb,
> void *cb_ident)
> @@ -406,10 +423,8 @@ int __flow_indr_block_cb_register(struct net_device *dev, void *cb_priv,
> if (err)
> goto err_dev_put;
>
> - if (indr_dev->block_ing_cmd_cb)
> - indr_dev->block_ing_cmd_cb(dev, indr_block_cb->cb,
> - indr_block_cb->cb_priv,
> - FLOW_BLOCK_BIND);
> + flow_block_ing_cmd(dev, indr_block_cb->cb, indr_block_cb->cb_priv,
> + FLOW_BLOCK_BIND);
>
> return 0;
>
> @@ -448,10 +463,8 @@ void __flow_indr_block_cb_unregister(struct net_device *dev,
> if (!indr_block_cb)
> return;
>
> - if (indr_dev->block_ing_cmd_cb)
> - indr_dev->block_ing_cmd_cb(dev, indr_block_cb->cb,
> - indr_block_cb->cb_priv,
> - FLOW_BLOCK_UNBIND);
> + flow_block_ing_cmd(dev, indr_block_cb->cb, indr_block_cb->cb_priv,
> + FLOW_BLOCK_UNBIND);
>
> flow_indr_block_cb_del(indr_block_cb);
> flow_indr_block_dev_put(indr_dev);
> @@ -469,7 +482,6 @@ void flow_indr_block_cb_unregister(struct net_device *dev,
> EXPORT_SYMBOL_GPL(flow_indr_block_cb_unregister);
>
> void flow_indr_block_call(struct net_device *dev,
> - flow_indr_block_ing_cmd_t cb,
> struct flow_block_offload *bo,
> enum flow_block_command command)
> {
> @@ -480,15 +492,24 @@ void flow_indr_block_call(struct net_device *dev,
> if (!indr_dev)
> return;
>
> - indr_dev->block_ing_cmd_cb = command == FLOW_BLOCK_BIND
> - ? cb : NULL;
> -
> list_for_each_entry(indr_block_cb, &indr_dev->cb_list, list)
> indr_block_cb->cb(dev, indr_block_cb->cb_priv, TC_SETUP_BLOCK,
> bo);
> }
> EXPORT_SYMBOL_GPL(flow_indr_block_call);
>
> +void flow_indr_add_block_ing_cb(struct flow_indr_block_ing_entry *entry)
> +{
... but registration does not protect the list with a mutex.
> + list_add_tail_rcu(&entry->list, &block_ing_cb_list);
> +}
> +EXPORT_SYMBOL_GPL(flow_indr_add_block_ing_cb);
next prev parent reply other threads:[~2019-08-06 16:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-04 13:23 [PATCH net-next v6 0/6] flow_offload: add indr-block in nf_table_offload wenxu
2019-08-04 13:23 ` [PATCH net-next v6 1/6] cls_api: modify the tc_indr_block_ing_cmd parameters wenxu
2019-08-04 13:23 ` [PATCH net-next v6 2/6] cls_api: remove the tcf_block cache wenxu
2019-08-04 13:23 ` [PATCH net-next v6 3/6] cls_api: add flow_indr_block_call function wenxu
2019-08-04 13:23 ` [PATCH net-next v6 4/6] flow_offload: move tc indirect block to flow offload wenxu
2019-08-04 13:24 ` [PATCH net-next v6 5/6] flow_offload: support get multi-subsystem block wenxu
2019-08-06 16:05 ` Pablo Neira Ayuso
2019-08-06 16:07 ` Pablo Neira Ayuso
2019-08-06 16:10 ` Pablo Neira Ayuso [this message]
2019-08-06 23:36 ` wenxu
2019-08-07 1:11 ` wenxu
2019-08-04 13:24 ` [PATCH net-next v6 6/6] netfilter: nf_tables_offload: support indr block call wenxu
2019-08-06 3:37 ` [PATCH net-next v6 0/6] flow_offload: add indr-block in nf_table_offload Jakub Kicinski
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=20190806161000.3csoy3jlpq6cletq@salvia \
--to=pablo@netfilter.org \
--cc=jakub.kicinski@netronome.com \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=wenxu@ucloud.cn \
/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