Skip to content

Commit

Permalink
netdev-linux: correct unit of burst parameter
Browse files Browse the repository at this point in the history
Correct calculation of burst parameter used when configuring TC policer
action for ingress port-based policing in the case where TC offload is in
use. This now matches the value calculated for the case where TC offload is
not in use.

The division by 8 is to convert from bits to bytes.
Its unclear why 64 was previously used.

Fixes: e7f6ba2 ("lib/tc: add ingress ratelimiting support for tc-offload")
Signed-off-by: Yong.Xu <yong.xu@corigine.com>
[simon: reworked changelog]
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Louis Peens <louis.peens@netronome.com>
Signed-off-by: 0-day Robot <robot@bytheb.org>
  • Loading branch information
bear110 authored and ovsrobot committed Mar 12, 2021
1 parent cdaa7e0 commit d115307
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/netdev-linux.c
Expand Up @@ -2572,7 +2572,7 @@ netdev_linux_set_advertisements(struct netdev *netdev_,
static struct tc_police
tc_matchall_fill_police(uint32_t kbits_rate, uint32_t kbits_burst)
{
unsigned int bsize = MIN(UINT32_MAX / 1024, kbits_burst) * 1024 / 64;
unsigned int bsize = MIN(UINT32_MAX / 1024, kbits_burst) * 1024 / 8;
unsigned int bps = ((uint64_t) kbits_rate * 1000) / 8;
struct tc_police police;
struct tc_ratespec rate;
Expand Down

0 comments on commit d115307

Please sign in to comment.