[PATCH net-next] sch_htb: Add extack messages for EOPNOTSUPP errors

Subsystems: networking [general], tc subsystem, the rest

STALE1754d REVIEWED: 4 (4M)

1 review trailer.

2 messages, 2 authors, 2021-10-28 · open the first message on its own page

[PATCH net-next] sch_htb: Add extack messages for EOPNOTSUPP errors

From: Maxim Mikityanskiy <hidden>
Date: 2021-10-28 12:25:15

In order to make the "Operation not supported" message clearer to the
user, add extack messages explaining why exactly adding offloaded HTB
could be not supported in each case.

Signed-off-by: Maxim Mikityanskiy <redacted>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
---
 net/sched/sch_htb.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index cf1d45db4e84..9267922ea9c3 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -1084,11 +1084,15 @@ static int htb_init(struct Qdisc *sch, struct nlattr *opt,
 	offload = nla_get_flag(tb[TCA_HTB_OFFLOAD]);
 
 	if (offload) {
-		if (sch->parent != TC_H_ROOT)
+		if (sch->parent != TC_H_ROOT) {
+			NL_SET_ERR_MSG(extack, "HTB must be the root qdisc to use offload");
 			return -EOPNOTSUPP;
+		}
 
-		if (!tc_can_offload(dev) || !dev->netdev_ops->ndo_setup_tc)
+		if (!tc_can_offload(dev) || !dev->netdev_ops->ndo_setup_tc) {
+			NL_SET_ERR_MSG(extack, "hw-tc-offload ethtool feature flag must be on");
 			return -EOPNOTSUPP;
+		}
 
 		q->num_direct_qdiscs = dev->real_num_tx_queues;
 		q->direct_qdiscs = kcalloc(q->num_direct_qdiscs,
-- 
2.25.1

Re: [PATCH net-next] sch_htb: Add extack messages for EOPNOTSUPP errors

From: patchwork-bot+netdevbpf@kernel.org
Date: 2021-10-28 13:40:10

Hello:

This patch was applied to netdev/net-next.git (master)
by David S. Miller [off-list ref]:

On Thu, 28 Oct 2021 15:24:36 +0300 you wrote:
In order to make the "Operation not supported" message clearer to the
user, add extack messages explaining why exactly adding offloaded HTB
could be not supported in each case.

Signed-off-by: Maxim Mikityanskiy <redacted>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>

[...]
Here is the summary with links:
  - [net-next] sch_htb: Add extack messages for EOPNOTSUPP errors
    https://git.kernel.org/netdev/net-next/c/648a991cf316

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help