Skip to content

Commit

Permalink
net: sched: create tc_can_offload_extack() wrapper
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Quentin Monnet authored and David S. Miller committed Jan 22, 2018
1 parent 8f0b425 commit f9eda14
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions include/net/pkt_cls.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f9eda14

Please sign in to comment.