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 CFBC0A0C43; Wed, 12 May 2021 12:43:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5BDB14003F; Wed, 12 May 2021 12:43:18 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 7949C4003E for ; Wed, 12 May 2021 12:43:16 +0200 (CEST) IronPort-SDR: 9CtPIoaIGwcoTT2E8ZyiuyldjcfQIyIP6hM6VCfy8cXFa+c5x9ADNnpT7B3yJsw6uBOZ7sI3uB iZ480+ELvceQ== X-IronPort-AV: E=McAfee;i="6200,9189,9981"; a="196577915" X-IronPort-AV: E=Sophos;i="5.82,293,1613462400"; d="scan'208";a="196577915" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2021 03:43:13 -0700 IronPort-SDR: QSfnbWAezxt1Etddywsvz3hBnsitKT54H/3z5qZBH8O+CeGNWJ7Le8HLQToSsScF/YYxbf4E/i h7+pIJ4fJJLw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,293,1613462400"; d="scan'208";a="542021131" Received: from irsmsx605.ger.corp.intel.com ([163.33.146.138]) by orsmga004.jf.intel.com with ESMTP; 12 May 2021 03:43:12 -0700 Received: from irsmsx604.ger.corp.intel.com (163.33.146.137) by IRSMSX605.ger.corp.intel.com (163.33.146.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Wed, 12 May 2021 11:43:11 +0100 Received: from irsmsx604.ger.corp.intel.com ([163.33.146.137]) by IRSMSX604.ger.corp.intel.com ([163.33.146.137]) with mapi id 15.01.2106.013; Wed, 12 May 2021 11:43:11 +0100 From: "Loftus, Ciara" To: "Burakov, Anatoly" CC: "dev@dpdk.org" , "Zhang, Qi Z" Thread-Topic: [21.08 PATCH v1 2/2] net/af_xdp: add power monitor support Thread-Index: AQHXRnr4O0fUCjLxxEqIoni3zbFfOqrfqJvw Date: Wed, 12 May 2021 10:43:11 +0000 Message-ID: <2c29518887a146acbd5b3987dd96fcdc@intel.com> References: <819ef1ace187365a615d3383e54579e3d9fb216e.1620747068.git.anatoly.burakov@intel.com> <9dabec2f673cbf733a958a23a9769802e9adf852.1620747068.git.anatoly.burakov@intel.com> In-Reply-To: <9dabec2f673cbf733a958a23a9769802e9adf852.1620747068.git.anatoly.burakov@intel.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 x-originating-ip: [163.33.253.164] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [21.08 PATCH v1 2/2] net/af_xdp: add power monitor support 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" >=20 > Implement support for .get_monitor_addr in AF_XDP driver. >=20 > Signed-off-by: Anatoly Burakov > --- > drivers/net/af_xdp/rte_eth_af_xdp.c | 52 ++++++++++++++++++++--------- > 1 file changed, 37 insertions(+), 15 deletions(-) >=20 > diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c > b/drivers/net/af_xdp/rte_eth_af_xdp.c > index 0c91a40c4a..a4b4a4b75d 100644 > --- a/drivers/net/af_xdp/rte_eth_af_xdp.c > +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c > @@ -37,6 +37,7 @@ > #include > #include > #include > +#include >=20 > #include "compat.h" >=20 > @@ -778,6 +779,26 @@ eth_dev_configure(struct rte_eth_dev *dev) > return 0; > } >=20 > +static int > +eth_get_monitor_addr(void *rx_queue, struct rte_power_monitor_cond > *pmc) > +{ > + struct pkt_rx_queue *rxq =3D rx_queue; > + unsigned int *prod =3D rxq->fq.producer; > + const uint32_t cur_val =3D rxq->fq.cached_prod; /* use cached value The above two lines should use the producer from the rx ring 'rx' instead o= f the fill queue 'fq'. So instead of rxq->fq.* should be rxq->rx.* Other than that, and once the additional whitespace you identified below is= removed it LGTM. Thanks, Ciara > */ > + > + /* watch for changes in producer ring */ > + pmc->addr =3D (void*)prod; > + > + /* store current value */ > + pmc->val =3D cur_val; > + pmc->mask =3D (uint32_t)~0; /* mask entire uint32_t value */ > + > + /* AF_XDP producer ring index is 32-bit */ > + pmc->size =3D sizeof(uint32_t); > + > + return 0; > +} > + > static int > eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) > { > @@ -1423,21 +1444,22 @@ eth_dev_promiscuous_disable(struct > rte_eth_dev *dev) > } >=20 > static const struct eth_dev_ops ops =3D { > - .dev_start =3D eth_dev_start, > - .dev_stop =3D eth_dev_stop, > - .dev_close =3D eth_dev_close, > - .dev_configure =3D eth_dev_configure, > - .dev_infos_get =3D eth_dev_info, > - .mtu_set =3D eth_dev_mtu_set, > - .promiscuous_enable =3D eth_dev_promiscuous_enable, > - .promiscuous_disable =3D eth_dev_promiscuous_disable, > - .rx_queue_setup =3D eth_rx_queue_setup, > - .tx_queue_setup =3D eth_tx_queue_setup, > - .rx_queue_release =3D eth_queue_release, > - .tx_queue_release =3D eth_queue_release, > - .link_update =3D eth_link_update, > - .stats_get =3D eth_stats_get, > - .stats_reset =3D eth_stats_reset, > + .dev_start =3D eth_dev_start, > + .dev_stop =3D eth_dev_stop, > + .dev_close =3D eth_dev_close, > + .dev_configure =3D eth_dev_configure, > + .dev_infos_get =3D eth_dev_info, > + .mtu_set =3D eth_dev_mtu_set, > + .promiscuous_enable =3D eth_dev_promiscuous_enable, > + .promiscuous_disable =3D eth_dev_promiscuous_disable, > + .rx_queue_setup =3D eth_rx_queue_setup, > + .tx_queue_setup =3D eth_tx_queue_setup, > + .rx_queue_release =3D eth_queue_release, > + .tx_queue_release =3D eth_queue_release, > + .link_update =3D eth_link_update, > + .stats_get =3D eth_stats_get, > + .stats_reset =3D eth_stats_reset, > + .get_monitor_addr =3D eth_get_monitor_addr > }; >=20 > /** parse busy_budget argument */ > -- > 2.25.1