From: Joergen Andreasen <joergen.andreasen@microchip.com>
To: <netdev@vger.kernel.org>
Cc: Joergen Andreasen <joergen.andreasen@microchip.com>,
Jamal Hadi Salim <jhs@mojatatu.com>,
Cong Wang <xiyou.wangcong@gmail.com>,
Jiri Pirko <jiri@resnulli.us>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>,
"David S. Miller" <davem@davemloft.net>,
Ralf Baechle <ralf@linux-mips.org>,
"Paul Burton" <paul.burton@mips.com>,
James Hogan <jhogan@kernel.org>, <linux-mips@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
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 [thread overview]
Message-ID: <20190502094029.22526-2-joergen.andreasen@microchip.com> (raw)
In-Reply-To: <20190502094029.22526-1-joergen.andreasen@microchip.com>
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 <joergen.andreasen@microchip.com>
---
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 <net/act_api.h>
+
+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 <linux/rtnetlink.h>
#include <linux/init.h>
#include <linux/slab.h>
-#include <net/act_api.h>
+#include <net/tc_act/tc_police.h>
#include <net/netlink.h>
#include <net/pkt_cls.h>
-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
next prev parent reply other threads:[~2019-05-02 9:41 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-02 9:40 [PATCH net-next 0/3] Add hw offload of TC police on MSCC ocelot Joergen Andreasen
2019-05-02 9:40 ` Joergen Andreasen [this message]
2019-05-02 20:38 ` [PATCH net-next 1/3] net/sched: act_police: move police parameters into separate header file Jiri Pirko
2019-05-02 9:40 ` [PATCH net-next 2/3] net: mscc: ocelot: Implement port policers via tc command Joergen Andreasen
2019-05-02 12:32 ` Andrew Lunn
2019-05-03 11:23 ` Joergen Andreasen
2019-05-02 20:36 ` Jiri Pirko
2019-05-03 11:38 ` Joergen Andreasen
2019-05-04 13:07 ` Jiri Pirko
2019-05-07 8:30 ` Joergen Andreasen
2019-05-02 9:40 ` [PATCH net-next 3/3] MIPS: generic: Add police related options to ocelot_defconfig Joergen Andreasen
2019-05-02 16:27 ` Alexandre Belloni
2019-05-03 10:47 ` Joergen Andreasen
2019-05-23 10:49 ` [PATCH net-next v2 0/1] Add hw offload of TC police on MSCC ocelot Joergen Andreasen
2019-05-23 10:49 ` [PATCH net-next v2 1/1] net: mscc: ocelot: Implement port policers via tc command Joergen Andreasen
2019-05-23 18:56 ` Jakub Kicinski
2019-05-24 11:40 ` Joergen Andreasen
2019-05-28 12:49 ` [PATCH net-next v3 0/1] Add hw offload of TC police on MSCC ocelot Joergen Andreasen
2019-05-28 12:49 ` [PATCH net-next v3 1/1] net: mscc: ocelot: Implement port policers via tc command Joergen Andreasen
2019-05-30 4:38 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190502094029.22526-2-joergen.andreasen@microchip.com \
--to=joergen.andreasen@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=davem@davemloft.net \
--cc=jhogan@kernel.org \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=paul.burton@mips.com \
--cc=ralf@linux-mips.org \
--cc=xiyou.wangcong@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).