netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] Fixes: 0e884c7 ipv4: L3 hash-based multipath: tag
@ 2015-10-05 22:14 Peter Nørlund
  2015-10-05 22:23 ` Alexander Duyck
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Nørlund @ 2015-10-05 22:14 UTC (permalink / raw)
  To: netdev
  Cc: David S. Miller, Alexey Kuznetsov, James Morris,
	Hideaki YOSHIFUJI, Patrick McHardy, Peter Noerlund

commit 0e884c78ee19e902f300ed147083c28a0c6302f0 ("ipv4: L3 hash-based
multipath") broke compilation for i386 and arm due to dependency on
64-bit division.

The problem is simply solved by using the proper macro for 64-bit
divison.

Signed-off-by: Peter Nørlund <pch@ordbogen.com>
---
 net/ipv4/fib_semantics.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 0c49d2f..52254e8 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -569,8 +569,8 @@ static void fib_rebalance(struct fib_info *fi)
 			upper_bound = -1;
 		} else {
 			w += nexthop_nh->nh_weight;
-			upper_bound = DIV_ROUND_CLOSEST(2147483648LL * w,
-							total) - 1;
+			upper_bound = DIV_ROUND_CLOSEST_ULL(2147483648ULL * w,
+							    total) - 1;
 		}
 
 		atomic_set(&nexthop_nh->nh_upper_bound, upper_bound);
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] Fixes: 0e884c7 ipv4: L3 hash-based multipath: tag
  2015-10-05 22:14 [PATCH net-next] Fixes: 0e884c7 ipv4: L3 hash-based multipath: tag Peter Nørlund
@ 2015-10-05 22:23 ` Alexander Duyck
  2015-10-05 23:35   ` Tom Herbert
  2015-10-06  5:21   ` Peter Nørlund
  0 siblings, 2 replies; 4+ messages in thread
From: Alexander Duyck @ 2015-10-05 22:23 UTC (permalink / raw)
  To: Peter Nørlund, netdev
  Cc: David S. Miller, Alexey Kuznetsov, James Morris,
	Hideaki YOSHIFUJI, Patrick McHardy

On 10/05/2015 03:14 PM, Peter Nørlund wrote:
> commit 0e884c78ee19e902f300ed147083c28a0c6302f0 ("ipv4: L3 hash-based
> multipath") broke compilation for i386 and arm due to dependency on
> 64-bit division.
>
> The problem is simply solved by using the proper macro for 64-bit
> divison.
>
> Signed-off-by: Peter Nørlund <pch@ordbogen.com>
> ---
>   net/ipv4/fib_semantics.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
> index 0c49d2f..52254e8 100644
> --- a/net/ipv4/fib_semantics.c
> +++ b/net/ipv4/fib_semantics.c
> @@ -569,8 +569,8 @@ static void fib_rebalance(struct fib_info *fi)
>   			upper_bound = -1;
>   		} else {
>   			w += nexthop_nh->nh_weight;
> -			upper_bound = DIV_ROUND_CLOSEST(2147483648LL * w,
> -							total) - 1;
> +			upper_bound = DIV_ROUND_CLOSEST_ULL(2147483648ULL * w,
> +							    total) - 1;
>   		}
>   
>   		atomic_set(&nexthop_nh->nh_upper_bound, upper_bound);

Normally the correct comment would include something like the following 
just before the signed-off-by line.
     Fixes: 0e884c78ee19 ("ipv4: L3 hash-based multipath")

I'm also kind of curious.  Why use 2147483648LL instead of just casting 
w as a u64 and shifting by 31?  It seems like that would be more readable.

Thanks.

- Alex

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] Fixes: 0e884c7 ipv4: L3 hash-based multipath: tag
  2015-10-05 22:23 ` Alexander Duyck
@ 2015-10-05 23:35   ` Tom Herbert
  2015-10-06  5:21   ` Peter Nørlund
  1 sibling, 0 replies; 4+ messages in thread
From: Tom Herbert @ 2015-10-05 23:35 UTC (permalink / raw)
  To: Alexander Duyck
  Cc: Peter Nørlund, Linux Kernel Network Developers,
	David S. Miller, Alexey Kuznetsov, James Morris,
	Hideaki YOSHIFUJI, Patrick McHardy

On Mon, Oct 5, 2015 at 3:23 PM, Alexander Duyck
<alexander.duyck@gmail.com> wrote:
> On 10/05/2015 03:14 PM, Peter Nørlund wrote:
>>
>> commit 0e884c78ee19e902f300ed147083c28a0c6302f0 ("ipv4: L3 hash-based
>> multipath") broke compilation for i386 and arm due to dependency on
>> 64-bit division.
>>
>> The problem is simply solved by using the proper macro for 64-bit
>> divison.
>>
>> Signed-off-by: Peter Nørlund <pch@ordbogen.com>
>> ---
>>   net/ipv4/fib_semantics.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
>> index 0c49d2f..52254e8 100644
>> --- a/net/ipv4/fib_semantics.c
>> +++ b/net/ipv4/fib_semantics.c
>> @@ -569,8 +569,8 @@ static void fib_rebalance(struct fib_info *fi)
>>                         upper_bound = -1;
>>                 } else {
>>                         w += nexthop_nh->nh_weight;
>> -                       upper_bound = DIV_ROUND_CLOSEST(2147483648LL * w,
>> -                                                       total) - 1;
>> +                       upper_bound = DIV_ROUND_CLOSEST_ULL(2147483648ULL
>> * w,
>> +                                                           total) - 1;
>>                 }
>>                 atomic_set(&nexthop_nh->nh_upper_bound, upper_bound);
>
>
> Normally the correct comment would include something like the following just
> before the signed-off-by line.
>     Fixes: 0e884c78ee19 ("ipv4: L3 hash-based multipath")
>
> I'm also kind of curious.  Why use 2147483648LL instead of just casting w as
> a u64 and shifting by 31?  It seems like that would be more readable.
>
+1, manifest constant is not good for readability here.

Tom

> Thanks.
>
> - Alex
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] Fixes: 0e884c7 ipv4: L3 hash-based multipath: tag
  2015-10-05 22:23 ` Alexander Duyck
  2015-10-05 23:35   ` Tom Herbert
@ 2015-10-06  5:21   ` Peter Nørlund
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Nørlund @ 2015-10-06  5:21 UTC (permalink / raw)
  To: Alexander Duyck
  Cc: netdev, David S. Miller, Alexey Kuznetsov, James Morris,
	Hideaki YOSHIFUJI, Patrick McHardy

On Mon, 5 Oct 2015 15:23:10 -0700
Alexander Duyck <alexander.duyck@gmail.com> wrote:

> Normally the correct comment would include something like the
> following just before the signed-off-by line.
>      Fixes: 0e884c78ee19 ("ipv4: L3 hash-based multipath")
> 

Got it - I misunderstood the format. I'll submit a revised patch in just
a sec.

> I'm also kind of curious.  Why use 2147483648LL instead of just
> casting w as a u64 and shifting by 31?  It seems like that would be
> more readable.

I thought about it it creating the fix patch, but thought I'd better
keep the changes small. I'll use shift in the revised patch.

Best Regards
 Peter Nørlund

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-10-06  5:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-05 22:14 [PATCH net-next] Fixes: 0e884c7 ipv4: L3 hash-based multipath: tag Peter Nørlund
2015-10-05 22:23 ` Alexander Duyck
2015-10-05 23:35   ` Tom Herbert
2015-10-06  5:21   ` Peter Nørlund

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).