netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Duyck <alexander.h.duyck@intel.com>
To: netdev@vger.kernel.org
Subject: [RFC PATCH 3/3] igb: example of how to update igb to make use of in-kernel Toeplitz hashing
Date: Fri, 17 Dec 2010 17:00:48 -0800	[thread overview]
Message-ID: <20101218010048.28602.49776.stgit@gitlad.jf.intel.com> (raw)
In-Reply-To: <20101218004210.28602.18499.stgit@gitlad.jf.intel.com>

This change allows igb to make use of the in-kernel Toeplitz hashing so
that RX and TX hash queues can be matched up.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
---

 drivers/net/igb/igb_main.c |   22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 72a2fad..9e6a437 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -45,6 +45,7 @@
 #include <linux/interrupt.h>
 #include <linux/if_ether.h>
 #include <linux/aer.h>
+#include <linux/toeplitz.h>
 #ifdef CONFIG_IGB_DCA
 #include <linux/dca.h>
 #endif
@@ -1691,6 +1692,7 @@ static const struct net_device_ops igb_netdev_ops = {
 	.ndo_open		= igb_open,
 	.ndo_stop		= igb_close,
 	.ndo_start_xmit		= igb_xmit_frame_adv,
+	.ndo_select_queue	= toeplitz_select_queue,
 	.ndo_get_stats64	= igb_get_stats64,
 	.ndo_set_rx_mode	= igb_set_rx_mode,
 	.ndo_set_multicast_list	= igb_set_rx_mode,
@@ -2660,19 +2662,14 @@ static void igb_setup_mrqc(struct igb_adapter *adapter)
 		u32 dword;
 		u8  bytes[4];
 	} reta;
-	static const u8 rsshash[40] = {
-		0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2, 0x41, 0x67,
-		0x25, 0x3d, 0x43, 0xa3, 0x8f, 0xb0, 0xd0, 0xca, 0x2b, 0xcb,
-		0xae, 0x7b, 0x30, 0xb4,	0x77, 0xcb, 0x2d, 0xa3, 0x80, 0x30,
-		0xf2, 0x0c, 0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa };
 
 	/* Fill out hash function seeds */
 	for (j = 0; j < 10; j++) {
-		u32 rsskey = rsshash[(j * 4)];
-		rsskey |= rsshash[(j * 4) + 1] << 8;
-		rsskey |= rsshash[(j * 4) + 2] << 16;
-		rsskey |= rsshash[(j * 4) + 3] << 24;
-		array_wr32(E1000_RSSRK(0), j, rsskey);
+		u32 toeplitz_key = (u32)toeplitz_get_key_byte((4 * j));
+		toeplitz_key |= (u32)toeplitz_get_key_byte((4 * j) + 1) << 8;
+		toeplitz_key |= (u32)toeplitz_get_key_byte((4 * j) + 2) << 16;
+		toeplitz_key |= (u32)toeplitz_get_key_byte((4 * j) + 3) << 24;
+		array_wr32(E1000_RSSRK(0), j, toeplitz_key);
 	}
 
 	num_rx_queues = adapter->rss_queues;
@@ -2700,8 +2697,9 @@ static void igb_setup_mrqc(struct igb_adapter *adapter)
 			shift = 6;
 	}
 
-	for (j = 0; j < (32 * 4); j++) {
-		reta.bytes[j & 3] = (j % num_rx_queues) << shift;
+	for (j = 0; j < 128; j++) {
+		u32 entry = ((j * num_rx_queues) & 0xFF80) >> 7;
+		reta.bytes[j & 3] = entry << shift;
 		if (shift2)
 			reta.bytes[j & 3] |= num_rx_queues << shift2;
 		if ((j & 3) == 3)


  parent reply	other threads:[~2010-12-18  1:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-18  1:00 [RFC PATCH 0/3] Simplified 16 bit Toeplitz hash algorithm Alexander Duyck
2010-12-18  1:00 ` [RFC PATCH 1/3] net: add simplified 16 bit Toeplitz hash function for transmit side hashing Alexander Duyck
2010-12-18  1:00 ` [RFC PATCH 2/3] ixgbe: example of how to update ixgbe to make use of in-kernel Toeplitz hash Alexander Duyck
2010-12-18  1:00 ` Alexander Duyck [this message]
2010-12-18  5:09   ` [RFC PATCH 3/3] igb: example of how to update igb to make use of in-kernel Toeplitz hashing David Miller
2010-12-18  6:53     ` Alexander Duyck
2010-12-18  6:59       ` David Miller
2011-01-03 18:47 ` [RFC PATCH 0/3] Simplified 16 bit Toeplitz hash algorithm Tom Herbert
2011-01-03 19:00   ` Alexander Duyck
2011-01-03 19:02   ` David Miller
2011-01-03 19:30     ` Ben Hutchings
2011-01-03 19:52       ` Alexander Duyck
2011-01-03 19:54         ` David Miller
2011-01-03 20:15         ` Ben Hutchings
2011-01-03 21:45           ` Alexander Duyck
2011-01-04  3:25           ` Tom Herbert
2011-01-04 15:43             ` Ben Hutchings

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=20101218010048.28602.49776.stgit@gitlad.jf.intel.com \
    --to=alexander.h.duyck@intel.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;
as well as URLs for NNTP newsgroup(s).