From: Victor Nogueira <victor@mojatatu.com>
To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, jhs@mojatatu.com, jiri@resnulli.us,
netdev@vger.kernel.org
Cc: horms@kernel.org, hybris@mojatatu.ai, sashiko-bot@kernel.org
Subject: [PATCH net-next 2/3] net/sched: add get_fill_size() to the five actions that lack one
Date: Sat, 19 Sep 2026 20:04:28 -0300 [thread overview]
Message-ID: <QDISC-RYTB.v1.20260918093205@mojatatu.com.2> (raw)
In-Reply-To: <QDISC-RYTB.v1.20260918093205@mojatatu.com>
act_simple, act_mpls, act_nat, act_skbmod and act_connmark each have a
tcf_*_dump but no .get_fill_size callback, so tcf_action_fill_size
budgets only the shared attributes and omits the per-action
TCA_*_PARMS and option bytes the dump emits.
Add a callback to each, sized from the attributes its dump emits. Size
every optional attribute unconditionally: reading the current flags to
size it conditionally would race a concurrent replace, which can flip
the attributes between sizing and dumping.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260824153903.4143642-1-victor@mojatatu.com
Co-developed-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Victor Nogueira <victor@mojatatu.com>
---
net/sched/act_connmark.c | 6 ++++++
net/sched/act_mpls.c | 11 +++++++++++
net/sched/act_nat.c | 6 ++++++
net/sched/act_simple.c | 7 +++++++
net/sched/act_skbmod.c | 9 +++++++++
5 files changed, 39 insertions(+)
diff --git a/net/sched/act_connmark.c b/net/sched/act_connmark.c
index c634af5edfcd..0b6ac6be60d2 100644
--- a/net/sched/act_connmark.c
+++ b/net/sched/act_connmark.c
@@ -236,12 +236,18 @@ static void tcf_connmark_cleanup(struct tc_action *a)
kfree_rcu(parms, rcu);
}
+static size_t tcf_connmark_get_fill_size(const struct tc_action *act)
+{
+ return nla_total_size(sizeof(struct tc_connmark)); /* TCA_CONNMARK_PARMS */
+}
+
static struct tc_action_ops act_connmark_ops = {
.kind = "connmark",
.id = TCA_ID_CONNMARK,
.owner = THIS_MODULE,
.act = tcf_connmark_act,
.dump = tcf_connmark_dump,
+ .get_fill_size = tcf_connmark_get_fill_size,
.init = tcf_connmark_init,
.cleanup = tcf_connmark_cleanup,
.size = sizeof(struct tcf_connmark_info),
diff --git a/net/sched/act_mpls.c b/net/sched/act_mpls.c
index 4ea8b2e08c3a..aa56521b7179 100644
--- a/net/sched/act_mpls.c
+++ b/net/sched/act_mpls.c
@@ -438,12 +438,23 @@ static int tcf_mpls_offload_act_setup(struct tc_action *act, void *entry_data,
return 0;
}
+static size_t tcf_mpls_get_fill_size(const struct tc_action *act)
+{
+ return nla_total_size(sizeof(struct tc_mpls)) /* TCA_MPLS_PARMS */
+ + nla_total_size(sizeof(u32)) /* TCA_MPLS_LABEL */
+ + nla_total_size(sizeof(u8)) /* TCA_MPLS_TC */
+ + nla_total_size(sizeof(u8)) /* TCA_MPLS_TTL */
+ + nla_total_size(sizeof(u8)) /* TCA_MPLS_BOS */
+ + nla_total_size(sizeof(u16)); /* TCA_MPLS_PROTO */
+}
+
static struct tc_action_ops act_mpls_ops = {
.kind = "mpls",
.id = TCA_ID_MPLS,
.owner = THIS_MODULE,
.act = tcf_mpls_act,
.dump = tcf_mpls_dump,
+ .get_fill_size = tcf_mpls_get_fill_size,
.init = tcf_mpls_init,
.cleanup = tcf_mpls_cleanup,
.offload_act_setup = tcf_mpls_offload_act_setup,
diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
index abb332dee836..a201979ac7cf 100644
--- a/net/sched/act_nat.c
+++ b/net/sched/act_nat.c
@@ -313,12 +313,18 @@ static void tcf_nat_cleanup(struct tc_action *a)
kfree_rcu(parms, rcu);
}
+static size_t tcf_nat_get_fill_size(const struct tc_action *act)
+{
+ return nla_total_size(sizeof(struct tc_nat)); /* TCA_NAT_PARMS */
+}
+
static struct tc_action_ops act_nat_ops = {
.kind = "nat",
.id = TCA_ID_NAT,
.owner = THIS_MODULE,
.act = tcf_nat_act,
.dump = tcf_nat_dump,
+ .get_fill_size = tcf_nat_get_fill_size,
.init = tcf_nat_init,
.cleanup = tcf_nat_cleanup,
.size = sizeof(struct tcf_nat),
diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c
index 8e69a919b4fe..80e5084b4dbd 100644
--- a/net/sched/act_simple.c
+++ b/net/sched/act_simple.c
@@ -79,6 +79,12 @@ static int reset_policy(struct tc_action *a, const struct nlattr *defdata,
return 0;
}
+static size_t tcf_simp_get_fill_size(const struct tc_action *act)
+{
+ return nla_total_size(sizeof(struct tc_defact)) /* TCA_DEF_PARMS */
+ + nla_total_size(SIMP_MAX_DATA); /* TCA_DEF_DATA */
+}
+
static const struct nla_policy simple_policy[TCA_DEF_MAX + 1] = {
[TCA_DEF_PARMS] = { .len = sizeof(struct tc_defact) },
[TCA_DEF_DATA] = { .type = NLA_STRING, .len = SIMP_MAX_DATA },
@@ -204,6 +210,7 @@ static struct tc_action_ops act_simp_ops = {
.owner = THIS_MODULE,
.act = tcf_simp_act,
.dump = tcf_simp_dump,
+ .get_fill_size = tcf_simp_get_fill_size,
.cleanup = tcf_simp_release,
.init = tcf_simp_init,
.size = sizeof(struct tcf_defact),
diff --git a/net/sched/act_skbmod.c b/net/sched/act_skbmod.c
index 7579cf1e0ff3..09e9dcf58253 100644
--- a/net/sched/act_skbmod.c
+++ b/net/sched/act_skbmod.c
@@ -279,12 +279,21 @@ static int tcf_skbmod_dump(struct sk_buff *skb, struct tc_action *a,
return -1;
}
+static size_t tcf_skbmod_get_fill_size(const struct tc_action *act)
+{
+ return nla_total_size(sizeof(struct tc_skbmod)) /* TCA_SKBMOD_PARMS */
+ + nla_total_size(ETH_ALEN) /* TCA_SKBMOD_DMAC */
+ + nla_total_size(ETH_ALEN) /* TCA_SKBMOD_SMAC */
+ + nla_total_size(sizeof(u16)); /* TCA_SKBMOD_ETYPE */
+}
+
static struct tc_action_ops act_skbmod_ops = {
.kind = "skbmod",
.id = TCA_ACT_SKBMOD,
.owner = THIS_MODULE,
.act = tcf_skbmod_act,
.dump = tcf_skbmod_dump,
+ .get_fill_size = tcf_skbmod_get_fill_size,
.init = tcf_skbmod_init,
.cleanup = tcf_skbmod_cleanup,
.size = sizeof(struct tcf_skbmod),
--
2.43.0
next prev parent reply other threads:[~2026-09-19 23:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-19 23:04 [PATCH net-next 0/3] net/sched: complete action notification accounting Victor Nogueira
2026-09-19 23:04 ` [PATCH net-next 1/3] net/sched: act_mirred: account for TCA_MIRRED_BLOCKID in get_fill_size Victor Nogueira
2026-09-19 23:04 ` Victor Nogueira [this message]
2026-09-19 23:04 ` [PATCH net-next 3/3] net/sched: act_api: budget TCA_ROOT_EXT_WARN_MSG in notify skbs Victor Nogueira
2026-09-21 16:13 ` [PATCH net-next 0/3] net/sched: complete action notification accounting Simon Horman
2026-09-22 11:00 ` patchwork-bot+netdevbpf
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=QDISC-RYTB.v1.20260918093205@mojatatu.com.2 \
--to=victor@mojatatu.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=hybris@mojatatu.ai \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sashiko-bot@kernel.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