net/sched: act_police: add support for packet-per-second policing
authorBaowen Zheng <baowen.zheng@corigine.com>
Fri, 12 Mar 2021 14:08:31 +0000 (15:08 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 13 Mar 2021 22:18:09 +0000 (14:18 -0800)
commit2ffe0395288aa237ff7e0143366bd1cd57bfc5b7
treee6afb13e32102f6b667b8f69c9a9cf9a0f270755
parent6a56e19902af01da447cd3104d5a6e8d01792ee1
net/sched: act_police: add support for packet-per-second policing

Allow a policer action to enforce a rate-limit based on packets-per-second,
configurable using a packet-per-second rate and burst parameters.

e.g.
tc filter add dev tap1 parent ffff: u32 match \
        u32 0 0 police pkts_rate 3000 pkts_burst 1000

Testing was unable to uncover a performance impact of this change on
existing features.

Signed-off-by: Baowen Zheng <baowen.zheng@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/sch_generic.h
include/net/tc_act/tc_police.h
include/uapi/linux/pkt_cls.h
net/sched/act_police.c
net/sched/sch_generic.c