From: Donald Hunter <donald.hunter@gmail.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>,
Jozsef Kadlecsik <kadlec@netfilter.org>,
Florian Westphal <fw@strlen.de>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Paul Blakey <paulb@nvidia.com>, Vlad Buslov <vladbu@nvidia.com>,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
netdev@vger.kernel.org
Cc: Donald Hunter <donald.hunter@gmail.com>
Subject: [PATCH netfilter] Fix hw flow offload from nftables
Date: Mon, 23 Oct 2023 11:13:47 +0100 [thread overview]
Message-ID: <20231023101347.564898-1-donald.hunter@gmail.com> (raw)
The NF_FLOW_HW_ESTABLISHED bit was not getting set in any nftables code
paths. It seems that the state was never correctly maintained but there
was no negative side-effect until commit 41f2c7c342d3 ("net/sched:
act_ct: Fix promotion of offloaded unreplied tuple") which uses it as
part of a flow outdated check. The net result is repeated cycles of
FLOW_CLS_REPLACE / FLOW_CLS_DESTROY commands and never getting any
FLOW_CLS_STATS commands for a flow.
This patch sets and clears the NF_FLOW_HW_ESTABLISHED bit for nftables.
Note that I don't have hardware to test this with. I have observed
the behaviour and verified the fix with modified veth code.
Signed-off-by: Donald Hunter <donald.hunter@gmail.com>
Fixes: 41f2c7c342d3 ("net/sched: act_ct: Fix promotion of offloaded unreplied tuple")
---
net/netfilter/nf_flow_table_offload.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/netfilter/nf_flow_table_offload.c b/net/netfilter/nf_flow_table_offload.c
index 1c26f03fc661..1d017191af80 100644
--- a/net/netfilter/nf_flow_table_offload.c
+++ b/net/netfilter/nf_flow_table_offload.c
@@ -918,6 +918,7 @@ static void flow_offload_work_add(struct flow_offload_work *offload)
goto out;
set_bit(IPS_HW_OFFLOAD_BIT, &offload->flow->ct->status);
+ set_bit(NF_FLOW_HW_ESTABLISHED, &offload->flow->flags);
out:
nf_flow_offload_destroy(flow_rule);
@@ -925,6 +926,7 @@ static void flow_offload_work_add(struct flow_offload_work *offload)
static void flow_offload_work_del(struct flow_offload_work *offload)
{
+ clear_bit(NF_FLOW_HW_ESTABLISHED, &offload->flow->flags);
clear_bit(IPS_HW_OFFLOAD_BIT, &offload->flow->ct->status);
flow_offload_tuple_del(offload, FLOW_OFFLOAD_DIR_ORIGINAL);
if (test_bit(NF_FLOW_HW_BIDIRECTIONAL, &offload->flow->flags))
--
2.41.0
next reply other threads:[~2023-10-23 10:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-23 10:13 Donald Hunter [this message]
2023-10-23 10:24 ` [PATCH netfilter] Fix hw flow offload from nftables Pablo Neira Ayuso
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=20231023101347.564898-1-donald.hunter@gmail.com \
--to=donald.hunter@gmail.com \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--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 \
--cc=paulb@nvidia.com \
--cc=vladbu@nvidia.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 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.