Netdev List
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: netdev@vger.kernel.org, linux-net-drivers@solarflare.com
Subject: [PATCH ethtool] ethtool: Fix handling of zero weights for flow hash indirection
Date: Fri, 06 Aug 2010 14:38:03 +0100	[thread overview]
Message-ID: <1281101883.2088.5.camel@achroite.uk.solarflarecom.com> (raw)

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 --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;
-- 
1.6.2.5

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


                 reply	other threads:[~2010-08-06 13:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1281101883.2088.5.camel@achroite.uk.solarflarecom.com \
    --to=bhutchings@solarflare.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-net-drivers@solarflare.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox