From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 26C07A04BA; Wed, 7 Oct 2020 20:47:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 884811B65F; Wed, 7 Oct 2020 20:47:29 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id D50821B62E for ; Wed, 7 Oct 2020 20:47:26 +0200 (CEST) IronPort-SDR: PcodYHBINzGYmEgHb6kF8NO7nGOXjFeEwiYsZHLOQSRGFIXrQLmQ0kQSniU0JE9vfzeNwDMb0F or9uckHdsM2A== X-IronPort-AV: E=McAfee;i="6000,8403,9767"; a="164294196" X-IronPort-AV: E=Sophos;i="5.77,347,1596524400"; d="scan'208";a="164294196" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Oct 2020 11:47:24 -0700 IronPort-SDR: nIZEX1SnoM66plXBzCP8TcJzAmNb/+zMMQxaRPeyFqopPkghnLU00VmP7QOzbpI4Z5169i5Pim PMpvnGv8bQKQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,347,1596524400"; d="scan'208";a="418805906" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmsmga001.fm.intel.com with ESMTP; 07 Oct 2020 11:47:24 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 7 Oct 2020 11:47:24 -0700 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) 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.1713.5; Wed, 7 Oct 2020 11:47:23 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 7 Oct 2020 11:47:23 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.173) 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.1713.5; Wed, 7 Oct 2020 11:47:22 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A008GK0GX9R1ZfJH9qQg++K5ZHuaNV/cLj1Io7XwfMj7nZ26tk+OYRKkzoyuiDSLoGk5Bn+7H9taM6FVEYn/mU2ZSIQG2YHmH9LfOR4FXonB2lPKxdo4WCOwnEN6ZxUFwVDY/LvUDKWo4uGDw1yvuZHiK1jb57LnuJn81qvUrwc63wWulLhB6QFjREM4MLtENMNQGhnkjHhx9hOcHy9JjJMF1h2EL9M1kFpaoTwshc9xeRr/gdcOP4K5FaTlHGxGOwDVJRCYuQvKGe9T1KT+DCYiYKjN7dNePfd1fPOHmmTtkJ2mVv7Dx2wDOFel5lT6hoaEP+uVJ29A3c3UR7CVHg== 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=iONzXXbFG5EY4pmUrHUObvJcUrGYR2leSAvowOrJ8AI=; b=NQsFEDyVMFBmsME8WaoKrKyFD80tma0qNZ5FkzaO3YF491gwgmciEyHD+YP++U7cYN/I9WozmANQKC1Tqyc1uSOjx048j3JxTRKq0DuoRvYRZ9CWm/f/xdy2rmSEZUbpqysmp4L5ATa0By7MQM7jo2KnEZV/yq8UNoUl7I8OznG1eMz2kKvMlBw9AtHGK+QfLjLagQgyMGLx1T+9HwqaOQsEo6qQGkT3JAPME8rEAVYRP22+u3gYXiBCo09V+sqlma4k6URZpOf6G0pVBYv9m8Cm/ySO1gQAHNrQxRwxUFoZGVPniO5NZ9bQvXQH1gvOJnc8/Az2krJK3oe1LeKNIA== 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=iONzXXbFG5EY4pmUrHUObvJcUrGYR2leSAvowOrJ8AI=; b=VTDKm2re3g3ZK/YbJIckiBBlEv5pptBm3gSYILB0D2D+tnXz7ixCBB+/dLKrEBL473mNB/oz1sd9mfrKjfCPYv0VHL8dhtvbSPnjj1djh+TqiWaEAQSfvWGPl+btRsDJKpLW1ERigSB09c32z81tXokIfVrpxXK2kGLBK4PGOp4= Received: from SN6PR11MB2574.namprd11.prod.outlook.com (2603:10b6:805:59::14) by SA2PR11MB4905.namprd11.prod.outlook.com (2603:10b6:806:117::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3433.34; Wed, 7 Oct 2020 18:47:20 +0000 Received: from SN6PR11MB2574.namprd11.prod.outlook.com ([fe80::902d:8f85:ea05:a7a]) by SN6PR11MB2574.namprd11.prod.outlook.com ([fe80::902d:8f85:ea05:a7a%4]) with mapi id 15.20.3455.021; Wed, 7 Oct 2020 18:47:20 +0000 From: "Eads, Gage" To: "McDaniel, Timothy" CC: "dev@dpdk.org" , "Carrillo, Erik G" , "Van Haaren, Harry" , "jerinj@marvell.com" Thread-Topic: [PATCH 07/22] event/dlb2: add xstats Thread-Index: AQHWiHpXFiPIjbo2rEmKa16vJG5FeKmMl/mQ Date: Wed, 7 Oct 2020 18:47:20 +0000 Message-ID: References: <1599855987-25976-1-git-send-email-timothy.mcdaniel@intel.com> <1599855987-25976-8-git-send-email-timothy.mcdaniel@intel.com> In-Reply-To: <1599855987-25976-8-git-send-email-timothy.mcdaniel@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.5.1.3 dlp-product: dlpe-windows dlp-reaction: no-action authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [68.203.30.51] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 83efde95-387e-436d-f1c5-08d86af16bd9 x-ms-traffictypediagnostic: SA2PR11MB4905: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: NqhievKva/xXIIQZS/4kvVgtrgv4W3U5FWhCwEkFTlF43IqZxnMDQoZikcbZD58SKMCiHQ9CCnRLeIu+ji/lKpVZHL7UmESrupPbW5AjFHZRGg6/WWrHcuDmE0vKf8nUTvJP/x4S+tx2EbJCLJLjgeF302NhBvzG7N7B7CpWrCJUgThNLdrFoGiHGOjCXy2VbRc4bW+u2geFqcS/ocpv9tQehwiv4mbJf+GVB2gp/NUsZeNuDIxpLNJjAUNi1KOu4eZKa1TPMwFEI/nh72YQW5oPkXoxn0igXOaaokLMJB5MLArv3KSboTVEWig/hhe2GqhTrFHe7PNeQq0OQp3qNw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN6PR11MB2574.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(346002)(366004)(39860400002)(136003)(376002)(316002)(54906003)(71200400001)(83380400001)(7696005)(26005)(186003)(478600001)(86362001)(6506007)(52536014)(4326008)(6862004)(5660300002)(66556008)(9686003)(66446008)(64756008)(8936002)(66946007)(8676002)(2906002)(76116006)(55016002)(33656002)(66476007)(6636002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: R/wXEibX/4pZRVdvWz3pDO1KHYMs2R492LSa6swczj2C8S9YRzU15ag9sED9NRTXSZg/HJh8t0H4+AHZcxgwWHw6AX7nGKCi/zgPDBbuA5WNZawQzlREAwPSPwtk5D8MgDQh9P4VnCLnSE3NIoNp9HxmkfXHN1+2Dkx0YpaCQc5a6DKyRnv+0hiYA9vmj1Uvs7XMeHf8rcFez9y6+qdGCmxstAaINQgB2EJb/7Bq6CgAXFuiabz3xQ6mK6pw9rF6tFFD6AH4SwOiN/Abuwpr8V/rvpPgLkhyIgunAqqS0KbcRUpRmkewxtCMjoHv8MthxX7NHWrmcV8fq7+SW99vDPB5t9ykN3YGLwoJfQOhl29i2j5MJwJyMq+Qm2KvXX6IW9uqsZDTKE7X7KnO/XyUct63zAuZzAHGqswhZacMYI5opnnZKOtqCBTKss8JICAGci8xetR6L96Rp3PpWdr9GhFM3ml3fCr22oRwFuU1QxC287AC3DYF2n0ChZhaXcv0+TXmwr8HSBn4BJxXZLa4RBJjYttCcU69IUAyDia2xuozJPAUyVpPinL2bLt8PxL1h7tiYXqNQlNWkY907j+55BnUy53LOK/O24FdSbS+GdfYP50fdSWnZyTSwHSOTsv4MPMfoz2/sJ4VwRKWttQ4Lw== 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: SN6PR11MB2574.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 83efde95-387e-436d-f1c5-08d86af16bd9 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Oct 2020 18:47:20.0633 (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: HA/KCum0LzpGGpfHcWsz8l1FLGcbK7zdbAqj4BsTG1UVLBBhDPl3bjTyA0kpMUcHCReJkABWZyGNXsoxRORFYg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR11MB4905 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH 07/22] event/dlb2: add xstats X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" > diff --git a/drivers/event/dlb2/dlb2_xstats.c b/drivers/event/dlb2/dlb2_x= stats.c > new file mode 100644 > index 0000000..9a69d78 > --- /dev/null > +++ b/drivers/event/dlb2/dlb2_xstats.c > @@ -0,0 +1,1269 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2016-2020 Intel Corporation > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include +inttypes.h for the printf format specifiers (PRIu64, etc.) > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include Besides rte_malloc.h and rte_eventdev.h, I suspect the rest are unnecessary= . [...] > +int > +dlb2_eventdev_xstats_get_names(const struct rte_eventdev *dev, > + enum rte_event_dev_xstats_mode mode, uint8_t > queue_port_id, > + struct rte_event_dev_xstats_name *xstats_names, > + unsigned int *ids, unsigned int size) > +{ > + const struct dlb2_eventdev *dlb2 =3D dlb2_pmd_priv(dev); > + unsigned int i; > + unsigned int xidx =3D 0; > + > + RTE_SET_USED(mode); > + RTE_SET_USED(queue_port_id); Not needed, these variables are used below. > + > + uint32_t xstats_mode_count =3D 0; > + uint32_t start_offset =3D 0; > + > + switch (mode) { > + case RTE_EVENT_DEV_XSTATS_DEVICE: > + xstats_mode_count =3D dlb2->xstats_count_mode_dev; > + break; > + case RTE_EVENT_DEV_XSTATS_PORT: > + if (queue_port_id >=3D DLB2_MAX_NUM_PORTS) > + break; > + xstats_mode_count =3D dlb2- > >xstats_count_per_port[queue_port_id]; > + start_offset =3D dlb2->xstats_offset_for_port[queue_port_id]; > + break; > + case RTE_EVENT_DEV_XSTATS_QUEUE: > +#if (DLB2_MAX_NUM_QUEUES <=3D 255) /* max 8 bit value */ Looks like this macro is tied to the h/w definition, is it subject to grow? > + if (queue_port_id >=3D DLB2_MAX_NUM_QUEUES) > + break; > +#endif > + xstats_mode_count =3D dlb2- > >xstats_count_per_qid[queue_port_id]; > + start_offset =3D dlb2->xstats_offset_for_qid[queue_port_id]; > + break; > + default: > + return -EINVAL; > + }; > + > + if (xstats_mode_count > size || !ids || !xstats_names) > + return xstats_mode_count; > + > + for (i =3D 0; i < dlb2->xstats_count && xidx < size; i++) { > + if (dlb2->xstats[i].mode !=3D mode) > + continue; > + > + if (mode !=3D RTE_EVENT_DEV_XSTATS_DEVICE && > + queue_port_id !=3D dlb2->xstats[i].obj_idx) > + continue; > + > + xstats_names[xidx] =3D dlb2->xstats[i].name; > + if (ids) > + ids[xidx] =3D start_offset + xidx; > + xidx++; > + } > + return xidx; > +} > + > +static int > +dlb2_xstats_update(struct dlb2_eventdev *dlb2, > + enum rte_event_dev_xstats_mode mode, > + uint8_t queue_port_id, const unsigned int ids[], > + uint64_t values[], unsigned int n, const uint32_t reset) > +{ > + unsigned int i; > + unsigned int xidx =3D 0; > + > + RTE_SET_USED(mode); > + RTE_SET_USED(queue_port_id); > + Not needed, these variables are used below. > + uint32_t xstats_mode_count =3D 0; > + > + switch (mode) { > + case RTE_EVENT_DEV_XSTATS_DEVICE: > + xstats_mode_count =3D dlb2->xstats_count_mode_dev; > + break; > + case RTE_EVENT_DEV_XSTATS_PORT: > + if (queue_port_id >=3D DLB2_MAX_NUM_PORTS) > + goto invalid_value; > + xstats_mode_count =3D dlb2- > >xstats_count_per_port[queue_port_id]; > + break; > + case RTE_EVENT_DEV_XSTATS_QUEUE: > +#if (DLB2_MAX_NUM_QUEUES <=3D 255) /* max 8 bit value */ (Same comment as above) [...] > +int > +dlb2_eventdev_xstats_reset(struct rte_eventdev *dev, > + enum rte_event_dev_xstats_mode mode, > + int16_t queue_port_id, > + const uint32_t ids[], > + uint32_t nb_ids) > +{ > + struct dlb2_eventdev *dlb2 =3D dlb2_pmd_priv(dev); > + uint32_t i; > + > + /* handle -1 for queue_port_id here, looping over all ports/queues */ > + switch (mode) { > + case RTE_EVENT_DEV_XSTATS_DEVICE: > + if (dlb2_xstats_reset_dev(dlb2, ids, nb_ids)) > + return -EINVAL; > + break; > + case RTE_EVENT_DEV_XSTATS_PORT: > + if (queue_port_id =3D=3D -1) { > + for (i =3D 0; i < DLB2_MAX_NUM_PORTS; i++) { > + if (dlb2_xstats_reset_port(dlb2, i, > + ids, nb_ids)) Nit: argument alignment (occurs below as well) > + return -EINVAL; > + } > + } else if (queue_port_id < DLB2_MAX_NUM_PORTS) { > + if (dlb2_xstats_reset_port(dlb2, queue_port_id, > + ids, nb_ids)) > + return -EINVAL; > + } > + break; > + case RTE_EVENT_DEV_XSTATS_QUEUE: > + if (queue_port_id =3D=3D -1) { > + for (i =3D 0; i < DLB2_MAX_NUM_QUEUES; i++) { > + if (dlb2_xstats_reset_queue(dlb2, i, > + ids, nb_ids)) > + return -EINVAL; > + } > + } else if (queue_port_id < DLB2_MAX_NUM_QUEUES) { > + if (dlb2_xstats_reset_queue(dlb2, queue_port_id, > + ids, nb_ids)) > + return -EINVAL; > + } > + break; > + }; > + > + return 0; > +} Thanks, Gage