Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sch_htb: Add extack messages for EOPNOTSUPP errors

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 <maximmi@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Maxim Mikityanskiy and committed by
David S. Miller
648a991c 3a26babb

+6 -2
+6 -2
net/sched/sch_htb.c
··· 1084 1084 offload = nla_get_flag(tb[TCA_HTB_OFFLOAD]); 1085 1085 1086 1086 if (offload) { 1087 - if (sch->parent != TC_H_ROOT) 1087 + if (sch->parent != TC_H_ROOT) { 1088 + NL_SET_ERR_MSG(extack, "HTB must be the root qdisc to use offload"); 1088 1089 return -EOPNOTSUPP; 1090 + } 1089 1091 1090 - if (!tc_can_offload(dev) || !dev->netdev_ops->ndo_setup_tc) 1092 + if (!tc_can_offload(dev) || !dev->netdev_ops->ndo_setup_tc) { 1093 + NL_SET_ERR_MSG(extack, "hw-tc-offload ethtool feature flag must be on"); 1091 1094 return -EOPNOTSUPP; 1095 + } 1092 1096 1093 1097 q->num_direct_qdiscs = dev->real_num_tx_queues; 1094 1098 q->direct_qdiscs = kcalloc(q->num_direct_qdiscs,