mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
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>
This commit is contained in:
parent
6a56e19902
commit
2ffe039528
5 changed files with 162 additions and 36 deletions
|
@ -1242,6 +1242,20 @@ static inline void psched_ratecfg_getrate(struct tc_ratespec *res,
|
|||
res->linklayer = (r->linklayer & TC_LINKLAYER_MASK);
|
||||
}
|
||||
|
||||
struct psched_pktrate {
|
||||
u64 rate_pkts_ps; /* packets per second */
|
||||
u32 mult;
|
||||
u8 shift;
|
||||
};
|
||||
|
||||
static inline u64 psched_pkt2t_ns(const struct psched_pktrate *r,
|
||||
unsigned int pkt_num)
|
||||
{
|
||||
return ((u64)pkt_num * r->mult) >> r->shift;
|
||||
}
|
||||
|
||||
void psched_ppscfg_precompute(struct psched_pktrate *r, u64 pktrate64);
|
||||
|
||||
/* Mini Qdisc serves for specific needs of ingress/clsact Qdisc.
|
||||
* The fast path only needs to access filter list and to update stats
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue