summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2011-07-20 10:20:54 +0000
committerDavid S. Miller <davem@davemloft.net>2011-07-21 12:36:15 -0700
commit9d53fa129628d4899083b06fa66b7ca10fed8eb4 (patch)
treecfe2b0fec3f5d72fa73eec6689c9ff406b4a5b32
parent5baa5e9aa28baccd2a1227095c25bb3e999f250d (diff)
downloadlinux-9d53fa129628d4899083b06fa66b7ca10fed8eb4.tar.gz
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 <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/tg3.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 5110ea0be910..e5c1bc919b4d 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -8723,15 +8723,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;
 			}