On 2021/7/18 1:51, Stephen Hemminger wrote:
> On Sun, 25 Apr 2021 21:02:22 +0800
> "Min Hu (Connor)" <humi...@huawei.com> wrote:
> 
>> +
>> +            memset(&reg_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.

>> +
>> +            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, &reg_info);
>> +            if (ret) {
>> +                    printf("Error getting device reg info: %d\n", ret);
>> +                    continue;
>> +            }
> .
> 

Reply via email to