]> git.baikalelectronics.ru Git - kernel.git/commitdiff
flow_offload: add support for packet-per-second policing
authorXingfeng Hu <xingfeng.hu@corigine.com>
Fri, 12 Mar 2021 14:08:29 +0000 (15:08 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 13 Mar 2021 22:18:09 +0000 (14:18 -0800)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/flow_offload.h
include/net/tc_act/tc_police.h
net/sched/cls_api.c

index e6bd8ebf9ac333c7d6cecc1809c6c4adef857d7f..fde025c57b4fc11e763318e8c848a655587cd250 100644 (file)
@@ -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 */
index 6d1e26b709b5a27d5b2571b8dfd9d9fd04304242..ae117f7937d5d52b4d99d8cf2300640dda8eecf8 100644 (file)
@@ -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);
index e37556cc37ab6d1ad6e163b2579aabf3f2ece446..ca8e177bf31b68cf4b032311e9089ac8af5ddb43 100644 (file)
@@ -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)) {