From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 8FAB845A38;
	Thu, 26 Sep 2024 14:37:31 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 622094028B;
	Thu, 26 Sep 2024 14:37:31 +0200 (CEST)
Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35])
 by mails.dpdk.org (Postfix) with ESMTP id 33AE84025D
 for <dev@dpdk.org>; Thu, 26 Sep 2024 14:37:29 +0200 (CEST)
Received: from mail.maildlp.com (unknown [172.19.88.234])
 by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4XDtPy289Rz1SBlc;
 Thu, 26 Sep 2024 20:36:38 +0800 (CST)
Received: from kwepemf500004.china.huawei.com (unknown [7.202.181.242])
 by mail.maildlp.com (Postfix) with ESMTPS id 972AF1402C6;
 Thu, 26 Sep 2024 20:37:27 +0800 (CST)
Received: from [10.67.121.175] (10.67.121.175) by
 kwepemf500004.china.huawei.com (7.202.181.242) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.2.1544.11; Thu, 26 Sep 2024 20:37:27 +0800
Message-ID: <ecf0e6d8-c02a-296a-46c3-f503565f548f@huawei.com>
Date: Thu, 26 Sep 2024 20:37:26 +0800
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
 Thunderbird/91.9.1
Subject: Re: [PATCH v8 8/8] net/hns3: support filter registers by module names
To: fengchengwen <fengchengwen@huawei.com>, <dev@dpdk.org>,
 <thomas@monjalon.net>, <ferruh.yigit@amd.com>,
 <andrew.rybchenko@oktetlabs.ru>
CC: <lihuisong@huawei.com>
References: <20231214015650.3738578-1-haijie1@huawei.com>
 <20240925064038.27135-1-haijie1@huawei.com>
 <20240925064038.27135-9-haijie1@huawei.com>
 <e032560d-a384-4731-866d-280c84468e42@huawei.com>
From: Jie Hai <haijie1@huawei.com>
In-Reply-To: <e032560d-a384-4731-866d-280c84468e42@huawei.com>
Content-Type: text/plain; charset="UTF-8"; format=flowed
Content-Transfer-Encoding: 7bit
X-Originating-IP: [10.67.121.175]
X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To
 kwepemf500004.china.huawei.com (7.202.181.242)
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

Hi, fengchengwen,

Thanks for your review.

On 2024/9/26 9:46, fengchengwen wrote:
> On 2024/9/25 14:40, Jie Hai wrote:
>> This patch support dumping registers which module name is the
>> `filter` string. The module names are in lower case and so is
>> the `filter`. Available module names are cmdq, common_pf,
>> common_vf, ring, tqp_intr, 32_bit_dfx, 64_bit_dfx, bios, igu_egu,
>> ssu, ppp, rpu, ncsi, rtc, rcb, etc.
>>
>> Signed-off-by: Jie Hai<haijie1@huawei.com>
>> ---
>>   doc/guides/nics/hns3.rst     |   7 +
>>   drivers/net/hns3/hns3_regs.c | 257 ++++++++++++++++++++---------------
>>   2 files changed, 157 insertions(+), 107 deletions(-)
>>
>> diff --git a/doc/guides/nics/hns3.rst b/doc/guides/nics/hns3.rst
>> index 97b4686bfabe..20765bd7d145 100644
>> --- a/doc/guides/nics/hns3.rst
>> +++ b/doc/guides/nics/hns3.rst
>> @@ -407,6 +407,13 @@ be provided to avoid scheduling the CPU core used by DPDK application threads fo
>>   other tasks. Before starting the Linux OS, add the kernel isolation boot parameter.
>>   For example, "isolcpus=1-18 nohz_full=1-18 rcu_nocbs=1-18".
>>   
>> +Dump registers
>> +--------------
>> +HNS3 supports dumping registers values with their names, and suppotrt filtering
> typo of suppotrt
> 
Will correct in V9.
>> +by module names. The available modules are ``bios``, ``ssu``, ``igu_egu``,
> The available modules names?
> 
>> +``rpu``, ``ncsi``, ``rtc``, ``ppp``, ``rcb``, ``tqp``, ``rtc``, ``cmdq``,
>> +``common_pf``, ``common_vf``, ``ring``, ``tqp_intr``, ``32_bit_dfx``,
>> +``64_bit_dfx``, etc.
> etc means there are more which don't list above, please don't add it because the doc should contain all modules names.
> 
Will remove 'etc' in V9.
>>   
>>   Limitations or Known issues
>>   ---------------------------

>> +static void
>> +hns3_get_module_names(char *names, uint32_t len)
>> +{
>> +	size_t i;
>> +
>> +	for (i = 0; i < RTE_DIM(hns3_module_name_map); i++) {
>> +		strlcat(names, " ", len);
>> +		strlcat(names, hns3_module_name_map[i].name, len);
>> +	}
>> +}
>> +
>> +static uint32_t
>> +hns3_parse_modules_by_filter(struct hns3_hw *hw, const char *filter)
>> +{
>> +	struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw);
>> +	char names[HNS3_MAX_MODULES_LEN] = {0};
>> +	uint32_t modules = 0;
>> +	size_t i;
>> +
>> +	if (filter == NULL) {
>> +		modules = (1 << RTE_DIM(hns3_reg_lists)) - 1;
>> +	} else {
>> +		for (i = 0; i < RTE_DIM(hns3_module_name_map); i++) {
>> +			if (strcmp(filter, hns3_module_name_map[i].name) == 0) {
>> +				modules |= hns3_module_name_map[i].module;
>> +				break;
>> +			}
>> +		}
>> +	}
>> +
>> +	if (hns->is_vf)
>> +		modules &= HNS3_VF_MODULES;
>> +	else
>> +		modules &= ~HNS3_VF_ONLY_MODULES;
>> +	if (modules == 0) {
>> +		hns3_get_module_names(names, HNS3_MAX_MODULES_LEN);
> the name is NULL.
> 
I am not sure what problem it is.
You mean the parameter names of hns3_get_module_names?
It is an array and not null for sure. And it is used for the names of 
all modules.
>> +		hns3_err(hw, "mismatched module name! Available names are:\n%s.",
> hns3_err already contain \n, please remove this.
This is a new line between the above expression and the name list
to prevent the overall output from being too long.
Not the last of the expression.
> 
>> +			 names);
>> +	}
>> +	return modules;
>>   }
>>