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 CD84CA04BC; Thu, 8 Oct 2020 22:53:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 134FC1B7D8; Thu, 8 Oct 2020 22:53:40 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 2665E1B7C0 for ; Thu, 8 Oct 2020 22:53:36 +0200 (CEST) IronPort-SDR: Cz9/c8h0o8wql/wiBFoXMFGCEX5o7XtVnNtXFXhjnn3NjVPVuuMWbCVQUelEal/HvUyCKTf6Fn dPCe8XCXciww== X-IronPort-AV: E=McAfee;i="6000,8403,9768"; a="152323690" X-IronPort-AV: E=Sophos;i="5.77,352,1596524400"; d="scan'208";a="152323690" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Oct 2020 13:53:34 -0700 IronPort-SDR: Iq+st5KeOFwXEydT0/uVXY5GXYhZkDBKIq1PS1UdkbW5fiBzql+1oFNmjSvndSdrtjIcV80PBI QQd6y+Yknj+w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,352,1596524400"; d="scan'208";a="518429442" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by fmsmga006.fm.intel.com with ESMTP; 08 Oct 2020 13:53:34 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) 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.1713.5; Thu, 8 Oct 2020 13:53:33 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 8 Oct 2020 13:53:33 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.41) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Thu, 8 Oct 2020 13:53:33 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hNO5HYjlsHydAVB82DANYWUjarckym6L10iP8Xn8L4hxZzJTq30LuDJzrM55+yJlp/ALeZP+u+yjdbZnwKBXaqemvv5N5ZIeTO7bUCx9pm6ViFBhC4JqpG08DiWZibKeO0Rzsrf1dz9BnQx33z22edXjYxUx2/9gOn6JfJYpLQeyv/1CuiG1VONtoSAzljvXaMW+lBTMKr7iLLuVlHZJD9XutWJjhflwDRvg8rB7LL6tHTqBYccujJKftLytj5D8VCravbQf9f5arBMjX+jl1fbz/IqZIiqDFoAxdzWU2QUj6TBZ5eHOCedFTo30w41EY9+VtEo8CXHxhDzcLo1prQ== 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=nSBXspDRi+l573iyc+mLpvWIdPfOcWLowBJ7O7pTWMk=; b=db9IRCwLOb3+ozxKJxhFICVutGcjrGYXFLEHGsM/wKbLPuo/vVmsV/P1pYOzNHiSLdIYleFVyorHmZicTlBAqqSRt9vPrufQxImNXdmWTBT0ILs7ijDDT9/wSM44LKWtLapRFe7XzlIc3x7k2F71z/UoWMvGaRODPxgd2/VtwiZHzZxr5WdfVqOO00azUysCUU6BhcCMoe3gg7TTqRptco3KLzWZ2nKkvqnNIpOtvW7Sh5YKg2bqbKhktQzHUVtl/PyGNji8EyV+1qZsb1Shpwftwcjard6mk3MkqCU6/Mr6/8xgd2K18lN5Qq3lTGDK7FRqdNGxpN4GaBM7UnPqbA== 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=nSBXspDRi+l573iyc+mLpvWIdPfOcWLowBJ7O7pTWMk=; b=Esp6lRlrVY8FXg3WMFT4eLUb+eVo4Wvciu0M3RP5upN1HLz/ZTbt6Rk853CiHJkanBTAlMf4T3C+SMtbJrsRIZr+h2bUgkYNux+DxhNqyoqWdpqU8KdR5UaDkEaFXFVV9uyt4pL3nRkNO4XSy5/hfGt59cpKVqQIfhZaIQ296iU= Received: from SN6PR11MB2574.namprd11.prod.outlook.com (2603:10b6:805:59::14) by SA0PR11MB4526.namprd11.prod.outlook.com (2603:10b6:806:96::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.24; Thu, 8 Oct 2020 20:53:33 +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.024; Thu, 8 Oct 2020 20:53:33 +0000 From: "Eads, Gage" To: "McDaniel, Timothy" CC: "dev@dpdk.org" , "Carrillo, Erik G" , "Van Haaren, Harry" , "jerinj@marvell.com" Thread-Topic: [PATCH v4 07/22] event/dlb: add xstats Thread-Index: AQHWiHDbWcUMPomLLkSulLsQUZ/bOqmOVZ0w Date: Thu, 8 Oct 2020 20:53:32 +0000 Message-ID: References: <1599851920-16802-1-git-send-email-timothy.mcdaniel@intel.com> <1599851920-16802-8-git-send-email-timothy.mcdaniel@intel.com> In-Reply-To: <1599851920-16802-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: 53e87c80-fc8d-4e40-c525-08d86bcc3802 x-ms-traffictypediagnostic: SA0PR11MB4526: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6790; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: /gsTtlqumBuqP6KsySeUwgHljpaD1db1FlfrkxDcY+r3H4req8r/cpPDgsRPg8buuW8wijelt0+tv79ruKSTiruH8qZqEioVrS5Z+fDp9+Be3SjVjPN60gjF3YRAGr+UNndDybM4ebc7Bel0DF5w2naUE01ABRDZlG+jXOxinmUq5tdsXbpqCEofz6C5cC9Ce4ciHKsgmM30nRprUfHMT6VgQe8UVOKSfyw5XTbBBi9JRR8kmHFEHKaJ4SxcNC53kCsCOqbPRvjOGWKce3l2FG3gVxMtwOEmmHhdeqj5EAmNwSXzFKbyDtc/qMBfo+zW 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)(366004)(346002)(396003)(376002)(136003)(39860400002)(66446008)(66946007)(83380400001)(5660300002)(8676002)(478600001)(6862004)(52536014)(186003)(26005)(86362001)(6506007)(7696005)(33656002)(6636002)(71200400001)(66476007)(9686003)(2906002)(4326008)(8936002)(66556008)(64756008)(55016002)(76116006)(316002)(54906003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: r/OINV5X8B6QwdVVH22VQZOQpa2BW6hEGMaL/JqOlssNH7M0nNbRS+MTjjtyd2OB7Onwuo0Nm3MnUKlx4k1MvUCb2QlCzUFHi0LvK6843LYm9ekZdFFqDRgJy8jYFi2XFY9g5UutlUl82Q82hj/h7IIaDF3pZu8ZYK3/zFLPBnRcbbpOZDkD/AhAm4HkI2uEqBYI7FBFYi22r/2PB0At385oUA95OZCiPZz3CyH9FoxAG7Gg+apbTIeBpYi1iWmK4XZ0Pu27zI3TMnq9w04SGv3rRsGX66Ogje1e7Uhc1wSxw4xLkfrUKJn3/aZ1941pDBE4mbT6tjagFPc538IzGOMbttTPESChfZLNGlGBaPfffP5ohqv5g6s6dmdZOdnzkXKUYy7C7DH3xcmJXwFY/mQJs9lSDDH4Iws7nsLoEh6ZZdpoUBH52iyhokMj52wE5mLZWfNXXWiiIxEC1Mr6l8TeOED7BTEcRL1QJ2Q5/U/4vxISgyngzjZCnWZibG3VGOg1NjWeg7XHyF4DxG2Z54+PWAD3PHwpXBItjdlhcEzBCOW0/PWivjKKo6847wC/CTdBRDHsSVnuTE/P5o0/24Peny7pQylK546LqQN5FM0eT2w/a1mhVzDErSEH7drLYUidu1o5r99GF7gZyqD/mg== 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: 53e87c80-fc8d-4e40-c525-08d86bcc3802 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Oct 2020 20:53:32.8622 (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: f8G3GoKXpxAJYYtBPV1//ulTlghdpnroTztytFKFomDS4LzTCvTWYoz5MFgXHhLdJf2Aqjiq7+XSvjRSlJ3xRg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR11MB4526 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v4 07/22] event/dlb: 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/dlb/dlb_xstats.c b/drivers/event/dlb/dlb_xstat= s.c > new file mode 100644 > index 0000000..4d01cc0 > --- /dev/null > +++ b/drivers/event/dlb/dlb_xstats.c > @@ -0,0 +1,1252 @@ > +/* 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 > +#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 > +dlb_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 dlb_eventdev *dlb =3D dlb_pmd_priv(dev); > + unsigned int i; > + unsigned int xidx =3D 0; > + > + RTE_SET_USED(mode); > + RTE_SET_USED(queue_port_id); RTE_SET_USED not needed for mode and queue_port_id > + > + 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 dlb->xstats_count_mode_dev; > + break; > + case RTE_EVENT_DEV_XSTATS_PORT: > + if (queue_port_id >=3D DLB_MAX_NUM_PORTS) > + break; > + xstats_mode_count =3D dlb- > >xstats_count_per_port[queue_port_id]; > + start_offset =3D dlb->xstats_offset_for_port[queue_port_id]; > + break; > + case RTE_EVENT_DEV_XSTATS_QUEUE: > +#if (DLB_MAX_NUM_QUEUES <=3D 255) /* max 8 bit value */ If this macro is tied to the hardware definition, will it change? > + if (queue_port_id >=3D DLB_MAX_NUM_QUEUES) > + break; > +#endif > + xstats_mode_count =3D dlb- > >xstats_count_per_qid[queue_port_id]; > + start_offset =3D dlb->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 < dlb->xstats_count && xidx < size; i++) { > + if (dlb->xstats[i].mode !=3D mode) > + continue; > + > + if (mode !=3D RTE_EVENT_DEV_XSTATS_DEVICE && > + queue_port_id !=3D dlb->xstats[i].obj_idx) > + continue; > + > + xstats_names[xidx] =3D dlb->xstats[i].name; > + if (ids) > + ids[xidx] =3D start_offset + xidx; > + xidx++; > + } > + return xidx; > +} > + > +static int > +dlb_xstats_update(struct dlb_eventdev *dlb, > + 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); RTE_SET_USED not needed for mode and queue_port_id > + > + uint32_t xstats_mode_count =3D 0; > + > + switch (mode) { > + case RTE_EVENT_DEV_XSTATS_DEVICE: > + xstats_mode_count =3D dlb->xstats_count_mode_dev; > + break; > + case RTE_EVENT_DEV_XSTATS_PORT: > + if (queue_port_id >=3D DLB_MAX_NUM_PORTS) > + goto invalid_value; > + xstats_mode_count =3D dlb- > >xstats_count_per_port[queue_port_id]; > + break; > + case RTE_EVENT_DEV_XSTATS_QUEUE: > +#if (DLB_MAX_NUM_QUEUES <=3D 255) /* max 8 bit value */ (See comment above) [...] > +void > +dlb_eventdev_dump(struct rte_eventdev *dev, FILE *f) > +{ > + struct dlb_eventdev *dlb; > + struct dlb_hw_dev *handle; > + int i; > + > + if (!f) { Like Mike pointed out the dlb2 review, avoid !pointer checks. Thanks, Gage