Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp7018886yba; Thu, 2 May 2019 02:42:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqyaCibeyQmmuwK2Egm8imW4vVje+VxXN71dqyXNN95hphfupemTSDYt7l5mzr6VUhGIrC9X X-Received: by 2002:a65:5342:: with SMTP id w2mr2955494pgr.220.1556790161448; Thu, 02 May 2019 02:42:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556790161; cv=none; d=google.com; s=arc-20160816; b=ZOSTQarpjn0ItID7PIw6KoluS03CZzFRyICzWvQz2qL9a0D+fYnL8rvB5C1vFjlcx5 PQkjNthf1Pn1wZhku5xN95mBtzr7lZQ4ErM/BhN+qs5tvGuogsbRJjXztAkRbohCgrsl iLRGuQHUrVbEHgw0BMXxyi7iUToV0dol36EmEpT5F4GFGFoUH3aaPattpFpzx01VW5fm 3MFJAIqUc8p9mSdPNbKtV1WJb5hfqfe0ngAhpWRR8CtHYe7cPe5JKI0vvE4JBFNmnU+z qDaMmSjadXVWkFqmIur5piSbdifkvEIjURoPk9Q19Mt8dWIiaXen5kTaQ7p+B537e4g/ kFgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=AfZhubsETZhZIafHA+HIyT6KS5YyaSU5ujIgdK+oKpw=; b=baXJapdWUCuaCXDJryOrMThUeRYCneSoMvEYi1wO0do8f2qNRg8ZXsWIgfQtdAhB5/ TQ9ULgF8jb4fa2oynedKWw/lX+sKiarjeIWYqY7ctbucgOKOW3ZfciVOSIzdyTCx5Dlg SF/2C5mUtucBzk+8C6BNluUdVaHVHitIvi30Y42tu+WqIYS8T8pWYZeHFqC60Hi4P6XI 4OwEFT6jyZYBUFkqbXps1lIcOebmh3/0UvQsLB9QyPH5HuzK49vm7Vn6dLXJCgcFrGVx tFicsUgziKF8N1qFJolGyNjMfSHxWBe82dJrIDoiKaO7yr1yUsgJeyq+WMfLDQfuD01m /bDA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=microchip.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 38si43196059pln.128.2019.05.02.02.42.26; Thu, 02 May 2019 02:42:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726393AbfEBJl3 (ORCPT + 99 others); Thu, 2 May 2019 05:41:29 -0400 Received: from esa6.microchip.iphmx.com ([216.71.154.253]:64068 "EHLO esa6.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726127AbfEBJl2 (ORCPT ); Thu, 2 May 2019 05:41:28 -0400 Received-SPF: Pass (esa6.microchip.iphmx.com: domain of Joergen.Andreasen@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa6.microchip.iphmx.com; envelope-from="Joergen.Andreasen@microchip.com"; x-sender="Joergen.Andreasen@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com a:mx1.microchip.iphmx.com a:mx2.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa6.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa6.microchip.iphmx.com; envelope-from="Joergen.Andreasen@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa6.microchip.iphmx.com; dkim=none (message not signed) header.i=none; spf=Pass smtp.mailfrom=Joergen.Andreasen@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dmarc=pass (p=none dis=none) d=microchip.com X-IronPort-AV: E=Sophos;i="5.60,421,1549954800"; d="scan'208";a="28787435" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 02 May 2019 02:41:02 -0700 Received: from localhost (10.10.76.4) by chn-sv-exch04.mchp-main.com (10.10.76.105) with Microsoft SMTP Server id 14.3.352.0; Thu, 2 May 2019 02:41:02 -0700 From: Joergen Andreasen To: CC: Joergen Andreasen , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Alexandre Belloni , Microchip Linux Driver Support , "David S. Miller" , Ralf Baechle , "Paul Burton" , James Hogan , , Subject: [PATCH net-next 1/3] net/sched: act_police: move police parameters into separate header file Date: Thu, 2 May 2019 11:40:27 +0200 Message-ID: <20190502094029.22526-2-joergen.andreasen@microchip.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190502094029.22526-1-joergen.andreasen@microchip.com> References: <20190502094029.22526-1-joergen.andreasen@microchip.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hardware offloading a policer requires access to it's parameters. This is now possible by including net/tc_act/tc_police.h. Signed-off-by: Joergen Andreasen --- include/net/tc_act/tc_police.h | 41 ++++++++++++++++++++++++++++++++++ net/sched/act_police.c | 27 +--------------------- 2 files changed, 42 insertions(+), 26 deletions(-) create mode 100644 include/net/tc_act/tc_police.h diff --git a/include/net/tc_act/tc_police.h b/include/net/tc_act/tc_police.h new file mode 100644 index 000000000000..052dc5f37aa9 --- /dev/null +++ b/include/net/tc_act/tc_police.h @@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __NET_TC_POLICE_H +#define __NET_TC_POLICE_H + +#include + +struct tcf_police_params { + int tcfp_result; + u32 tcfp_ewma_rate; + s64 tcfp_burst; + u32 tcfp_mtu; + s64 tcfp_mtu_ptoks; + struct psched_ratecfg rate; + bool rate_present; + struct psched_ratecfg peak; + bool peak_present; + struct rcu_head rcu; +}; + +struct tcf_police { + struct tc_action common; + struct tcf_police_params __rcu *params; + + spinlock_t tcfp_lock ____cacheline_aligned_in_smp; + s64 tcfp_toks; + s64 tcfp_ptoks; + s64 tcfp_t_c; +}; + +#define to_police(pc) ((struct tcf_police *)pc) + +static inline bool is_tcf_police(const struct tc_action *a) +{ +#ifdef CONFIG_NET_CLS_ACT + if (a->ops && a->ops->id == TCA_ID_POLICE) + return true; +#endif + return false; +} + +#endif /* __NET_TC_POLICE_H */ diff --git a/net/sched/act_police.c b/net/sched/act_police.c index 2b8581f6ab51..5cb053f2c7b1 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c @@ -19,35 +19,10 @@ #include #include #include -#include +#include #include #include -struct tcf_police_params { - int tcfp_result; - u32 tcfp_ewma_rate; - s64 tcfp_burst; - u32 tcfp_mtu; - s64 tcfp_mtu_ptoks; - struct psched_ratecfg rate; - bool rate_present; - struct psched_ratecfg peak; - bool peak_present; - struct rcu_head rcu; -}; - -struct tcf_police { - struct tc_action common; - struct tcf_police_params __rcu *params; - - spinlock_t tcfp_lock ____cacheline_aligned_in_smp; - s64 tcfp_toks; - s64 tcfp_ptoks; - s64 tcfp_t_c; -}; - -#define to_police(pc) ((struct tcf_police *)pc) - /* old policer structure from before tc actions */ struct tc_police_compat { u32 index; -- 2.17.1