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 AF949A0A0C; Mon, 19 Jul 2021 08:40:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 47E544068B; Mon, 19 Jul 2021 08:40:38 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 9CCFB4067A for ; Mon, 19 Jul 2021 08:40:35 +0200 (CEST) Received: from dggeme765-chm.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4GSsX62STrzYd6b; Mon, 19 Jul 2021 14:34:46 +0800 (CST) Received: from [10.69.27.114] (10.69.27.114) by dggeme765-chm.china.huawei.com (10.3.19.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Mon, 19 Jul 2021 14:40:30 +0800 To: Stephen Hemminger , "Min Hu (Connor)" References: <1619355742-15429-1-git-send-email-humin29@huawei.com> <20210717105107.3d87bd56@hermes.local> CC: , , From: Chengchang Tang Message-ID: <9231217e-8db4-e816-600a-5b6a0d8675fe@huawei.com> Date: Mon, 19 Jul 2021 14:40:30 +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: <20210717105107.3d87bd56@hermes.local> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.69.27.114] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggeme765-chm.china.huawei.com (10.3.19.111) X-CFilter-Loop: Reflected Subject: Re: [dpdk-dev] [PATCH] app/procinfo: add device registers dump 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 Sender: "dev" On 2021/7/18 1:51, Stephen Hemminger wrote: > On Sun, 25 Apr 2021 21:02:22 +0800 > "Min Hu (Connor)" wrote: > >> + >> + 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. >> + >> + 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; >> + } > . >