From: Simon Horman <simon.horman@netronome.com>
To: David Miller <davem@davemloft.net>, Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, oss-drivers@netronome.com,
Xingfeng Hu <xingfeng.hu@corigine.com>,
Baowen Zheng <baowen.zheng@corigine.com>,
Louis Peens <louis.peens@netronome.com>,
Simon Horman <simon.horman@netronome.com>
Subject: [PATCH v3 net-next 1/3] flow_offload: add support for packet-per-second policing
Date: Fri, 12 Mar 2021 15:08:29 +0100 [thread overview]
Message-ID: <20210312140831.23346-2-simon.horman@netronome.com> (raw)
In-Reply-To: <20210312140831.23346-1-simon.horman@netronome.com>
From: Xingfeng Hu <xingfeng.hu@corigine.com>
Allow flow_offload API to configure packet-per-second policing using rate
and burst parameters.
Dummy implementations of tcf_police_rate_pkt_ps() and
tcf_police_burst_pkt() are supplied which return 0, the unconfigured state.
This is to facilitate splitting the offload, driver, and TC code portion of
this feature into separate patches with the aim of providing a logical flow
for review. And the implementation of these helpers will be filled out by a
follow-up patch.
Signed-off-by: Xingfeng Hu <xingfeng.hu@corigine.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Louis Peens <louis.peens@netronome.com>
---
include/net/flow_offload.h | 2 ++
include/net/tc_act/tc_police.h | 12 ++++++++++++
net/sched/cls_api.c | 3 +++
3 files changed, 17 insertions(+)
diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h
index e6bd8ebf9ac3..fde025c57b4f 100644
--- a/include/net/flow_offload.h
+++ b/include/net/flow_offload.h
@@ -234,6 +234,8 @@ struct flow_action_entry {
u32 index;
u32 burst;
u64 rate_bytes_ps;
+ u64 burst_pkt;
+ u64 rate_pkt_ps;
u32 mtu;
} police;
struct { /* FLOW_ACTION_CT */
diff --git a/include/net/tc_act/tc_police.h b/include/net/tc_act/tc_police.h
index 6d1e26b709b5..ae117f7937d5 100644
--- a/include/net/tc_act/tc_police.h
+++ b/include/net/tc_act/tc_police.h
@@ -97,6 +97,18 @@ static inline u32 tcf_police_burst(const struct tc_action *act)
return burst;
}
+static inline u64 tcf_police_rate_pkt_ps(const struct tc_action *act)
+{
+ /* Not implemented */
+ return 0;
+}
+
+static inline u32 tcf_police_burst_pkt(const struct tc_action *act)
+{
+ /* Not implemented */
+ return 0;
+}
+
static inline u32 tcf_police_tcfp_mtu(const struct tc_action *act)
{
struct tcf_police *police = to_police(act);
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index e37556cc37ab..ca8e177bf31b 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -3661,6 +3661,9 @@ int tc_setup_flow_action(struct flow_action *flow_action,
entry->police.burst = tcf_police_burst(act);
entry->police.rate_bytes_ps =
tcf_police_rate_bytes_ps(act);
+ entry->police.burst_pkt = tcf_police_burst_pkt(act);
+ entry->police.rate_pkt_ps =
+ tcf_police_rate_pkt_ps(act);
entry->police.mtu = tcf_police_tcfp_mtu(act);
entry->police.index = act->tcfa_index;
} else if (is_tcf_ct(act)) {
--
2.20.1
next prev parent reply other threads:[~2021-03-12 14:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-12 14:08 [PATCH v3 net-next 0/3] net/sched: act_police: add support for packet-per-second policing Simon Horman
2021-03-12 14:08 ` Simon Horman [this message]
2021-03-12 14:08 ` [PATCH v3 net-next 2/3] flow_offload: reject configuration of packet-per-second policing in offload drivers Simon Horman
2021-03-12 14:08 ` [PATCH v3 net-next 3/3] net/sched: act_police: add support for packet-per-second policing Simon Horman
2021-03-12 14:22 ` [PATCH v3 net-next 0/3] " Simon Horman
2021-03-16 13:53 ` Jamal Hadi Salim
2021-03-16 16:40 ` Simon Horman
2021-03-13 22:40 ` patchwork-bot+netdevbpf
2021-03-14 8:17 ` Ido Schimmel
2021-03-15 14:41 ` Simon Horman
2021-03-16 8:35 ` Ido Schimmel
2021-03-16 10:42 ` Simon Horman
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=20210312140831.23346-2-simon.horman@netronome.com \
--to=simon.horman@netronome.com \
--cc=baowen.zheng@corigine.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=louis.peens@netronome.com \
--cc=netdev@vger.kernel.org \
--cc=oss-drivers@netronome.com \
--cc=xingfeng.hu@corigine.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).