From: Florian Westphal <fw@strlen.de>
To: <netdev@vger.kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
<netfilter-devel@vger.kernel.org>,
pablo@netfilter.org
Subject: [PATCH v2 net-next 1/2] netdevsim: tc: allow to test nf_tables offload control plane code
Date: Fri, 12 Jun 2026 11:22:08 +0200 [thread overview]
Message-ID: <20260612092209.11966-2-fw@strlen.de> (raw)
In-Reply-To: <20260612092209.11966-1-fw@strlen.de>
The actual 'offload' is phony, all commands are ignored: this is only
useful to test control plane code.
Tag the existing callback to permit error injection to test rollback/abort
code in nf_tables. This is also for fuzzers - the fault injection
framework allows probabilistic error insertion.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
v2: move extack error to nsim_setup_tc_block_cb
drivers/net/netdevsim/bpf.c | 6 ------
drivers/net/netdevsim/tc.c | 20 +++++++++++++++++++-
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/drivers/net/netdevsim/bpf.c b/drivers/net/netdevsim/bpf.c
index 8eebcc933ddb..16aa88278398 100644
--- a/drivers/net/netdevsim/bpf.c
+++ b/drivers/net/netdevsim/bpf.c
@@ -123,12 +123,6 @@ int nsim_bpf_setup_tc_block_cb(enum tc_setup_type type,
struct netdevsim *ns = cb_priv;
struct bpf_prog *oldprog;
- if (type != TC_SETUP_CLSBPF) {
- NSIM_EA(cls_bpf->common.extack,
- "only offload of BPF classifiers supported");
- return -EOPNOTSUPP;
- }
-
if (!tc_cls_can_offload_and_chain0(ns->netdev, &cls_bpf->common))
return -EOPNOTSUPP;
diff --git a/drivers/net/netdevsim/tc.c b/drivers/net/netdevsim/tc.c
index 8f013a5895a2..a415e02a6df1 100644
--- a/drivers/net/netdevsim/tc.c
+++ b/drivers/net/netdevsim/tc.c
@@ -9,7 +9,22 @@
static int
nsim_setup_tc_block_cb(enum tc_setup_type type, void *type_data, void *cb_priv)
{
- return nsim_bpf_setup_tc_block_cb(type, type_data, cb_priv);
+ struct flow_cls_common_offload *common = type_data;
+ int err = 0;
+
+ switch (type) {
+ case TC_SETUP_CLSBPF:
+ err = nsim_bpf_setup_tc_block_cb(type, type_data, cb_priv);
+ break;
+ case TC_SETUP_CLSFLOWER:
+ break;
+ default:
+ NSIM_EA(common->extack, "offload type not supported");
+ err = -EOPNOTSUPP;
+ break;
+ }
+
+ return err;
}
static void nsim_taprio_stats(struct tc_taprio_qopt_stats *stats)
@@ -73,7 +88,10 @@ nsim_setup_tc(struct net_device *dev, enum tc_setup_type type, void *type_data)
&nsim_block_cb_list,
nsim_setup_tc_block_cb,
ns, ns, true);
+ case TC_SETUP_FT:
+ return 0;
default:
return -EOPNOTSUPP;
}
}
+ALLOW_ERROR_INJECTION(nsim_setup_tc, ERRNO);
--
2.53.0
next prev parent reply other threads:[~2026-06-12 9:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-12 9:22 [PATCH v2 net-next 0/2] netdevsim: add fake FT/CLS_FLOWER offload Florian Westphal
2026-06-12 9:22 ` Florian Westphal [this message]
2026-06-12 9:22 ` [PATCH v2 net-next 2/2] selftests: netfilter: add phony nft_offload test Florian Westphal
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=20260612092209.11966-2-fw@strlen.de \
--to=fw@strlen.de \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--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