Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

flow_offload: add support for packet-per-second policing

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>

authored by

Xingfeng Hu and committed by
David S. Miller
25660156 4849d9be

+17
+2
include/net/flow_offload.h
··· 234 234 u32 index; 235 235 u32 burst; 236 236 u64 rate_bytes_ps; 237 + u64 burst_pkt; 238 + u64 rate_pkt_ps; 237 239 u32 mtu; 238 240 } police; 239 241 struct { /* FLOW_ACTION_CT */
+12
include/net/tc_act/tc_police.h
··· 97 97 return burst; 98 98 } 99 99 100 + static inline u64 tcf_police_rate_pkt_ps(const struct tc_action *act) 101 + { 102 + /* Not implemented */ 103 + return 0; 104 + } 105 + 106 + static inline u32 tcf_police_burst_pkt(const struct tc_action *act) 107 + { 108 + /* Not implemented */ 109 + return 0; 110 + } 111 + 100 112 static inline u32 tcf_police_tcfp_mtu(const struct tc_action *act) 101 113 { 102 114 struct tcf_police *police = to_police(act);
+3
net/sched/cls_api.c
··· 3661 3661 entry->police.burst = tcf_police_burst(act); 3662 3662 entry->police.rate_bytes_ps = 3663 3663 tcf_police_rate_bytes_ps(act); 3664 + entry->police.burst_pkt = tcf_police_burst_pkt(act); 3665 + entry->police.rate_pkt_ps = 3666 + tcf_police_rate_pkt_ps(act); 3664 3667 entry->police.mtu = tcf_police_tcfp_mtu(act); 3665 3668 entry->police.index = act->tcfa_index; 3666 3669 } else if (is_tcf_ct(act)) {