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 D21C7A0A0F; Fri, 4 Jun 2021 17:05:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8D5CF4068F; Fri, 4 Jun 2021 17:05:01 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 7A97340147 for ; Fri, 4 Jun 2021 17:05:00 +0200 (CEST) IronPort-SDR: eXIMg4Ti/XEDyHV73a6uTOf6ePMzlFr+QrnzP2iXoUxjMSvcYED7+BijI/XsMOF8vTGCgmdgH1 89wJbfJYPi3g== X-IronPort-AV: E=McAfee;i="6200,9189,10005"; a="202446597" X-IronPort-AV: E=Sophos;i="5.83,248,1616482800"; d="scan'208";a="202446597" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2021 08:04:45 -0700 IronPort-SDR: mQ9NMIF2lbcIL+1AseyX8v3Ffn9Kh8gHqvlUXikHDSplEblxt0SrAL0Vu1nrFiWOXJbburoXZ6 U1k4j/Uw+31A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,248,1616482800"; d="scan'208";a="634052230" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by fmsmga006.fm.intel.com with ESMTP; 04 Jun 2021 08:04:44 -0700 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Fri, 4 Jun 2021 08:04:43 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Fri, 4 Jun 2021 08:04:43 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4 via Frontend Transport; Fri, 4 Jun 2021 08:04:43 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.176) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.4; Fri, 4 Jun 2021 08:04:43 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TqHcpF77BEbfuKajnPKdYKMpk2aEKJEdwBV5sFl6IBZclBNaQzA6nhgnhSbe0yQceVbcePXkcx4i6yNGNDjxzZ3kVXj1hWCDPJ+fMRKCXdt2UHapaNMKs155WQXYFb09PrOmIwuw6u2VzBqWHZy/qJdNQtrD5osSj2bMrrL0oOc5q6Eoyp6UCJYVbBStDR2nznDv1VzwIsR+0olCK6y4ela/KgTFx1rAus8d1DYmcIXKJ9Id5xsoKt0zyB6OsXZFT3qqK8FQ9R4IMDzjY3NbZEbfmHs8TrD56RiRgOyX4Y0c98GzjeUMORYIQJZWGaORuIfjBKglDDe2iZhAaKamsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JqQ9NP5g5zuVmyxYZ1Q/5MEggtpLh2z0pfP5rKRt8Q8=; b=PLWJiH3im3hkGlkRPHzjAsBfvwwX1Km+svx1z2RrXmlayOB4b8JBZQQBpieRlroVGJea5+9f3f0E8ofg+0qqf9I+XO7/gP8hTOH1UDr3pDhXn449d+fVP+sCVq23YUQZp54hBlPGt8sEgthDDgDiKEhBguq+0kuvYlyPeEFls5SibqVqq3FuhslzzmIhQ6jZFAAqWdtM2nV0RLNOksekyeppjfWlfdzNASSgJ23qMCQncRCYB5imGll4CXSAzA5IqpHF2dsZS6A32YW6BsA34PPh/hxCVhRuIqLAVP7K2MMVhhcnF4aUS4rc18M7qmpIK5JINFm+00GtQ6gb8S7cWA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JqQ9NP5g5zuVmyxYZ1Q/5MEggtpLh2z0pfP5rKRt8Q8=; b=lW0bEuh6zt/j1eRaSc8MTo4KYBXxl4nwk/vJr5KkwFy/mhlIba3MA2QwI8PIF0/H3VraiOZEwJintjT7KjwswkRDaviiP7XUdVJ2zFm+SJZ9hoSuzpZAu5Sx5vRNRhLvInM1JUbrWBAwTjO9B0ZDv2hbV53JHUu+JijY8/kJbn8= Received: from BYAPR11MB3366.namprd11.prod.outlook.com (2603:10b6:a03:7f::20) by BY5PR11MB3877.namprd11.prod.outlook.com (2603:10b6:a03:186::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.23; Fri, 4 Jun 2021 15:04:41 +0000 Received: from BYAPR11MB3366.namprd11.prod.outlook.com ([fe80::1065:c305:763b:f8a4]) by BYAPR11MB3366.namprd11.prod.outlook.com ([fe80::1065:c305:763b:f8a4%6]) with mapi id 15.20.4195.022; Fri, 4 Jun 2021 15:04:41 +0000 From: "Pattan, Reshma" To: "Min Hu (Connor)" , "dev@dpdk.org" CC: "Tahhan, Maryam" Thread-Topic: [PATCH] app/procinfo: add device registers dump Thread-Index: AQHXOdNE8Pnowuc3xEy1vkqPqohqjqsEIKYA Date: Fri, 4 Jun 2021 15:04:41 +0000 Message-ID: References: <1619355742-15429-1-git-send-email-humin29@huawei.com> In-Reply-To: <1619355742-15429-1-git-send-email-humin29@huawei.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: huawei.com; dkim=none (message not signed) header.d=none;huawei.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [51.37.232.46] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ea90db43-a9d4-40b4-3fee-08d9276a1497 x-ms-traffictypediagnostic: BY5PR11MB3877: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:556; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ZSXKaikqeBetO4tv7xRzOIxKtCnjD+adw0s7LUVWVSDt/XlkwMqHz56VngaymHjmNlMZM44pO1Io1vgEcaeoCVwkBrou0cqlw8uRBA+aPUSyGZRm96h17W9uBcpjjB+/Q7oR9vfNqcozbzqKt2YxNxAXykAgYCAJd2ZY7owG5KvJy1dq5ioFaALl+qQUe+nbbTtvGMaU9WQZ3asFXzNd5tDPS2DOcJ4fwy1H/6ud/EdadNitx75OARL78FGOefGeKc21iLtV5RNTeLCA9NF98Og4es81xv7/v0hmFjydqg264rzunBkYGWc2ND4LZdyxQXUil7iLrJ3Se1NxH3nPahZLnzoPg/1sLK1YkfqIQ+52/y+WWkhoPDtKVgYUuXKdb/zdyE529Nqf14sewmUaPZYlPW2qZTKIZhzPxm+R9qpTxlEWvdUM6l4GbtjqQRjsU3EsJ7PObLw9uuAfUjPrfP8Lu0gFsHRiIdhDmdFXfiRAGjVkhSrvzRFI7OZQRUT9kC6C4ufYWtr02kLqZwdWTNFITXUPaluXE5BdlczDJRQDU4o/cUkTKaceijthodYnFZG6ZjfJIvQJawd5jST9hELjFAUqFtnqd10EyF6084Q= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB3366.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(396003)(39860400002)(346002)(366004)(136003)(376002)(66556008)(66476007)(110136005)(66946007)(66446008)(86362001)(8676002)(55016002)(33656002)(9686003)(64756008)(316002)(186003)(26005)(8936002)(7696005)(76116006)(478600001)(83380400001)(6506007)(71200400001)(5660300002)(52536014)(38100700002)(122000001)(107886003)(4326008)(2906002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: lO8zbShmttiu8+6fF4dI7dbvWaHBqBv4ctyg5X65y1H/bezBV2cqcSuKmcXBchm+1D/XxJLXDCGmQKZBvDWnR2ry54XHfiProHcSjY6lLtt/y/lVQThJqEi7aysRIuO3t5Z2BHwxLpKsFbUkvokkwQR3nxROszpAKSMg6iGbgwUiExylGfXq5VsJEZHdRZ235rBAMS5/V7LyeWHfN8LRAO9VF+Gbba4ZGu5ljLSPFszsjCamqchklmHZDvFPIm1AsgfIgqOjXUrlXp5PVwesmJ9YdIxdCGfma+lB3RXq0oSwTWraNTuvUMumCsJTWqk/OJ5BmMpEZb91NjcBCCuZzCbNe6tNs2f7C6AsmaCuBu84BzhSwC4MI3wE7U7dt4In8HNhMPWW60WyZgrHz34zPsrTZHsovtqlpiMlL2wOP9tyjGgcj6Z0ISwZJF/aDP11FT47VURrL6OrYphyShpMYqhfW0yGyTFbBS7tNMn596cZBX55DuofgfH2cG2CMnXD5w7nOS4zn2R9lvkrE1zuZMx+Kz6v6HXbrq4/gNerzmKgoRGEyFVOEE8guKKpQ+LT+YSwbiitYt2qnndM9kEZHAphSN/MW8xyNu5A1NC7sJcZOc7VbMS8bRJs2PAGFs4OfQO3dbjmJnD5OsLqB5RicHNH8cT5bOIhN9jtsDpE9BSb3w03ulEFcu4wMDbUKewoFyjmgSrWjJ3+T6L7m3G3foXR24whzN+DgeiFv2fwxOg= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR11MB3366.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ea90db43-a9d4-40b4-3fee-08d9276a1497 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Jun 2021 15:04:41.2250 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: YC8+6LQziubNMhi29le6FlD1xrhlyIoAhOx6iBvJe2PAXO6P0Z1N8T/hjW3UO287o3RAb7Lq1x6ocu41OepmDw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR11MB3877 X-OriginatorOrg: intel.com 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" > -----Original Message----- > From: Min Hu (Connor) =20 > + ret =3D rte_eth_dev_get_reg_info(i, ®_info); > + if (ret) { > + printf("Error getting device reg info: %d\n", ret); > + continue; > + } > + > + buf_size =3D reg_info.length * reg_info.width; If it is to get the regs length, you can directly call "rte_ethtool_get_re= gs_len(uint16_t port_id)" API , instead of again writing the above logic. And use the returned length in below malloc. > + fp_regs =3D fopen(file_name, "wb"); > + if (fp_regs =3D=3D NULL) { > + printf("Error during opening '%s' for writing\n", > + file_name); Better to print error string from fopen() errno on failure , to indicate th= e exact error. > + } else { > + if ((int)fwrite(buf_data, 1, buf_size, fp_regs) !=3D Better have "((int)fwrite(buf_data, 1, buf_size, fp_regs)" In separate line= and use the returned value inside if check. > + buf_size) > + printf("Error during writing %s\n", > + file_prefix); Better to print error string from fwrite errno on failure , to indicate the= exact error. > + else > + printf("dump device (%s) regs successfully, " Reframe the sente to "Device regs dumped successfully"