lkml.org 
[lkml]   [2020]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] net: openvswitch: use do_div() for 64-by-32 divisions:
From
Date


On 4/24/20 5:10 AM, Geert Uytterhoeven wrote:
> On 32-bit architectures (e.g. m68k):
>
> ERROR: modpost: "__udivdi3" [net/openvswitch/openvswitch.ko] undefined!
> ERROR: modpost: "__divdi3" [net/openvswitch/openvswitch.ko] undefined!
>
> Fixes: e57358873bb5d6ca ("net: openvswitch: use u64 for meter bucket")
> Reported-by: noreply@ellerman.id.au
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
> 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 915f31123f235c03..3498a5ab092ab2b8 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 = do_div(band->bucket, band->rate);
> if (band_max_delta_t > meter->max_delta_t)
> meter->max_delta_t = band_max_delta_t;
> band++;
>

This is fascinating... Have you tested this patch ?

Please double check what do_div() return value is supposed to be !

Thanks.

\
 
 \ /
  Last update: 2020-04-24 17:07    [W:0.067 / U:0.372 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site