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 2C3D842BF1; Mon, 5 Jun 2023 15:04:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 181DD4021F; Mon, 5 Jun 2023 15:04:11 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 92C994003C; Mon, 5 Jun 2023 15:04:09 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4QZYhP03YqzTl0D; Mon, 5 Jun 2023 21:03:48 +0800 (CST) Received: from [10.67.103.235] (10.67.103.235) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 5 Jun 2023 21:04:06 +0800 Subject: Re: [PATCH 3/5] app/proc-info: fix never show RSS info To: Ferruh Yigit , , , , References: <20230315110033.30143-1-liudongdong3@huawei.com> <20230315110033.30143-4-liudongdong3@huawei.com> <5c0b4937-2c5c-9d94-2145-eb88a69384ee@amd.com> CC: , , Jie Hai , Maryam Tahhan , Vipin Varghese , John McNamara From: Dongdong Liu Message-ID: Date: Mon, 5 Jun 2023 21:04:05 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <5c0b4937-2c5c-9d94-2145-eb88a69384ee@amd.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.103.235] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemi500017.china.huawei.com (7.221.188.110) 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 Hi Ferruh On 2023/6/3 4:19, Ferruh Yigit wrote: > On 3/15/2023 11:00 AM, Dongdong Liu wrote: > >> From: Jie Hai >> >> Command show-port shows rss info only if rss_conf.rss_key >> is not null but it will never be true. This patch allocates >> memory for rss_conf.rss_key and makes it possible to show >> rss info. >> > > Why 'rss_conf.rss_key == NULL' case is never true? > > 'rss_key' is pointer and 'rte_eth_dev_rss_hash_conf_get()' doesn't > allocate it, so can't it be NULL? The code want to show rss info (rss_key, len and rss_hf), but it does not allocate memory for rss_conf.rss_key, so current code rss_conf.rss_key will be always NULL, This patch fixes that. Maybe the description of commit message is not correct, will fix that. Thanks, Dongdong > > >> Fixes: 8a37f37fc243 ("app/procinfo: add --show-port") >> Cc: stable@dpdk.org >> >> Signed-off-by: Jie Hai >> Signed-off-by: Dongdong Liu >> --- >> app/proc-info/main.c | 26 +++++++++++++++++--------- >> 1 file changed, 17 insertions(+), 9 deletions(-) >> >> diff --git a/app/proc-info/main.c b/app/proc-info/main.c >> index 53e852a07c..878ce37e8b 100644 >> --- a/app/proc-info/main.c >> +++ b/app/proc-info/main.c >> @@ -823,6 +823,7 @@ show_port(void) >> struct rte_eth_fc_conf fc_conf; >> struct rte_ether_addr mac; >> struct rte_eth_dev_owner owner; >> + uint8_t *rss_key; >> >> /* Skip if port is not in mask */ >> if ((enabled_port_mask & (1ul << i)) == 0) >> @@ -981,19 +982,26 @@ show_port(void) >> printf("\n"); >> } >> >> + rss_key = rte_malloc(NULL, >> + dev_info.hash_key_size * sizeof(uint8_t), 0); >> + if (rss_key == NULL) >> + return; >> + >> + rss_conf.rss_key = rss_key; >> + rss_conf.rss_key_len = dev_info.hash_key_size; >> ret = rte_eth_dev_rss_hash_conf_get(i, &rss_conf); >> if (ret == 0) { >> - if (rss_conf.rss_key) { >> - printf(" - RSS\n"); >> - printf("\t -- RSS len %u key (hex):", >> - rss_conf.rss_key_len); >> - for (k = 0; k < rss_conf.rss_key_len; k++) >> - printf(" %x", rss_conf.rss_key[k]); >> - printf("\t -- hf 0x%"PRIx64"\n", >> - rss_conf.rss_hf); >> - } >> + printf(" - RSS\n"); >> + printf("\t -- RSS len %u key (hex):", >> + rss_conf.rss_key_len); >> + for (k = 0; k < rss_conf.rss_key_len; k++) >> + printf(" %x", rss_conf.rss_key[k]); >> + printf("\t -- hf 0x%"PRIx64"\n", >> + rss_conf.rss_hf); >> } >> >> + rte_free(rss_key); >> + >> #ifdef RTE_LIB_SECURITY >> show_security_context(i, true); >> #endif >> -- >> 2.22.0 >> > > . >