From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id E9DF77EB0 for ; Wed, 19 Nov 2014 15:48:01 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 19 Nov 2014 06:56:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,417,1413270000"; d="scan'208";a="639737714" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga002.jf.intel.com with ESMTP; 19 Nov 2014 06:58:26 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id sAJEwNKa032268; Wed, 19 Nov 2014 22:58:23 +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 sAJEwLJG001381; Wed, 19 Nov 2014 22:58:23 +0800 Received: (from hzhan75@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id sAJEwLMq001377; Wed, 19 Nov 2014 22:58:21 +0800 From: Helin Zhang To: dev@dpdk.org Date: Wed, 19 Nov 2014 22:58:14 +0800 Message-Id: <1416409096-1340-2-git-send-email-helin.zhang@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1416409096-1340-1-git-send-email-helin.zhang@intel.com> References: <1413861289-26662-1-git-send-email-helin.zhang@intel.com> <1416409096-1340-1-git-send-email-helin.zhang@intel.com> Subject: [dpdk-dev] [PATCH v6 1/3] i40e: Use constant as the default hash keys 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: Wed, 19 Nov 2014 14:48:02 -0000 Calculating the default RSS hash keys at run time is not needed at all, and may have race conditions. The alternative is to use array of random values which were generated manually as the default hash keys. Signed-off-by: Helin Zhang --- lib/librte_pmd_i40e/i40e_ethdev.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c index 5074262..9096802 100644 --- a/lib/librte_pmd_i40e/i40e_ethdev.c +++ b/lib/librte_pmd_i40e/i40e_ethdev.c @@ -92,7 +92,7 @@ #define I40E_48_BIT_SHIFT 48 #define I40E_48_BIT_MASK 0xFFFFFFFFFFFFULL -/* Default queue interrupt throttling time in microseconds*/ +/* Default queue interrupt throttling time in microseconds */ #define I40E_ITR_INDEX_DEFAULT 0 #define I40E_QUEUE_ITR_INTERVAL_DEFAULT 32 /* 32 us */ #define I40E_QUEUE_ITR_INTERVAL_MAX 8160 /* 8160 us */ @@ -210,9 +210,6 @@ static int i40e_dev_filter_ctrl(struct rte_eth_dev *dev, enum rte_filter_op filter_op, void *arg); -/* Default hash key buffer for RSS */ -static uint32_t rss_key_default[I40E_PFQF_HKEY_MAX_INDEX + 1]; - static struct rte_pci_id pci_id_i40e_map[] = { #define RTE_PCI_DEV_ID_DECL_I40E(vend, dev) {RTE_PCI_DEVICE(vend, dev)}, #include "rte_pci_dev_ids.h" @@ -4893,9 +4890,12 @@ i40e_pf_config_rss(struct i40e_pf *pf) } if (rss_conf.rss_key == NULL || rss_conf.rss_key_len < (I40E_PFQF_HKEY_MAX_INDEX + 1) * sizeof(uint32_t)) { - /* Calculate the default hash key */ - for (i = 0; i <= I40E_PFQF_HKEY_MAX_INDEX; i++) - rss_key_default[i] = (uint32_t)rte_rand(); + /* Random default keys */ + static uint32_t rss_key_default[] = {0x6b793944, + 0x23504cb5, 0x5bea75b6, 0x309f4f12, 0x3dc0a2b8, + 0x024ddcdf, 0x339b8ca0, 0x4c4af64a, 0x34fac605, + 0x55d85839, 0x3a58997d, 0x2ec938e1, 0x66031581}; + rss_conf.rss_key = (uint8_t *)rss_key_default; rss_conf.rss_key_len = (I40E_PFQF_HKEY_MAX_INDEX + 1) * sizeof(uint32_t); -- 1.8.1.4