From: Helin Zhang <helin.zhang@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2 5/6] i40e: Initialize hash function during port initialization.
Date: Mon, 28 Jul 2014 16:25:54 +0800 [thread overview]
Message-ID: <1406535955-31070-6-git-send-email-helin.zhang@intel.com> (raw)
In-Reply-To: <1406535955-31070-1-git-send-email-helin.zhang@intel.com>
As hash function are configured in gloabal registers, those
registers will not be reloaded unless a gloabl NIC hardware
reset. That means a DPDK application launch will not load
the default configuration of hash functions. It needs an
initialization of those registers during the port
initialization to make sure all those registers are in an
expected state.
Signed-off-by: Helin Zhang <helin.zhang@intel.com>
---
lib/librte_pmd_i40e/i40e_ethdev.c | 71 +++++++++++++++++++++++++++++++++++++++
1 file changed, 71 insertions(+)
diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c
index 87a4999..386d864 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev.c
@@ -204,6 +204,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_init_hash_function(struct i40e_hw *hw);
static int i40e_dev_is_command_supported(struct rte_eth_dev *dev __rte_unused,
enum rte_eth_command cmd);
static int i40e_rx_classification_filter_ctl(struct rte_eth_dev *dev,
@@ -392,6 +393,9 @@ eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv,
return ret;
}
+ /* Init hash functions */
+ i40e_init_hash_function(hw);
+
/* Initialize the shared code (base driver) */
ret = i40e_init_shared_code(hw);
if (ret) {
@@ -4369,3 +4373,70 @@ i40e_rx_classification_filter_ctl(struct rte_eth_dev *dev,
return ret;
}
+
+/**
+ * Initialize hash functions. It includes,
+ * - set hash function to Toeplitz.
+ * - set the default filter swap configurations.
+ * - disable hash function enable per port.
+ * - disable hash function enable per pctype.
+ * Only global reset can reload the firmware configurations.
+ */
+static void
+i40e_init_hash_function(struct i40e_hw *hw)
+{
+ static struct rte_i40e_filter_swap_info swap_info[] = {
+ {ETH_PCTYPE_NONF_IPV4_UDP,
+ 0x1e, 0x36, 0x04, 0x3a, 0x3c, 0x02},
+ {ETH_PCTYPE_NONF_IPV4_TCP,
+ 0x1e, 0x36, 0x04, 0x3a, 0x3c, 0x02},
+ {ETH_PCTYPE_NONF_IPV4_SCTP,
+ 0x1e, 0x36, 0x04, 0x00, 0x00, 0x00},
+ {ETH_PCTYPE_NONF_IPV4_OTHER,
+ 0x1e, 0x36, 0x04, 0x00, 0x00, 0x00},
+ {ETH_PCTYPE_FRAG_IPV4,
+ 0x1e, 0x36, 0x04, 0x00, 0x00, 0x00},
+ {ETH_PCTYPE_NONF_IPV6_UDP,
+ 0x1a, 0x2a, 0x10, 0x3a, 0x3c, 0x02},
+ {ETH_PCTYPE_NONF_IPV6_TCP,
+ 0x1a, 0x2a, 0x10, 0x3a, 0x3c, 0x02},
+ {ETH_PCTYPE_NONF_IPV6_SCTP,
+ 0x1a, 0x2a, 0x10, 0x00, 0x00, 0x00},
+ {ETH_PCTYPE_NONF_IPV6_OTHER,
+ 0x1a, 0x2a, 0x10, 0x00, 0x00, 0x00},
+ {ETH_PCTYPE_FRAG_IPV6,
+ 0x1a, 0x2a, 0x10, 0x00, 0x00, 0x00},
+ {ETH_PCTYPE_L2_PAYLOAD,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+ };
+ static struct rte_i40e_sym_hash_enable_info sym_hash_ena_info[] = {
+ {ETH_PCTYPE_NONF_IPV4_UDP, 0},
+ {ETH_PCTYPE_NONF_IPV4_TCP, 0},
+ {ETH_PCTYPE_NONF_IPV4_SCTP, 0},
+ {ETH_PCTYPE_NONF_IPV4_OTHER, 0},
+ {ETH_PCTYPE_FRAG_IPV4, 0},
+ {ETH_PCTYPE_NONF_IPV6_UDP, 0},
+ {ETH_PCTYPE_NONF_IPV6_TCP, 0},
+ {ETH_PCTYPE_NONF_IPV6_SCTP, 0},
+ {ETH_PCTYPE_NONF_IPV6_OTHER, 0},
+ {ETH_PCTYPE_FRAG_IPV6, 0},
+ {ETH_PCTYPE_L2_PAYLOAD, 0},
+ };
+ static enum rte_i40e_hash_function hf = rte_i40e_hash_function_toeplitz;
+ uint32_t i;
+
+ /* set hash function to Toeplitz by default */
+ i40e_set_hash_function(hw, &hf);
+
+ /* initialize filter swap */
+ for (i = 0; i < RTE_DIM(swap_info); i++)
+ i40e_set_filter_swap(hw, &swap_info[i]);
+
+ /* disable all symmetric hash per pctype */
+ for (i = 0; i < RTE_DIM(sym_hash_ena_info); i++)
+ i40e_set_symmetric_hash_enable_per_pctype(hw,
+ &sym_hash_ena_info[i]);
+
+ /* disable symmetric hash per port */
+ i40e_set_symmetric_hash_enable_per_port(hw, 0);
+}
--
1.8.1.4
next prev parent reply other threads:[~2014-07-28 8:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-28 8:25 [dpdk-dev] [PATCH v2 0/6] Support configuring hash functions Helin Zhang
2014-07-28 8:25 ` [dpdk-dev] [PATCH v2 1/6] ethdev: rename macros of packet classification type Helin Zhang
2014-08-27 16:44 ` Thomas Monjalon
2014-07-28 8:25 ` [dpdk-dev] [PATCH v2 2/6] ethdev: add new ops of 'is_command_supported' and 'rx_classification_filter_ctl' Helin Zhang
2014-07-28 8:25 ` [dpdk-dev] [PATCH v2 3/6] i40e: support of 'rx_classification_filter_ctl' Helin Zhang
2014-07-28 8:25 ` [dpdk-dev] [PATCH v2 4/6] i40e: support of 'is_command_supported' Helin Zhang
2014-07-28 8:25 ` Helin Zhang [this message]
2014-07-28 8:25 ` [dpdk-dev] [PATCH v2 6/6] app/testpmd: add commands for configuring hash functions Helin Zhang
2014-07-29 2:57 ` [dpdk-dev] [PATCH v2 0/6] Support " Wu, Jingjing
2014-07-31 2:49 ` Zhan, Zhaochen
2014-08-01 5:26 ` Zhang, Helin
2014-08-29 16:11 ` Thomas Monjalon
2014-08-20 7:05 ` Zhang, Helin
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=1406535955-31070-6-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).