From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jiri Pirko Subject: Re: [RFC net-next 1/8] pkt_cls: make tc_can_offload_extack() check chain index Date: Wed, 24 Jan 2018 09:28:44 +0100 Message-ID: <20180124082844.GA2234@nanopsycho> References: <20180123213340.19235-1-jakub.kicinski@netronome.com> <20180123213340.19235-2-jakub.kicinski@netronome.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: netdev@vger.kernel.org, oss-drivers@netronome.com, dsahern@gmail.com To: Jakub Kicinski Return-path: Received: from mail-wr0-f193.google.com ([209.85.128.193]:34066 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932260AbeAXI2q (ORCPT ); Wed, 24 Jan 2018 03:28:46 -0500 Received: by mail-wr0-f193.google.com with SMTP id 36so3240110wrh.1 for ; Wed, 24 Jan 2018 00:28:45 -0800 (PST) Content-Disposition: inline In-Reply-To: <20180123213340.19235-2-jakub.kicinski@netronome.com> Sender: netdev-owner@vger.kernel.org List-ID: Tue, Jan 23, 2018 at 10:33:33PM CET, jakub.kicinski@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 >--- [...] >--- 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 >