From c4beb771d8e9bebc836054d513dc65c5abbe9730 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Fri, 6 Aug 2010 14:38:03 +0100 Subject: ethtool: Fix handling of zero weights for flow hash indirection 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 Signed-off-by: Jeff Garzik --- ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ethtool.c') diff --git a/ethtool.c b/ethtool.c index 16efb42..6b2b7c8 100644 --- a/ethtool.c +++ b/ethtool.c @@ -2899,7 +2899,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; -- cgit v1.2.1