diff options
author | Quentin Monnet <quentin.monnet@netronome.com> | 2018-01-19 17:44:48 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-01-22 16:28:32 -0500 |
commit | f9eda14f039294298643d034bc5c06340fe16cc0 (patch) | |
tree | 76a2b604bdd1ee09153df6c89896daab7ddb7739 /include/net | |
parent | 8f0b425a712b82732127ff7880f92504f20fcc11 (diff) |
net: sched: create tc_can_offload_extack() wrapper
Create a wrapper around tc_can_offload() that takes an additional
extack pointer argument in order to output an error message if TC
offload is disabled on the device.
In this way, the error message is handled by the core and can be the
same for all drivers.
Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/pkt_cls.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index f497f622580b..2f8f16a4d88e 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h @@ -656,6 +656,17 @@ static inline bool tc_can_offload(const struct net_device *dev) return dev->features & NETIF_F_HW_TC; } +static inline bool tc_can_offload_extack(const struct net_device *dev, + struct netlink_ext_ack *extack) +{ + bool can = tc_can_offload(dev); + + if (!can) + NL_SET_ERR_MSG(extack, "TC offload is disabled on net device"); + + return can; +} + static inline bool tc_skip_hw(u32 flags) { return (flags & TCA_CLS_FLAGS_SKIP_HW) ? true : false; |