From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Borkmann Subject: Re: [patch net-next v2 10/10] net: sched: add termination action to allow goto chain Date: Tue, 16 May 2017 09:59:36 +0200 Message-ID: <591AB168.30202@iogearbox.net> References: <20170515083857.3615-1-jiri@resnulli.us> <20170515083857.3615-11-jiri@resnulli.us> <591A0940.2070801@iogearbox.net> <20170516044319.GA24493@nanopsycho> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, davem@davemloft.net, jhs@mojatatu.com, xiyou.wangcong@gmail.com, dsa@cumulusnetworks.com, edumazet@google.com, stephen@networkplumber.org, alexander.h.duyck@intel.com, simon.horman@netronome.com, mlxsw@mellanox.com, alexei.starovoitov@gmail.com To: Jiri Pirko Return-path: Received: from www62.your-server.de ([213.133.104.62]:43551 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751215AbdEPH7n (ORCPT ); Tue, 16 May 2017 03:59:43 -0400 In-Reply-To: <20170516044319.GA24493@nanopsycho> Sender: netdev-owner@vger.kernel.org List-ID: On 05/16/2017 06:43 AM, Jiri Pirko wrote: > Mon, May 15, 2017 at 10:02:08PM CEST, daniel@iogearbox.net wrote: >> On 05/15/2017 10:38 AM, Jiri Pirko wrote: >>> From: Jiri Pirko >>> >>> Introduce new type of termination action called "goto_chain". This allows >>> user to specify a chain to be processed. This action type is >>> then processed as a return value in tcf_classify loop in similar >>> way as "reclassify" is, only it does not reset to the first filter >>> in chain but rather reset to the first filter of the desired chain. >>> >>> Signed-off-by: Jiri Pirko >> [...] >>> diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c >>> index 1112a2b..98cc689 100644 >>> --- a/net/sched/cls_api.c >>> +++ b/net/sched/cls_api.c >>> @@ -304,10 +304,14 @@ int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp, >>> continue; >>> >>> err = tp->classify(skb, tp, res); >>> - if (unlikely(err == TC_ACT_RECLASSIFY && !compat_mode)) >>> + if (err == TC_ACT_RECLASSIFY && !compat_mode) { >>> goto reset; >>> - if (err >= 0) >>> + } else if (TC_ACT_EXT_CMP(err, TC_ACT_GOTO_CHAIN)) { >>> + old_tp = res->goto_tp; >>> + goto reset; >>> + } else if (err >= 0) { >>> return err; >>> + } >> >> Given this goto chain feature is pretty much only interesting for hw >> offloads, can we move this further away from the sw fast path to not >> add up to the cost per packet? (I doubt anyone is using TC_ACT_RECLASSIFY >> in sw as well ...) > > I don't think so. First of all, the whole thing would be broken then in > sw. It is useful to have it in sw, at least for testing reasons. > So I would leave the unlikely and add it to the second check as well. Ok, lets go with that then, thanks!