From patchwork Tue May 23 14:31:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 766028 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3wXHyn2ZcKz9sPB for ; Wed, 24 May 2017 00:31:29 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=resnulli-us.20150623.gappssmtp.com header.i=@resnulli-us.20150623.gappssmtp.com header.b="epqAYJzH"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966380AbdEWOb1 (ORCPT ); Tue, 23 May 2017 10:31:27 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:35035 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934599AbdEWObU (ORCPT ); Tue, 23 May 2017 10:31:20 -0400 Received: by mail-wm0-f66.google.com with SMTP id g15so20234515wmc.2 for ; Tue, 23 May 2017 07:31:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EM2p/cqdIpaZHU+Z0vCErB26zgWoqx8UE+xpsPQomY4=; b=epqAYJzHy5zyz7aRQiWwzeTiteiDT//p8pWI7fUWpjoc83RBuY2UxgSATbJkFeh5dz Xxf+nw+6zdZmN1wHGWujn8H5Szd5Kq1r79WMCdWtEI9fIwQBfwFy4xY+7IUIt5VBOUKR 1NMbfXu2B0/J4ap5PqkbxX67xzvl7Wnid/GTV27LxbdULUDwrF9CJKwOxdeAECON31Cd 10dkIIaSlKgt3F6jtKZOBTS0dXX6yw8qbUng2FEsEqKH0i7XJjhxsUHOlXpyHtArsQ3w BawLpUAPVROpiZiDhSRyDsp3lnttUnjNPv2QZU/CH/W1jveaMB/k/xxZAfXuEE+W9z85 HHvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EM2p/cqdIpaZHU+Z0vCErB26zgWoqx8UE+xpsPQomY4=; b=UyprbxzyImpnpHFGkkuV4OeIWpcLvXjEaazbaXmFT23ScelWsg5cMjKwMu03HSwKOK /c/NnP2pmkoOlCCm1TvnVrXOK3VXS+yN7ESY8J0bvzokDNkmH/Wnx18g36V8+BDQb3Jm rlIUbfyMz6A/JoVvrKD0Jad6Fc/UkbT7+jaMB6LR5PpnuMN2vQKs07ZWjgzbE1JnFMHe uqRPFkBiS8iEufFOJHtf0s88IsPlg14ShJLAANBkfGQ7C4dGV/DYqf8r103PbPnkV20y RsHHlncziS5NezTQ92vl2ad9WSXRqt9mD/QyXvU4bK9+Y0rcD1pPeuJ4r3PqFBL0UO29 ycsA== X-Gm-Message-State: AODbwcD4ZAp+jc6J7WdoTcE2eYBW3quaXqyMC4dTSkSbe9CqGYTeHJbv l01gPCWwqHLWUK/mPvA= X-Received: by 10.28.22.12 with SMTP id 12mr2468728wmw.97.1495549874845; Tue, 23 May 2017 07:31:14 -0700 (PDT) Received: from localhost (jirka.pirko.cz. [84.16.102.26]) by smtp.gmail.com with ESMTPSA id t26sm1069097wra.43.2017.05.23.07.31.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 May 2017 07:31:14 -0700 (PDT) From: Jiri Pirko To: netdev@vger.kernel.org Cc: davem@davemloft.net, jhs@mojatatu.com, xiyou.wangcong@gmail.com, simon.horman@netronome.com, mlxsw@mellanox.com, idosch@mellanox.com Subject: [patch net-next 1/5] net: sched: cls_api: make reclassify return all the way back to the original tp Date: Tue, 23 May 2017 16:31:06 +0200 Message-Id: <20170523143110.5006-2-jiri@resnulli.us> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170523143110.5006-1-jiri@resnulli.us> References: <20170523143110.5006-1-jiri@resnulli.us> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jiri Pirko With the introduction of chain goto action, the reclassification would cause the re-iteration of the actual chain. It makes more sense to restart the whole thing and re-iterate starting from the original tp - start of chain 0. Signed-off-by: Jiri Pirko --- net/sched/cls_api.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 01a8b8b..89fbb35 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -300,7 +300,8 @@ int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp, __be16 protocol = tc_skb_protocol(skb); #ifdef CONFIG_NET_CLS_ACT const int max_reclassify_loop = 4; - const struct tcf_proto *old_tp = tp; + const struct tcf_proto *orig_tp = tp; + const struct tcf_proto *first_tp; int limit = 0; reclassify: @@ -315,9 +316,10 @@ int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp, err = tp->classify(skb, tp, res); #ifdef CONFIG_NET_CLS_ACT if (unlikely(err == TC_ACT_RECLASSIFY && !compat_mode)) { + first_tp = orig_tp; goto reset; } else if (unlikely(TC_ACT_EXT_CMP(err, TC_ACT_GOTO_CHAIN))) { - old_tp = res->goto_tp; + first_tp = res->goto_tp; goto reset; } #endif @@ -335,7 +337,7 @@ int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp, return TC_ACT_SHOT; } - tp = old_tp; + tp = first_tp; protocol = tc_skb_protocol(skb); goto reclassify; #endif