diff mbox series

[ovs-dev,v3,1/2] netdev-linux: correct unit of burst parameter

Message ID 20210409115215.9505-2-simon.horman@netronome.com
State Accepted
Headers show
Series netdev-linux: correct unit of burst parameter | expand

Commit Message

Simon Horman April 9, 2021, 11:52 a.m. UTC
From: Yong Xu <yong.xu@corigine.com>

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: e7f6ba220 ("lib/tc: add ingress ratelimiting support for tc-offload")
Signed-off-by: Yong Xu <yong.xu@corigine.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Louis Peens <louis.peens@netronome.com>
---
 lib/netdev-linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

0-day Robot April 9, 2021, 11:59 a.m. UTC | #1
Bleep bloop.  Greetings Simon Horman, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
WARNING: Unexpected sign-offs from developers who are not authors or co-authors or committers: Simon Horman <simon.horman@netronome.com>, Louis Peens <louis.peens@netronome.com>
Lines checked: 37, Warnings: 1, Errors: 0


Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot
Tonghao Zhang April 13, 2021, 1:04 p.m. UTC | #2
On Fri, Apr 9, 2021 at 7:52 PM Simon Horman <simon.horman@netronome.com> wrote:
>
> From: Yong Xu <yong.xu@corigine.com>
>
> 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: e7f6ba220 ("lib/tc: add ingress ratelimiting support for tc-offload")
> Signed-off-by: Yong Xu <yong.xu@corigine.com>
> Signed-off-by: Simon Horman <simon.horman@netronome.com>
> Signed-off-by: Louis Peens <louis.peens@netronome.com>
Reviewed-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Thanks!
> ---
>  lib/netdev-linux.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
> index 15b25084b..f87a20075 100644
> --- a/lib/netdev-linux.c
> +++ b/lib/netdev-linux.c
> @@ -2572,7 +2572,7 @@ exit:
>  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;
> --
> 2.20.1
>
Simon Horman April 13, 2021, 1:54 p.m. UTC | #3
On Tue, Apr 13, 2021 at 09:04:02PM +0800, Tonghao Zhang wrote:
> On Fri, Apr 9, 2021 at 7:52 PM Simon Horman <simon.horman@netronome.com> wrote:
> >
> > From: Yong Xu <yong.xu@corigine.com>
> >
> > 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: e7f6ba220 ("lib/tc: add ingress ratelimiting support for tc-offload")
> > Signed-off-by: Yong Xu <yong.xu@corigine.com>
> > Signed-off-by: Simon Horman <simon.horman@netronome.com>
> > Signed-off-by: Louis Peens <louis.peens@netronome.com>
> Reviewed-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>

Thanks, pushed to master.

I will also work on backporting this to branch 2.14, 2.13 and 2.12.
Simon Horman April 13, 2021, 5:16 p.m. UTC | #4
On Tue, Apr 13, 2021 at 03:54:16PM +0200, Simon Horman wrote:
> On Tue, Apr 13, 2021 at 09:04:02PM +0800, Tonghao Zhang wrote:
> > On Fri, Apr 9, 2021 at 7:52 PM Simon Horman <simon.horman@netronome.com> wrote:
> > >
> > > From: Yong Xu <yong.xu@corigine.com>
> > >
> > > 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: e7f6ba220 ("lib/tc: add ingress ratelimiting support for tc-offload")
> > > Signed-off-by: Yong Xu <yong.xu@corigine.com>
> > > Signed-off-by: Simon Horman <simon.horman@netronome.com>
> > > Signed-off-by: Louis Peens <louis.peens@netronome.com>
> > Reviewed-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> 
> Thanks, pushed to master.
> 
> I will also work on backporting this to branch 2.14, 2.13 and 2.12.

Backports to branches 2.12 - 2.15 also pushed.
diff mbox series

Patch

diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 15b25084b..f87a20075 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -2572,7 +2572,7 @@  exit:
 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;