From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 6AA175685 for ; Fri, 27 Nov 2015 16:34:41 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP; 27 Nov 2015 07:34:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,352,1444719600"; d="scan'208";a="3198411" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga004.fm.intel.com with ESMTP; 27 Nov 2015 07:34:37 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id tARFYTn2028362; Fri, 27 Nov 2015 23:34:29 +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 tARFYQ9H000748; Fri, 27 Nov 2015 23:34:28 +0800 Received: (from hzhan75@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id tARFYQ6Z000744; Fri, 27 Nov 2015 23:34:26 +0800 From: Helin Zhang To: dev@dpdk.org Date: Fri, 27 Nov 2015 23:34:24 +0800 Message-Id: <1448638464-714-1-git-send-email-helin.zhang@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH] i40evf: fix the issue of configuring rss key enable flags 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: Fri, 27 Nov 2015 15:34:42 -0000 It fixes the issue of not configuring rss key enable flags when there is no rss key available. Fixes: 647d1eaf758b ("i40evf: support AQ based RSS config") Signed-off-by: Helin Zhang --- drivers/net/i40e/i40e_ethdev_vf.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index ea96f85..5c554f2 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -2200,9 +2200,14 @@ i40evf_set_rss_key(struct i40e_vsi *vsi, uint8_t *key, uint8_t key_len) struct i40e_hw *hw = I40E_VSI_TO_HW(vsi); int ret = 0; - if (!key || key_len != ((I40E_VFQF_HKEY_MAX_INDEX + 1) * - sizeof(uint32_t))) + if (!key || key_len == 0) { + PMD_DRV_LOG(DEBUG, "No key to be configured"); + return 0; + } else if (key_len != (I40E_VFQF_HKEY_MAX_INDEX + 1) * + sizeof(uint32_t)) { + PMD_DRV_LOG(ERR, "Invalid key length %u", key_len); return -EINVAL; + } if (vf->flags & I40E_FLAG_RSS_AQ_CAPABLE) { struct i40e_aqc_get_set_rss_key_data *key_dw = @@ -2322,12 +2327,14 @@ i40evf_config_rss(struct i40e_vf *vf) return 0; } - if (rss_conf.rss_key == NULL || rss_conf.rss_key_len < nb_q) { + if (rss_conf.rss_key == NULL || rss_conf.rss_key_len < + (I40E_VFQF_HKEY_MAX_INDEX + 1) * sizeof(uint32_t)) { /* Calculate the default hash key */ for (i = 0; i <= I40E_VFQF_HKEY_MAX_INDEX; i++) rss_key_default[i] = (uint32_t)rte_rand(); rss_conf.rss_key = (uint8_t *)rss_key_default; - rss_conf.rss_key_len = nb_q; + rss_conf.rss_key_len = (I40E_VFQF_HKEY_MAX_INDEX + 1) * + sizeof(uint32_t); } return i40evf_hw_rss_hash_set(vf, &rss_conf); -- 1.9.3