Skip to contentSkip to conversation

Fixes: 0e884c7 ipv4: L3 hash-based multipath: tag

PATCH In review Peter Nørlund 3 participants 4 messages Oct 5, 2015 – Oct 6, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fixes: 0e884c7 ipv4: L3 hash-based multipath: tag

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.

---
 net/ipv4/fib_semantics.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv4/fib_semantics.c +2 -2
index 0c49d2f..52254e8 100644
@@ -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);
Signature · 1 line
2.1.4
#1 lore raw
Quoted 17 lines · Peter Nørlund

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.

---
  net/ipv4/fib_semantics.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv4/fib_semantics.c +0 -0
index 0c49d2f..52254e8 100644

net/ipv4/fib_semantics.c static void fib_rebalance(struct fib_info *fi) · line 576

Quoted 10 lines
net/ipv4/fib_semantics.c +2 -2
@@ -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

#2 lore raw
Quoted 33 lines · Alexander Duyck
Quoted 18 lines · Peter Nørlund

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.

---
  net/ipv4/fib_semantics.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv4/fib_semantics.c +0 -0
index 0c49d2f..52254e8 100644

net/ipv4/fib_semantics.c static void fib_rebalance(struct fib_info *fi) · line 576

Quoted 10 lines
net/ipv4/fib_semantics.c +2 -2
@@ -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.

Quoted 5 lines
    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

Quoted 8 lines

Thanks.

- Alex

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
In reply to Alexander Duyck
Quoted 4 lines · On Mon, 5 Oct 2015 15:23:10 -0700 Alexander Duyck <[email protected]>…

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.

Quoted 3 lines

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