From: Simon Horman <horms@kernel.org>
To: Eric Woudstra <ericwouds@gmail.com>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
Jozsef Kadlecsik <kadlec@netfilter.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netfilter-devel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH v2 nf-next 2/3] netfilter: nf_flow_table_core: teardown direct xmit when destination changed
Date: Fri, 11 Apr 2025 11:23:08 +0100 [thread overview]
Message-ID: <20250411102308.GX395307@horms.kernel.org> (raw)
In-Reply-To: <20250408142848.96281-3-ericwouds@gmail.com>
On Tue, Apr 08, 2025 at 04:28:47PM +0200, Eric Woudstra wrote:
> In case of a bridge in the forward-fastpath or bridge-fastpath the fdb is
> used to create the tuple. In case of roaming at layer 2 level, for example
> 802.11r, the destination device is changed in the fdb. The destination
> device of a direct transmitting tuple is no longer valid and traffic is
> send to the wrong destination. Also the hardware offloaded fastpath is not
> valid anymore.
>
> In case of roaming, a switchdev notification is send to delete the old fdb
> entry. Upon receiving this notification, mark all direct transmitting flows
> with the same ifindex, vid and hardware address as the fdb entry to be
> teared down. The hardware offloaded fastpath is still in effect, so
> minimize the delay of the work queue by setting the delay to zero.
>
> Signed-off-by: Eric Woudstra <ericwouds@gmail.com>
> ---
> net/netfilter/nf_flow_table_core.c | 65 ++++++++++++++++++++++++++++++
> 1 file changed, 65 insertions(+)
>
> diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c
...
> +struct notifier_block nf_flow_table_switchdev_nb __read_mostly = {
> + .notifier_call = nf_flow_table_switchdev_event,
> +};
Hi Eric,
A minor nit from my side:
nf_flow_table_switchdev_nb seems only be used in this file and if so it
should be static.
Flagged by Sparse.
> +
> void nf_flow_table_free(struct nf_flowtable *flow_table)
> {
> mutex_lock(&flowtable_lock);
> @@ -816,6 +874,10 @@ static int __init nf_flow_table_module_init(void)
> if (ret)
> goto out_offload;
>
> + ret = register_switchdev_notifier(&nf_flow_table_switchdev_nb);
> + if (ret < 0)
> + goto out_sw_noti;
> +
> ret = nf_flow_register_bpf();
> if (ret)
> goto out_bpf;
> @@ -823,6 +885,8 @@ static int __init nf_flow_table_module_init(void)
> return 0;
>
> out_bpf:
> + unregister_switchdev_notifier(&nf_flow_table_switchdev_nb);
> +out_sw_noti:
> nf_flow_table_offload_exit();
> out_offload:
> unregister_pernet_subsys(&nf_flow_table_net_ops);
> @@ -831,6 +895,7 @@ static int __init nf_flow_table_module_init(void)
>
> static void __exit nf_flow_table_module_exit(void)
> {
> + unregister_switchdev_notifier(&nf_flow_table_switchdev_nb);
> nf_flow_table_offload_exit();
> unregister_pernet_subsys(&nf_flow_table_net_ops);
> }
> --
> 2.47.1
>
next prev parent reply other threads:[~2025-04-11 10:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-08 14:28 [PATCH v2 nf-next 0/3] flow offload teardown when layer 2 roaming Eric Woudstra
2025-04-08 14:28 ` [PATCH v2 nf-next 1/3] netfilter: flow: Add bridge_vid member Eric Woudstra
2025-04-08 14:28 ` [PATCH v2 nf-next 2/3] netfilter: nf_flow_table_core: teardown direct xmit when destination changed Eric Woudstra
2025-04-11 10:23 ` Simon Horman [this message]
2025-04-08 14:28 ` [PATCH v2 nf-next 3/3] netfilter: nf_flow_table_ip: don't follow fastpath when marked teardown Eric Woudstra
2025-04-11 15:32 ` [PATCH v2 nf-next 0/3] flow offload teardown when layer 2 roaming Eric Woudstra
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=20250411102308.GX395307@horms.kernel.org \
--to=horms@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=ericwouds@gmail.com \
--cc=kadlec@netfilter.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
/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).