* [PATCH net-next] net/sched: act_sample: reset truncation settings on action replace
@ 2026-08-25 16:01 Khawar Ahemad
2026-08-25 17:03 ` Victor Nogueira
2026-08-27 8:11 ` Paolo Abeni
0 siblings, 2 replies; 3+ messages in thread
From: Khawar Ahemad @ 2026-08-25 16:01 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, jhs, jiri, davem, edumazet, kuba, pabeni, horms,
ahemadkhawar123
When replacing an existing sample action, if TCA_SAMPLE_TRUNC_SIZE is not
passed in the netlink request, s->truncate and s->trunc_size retain their
previous values from the prior configuration.
As a result, a user cannot disable packet truncation when replacing a
sample action unless the action is fully deleted and recreated. In
addition, the hardware offload state and netlink dump continue to report
truncation as active.
Fix this by explicitly resetting s->truncate to false and s->trunc_size
to 0 when TCA_SAMPLE_TRUNC_SIZE is omitted during tcf_sample_init().
Fixes: 5c56784d852a ("net/sched: act_sample: add support for packet truncation")
Signed-off-by: Khawar Ahemad <ahemadkhawar123@gmail.com>
---
net/sched/act_sample.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c
index 2ceb4d141b..2bdc7a0eb6 100644
--- a/net/sched/act_sample.c
+++ b/net/sched/act_sample.c
@@ -116,6 +116,9 @@ static int tcf_sample_init(struct net *net, struct nlattr *nla,
if (tb[TCA_SAMPLE_TRUNC_SIZE]) {
s->truncate = true;
s->trunc_size = nla_get_u32(tb[TCA_SAMPLE_TRUNC_SIZE]);
+ } else {
+ s->truncate = false;
+ s->trunc_size = 0;
}
spin_unlock_bh(&s->tcf_lock);
--
2.54.0 (Apple Git-157)
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net-next] net/sched: act_sample: reset truncation settings on action replace
2026-08-25 16:01 [PATCH net-next] net/sched: act_sample: reset truncation settings on action replace Khawar Ahemad
@ 2026-08-25 17:03 ` Victor Nogueira
2026-08-27 8:11 ` Paolo Abeni
1 sibling, 0 replies; 3+ messages in thread
From: Victor Nogueira @ 2026-08-25 17:03 UTC (permalink / raw)
To: Khawar Ahemad, netdev
Cc: linux-kernel, jhs, jiri, davem, edumazet, kuba, pabeni, horms
On 25/08/2026 13:01, Khawar Ahemad wrote:
> When replacing an existing sample action, if TCA_SAMPLE_TRUNC_SIZE is not
> passed in the netlink request, s->truncate and s->trunc_size retain their
> previous values from the prior configuration.
>
> As a result, a user cannot disable packet truncation when replacing a
> sample action unless the action is fully deleted and recreated. In
> addition, the hardware offload state and netlink dump continue to report
> truncation as active.
>
> Fix this by explicitly resetting s->truncate to false and s->trunc_size
> to 0 when TCA_SAMPLE_TRUNC_SIZE is omitted during tcf_sample_init().
This would be a behavioural regression. Users are not expecting that
a replace omitting truncation parameters will silently overwrite their
previous truncation settings. Can you instead create a new netlink
attribute? Something like "TCA_SAMPLE_FLAGS" which might have a
flag telling the action to unset this parameter?
Other option is to interpret 0 as "unset", but that might break
some setups.
Your fixes commit doesn't seem to exist and, since this is a fix,
you should target net and not net-next.
Also remember to wait 24 hours before posting a v2.
cheers,
Victor
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net/sched: act_sample: reset truncation settings on action replace
2026-08-25 16:01 [PATCH net-next] net/sched: act_sample: reset truncation settings on action replace Khawar Ahemad
2026-08-25 17:03 ` Victor Nogueira
@ 2026-08-27 8:11 ` Paolo Abeni
1 sibling, 0 replies; 3+ messages in thread
From: Paolo Abeni @ 2026-08-27 8:11 UTC (permalink / raw)
To: Khawar Ahemad, netdev
Cc: linux-kernel, jhs, jiri, davem, edumazet, kuba, horms
On 8/25/26 6:01 PM, Khawar Ahemad wrote:
> When replacing an existing sample action, if TCA_SAMPLE_TRUNC_SIZE is not
> passed in the netlink request, s->truncate and s->trunc_size retain their
> previous values from the prior configuration.
>
> As a result, a user cannot disable packet truncation when replacing a
> sample action unless the action is fully deleted and recreated. In
> addition, the hardware offload state and netlink dump continue to report
> truncation as active.
>
> Fix this by explicitly resetting s->truncate to false and s->trunc_size
> to 0 when TCA_SAMPLE_TRUNC_SIZE is omitted during tcf_sample_init().
>
> Fixes: 5c56784d852a ("net/sched: act_sample: add support for packet truncation")
> Signed-off-by: Khawar Ahemad <ahemadkhawar123@gmail.com>
## Form letter - net-next-closed
net-next pull request for v7.3 has already been merged, and therefore
the net-next tree is closed for new drivers, features, code refactoring
and optimizations. We are currently accepting bug fixes only.
Please repost when net-next reopens after Aug 31st.
RFC patches sent for review only are obviously welcome at any time.
See:
https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle
--
pw-bot: defer
pv-bot: closed
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-27 8:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-25 16:01 [PATCH net-next] net/sched: act_sample: reset truncation settings on action replace Khawar Ahemad
2026-08-25 17:03 ` Victor Nogueira
2026-08-27 8:11 ` Paolo Abeni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox