From: Alexander Duyck <alexander.h.duyck@intel.com>
To: netdev@vger.kernel.org
Subject: [RFC PATCH 2/3] ixgbe: example of how to update ixgbe to make use of in-kernel Toeplitz hash
Date: Fri, 17 Dec 2010 17:00:43 -0800 [thread overview]
Message-ID: <20101218010043.28602.43172.stgit@gitlad.jf.intel.com> (raw)
In-Reply-To: <20101218004210.28602.18499.stgit@gitlad.jf.intel.com>
This change allows ixgbe 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/ixgbe/ixgbe_main.c | 47 ++++++++++++++++++++++------------------
1 files changed, 26 insertions(+), 21 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index a060610..0d0fcde 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -42,6 +42,7 @@
#include <linux/ethtool.h>
#include <linux/if_vlan.h>
#include <scsi/fc/fc_fcoe.h>
+#include <linux/toeplitz.h>
#include "ixgbe.h"
#include "ixgbe_common.h"
@@ -2847,27 +2848,31 @@ static void ixgbe_configure_srrctl(struct ixgbe_adapter *adapter,
static void ixgbe_setup_mrqc(struct ixgbe_adapter *adapter)
{
struct ixgbe_hw *hw = &adapter->hw;
- static const u32 seed[10] = { 0xE291D73D, 0x1805EC6C, 0x2A94B30D,
- 0xA54F2BEC, 0xEA49AF7C, 0xE214AD3D, 0xB855AABE,
- 0x6A3E67EA, 0x14364D17, 0x3BED200D};
- u32 mrqc = 0, reta = 0;
+ u32 mrqc = 0;
u32 rxcsum;
- int i, j;
+ int i, j, indices;
int mask;
/* Fill out hash function seeds */
- for (i = 0; i < 10; i++)
- IXGBE_WRITE_REG(hw, IXGBE_RSSRK(i), seed[i]);
+ for (i = 0; i < 10; i++) {
+ u32 toeplitz_key = (u32)toeplitz_get_key_byte((4 * i));
+ toeplitz_key |= (u32)toeplitz_get_key_byte((4 * i) + 1) << 8;
+ toeplitz_key |= (u32)toeplitz_get_key_byte((4 * i) + 2) << 16;
+ toeplitz_key |= (u32)toeplitz_get_key_byte((4 * i) + 3) << 24;
+ IXGBE_WRITE_REG(hw, IXGBE_RSSRK(i), toeplitz_key);
+ }
/* Fill out redirection table */
- for (i = 0, j = 0; i < 128; i++, j++) {
- if (j == adapter->ring_feature[RING_F_RSS].indices)
- j = 0;
+ indices = adapter->ring_feature[RING_F_RSS].indices;
+ for (i = 0; i < 32; i++) {
+ u32 reta = 0;
/* reta = 4-byte sliding window of
* 0x00..(indices-1)(indices-1)00..etc. */
- reta = (reta << 8) | (j * 0x11);
- if ((i & 3) == 3)
- IXGBE_WRITE_REG(hw, IXGBE_RETA(i >> 2), reta);
+ for (j = 0; j < 4; j++) {
+ u32 entry = (indices * ((i * 4) + j)) >> 7;
+ reta |= entry << (8 * j);
+ }
+ IXGBE_WRITE_REG(hw, IXGBE_RETA(i), reta);
}
/* Disable indicating checksum in descriptor, enables RSS hash */
@@ -6643,14 +6648,8 @@ static u16 ixgbe_select_queue(struct net_device *dev, struct sk_buff *skb)
#endif
}
}
-#endif
-
- if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) {
- while (unlikely(txq >= dev->real_num_tx_queues))
- txq -= dev->real_num_tx_queues;
- return txq;
- }
+#endif
if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
if (skb->priority == TC_PRIO_CONTROL)
txq = adapter->ring_feature[RING_F_DCB].indices-1;
@@ -6660,7 +6659,13 @@ static u16 ixgbe_select_queue(struct net_device *dev, struct sk_buff *skb)
return txq;
}
- return skb_tx_hash(dev, skb);
+ if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) {
+ while (unlikely(txq >= dev->real_num_tx_queues))
+ txq -= dev->real_num_tx_queues;
+ return txq;
+ }
+
+ return toeplitz_select_queue(dev, skb);
}
netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb,
next prev parent reply other threads:[~2010-12-18 1:01 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 ` Alexander Duyck [this message]
2010-12-18 1:00 ` [RFC PATCH 3/3] igb: example of how to update igb to make use of in-kernel Toeplitz hashing Alexander Duyck
2010-12-18 5:09 ` 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=20101218010043.28602.43172.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).