diff mbox

[ethtool] ethtool: Fix handling of zero weights for flow hash indirection

Message ID 1281101883.2088.5.camel@achroite.uk.solarflarecom.com
State Not Applicable, archived
Delegated to: David Miller
Headers show

Commit Message

Ben Hutchings Aug. 6, 2010, 1:38 p.m. UTC
The loop to generate an indirection table from a list of weights never
advances by more than one weight at a time.  Thus, if there is a 0
in the list (except at the end) the corresponding RX ring will be
assigned 1 hash bucket rather than 0.  Change 'if' to 'while'.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
Please include this in 2.6.35 if you haven't finalised it yet.

Ben.

 ethtool.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff mbox

Patch

diff --git a/ethtool.c b/ethtool.c
index 0f7dec6..66b5c07 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -2977,7 +2977,7 @@  static int do_srxfhindir(int fd, struct ifreq *ifr)
 
 		j = -1;
 		for (i = 0; i < indir->size; i++) {
-			if (i >= indir->size * partial / sum) {
+			while (i >= indir->size * partial / sum) {
 				j += 1;
 				weight = get_u32(rxfhindir_weight[j], 0);
 				partial += weight;