On 16-02-26 09:39 AM, Cong Wang wrote: > On Fri, Feb 26, 2016 at 7:53 AM, John Fastabend > <john.fastab...@gmail.com> wrote: >> The offload decision was originally very basic and tied to if the dev >> implemented the appropriate ndo op hook. The next step is to allow >> the user to more flexibly define if any paticular rule should be >> offloaded or not. In order to have this logic in one function lift >> the current check into a helper routine tc_should_offload(). >> >> Signed-off-by: John Fastabend <john.r.fastab...@intel.com> >> --- >> include/net/pkt_cls.h | 5 +++++ >> net/sched/cls_u32.c | 8 ++++---- >> 2 files changed, 9 insertions(+), 4 deletions(-) >> >> diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h >> index 2121df5..e64d20b 100644 >> --- a/include/net/pkt_cls.h >> +++ b/include/net/pkt_cls.h >> @@ -392,4 +392,9 @@ struct tc_cls_u32_offload { >> }; >> }; >> >> +static inline bool tc_should_offload(struct net_device *dev) >> +{ >> + return dev->netdev_ops->ndo_setup_tc; >> +} >> + > > These should be protected by CONFIG_NET_CLS_U32, no? >
Its not necessary it is a completely general function and I only lifted it out of cls_u32 so that the cls_flower classifier could also use it. I don't see the need off-hand to have it wrapped in an ORd ifdef statement where its (CONFIG_NET_CLS_U32 | CONFIG_NET_CLS_X ...). Any particular reason you were thnking it should be wrapped in ifdefs? Thanks for taking a look at the patches. .John