From: Helin Zhang <helin.zhang@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 3/5] i40e: support selecting hash functions
Date: Thu, 24 Jul 2014 14:42:27 +0800 [thread overview]
Message-ID: <1406184149-11531-4-git-send-email-helin.zhang@intel.com> (raw)
In-Reply-To: <1406184149-11531-1-git-send-email-helin.zhang@intel.com>
Toeplitz and simple XOR hash functions are supported by
hardware, code changes are to tell the hardware which hash
function is selected according to the configuration.
Signed-off-by: Helin Zhang <helin.zhang@intel.com>
---
config/common_bsdapp | 1 +
config/common_linuxapp | 1 +
lib/librte_pmd_i40e/i40e_ethdev.c | 30 ++++++++++++++++++++++++++++++
3 files changed, 32 insertions(+)
diff --git a/config/common_bsdapp b/config/common_bsdapp
index bf6d8a0..e73629e 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -187,6 +187,7 @@ CONFIG_RTE_LIBRTE_I40E_16BYTE_RX_DESC=n
CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_VF=4
# interval up to 8160 us, aligned to 2 (or default value)
CONFIG_RTE_LIBRTE_I40E_ITR_INTERVAL=-1
+CONFIG_RTE_LIBRTE_I40E_HASH_FUNC_TOEPLITZ=y
#
# Compile burst-oriented VIRTIO PMD driver
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 9047975..9e00513 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -210,6 +210,7 @@ CONFIG_RTE_LIBRTE_I40E_16BYTE_RX_DESC=n
CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_VF=4
# interval up to 8160 us, aligned to 2 (or default value)
CONFIG_RTE_LIBRTE_I40E_ITR_INTERVAL=-1
+CONFIG_RTE_LIBRTE_I40E_HASH_FUNC_TOEPLITZ=y
#
# Compile burst-oriented VIRTIO PMD driver
diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c
index 9ed31b5..cc04c70 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev.c
@@ -203,6 +203,7 @@ static int i40e_dev_rss_hash_update(struct rte_eth_dev *dev,
struct rte_eth_rss_conf *rss_conf);
static int i40e_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
struct rte_eth_rss_conf *rss_conf);
+static void i40e_select_hash_function(struct i40e_hw *hw);
/* Default hash key buffer for RSS */
static uint32_t rss_key_default[I40E_PFQF_HKEY_MAX_INDEX + 1];
@@ -384,6 +385,9 @@ eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv,
return ret;
}
+ /* Select hash functions */
+ i40e_select_hash_function(hw);
+
/* Initialize the shared code (base driver) */
ret = i40e_init_shared_code(hw);
if (ret) {
@@ -3956,3 +3960,29 @@ i40e_pf_config_mq_rx(struct i40e_pf *pf)
return 0;
}
+
+static void
+i40e_select_hash_function(struct i40e_hw *hw)
+{
+ uint32_t reg;
+
+ reg = I40E_READ_REG(hw, I40E_GLQF_CTL);
+#ifdef RTE_LIBRTE_I40E_HASH_FUNC_TOEPLITZ
+ if (reg & I40E_GLQF_CTL_HTOEP_MASK) {
+ PMD_DRV_LOG(DEBUG, "Hash function already set to Hoeplitz\n");
+ return;
+ }
+ reg |= I40E_GLQF_CTL_HTOEP_MASK;
+#else
+ if (!(reg & I40E_GLQF_CTL_HTOEP_MASK)) {
+ PMD_DRV_LOG(DEBUG, "Hash function already set to "
+ "Simple XOR\n");
+ return;
+ }
+ reg &= ~I40E_GLQF_CTL_HTOEP_MASK;
+#endif
+ PMD_DRV_LOG(INFO, "Hash function set to %s\n",
+ (reg & I40E_GLQF_CTL_HTOEP_MASK) ? "Toeplitz" : "XOR");
+ I40E_WRITE_REG(hw, I40E_GLQF_CTL, reg);
+ I40E_WRITE_FLUSH(hw);
+}
--
1.8.1.4
next prev parent reply other threads:[~2014-07-24 6:41 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-24 6:42 [dpdk-dev] [PATCH 0/5] Support configuring " Helin Zhang
2014-07-24 6:42 ` [dpdk-dev] [PATCH 1/5] ethdev: Rename macros of packet classification type Helin Zhang
2014-07-24 7:48 ` Thomas Monjalon
2014-07-24 8:14 ` Zhang, Helin
2014-07-24 8:19 ` Thomas Monjalon
2014-07-24 8:23 ` Zhang, Helin
2014-07-24 6:42 ` [dpdk-dev] [PATCH 2/5] ethdev: add new ops of 'check_command_supported' and 'rx_classification_filter_ctl' Helin Zhang
2014-07-24 7:56 ` Thomas Monjalon
2014-07-24 8:49 ` Zhang, Helin
2014-07-24 6:42 ` Helin Zhang [this message]
2014-07-24 7:59 ` [dpdk-dev] [PATCH 3/5] i40e: support selecting hash functions Thomas Monjalon
2014-07-24 8:01 ` Matthew Hall
2014-07-24 8:07 ` Thomas Monjalon
2014-07-24 8:14 ` Matthew Hall
2014-07-24 8:54 ` Zhang, Helin
2014-07-24 6:42 ` [dpdk-dev] [PATCH 4/5] i40e: support configuring symmetric hash function Helin Zhang
2014-07-24 6:42 ` [dpdk-dev] [PATCH 5/5] app/testpmd: new commands for configuring hash functions Helin Zhang
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=1406184149-11531-4-git-send-email-helin.zhang@intel.com \
--to=helin.zhang@intel.com \
--cc=dev@dpdk.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).