Re: [dpdk-dev] [PATCH] app/procinfo: add device registers dump
From: Chengchang Tang <tangchengchang@huawei.com>
Date: 2021-07-19 06:40:39
From: Chengchang Tang <tangchengchang@huawei.com>
Date: 2021-07-19 06:40:39
On 2021/7/18 1:51, Stephen Hemminger wrote:
On Sun, 25 Apr 2021 21:02:22 +0800 "Min Hu (Connor)" [off-list ref] wrote:quoted
+ + memset(®_info, 0, sizeof(reg_info)); + memset(&dev_info, 0, sizeof(dev_info));This memset is redundant, rte_eth_dev_info_get already has the same memset. For the registers, ethdev should be fixed to do it.
The memset for dev_info is indeed redundant. But the memset for reg_info seems reasonable, because there are some input parameters in reg_info. E.g. If info->data is NULL the get_reg_info() fills in the width and length fields. If non-NULL the registers are put into the buffer pointed at by the data field. So, I will remove the redundant memset for dev_info, and keep the memset for reg_info in the next version.
quoted
+ + ret = rte_eth_dev_info_get(i, &dev_info); + if (ret) { + printf("Error getting device info: %d\n", ret); + continue; + } + + ret = rte_eth_dev_get_reg_info(i, ®_info); + if (ret) { + printf("Error getting device reg info: %d\n", ret); + continue; + }.