Commit f9eda14f authored by Quentin Monnet's avatar Quentin Monnet Committed by David S. Miller

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: default avatarQuentin Monnet <quentin.monnet@netronome.com>
Reviewed-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8f0b425a
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment