DPDK patches and discussions
 help / color / mirror / Atom feed
From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org, Ciara Loftus <ciara.loftus@intel.com>,
	Qi Zhang <qi.z.zhang@intel.com>
Subject: [dpdk-dev] [21.08 PATCH v1 2/2] net/af_xdp: add power monitor support
Date: Tue, 11 May 2021 15:31:53 +0000	[thread overview]
Message-ID: <9dabec2f673cbf733a958a23a9769802e9adf852.1620747068.git.anatoly.burakov@intel.com> (raw)
In-Reply-To: <819ef1ace187365a615d3383e54579e3d9fb216e.1620747068.git.anatoly.burakov@intel.com>

Implement support for .get_monitor_addr in AF_XDP driver.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 drivers/net/af_xdp/rte_eth_af_xdp.c | 52 ++++++++++++++++++++---------
 1 file changed, 37 insertions(+), 15 deletions(-)

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 <rte_malloc.h>
 #include <rte_ring.h>
 #include <rte_spinlock.h>
+#include <rte_power_intrinsics.h>
 
 #include "compat.h"
 
@@ -778,6 +779,26 @@ eth_dev_configure(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int
+eth_get_monitor_addr(void *rx_queue, struct rte_power_monitor_cond *pmc)
+{
+	struct pkt_rx_queue *rxq = rx_queue;
+	unsigned int *prod = rxq->fq.producer;
+	const uint32_t cur_val = rxq->fq.cached_prod; /* use cached value */
+
+	/* watch for changes in producer ring */
+	pmc->addr = (void*)prod;
+
+	/* store current value */
+	pmc->val = cur_val;
+	pmc->mask = (uint32_t)~0; /* mask entire uint32_t value */
+
+	/* AF_XDP producer ring index is 32-bit */
+	pmc->size = 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)
 }
 
 static const struct eth_dev_ops ops = {
-	.dev_start = eth_dev_start,
-	.dev_stop = eth_dev_stop,
-	.dev_close = eth_dev_close,
-	.dev_configure = eth_dev_configure,
-	.dev_infos_get = eth_dev_info,
-	.mtu_set = eth_dev_mtu_set,
-	.promiscuous_enable = eth_dev_promiscuous_enable,
-	.promiscuous_disable = eth_dev_promiscuous_disable,
-	.rx_queue_setup = eth_rx_queue_setup,
-	.tx_queue_setup = eth_tx_queue_setup,
-	.rx_queue_release = eth_queue_release,
-	.tx_queue_release = eth_queue_release,
-	.link_update = eth_link_update,
-	.stats_get = eth_stats_get,
-	.stats_reset = eth_stats_reset,
+    .dev_start = eth_dev_start,
+    .dev_stop = eth_dev_stop,
+    .dev_close = eth_dev_close,
+    .dev_configure = eth_dev_configure,
+    .dev_infos_get = eth_dev_info,
+    .mtu_set = eth_dev_mtu_set,
+    .promiscuous_enable = eth_dev_promiscuous_enable,
+    .promiscuous_disable = eth_dev_promiscuous_disable,
+    .rx_queue_setup = eth_rx_queue_setup,
+    .tx_queue_setup = eth_tx_queue_setup,
+    .rx_queue_release = eth_queue_release,
+    .tx_queue_release = eth_queue_release,
+    .link_update = eth_link_update,
+    .stats_get = eth_stats_get,
+    .stats_reset = eth_stats_reset,
+    .get_monitor_addr = eth_get_monitor_addr
 };
 
 /** parse busy_budget argument */
-- 
2.25.1


  reply	other threads:[~2021-05-11 15:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-11 15:31 [dpdk-dev] [21.08 PATCH v1 1/2] power: invert the monitor check Anatoly Burakov
2021-05-11 15:31 ` Anatoly Burakov [this message]
2021-05-11 15:37   ` [dpdk-dev] [21.08 PATCH v1 2/2] net/af_xdp: add power monitor support Burakov, Anatoly
2021-05-12 10:43   ` Loftus, Ciara
2021-06-01 15:02   ` Liang Ma
2021-05-11 15:39 ` [dpdk-dev] [21.08 PATCH v1 1/2] power: invert the monitor check Burakov, Anatoly
2021-05-12 17:57   ` Alexander Kozyrev
2021-05-11 16:28 ` McDaniel, Timothy
2021-05-25  9:15 ` Liu, Yong
2021-05-27 13:06   ` Burakov, Anatoly
2021-05-28  1:07     ` Liu, Yong
2021-05-28  9:09       ` Ananyev, Konstantin
2021-06-01 14:21         ` Burakov, Anatoly

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9dabec2f673cbf733a958a23a9769802e9adf852.1620747068.git.anatoly.burakov@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=ciara.loftus@intel.com \
    --cc=dev@dpdk.org \
    --cc=qi.z.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).