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 A2C7842B8E; Wed, 24 May 2023 17:10:49 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2AF5540156; Wed, 24 May 2023 17:10:49 +0200 (CEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id EFCA3400EF for ; Wed, 24 May 2023 17:10:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684941047; x=1716477047; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=YTT4zLy1X2OzBaxq2xS4gttw+xiuTaOuHzx+Jxbr6oM=; b=I3fpyvlxSQIyZnBdh10Q7qONdvsy3n8xDMuNjC/BefLYQ/1yBDcc1KAj 66d1SG3sGXR3Lgjg5HPXwiJ1RHlzf/sZvyMHSYo8Axj9Sr/uXZ9rPhHm7 hdWkI2js/y0taDEw1Y4eVEvVY8vrSzg3N87Lhl8oA3xl1mh/9OcDS5iRE 8tNZ1f2BuXjFwI/DXyNPtQvAS8mSp4FHDsn00A4UyBdOvEA9pF1Gkpj0e Q0x02JfcUX3NAPiqACS9vBCludQVShgCb1iIMFV3Jc9mDSRBgtBs3ufoL swvlIujGlW1XLDZLaMBewTSJ5mAifhtZ8nkJ3GzsNp3pkwB+eBwC1cUMm w==; X-IronPort-AV: E=McAfee;i="6600,9927,10720"; a="417053435" X-IronPort-AV: E=Sophos;i="6.00,189,1681196400"; d="scan'208";a="417053435" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 May 2023 08:10:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10720"; a="816628692" X-IronPort-AV: E=Sophos;i="6.00,189,1681196400"; d="scan'208";a="816628692" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga002.fm.intel.com with ESMTP; 24 May 2023 08:09:55 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 24 May 2023 08:09:54 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Wed, 24 May 2023 08:09:54 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.177) 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.2507.23; Wed, 24 May 2023 08:09:54 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a30gC0kKIH7+z2V1kN5aSyOi2NsPtf46zHiKevSMF2RxEzrLXYFKzBoJjUztYKhpPY7eGGg4jcw9emrHgKlERF9EkOvWkuHdO1NVr8D4Nl7Dc7N9itUwgHj7QMpCrnt+Qp0oTXrotxOOy7zFOWLdbTODbN0n3Y0Ef8gV4//3xHXJLLOKmhnztyzpxOgOT661ewl1dd00FgE4xjJGOEChN/LGjplJV8mYLjiOiJgFpCoeBllsT94KDZIcziZZ97NAPGLsxcMqZi3jXatrxVDwTOvi+093HhrpVwBeVWLQRCV3b7lY8bCx8/MkJ9wB7JUloiHqpA9gADoXHws6zBt4aA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Y/VZf+bhBa36FipDXFVwvOzM45dyO9RcJtT5ymsKslY=; b=hNCLyr0HjAocusfyCA2XDU3OLC9XBV0EBMS6ir7Ecgm8m53EBSJt/oYRHvuecIHeypyap3H3Wd3Vdav2V/d26R55cCcEpX6nDAT14twgKWRs3Vqw8AOxy2Mv8WHIP67uUx6Nj7sDOGv279GhsYkYoX/YwUBXg8EhG6H02dEhTBIfc6ovJvPjQJNpjheRNCMAw5/GjBvPVZAI2ry5C2rz/ywdlX3YnY2oZobYeMh+AR0MRmWq2+hwkqQSGCh9Ish07I4vX49XcYQ6pbdhsESt7fmBJiRVxuqbIK69CKhX2BwxL0EPyDOg6gDyD795Kt3+5ggp803XSrDzYhyxWkLKiw== 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 Received: from BYAPR11MB3366.namprd11.prod.outlook.com (2603:10b6:a03:7f::20) by PH8PR11MB8257.namprd11.prod.outlook.com (2603:10b6:510:1c0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15; Wed, 24 May 2023 15:09:52 +0000 Received: from BYAPR11MB3366.namprd11.prod.outlook.com ([fe80::d48a:e3db:59d4:fcc1]) by BYAPR11MB3366.namprd11.prod.outlook.com ([fe80::d48a:e3db:59d4:fcc1%3]) with mapi id 15.20.6411.028; Wed, 24 May 2023 15:09:52 +0000 From: "Pattan, Reshma" To: "Sevincer, Abdullah" , "dev@dpdk.org" CC: "jerinj@marvell.com" Subject: RE: [PATCH v14] app/procinfo: display eventdev xstats Thread-Topic: [PATCH v14] app/procinfo: display eventdev xstats Thread-Index: AQHZiRAsbq+vd5P3706PoO2red39R69pI4vA Date: Wed, 24 May 2023 15:09:52 +0000 Message-ID: References: <20230320022316.2298874-1-abdullah.sevincer@intel.com> <20230517223724.2417630-1-abdullah.sevincer@intel.com> In-Reply-To: <20230517223724.2417630-1-abdullah.sevincer@intel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BYAPR11MB3366:EE_|PH8PR11MB8257:EE_ x-ms-office365-filtering-correlation-id: 6bfd9b16-0678-4f66-e021-08db5c68ed1c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: bFgaty6+43ipb2h9PyX56juL5rcqe7i/q4pah0qYMpRc5DWSTafzwJJVRPA//6ooctX6hIpbIvVa2/QkyCYw1IlhfspfaQDhjd8rBBE0rlyRtq1T4bi2LLNuG8c61aR241Jf8y/IX26NpIz9LJvxDjS8JcFdd1plq+Y6xGi1jnQJ36DU+u7EwlIxWudofT+fHOFy/qAnak6BZPfSlllulvbUEu/4xF6aNhChySe74KgZ+sqoxsvcxOA4w1cANMM+ilE8DkcNU67kWBVEOZsEqaLFG97rtX+//eXZO1TRVpjTAvc3PWmft9J651fghXu/z5Fye5zTwo15dKu6502DvKZnXvUnlQtH7eNhUYEOwfeRQADYKGXt88AjjAdgGX0ERS+Y4fXeH310DX94cJqI86QEq1q0UmjQ8naD/M0VkdZ+GqvAF0qO+taUbzc8qrsqpgzs5ifkGcxytN8dey5ueZpggBjj9mdDGfNNJRi1Lvla7mqeShknJOAA1R1kt2F1eUjWtxtkmNVTYCwPnwAnKyRLhbOIEZ5OBtzeCKEUw8+bdfl1Yfn0Dt45LZPwMLF9RfrApvgH2/wgI2PUnMsXTCJ71qyw0FGiCkt62cfzzZOl2X/jQ5BURfl1Qy36PKOZ 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:(13230028)(396003)(366004)(346002)(376002)(39860400002)(136003)(451199021)(71200400001)(110136005)(478600001)(33656002)(83380400001)(86362001)(38070700005)(55016003)(38100700002)(122000001)(82960400001)(7696005)(26005)(9686003)(6506007)(186003)(41300700001)(8936002)(316002)(5660300002)(52536014)(2906002)(8676002)(66946007)(66556008)(66476007)(66446008)(76116006)(4326008)(64756008); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?/17dWTbPAptpCmBZaBNAcbTNjS6l6fZ5j9BVkLv+15xgJyDuQFaYHN6YR/r2?= =?us-ascii?Q?LIxuZkl+5HA91UlQVRFNt8+HkATy5RVVA9wdv6hpW0Ui32JmezRimeOKDTxt?= =?us-ascii?Q?Gnx+kRPTmMcmv8ogCSHlAa3nZnvwezQTc7iJgWX4QRVunfnsdvdRTUfTdtpC?= =?us-ascii?Q?g5SkTeFxV69zH15SmtqpijGenH0zw/zBwY+zRSyow2d1X7T03JT2KyXrRqj2?= =?us-ascii?Q?2tfFFjKJn6YH+Qv/+Ki9RoKSulkrmk3w1SUoatooL6U4Wm7CsrZ77NAPSrTB?= =?us-ascii?Q?Gi/FDLqeHT1jGBnKfmGqn+Aji06xPbLVHNgFcwxxeONSGBrNN0VuGumP1lNc?= =?us-ascii?Q?wQy/YJSG7IXnFN78YAdmC0PXW86U+OOd1opgj5SwMY97MlnpXcKLRhaLDG48?= =?us-ascii?Q?jHTjfd4om8T2wZj6HUR7uyfCKlFexn7BLivwEylx2xhYUEHG3lqE5NACkU/t?= =?us-ascii?Q?zheIywk2wFrWo4/xgCJH2etcJ3wMmxzBf3ZswOaaicx6flCoCrACDRIk9yR4?= =?us-ascii?Q?LAdwh0fssShGlrkiK4UR+cx8oPCFXTLG38vSorc4+f2UhPaA79RJePzK68VP?= =?us-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LW4pPdtixUsBInddsDw5u4HYX?= =?us-ascii?Q?pQ26nf2eUX7H6vzVBBPuFsQ+Ja2j4wGiyl6oh8/5Dx/5VX1H+cz4XA7dwM6r?= =?us-ascii?Q?2c5jXpciQIoYPlS8lbuL4FvQbhJ1a6GjQtlzv3Bz?= 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: 6bfd9b16-0678-4f66-e021-08db5c68ed1c X-MS-Exchange-CrossTenant-originalarrivaltime: 24 May 2023 15:09:52.7494 (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: mF6HE1ko5kFxWI0y/HZS/F/x1V20chpqdoVJpWWIxKeqByz5SiiYMenMUWYiTD0j0ycVrluKp8ZLE8TvVeipdg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR11MB8257 X-OriginatorOrg: intel.com 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 > -----Original Message----- > From: Sevincer, Abdullah The code looks better now, however if you can make below changes that would= be great. > + > +struct eventdev_params { > + uint32_t show_eventdev; Can't we get rid of the "show_eventdev", and just rely below flags=20 > + uint8_t num_queues; > + uint8_t num_ports; > + uint32_t shw_all_queues; > + uint32_t shw_all_ports; > + uint32_t dump_xstats; > + uint32_t reset_xstats; > + uint32_t shw_device_xstats; > +parse_eventdev_dump_xstats_params(char *list) { > + > + if (!eventdev_var[evdev_id].show_eventdev) > + eventdev_var[evdev_id].show_eventdev =3D 1; You can set the " eventdev_var[evdev_id].show_eventdev =3D 1;" without the= if check. Here and in other places. However , you don't need to have show_eventdev=3D1. You can think of gett= ing rid of the "show_eventdev" altogether. Here and other places. > +parse_eventdev_port_xstats_params(char *list) { > + uint8_t port_id; > + uint8_t evdev_id; > + if (sscanf(list, "*:%hhu", &evdev_id) =3D=3D 1) { > + if (evdev_id >=3D RTE_EVENT_MAX_DEVS) { > + printf("Invalid eventdev id, id should be between 0 - > %d\n", Do you need to validate the port id and queue ids here and in below functio= ns. > +xstats_display(uint8_t dev_id, > + enum rte_event_dev_xstats_mode mode, > + uint8_t queue_port_id) > +{ > + int ret; > + struct rte_event_dev_xstats_name *xstats_names; > + uint64_t *ids; > + uint64_t *values; > + unsigned int size; > + int i; > + > + size =3D xstats_get_names_and_ids_size(dev_id, mode, queue_port_id); > + > + if (size =3D=3D 0) { > + printf( > + "No stats available for this item, mode=3D%d, > queue_port_id=3D%d\n", > + mode, queue_port_id); > + return; > + } > + > + /* Get memory to hold stat names, IDs, and values */ > + xstats_names =3D malloc(sizeof(struct rte_event_dev_xstats_name) * > size); > + ids =3D malloc(sizeof(unsigned int) * size); > + > + if (!xstats_names || !ids) > + rte_panic("unable to alloc memory for stats retrieval\n"); > + > + ret =3D rte_event_dev_xstats_names_get(dev_id, mode, queue_port_id, > + xstats_names, ids, > + size); You need size in unsigned int form only to pass to the function rte_event_= dev_xstats_names_get() , so why not use unsigned int(size) here and remove= =20 the cast of size in function xstats_get_names_and_ids_size().=20 I also feel you don't need xstats_get_names_and_ids_size(), just call rte_= event_dev_xstats_names_get() directly in this function , to get the size in= int, use int size everywhere else,=20 and use it with cast while passing to rte_event_dev_xstats_names_get() aga= in. It makes easy to follow the code . This way You no need to do (int)size in below code too. > + if (ret !=3D (int)size) > + rte_panic("rte_event_dev_xstats_names_get err %d\n", ret); > + > +A typical command line usage for eventdev stats: > + > + .. code-block:: console > + > + ./dpdk-proc-info -- --show-edev-port-xstats=3D1:0 If you want to provide the command examples, you can give example under ea= ch command section, else you can remove this as well.