Skip to content

Commit 429c3be

Browse files
nvmmaxkuba-moo
authored andcommitted
sch_htb: Fail on unsupported parameters when offload is requested
The current implementation of HTB offload doesn't support some parameters. Instead of ignoring them, actively return the EINVAL error when they are set to non-defaults. As this patch goes to stable, the driver API is not changed here. If future drivers support more offload parameters, the checks can be moved to the driver side. Note that the buffer and cbuffer parameters are also not supported, but the tc userspace tool assigns some default values derived from rate and ceil, and identifying these defaults in sch_htb would be unreliable, so they are still ignored. Fixes: d03b195 ("sch_htb: Hierarchical QoS hardware offload") Reported-by: Jakub Kicinski <[email protected]> Signed-off-by: Maxim Mikityanskiy <[email protected]> Reviewed-by: Tariq Toukan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 8bdd249 commit 429c3be

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

net/sched/sch_htb.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,6 +1810,26 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
18101810
if (!hopt->rate.rate || !hopt->ceil.rate)
18111811
goto failure;
18121812

1813+
if (q->offload) {
1814+
/* Options not supported by the offload. */
1815+
if (hopt->rate.overhead || hopt->ceil.overhead) {
1816+
NL_SET_ERR_MSG(extack, "HTB offload doesn't support the overhead parameter");
1817+
goto failure;
1818+
}
1819+
if (hopt->rate.mpu || hopt->ceil.mpu) {
1820+
NL_SET_ERR_MSG(extack, "HTB offload doesn't support the mpu parameter");
1821+
goto failure;
1822+
}
1823+
if (hopt->quantum) {
1824+
NL_SET_ERR_MSG(extack, "HTB offload doesn't support the quantum parameter");
1825+
goto failure;
1826+
}
1827+
if (hopt->prio) {
1828+
NL_SET_ERR_MSG(extack, "HTB offload doesn't support the prio parameter");
1829+
goto failure;
1830+
}
1831+
}
1832+
18131833
/* Keeping backward compatible with rate_table based iproute2 tc */
18141834
if (hopt->rate.linklayer == TC_LINKLAYER_UNAWARE)
18151835
qdisc_put_rtab(qdisc_get_rtab(&hopt->rate, tb[TCA_HTB_RTAB],

0 commit comments

Comments
 (0)