From patchwork Sun Aug 14 05:35:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cong Wang X-Patchwork-Id: 659016 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 3sBtvj652qz9s5l for ; Sun, 14 Aug 2016 19:42:41 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=KaCHoWbN; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752911AbcHNJmi (ORCPT ); Sun, 14 Aug 2016 05:42:38 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:34472 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750701AbcHNJmh (ORCPT ); Sun, 14 Aug 2016 05:42:37 -0400 Received: by mail-pf0-f194.google.com with SMTP id g202so2059775pfb.1 for ; Sun, 14 Aug 2016 02:42:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Rhdp4lzFp3gc5KZ2qYpuhu6ycNexWx/j6SjPyCaRApA=; b=KaCHoWbNd2qYnJIXcZutrX1qG8/DFQtveRfpUMMZYCaghqWqtPPG9idyfgMTJGvo7K KmKL3qR0FXmIg/FJ+bJN/8Np0M9uXZJIzURLMwGiO/5RCNVHIIkaB2A0enFtGr7hPMW8 2W4kdbYNYgs0AQQc2Mn6eRCCqvccw8NT8slawfaBqGJZaBW48qb3eSEvJn4pT5wj/FD2 0FeAvuI1H83qBfxBVJ8nqU/4k+P4XgZAxJ+BS9tLX2TdxyfpyaT+6hf4WsPviAHt9kDu rXxYzoteNKdPEO5EebaVIqI9jnNlt8buCTjya+U0nGSHrINbJrRnFh3zK5ZyeQuO5IHC ZHLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Rhdp4lzFp3gc5KZ2qYpuhu6ycNexWx/j6SjPyCaRApA=; b=dboMci6ejmrXkZHQfx+nu0z5FpcFyl507u9uQLeKsEyCq5Wr+D/cw96abqFZHMeqs0 APMFRMzmd+nOUtQG1z9F13bQbG0Qmb5a7oqsN1qAZRBcWMx6s1O7XIW+bSeFxT8jkBu9 s6x1P/xH52cYA6jxgfOBxoHmnA8VFL9dBDuoPZAMdEJZNx1ix+39Txhu4WRyHi6o7pjy vEIFuVuFXl3GDgwmOTtdWbHw8HDnalDCuBcJhVGy/8eqjAadixqPsoua2a9NELarjx1P 2kv8sEV7jf+3kdFhf6hXOpwqBaESpLVHiWYx1hUQPaAJM3KnB4ZYeVaK++Isn6DQA9w2 KenA== X-Gm-Message-State: AEkoouuUQJNrFEO9511zGGvI7MFwXvv7biu2ehW51FniXJUJzE8AmGRfis/1QfEaz+I5zQ== X-Received: by 10.98.34.66 with SMTP id i63mr42155743pfi.130.1471153040904; Sat, 13 Aug 2016 22:37:20 -0700 (PDT) Received: from linux-6brj.site (c-73-162-46-141.hsd1.ca.comcast.net. [73.162.46.141]) by smtp.gmail.com with ESMTPSA id m65sm23746733pfg.79.2016.08.13.22.37.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 Aug 2016 22:37:20 -0700 (PDT) From: Cong Wang To: netdev@vger.kernel.org Cc: jhs@mojatatu.com, Cong Wang , Roman Mashak Subject: [Patch net v4 7/7] net_sched: allow flushing tc police actions Date: Sat, 13 Aug 2016 22:35:02 -0700 Message-Id: <1471152902-12444-8-git-send-email-xiyou.wangcong@gmail.com> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1471152902-12444-1-git-send-email-xiyou.wangcong@gmail.com> References: <1471152902-12444-1-git-send-email-xiyou.wangcong@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Roman Mashak The act_police uses its own code to walk the action hashtable, which leads to that we could not flush standalone tc police actions, so just switch to tcf_generic_walker() like other actions. (Joint work from Roman and Cong.) Signed-off-by: Roman Mashak Signed-off-by: Cong Wang Acked-by: Jamal Hadi Salim --- net/sched/act_police.c | 43 +------------------------------------------ 1 file changed, 1 insertion(+), 42 deletions(-) diff --git a/net/sched/act_police.c b/net/sched/act_police.c index 259352d..8a3be1d 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c @@ -63,49 +63,8 @@ static int tcf_act_police_walker(struct net *net, struct sk_buff *skb, const struct tc_action_ops *ops) { struct tc_action_net *tn = net_generic(net, police_net_id); - struct tcf_hashinfo *hinfo = tn->hinfo; - int err = 0, index = -1, i = 0, s_i = 0, n_i = 0; - struct nlattr *nest; - - spin_lock_bh(&hinfo->lock); - - s_i = cb->args[0]; - - for (i = 0; i < (POL_TAB_MASK + 1); i++) { - struct hlist_head *head; - struct tc_action *p; - - head = &hinfo->htab[tcf_hash(i, POL_TAB_MASK)]; - - hlist_for_each_entry_rcu(p, head, tcfa_head) { - index++; - if (index < s_i) - continue; - nest = nla_nest_start(skb, index); - if (nest == NULL) - goto nla_put_failure; - if (type == RTM_DELACTION) - err = tcf_action_dump_1(skb, p, 0, 1); - else - err = tcf_action_dump_1(skb, p, 0, 0); - if (err < 0) { - index--; - nla_nest_cancel(skb, nest); - goto done; - } - nla_nest_end(skb, nest); - n_i++; - } - } -done: - spin_unlock_bh(&hinfo->lock); - if (n_i) - cb->args[0] += n_i; - return n_i; -nla_put_failure: - nla_nest_cancel(skb, nest); - goto done; + return tcf_generic_walker(tn, skb, cb, type, ops); } static const struct nla_policy police_policy[TCA_POLICE_MAX + 1] = {