Tue, Jan 23, 2018 at 10:33:33PM CET, jakub.kicin...@netronome.com wrote: >No upstream drivers seem to allow offload of chains other than 0.
mlxsw does. And I know that Intel was talking about adding the support to i40e iirc. >Save driver developers typing and make tc_can_offload_extack() >check for that condition as well. Rename the function to >tc_can_offload_cls() to better represent its application. > >Signed-off-by: Jakub Kicinski <jakub.kicin...@netronome.com> >--- [...] >--- a/include/net/pkt_cls.h >+++ b/include/net/pkt_cls.h >@@ -645,15 +645,21 @@ 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) >+static inline bool tc_can_offload_cls(const struct net_device *dev, >+ struct tc_cls_common_offload *common) > { >- bool can = tc_can_offload(dev); >- >- if (!can) >- NL_SET_ERR_MSG(extack, "TC offload is disabled on net device"); >+ if (common->chain_index) { This check here is wrong. It is up to the driver if it supports multichain offload or not, should not be checked in a generic code along with tc_can_offload. >+ NL_SET_ERR_MSG(common->extack, >+ "Driver supports only offload of chain 0"); >+ return false; >+ } >+ if (!tc_can_offload(dev)) { >+ NL_SET_ERR_MSG(common->extack, >+ "TC offload is disabled on net device"); >+ return false; >+ } > >- return can; >+ return true; > } > > static inline bool tc_skip_hw(u32 flags) >-- >2.15.1 >