From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 1150B959 for ; Mon, 28 Jul 2014 10:24:31 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 28 Jul 2014 01:26:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,747,1400050800"; d="scan'208";a="549983743" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga001.jf.intel.com with ESMTP; 28 Jul 2014 01:26:15 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id s6S8QDnF023662; Mon, 28 Jul 2014 16:26:13 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id s6S8Q9gV031218; Mon, 28 Jul 2014 16:26:11 +0800 Received: (from hzhan75@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s6S8Q9gg031213; Mon, 28 Jul 2014 16:26:09 +0800 From: Helin Zhang To: dev@dpdk.org Date: Mon, 28 Jul 2014 16:25:54 +0800 Message-Id: <1406535955-31070-6-git-send-email-helin.zhang@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1406535955-31070-1-git-send-email-helin.zhang@intel.com> References: <1406535955-31070-1-git-send-email-helin.zhang@intel.com> Subject: [dpdk-dev] [PATCH v2 5/6] i40e: Initialize hash function during port initialization. X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 08:24:32 -0000 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 --- 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