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 67BFAA0508; Wed, 13 Apr 2022 11:01:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4932640694; Wed, 13 Apr 2022 11:01:40 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 8CE684068B for ; Wed, 13 Apr 2022 11:01:38 +0200 (CEST) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Kdc3k1kJ8zgYcw; Wed, 13 Apr 2022 16:59:46 +0800 (CST) Received: from [10.67.103.128] (10.67.103.128) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 13 Apr 2022 17:01:35 +0800 Subject: Re: [PATCH v3 1/1] net/bonding: fix rss key configuration when the key length is 52 To: Ke Zhang , , References: <20220411030231.58268-1-ke1x.zhang@intel.com> <20220411054003.60095-1-ke1x.zhang@intel.com> From: "Min Hu (Connor)" Message-ID: <3f20d3e3-9a6e-7cfc-5181-5af5ff751d28@huawei.com> Date: Wed, 13 Apr 2022 17:01:35 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: <20220411054003.60095-1-ke1x.zhang@intel.com> Content-Type: text/plain; charset="gbk"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.103.128] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected 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 Acked-by: Min Hu (Connor) ÔÚ 2022/4/11 13:40, Ke Zhang дµÀ: > 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++) { >