From: Matt Carlson Date: Wed, 20 Jul 2011 10:20:54 +0000 (+0000) Subject: tg3: Fix RSS indirection table distribution X-Git-Tag: v2.6.39-400.9.0~423^2~19^2~11^2~700 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=afe84b699be94d98d2fae3a59d65665457be8d36;p=users%2Fjedix%2Flinux-maple.git tg3: Fix RSS indirection table distribution The current RSS indirection table is populated such that more traffic will hit the first RSS ring. This patch adjusts the indirection table so that the load is more evenly distributed. Signed-off-by: Matt Carlson Reviewed-by: Michael Chan Signed-off-by: David S. Miller (cherry picked from commit 9d53fa129628d4899083b06fa66b7ca10fed8eb4) Signed-off-by: Joe Jin --- diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 64d8711b53e3..10d5c5ef3224 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -8721,15 +8721,24 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) udelay(100); if (tg3_flag(tp, ENABLE_RSS)) { + int i = 0; u32 reg = MAC_RSS_INDIR_TBL_0; - u8 *ent = (u8 *)&val; - /* Setup the indirection table */ - for (i = 0; i < TG3_RSS_INDIR_TBL_SIZE; i++) { - int idx = i % sizeof(val); + if (tp->irq_cnt == 2) { + for (i = 0; i < TG3_RSS_INDIR_TBL_SIZE; i += 8) { + tw32(reg, 0x0); + reg += 4; + } + } else { + u32 val; - ent[idx] = i % (tp->irq_cnt - 1); - if (idx == sizeof(val) - 1) { + while (i < TG3_RSS_INDIR_TBL_SIZE) { + val = i % (tp->irq_cnt - 1); + i++; + for (; i % 8; i++) { + val <<= 4; + val |= (i % (tp->irq_cnt - 1)); + } tw32(reg, val); reg += 4; }