* [PATCH net-next] net/sched: taprio: align entry index attr validation with mqprio
@ 2025-07-25 9:56 Simon Horman
2025-07-25 22:35 ` Cong Wang
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Simon Horman @ 2025-07-25 9:56 UTC (permalink / raw)
To: Vinicius Costa Gomes
Cc: Cong Wang, David S. Miller, Eric Dumazet, Jakub Kicinski,
Jamal Hadi Salim, Jiri Pirko, Maher Azzouzi, Paolo Abeni,
Vladimir Oltean, netdev, Simon Horman
Both taprio and mqprio have code to validate respective entry index
attributes. The validation is indented to ensure that the attribute is
present, and that it's value is in range, and that each value is only
used once.
The purpose of this patch is to align the implementation of taprio with
that of mqprio as there seems to be no good reason for them to differ.
For one thing, this way, bugs will be present in both or neither.
As a follow-up some consideration could be given to a common function
used by both sch.
No functional change intended.
Except of tdc run: the results of the taprio tests
# ok 81 ba39 - Add taprio Qdisc to multi-queue device (8 queues)
# ok 82 9462 - Add taprio Qdisc with multiple sched-entry
# ok 83 8d92 - Add taprio Qdisc with txtime-delay
# ok 84 d092 - Delete taprio Qdisc with valid handle
# ok 85 8471 - Show taprio class
# ok 86 0a85 - Add taprio Qdisc to single-queue device
# ok 87 6f62 - Add taprio Qdisc with too short interval
# ok 88 831f - Add taprio Qdisc with too short cycle-time
# ok 89 3e1e - Add taprio Qdisc with an invalid cycle-time
# ok 90 39b4 - Reject grafting taprio as child qdisc of software taprio
# ok 91 e8a1 - Reject grafting taprio as child qdisc of offloaded taprio
# ok 92 a7bf - Graft cbs as child of software taprio
# ok 93 6a83 - Graft cbs as child of offloaded taprio
Cc: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: Maher Azzouzi <maherazz04@gmail.com>
Link: https://lore.kernel.org/netdev/20250723125521.GA2459@horms.kernel.org/
Signed-off-by: Simon Horman <horms@kernel.org>
---
net/sched/sch_taprio.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
index 2b14c81a87e5..e759e43ad27e 100644
--- a/net/sched/sch_taprio.c
+++ b/net/sched/sch_taprio.c
@@ -998,7 +998,7 @@ static const struct nla_policy entry_policy[TCA_TAPRIO_SCHED_ENTRY_MAX + 1] = {
static const struct nla_policy taprio_tc_policy[TCA_TAPRIO_TC_ENTRY_MAX + 1] = {
[TCA_TAPRIO_TC_ENTRY_INDEX] = NLA_POLICY_MAX(NLA_U32,
- TC_QOPT_MAX_QUEUE),
+ TC_QOPT_MAX_QUEUE - 1),
[TCA_TAPRIO_TC_ENTRY_MAX_SDU] = { .type = NLA_U32 },
[TCA_TAPRIO_TC_ENTRY_FP] = NLA_POLICY_RANGE(NLA_U32,
TC_FP_EXPRESS,
@@ -1698,19 +1698,15 @@ static int taprio_parse_tc_entry(struct Qdisc *sch,
if (err < 0)
return err;
- if (!tb[TCA_TAPRIO_TC_ENTRY_INDEX]) {
+ if (NL_REQ_ATTR_CHECK(extack, opt, tb, TCA_TAPRIO_TC_ENTRY_INDEX)) {
NL_SET_ERR_MSG_MOD(extack, "TC entry index missing");
return -EINVAL;
}
tc = nla_get_u32(tb[TCA_TAPRIO_TC_ENTRY_INDEX]);
- if (tc >= TC_QOPT_MAX_QUEUE) {
- NL_SET_ERR_MSG_MOD(extack, "TC entry index out of range");
- return -ERANGE;
- }
-
if (*seen_tcs & BIT(tc)) {
- NL_SET_ERR_MSG_MOD(extack, "Duplicate TC entry");
+ NL_SET_ERR_MSG_ATTR(extack, tb[TCA_TAPRIO_TC_ENTRY_INDEX],
+ "Duplicate tc entry");
return -EINVAL;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net/sched: taprio: align entry index attr validation with mqprio
2025-07-25 9:56 [PATCH net-next] net/sched: taprio: align entry index attr validation with mqprio Simon Horman
@ 2025-07-25 22:35 ` Cong Wang
2025-07-26 0:10 ` Vinicius Costa Gomes
2025-07-26 18:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Cong Wang @ 2025-07-25 22:35 UTC (permalink / raw)
To: Simon Horman
Cc: Vinicius Costa Gomes, David S. Miller, Eric Dumazet,
Jakub Kicinski, Jamal Hadi Salim, Jiri Pirko, Maher Azzouzi,
Paolo Abeni, Vladimir Oltean, netdev
On Fri, Jul 25, 2025 at 10:56:47AM +0100, Simon Horman wrote:
> Both taprio and mqprio have code to validate respective entry index
> attributes. The validation is indented to ensure that the attribute is
> present, and that it's value is in range, and that each value is only
> used once.
>
> The purpose of this patch is to align the implementation of taprio with
> that of mqprio as there seems to be no good reason for them to differ.
> For one thing, this way, bugs will be present in both or neither.
>
> As a follow-up some consideration could be given to a common function
> used by both sch.
>
> No functional change intended.
>
> Except of tdc run: the results of the taprio tests
>
> # ok 81 ba39 - Add taprio Qdisc to multi-queue device (8 queues)
> # ok 82 9462 - Add taprio Qdisc with multiple sched-entry
> # ok 83 8d92 - Add taprio Qdisc with txtime-delay
> # ok 84 d092 - Delete taprio Qdisc with valid handle
> # ok 85 8471 - Show taprio class
> # ok 86 0a85 - Add taprio Qdisc to single-queue device
> # ok 87 6f62 - Add taprio Qdisc with too short interval
> # ok 88 831f - Add taprio Qdisc with too short cycle-time
> # ok 89 3e1e - Add taprio Qdisc with an invalid cycle-time
> # ok 90 39b4 - Reject grafting taprio as child qdisc of software taprio
> # ok 91 e8a1 - Reject grafting taprio as child qdisc of offloaded taprio
> # ok 92 a7bf - Graft cbs as child of software taprio
> # ok 93 6a83 - Graft cbs as child of offloaded taprio
>
> Cc: Vladimir Oltean <vladimir.oltean@nxp.com>
> Cc: Maher Azzouzi <maherazz04@gmail.com>
> Link: https://lore.kernel.org/netdev/20250723125521.GA2459@horms.kernel.org/
> Signed-off-by: Simon Horman <horms@kernel.org>
Reviewed-by: Cong Wang <xiyou.wangcong@gmail.com>
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net/sched: taprio: align entry index attr validation with mqprio
2025-07-25 9:56 [PATCH net-next] net/sched: taprio: align entry index attr validation with mqprio Simon Horman
2025-07-25 22:35 ` Cong Wang
@ 2025-07-26 0:10 ` Vinicius Costa Gomes
2025-07-26 18:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Vinicius Costa Gomes @ 2025-07-26 0:10 UTC (permalink / raw)
To: Simon Horman
Cc: Cong Wang, David S. Miller, Eric Dumazet, Jakub Kicinski,
Jamal Hadi Salim, Jiri Pirko, Maher Azzouzi, Paolo Abeni,
Vladimir Oltean, netdev, Simon Horman
Simon Horman <horms@kernel.org> writes:
> Both taprio and mqprio have code to validate respective entry index
> attributes. The validation is indented to ensure that the attribute is
> present, and that it's value is in range, and that each value is only
> used once.
>
> The purpose of this patch is to align the implementation of taprio with
> that of mqprio as there seems to be no good reason for them to differ.
> For one thing, this way, bugs will be present in both or neither.
>
> As a follow-up some consideration could be given to a common function
> used by both sch.
>
> No functional change intended.
>
> Except of tdc run: the results of the taprio tests
>
> # ok 81 ba39 - Add taprio Qdisc to multi-queue device (8 queues)
> # ok 82 9462 - Add taprio Qdisc with multiple sched-entry
> # ok 83 8d92 - Add taprio Qdisc with txtime-delay
> # ok 84 d092 - Delete taprio Qdisc with valid handle
> # ok 85 8471 - Show taprio class
> # ok 86 0a85 - Add taprio Qdisc to single-queue device
> # ok 87 6f62 - Add taprio Qdisc with too short interval
> # ok 88 831f - Add taprio Qdisc with too short cycle-time
> # ok 89 3e1e - Add taprio Qdisc with an invalid cycle-time
> # ok 90 39b4 - Reject grafting taprio as child qdisc of software taprio
> # ok 91 e8a1 - Reject grafting taprio as child qdisc of offloaded taprio
> # ok 92 a7bf - Graft cbs as child of software taprio
> # ok 93 6a83 - Graft cbs as child of offloaded taprio
>
> Cc: Vladimir Oltean <vladimir.oltean@nxp.com>
> Cc: Maher Azzouzi <maherazz04@gmail.com>
> Link: https://lore.kernel.org/netdev/20250723125521.GA2459@horms.kernel.org/
> Signed-off-by: Simon Horman <horms@kernel.org>
> ---
Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Cheers,
--
Vinicius
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net/sched: taprio: align entry index attr validation with mqprio
2025-07-25 9:56 [PATCH net-next] net/sched: taprio: align entry index attr validation with mqprio Simon Horman
2025-07-25 22:35 ` Cong Wang
2025-07-26 0:10 ` Vinicius Costa Gomes
@ 2025-07-26 18:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-07-26 18:40 UTC (permalink / raw)
To: Simon Horman
Cc: vinicius.gomes, xiyou.wangcong, davem, edumazet, kuba, jhs, jiri,
maherazz04, pabeni, vladimir.oltean, netdev
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Fri, 25 Jul 2025 10:56:47 +0100 you wrote:
> Both taprio and mqprio have code to validate respective entry index
> attributes. The validation is indented to ensure that the attribute is
> present, and that it's value is in range, and that each value is only
> used once.
>
> The purpose of this patch is to align the implementation of taprio with
> that of mqprio as there seems to be no good reason for them to differ.
> For one thing, this way, bugs will be present in both or neither.
>
> [...]
Here is the summary with links:
- [net-next] net/sched: taprio: align entry index attr validation with mqprio
https://git.kernel.org/netdev/net-next/c/c471b90bb332
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-07-26 18:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-25 9:56 [PATCH net-next] net/sched: taprio: align entry index attr validation with mqprio Simon Horman
2025-07-25 22:35 ` Cong Wang
2025-07-26 0:10 ` Vinicius Costa Gomes
2025-07-26 18:40 ` patchwork-bot+netdevbpf
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).