From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B9510A00C4; Mon, 11 Apr 2022 07:45:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 572E340685; Mon, 11 Apr 2022 07:45:20 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id C9D2F4067B for ; Mon, 11 Apr 2022 07:45:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649655918; x=1681191918; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TOFqBkV5nA5Ywb/5WXwNsOwO/PGOrK4sraaPXK5Exyk=; b=oDCCiFxa3Rq3ZwFaaX+50Bnmw+NVFHeGuxv+zGVLWXCieRY8hRafwlHl lpBloOjDbYR7EE1i7asg5oEWmHPxdMiM50ak/H0jMIb75CR6bV0DAnQW5 4+KC9bjHIhNG+6xd0GeUMaPyWvd03+g0EEFSz9g54GJsHCBRqfPcnkm7C jBo8eq23/GgBEp7OVSE2pfhogaIy8blOFMq2rmf6h/EaEZOKMa55Gvf32 NaDOFewSD1y5Tkn9DxxYAr/nRuQDkLrZWDTjOfNxZ7XU1xMTeTty1xJHN NyTdgaQoin3QyL6/4rb2vuopop9qgt27Msq1U9MJWRxTkahGWDWo4gRnD A==; X-IronPort-AV: E=McAfee;i="6400,9594,10313"; a="287043665" X-IronPort-AV: E=Sophos;i="5.90,251,1643702400"; d="scan'208";a="287043665" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Apr 2022 22:45:12 -0700 X-IronPort-AV: E=Sophos;i="5.90,251,1643702400"; d="scan'208";a="550988241" Received: from unknown (HELO localhost.localdomain) ([10.239.251.104]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Apr 2022 22:45:05 -0700 From: Ke Zhang To: chas3@att.com, humin29@huawei.com, dev@dpdk.org Cc: Ke Zhang Subject: [PATCH v3 1/1] net/bonding: fix rss key configuration when the key length is 52 Date: Mon, 11 Apr 2022 05:40:03 +0000 Message-Id: <20220411054003.60095-1-ke1x.zhang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220411030231.58268-1-ke1x.zhang@intel.com> References: <20220411030231.58268-1-ke1x.zhang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org when creating a bonding device, if the slave device's rss key length = standard_rss_key length + extended_hash_key length, then bonding device will be same as slave, in function bond_ethdev_configure(), the default_rss_key length is 40, it is not matched, so it should calculate a new key for bonding device if the default key could not be used. Signed-off-by: Ke Zhang --- drivers/net/bonding/rte_eth_bond_pmd.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index b305b6a35b..5cbe89031b 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -3617,13 +3617,18 @@ bond_ethdev_configure(struct rte_eth_dev *dev) internals->rss_key_len); } else { if (internals->rss_key_len > sizeof(default_rss_key)) { - RTE_BOND_LOG(ERR, - "There is no suitable default hash key"); - return -EINVAL; + /* + * If the rss_key includes standard_rss_key and + * extended_hash_key, the rss key length will be + * larger than default rss key length, so it should + * re-calculate the hash key. + */ + for (i = 0; i < internals->rss_key_len; i++) + internals->rss_key[i] = (uint8_t)rte_rand(); + } else { + memcpy(internals->rss_key, default_rss_key, + internals->rss_key_len); } - - memcpy(internals->rss_key, default_rss_key, - internals->rss_key_len); } for (i = 0; i < RTE_DIM(internals->reta_conf); i++) { -- 2.25.1