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 6F5BE4236C; Thu, 12 Oct 2023 06:00:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 518F4402E1; Thu, 12 Oct 2023 06:00:03 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 7CE2240279 for ; Thu, 12 Oct 2023 06:00:01 +0200 (CEST) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4S5bRJ3Q3fzVlMl for ; Thu, 12 Oct 2023 11:56:28 +0800 (CST) Received: from [10.67.121.161] (10.67.121.161) by dggpeml100024.china.huawei.com (7.185.36.115) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Thu, 12 Oct 2023 11:59:59 +0800 Subject: Re: [PATCH v5 36/40] net/hns3: support setting and querying RSS hash function To: Jie Hai , , Dongdong Liu , Yisen Zhuang CC: References: <20230908080030.3837515-1-haijie1@huawei.com> <20231011092805.693171-1-haijie1@huawei.com> <20231011092805.693171-37-haijie1@huawei.com> <07445fad-a87d-5667-9c25-7abec299f3e5@huawei.com> From: fengchengwen Message-ID: <135b12bf-884e-e6c4-1106-18c6234a6b90@huawei.com> Date: Thu, 12 Oct 2023 11:59:59 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.121.161] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml100024.china.huawei.com (7.185.36.115) 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 On 2023/10/12 11:05, Jie Hai wrote: > On 2023/10/12 10:23, fengchengwen wrote: >> The new algorithm (RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT) should treat as Not Support. >> >> With above fix >> Acked-by: Chengwen Feng >> > Actually, the new algorithm is not supported. > see hns3_update_rss_algo_key(). > >     if (modify_algo && hash_func >= RTE_DIM(hns3_hash_func_map)) { >         hns3_err(hw, "hash func (%u) is unsupported.", hash_func); >         return -ENOTSUP; >     } Got it, thanks. > >> On 2023/10/11 17:28, Jie Hai wrote: >>> From: Huisong Li >>> >>> Support setting and querying RSS hash function by ethdev ops. >>> >>> Signed-off-by: Huisong Li >>> Signed-off-by: Dongdong Liu >>> --- >>>   drivers/net/hns3/hns3_rss.c | 47 +++++++++++++++++++++---------------- >>>   1 file changed, 27 insertions(+), 20 deletions(-) >>> >>> diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c >>> index 6126512bd780..010a759f23d9 100644 >>> --- a/drivers/net/hns3/hns3_rss.c >>> +++ b/drivers/net/hns3/hns3_rss.c >>> @@ -646,14 +646,14 @@ hns3_dev_rss_hash_update(struct rte_eth_dev *dev, >>>       if (ret) >>>           goto set_tuple_fail; >>>   -    if (key) { >>> -        ret = hns3_rss_set_algo_key(hw, hw->rss_info.hash_algo, >>> -                        key, hw->rss_key_size); >>> -        if (ret) >>> -            goto set_algo_key_fail; >>> -        /* Update the shadow RSS key with user specified */ >>> +    ret = hns3_update_rss_algo_key(hw, rss_conf->algorithm, key, key_len); >>> +    if (ret != 0) >>> +        goto set_algo_key_fail; >>> + >>> +    if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT) >>> +        hw->rss_info.hash_algo = hns3_hash_func_map[rss_conf->algorithm]; >>> +    if (key != NULL) >>>           memcpy(hw->rss_info.key, key, hw->rss_key_size); >>> -    } >>>       hw->rss_info.rss_hf = rss_hf; >>>       rte_spinlock_unlock(&hw->lock); >>>   @@ -769,7 +769,13 @@ int >>>   hns3_dev_rss_hash_conf_get(struct rte_eth_dev *dev, >>>                  struct rte_eth_rss_conf *rss_conf) >>>   { >>> +    const uint8_t hash_func_map[] = { >>> +        [HNS3_RSS_HASH_ALGO_TOEPLITZ] = RTE_ETH_HASH_FUNCTION_TOEPLITZ, >>> +        [HNS3_RSS_HASH_ALGO_SIMPLE] = RTE_ETH_HASH_FUNCTION_SIMPLE_XOR, >>> +        [HNS3_RSS_HASH_ALGO_SYMMETRIC_TOEP] = RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ, >>> +    }; >>>       struct hns3_adapter *hns = dev->data->dev_private; >>> +    uint8_t rss_key[HNS3_RSS_KEY_SIZE_MAX] = {0}; >>>       struct hns3_hw *hw = &hns->hw; >>>       uint8_t hash_algo; >>>       int ret; >>> @@ -777,26 +783,27 @@ hns3_dev_rss_hash_conf_get(struct rte_eth_dev *dev, >>>       rte_spinlock_lock(&hw->lock); >>>       ret = hns3_rss_hash_get_rss_hf(hw, &rss_conf->rss_hf); >>>       if (ret != 0) { >>> +        rte_spinlock_unlock(&hw->lock); >>>           hns3_err(hw, "obtain hash tuples failed, ret = %d", ret); >>> -        goto out; >>> +        return ret; >>> +    } >>> + >>> +    ret = hns3_rss_get_algo_key(hw, &hash_algo, rss_key, hw->rss_key_size); >>> +    if (ret != 0) { >>> +        rte_spinlock_unlock(&hw->lock); >>> +        hns3_err(hw, "obtain hash algo and key failed, ret = %d", ret); >>> +        return ret; >>>       } >>> +    rte_spinlock_unlock(&hw->lock); >>>   -    /* Get the RSS Key required by the user */ >>> +    /* Get the RSS Key if user required. */ >>>       if (rss_conf->rss_key && rss_conf->rss_key_len >= hw->rss_key_size) { >>> -        ret = hns3_rss_get_algo_key(hw, &hash_algo, rss_conf->rss_key, >>> -                        hw->rss_key_size); >>> -        if (ret != 0) { >>> -            hns3_err(hw, "obtain hash algo and key failed, ret = %d", >>> -                 ret); >>> -            goto out; >>> -        } >>> +        memcpy(rss_conf->rss_key, rss_key, hw->rss_key_size); >>>           rss_conf->rss_key_len = hw->rss_key_size; >>>       } >>> +    rss_conf->algorithm = hash_func_map[hash_algo]; >>>   -out: >>> -    rte_spinlock_unlock(&hw->lock); >>> - >>> -    return ret; >>> +    return 0; >>>   } >>>     /* >>> >> . > .