2020-04-25 03:44:56

by Tonghao Zhang

[permalink] [raw]
Subject: [PATCH 2/2] net: openvswitch: use div_u64() for 64-by-32 divisions

From: Tonghao Zhang <[email protected]>

Compile the kernel for arm 32 platform, the build warning found.
To fix that, should use div_u64() for divisions.
| net/openvswitch/meter.c:396: undefined reference to `__udivdi3'

[add more commit msg, change reported tag, and use div_u64 instead
of do_div by Tonghao]

Fixes: e57358873bb5d6ca ("net: openvswitch: use u64 for meter bucket")
Reported-by: kbuild test robot <[email protected]>
Signed-off-by: Tonghao Zhang <[email protected]>
Tested-by: Tonghao Zhang <[email protected]>
---
The author should be:
Geert Uytterhoeven <[email protected]>
---
net/openvswitch/meter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/openvswitch/meter.c b/net/openvswitch/meter.c
index 612ad5586ce9..3d3d8e094546 100644
--- a/net/openvswitch/meter.c
+++ b/net/openvswitch/meter.c
@@ -393,7 +393,7 @@ static struct dp_meter *dp_meter_create(struct nlattr **a)
* Start with a full bucket.
*/
band->bucket = (band->burst_size + band->rate) * 1000ULL;
- band_max_delta_t = band->bucket / band->rate;
+ band_max_delta_t = div_u64(band->bucket, band->rate);
if (band_max_delta_t > meter->max_delta_t)
meter->max_delta_t = band_max_delta_t;
band++;
--
2.23.0


2020-04-26 03:52:29

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 2/2] net: openvswitch: use div_u64() for 64-by-32 divisions

From: [email protected]
Date: Sat, 25 Apr 2020 11:39:48 +0800

> From: Tonghao Zhang <[email protected]>
>
> Compile the kernel for arm 32 platform, the build warning found.
> To fix that, should use div_u64() for divisions.
> | net/openvswitch/meter.c:396: undefined reference to `__udivdi3'
>
> [add more commit msg, change reported tag, and use div_u64 instead
> of do_div by Tonghao]
>
> Fixes: e57358873bb5d6ca ("net: openvswitch: use u64 for meter bucket")
> Reported-by: kbuild test robot <[email protected]>
> Signed-off-by: Tonghao Zhang <[email protected]>
> Tested-by: Tonghao Zhang <[email protected]>

Applied.