DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: liujie5@linkdatatechnology.com
To: stephen@networkplumber.org
Cc: dev@dpdk.org, Jie Liu <liujie5@linkdatatechnology.com>
Subject: [PATCH v10 16/23] net/sxe2: implement get monitor address
Date: Sat, 27 Jun 2026 12:13:16 +0800	[thread overview]
Message-ID: <20260627041317.846560-1-liujie5@linkdatatechnology.com> (raw)
In-Reply-To: <20260626064954.361771-1-liujie5@linkdatatechnology.com>

From: Jie Liu <liujie5@linkdatatechnology.com>

This patch implements the 'get_monitor_addr' ethdev ops in the sxe2
PMD. This interface allows the Ethernet device to provide the
address of the next expected Rx descriptor to the power management
library.

The implementation calculates the address of the next Rx descriptor
based on the receive queue's current hardware ring position and
descriptor size. Applications can then use this address with
rte_power_monitor() to put the CPU into a low-power state until
new packets are written to the descriptor by the hardware.

Signed-off-by: Jie Liu <liujie5@linkdatatechnology.com>
---
 drivers/net/sxe2/sxe2_ethdev.c |  2 ++
 drivers/net/sxe2/sxe2_rx.c     | 21 +++++++++++++++++++++
 drivers/net/sxe2/sxe2_rx.h     |  2 ++
 3 files changed, 25 insertions(+)

diff --git a/drivers/net/sxe2/sxe2_ethdev.c b/drivers/net/sxe2/sxe2_ethdev.c
index 02ff6be322..d6efab239c 100644
--- a/drivers/net/sxe2/sxe2_ethdev.c
+++ b/drivers/net/sxe2/sxe2_ethdev.c
@@ -183,6 +183,8 @@ static const struct eth_dev_ops sxe2_eth_dev_ops = {
 	.queue_stats_mapping_set    = sxe2_queue_stats_mapping_set,
 
 	.fw_version_get             = sxe2_fw_version_string_get,
+
+	.get_monitor_addr           = sxe2_get_monitor_addr,
 };
 
 static int32_t sxe2_dev_configure(struct rte_eth_dev *dev)
diff --git a/drivers/net/sxe2/sxe2_rx.c b/drivers/net/sxe2/sxe2_rx.c
index 2495ab3ab7..820d4f0620 100644
--- a/drivers/net/sxe2/sxe2_rx.c
+++ b/drivers/net/sxe2/sxe2_rx.c
@@ -534,3 +534,24 @@ void __rte_cold sxe2_rxqs_all_stop(struct rte_eth_dev *dev)
 		}
 	}
 }
+
+static int32_t sxe2_monitor_callback(const uint64_t value,
+				 const uint64_t arg[RTE_POWER_MONITOR_OPAQUE_SZ] __rte_unused)
+{
+	const uint64_t dd_state = rte_cpu_to_le_64(SXE2_RX_DESC_STATUS_DD_MASK);
+	return (value & dd_state) == dd_state ? -1 : 0;
+}
+
+int32_t sxe2_get_monitor_addr(void *rx_queue, struct rte_power_monitor_cond *pmc)
+{
+	volatile union sxe2_rx_desc *rxdp;
+	struct sxe2_rx_queue *rxq = (struct sxe2_rx_queue *)rx_queue;
+
+	rxdp = &rxq->desc_ring[rxq->processing_idx];
+
+	pmc->addr = &rxdp->wb.status_err_ptype_len;
+	pmc->fn   = sxe2_monitor_callback;
+	pmc->size = sizeof(uint16_t);
+
+	return 0;
+}
diff --git a/drivers/net/sxe2/sxe2_rx.h b/drivers/net/sxe2/sxe2_rx.h
index 295d9005e0..c2582bc571 100644
--- a/drivers/net/sxe2/sxe2_rx.h
+++ b/drivers/net/sxe2/sxe2_rx.h
@@ -29,4 +29,6 @@ int32_t __rte_cold sxe2_rxqs_all_start(struct rte_eth_dev *dev);
 
 void __rte_cold sxe2_rxqs_all_stop(struct rte_eth_dev *dev);
 
+int32_t sxe2_get_monitor_addr(void *rx_queue, struct rte_power_monitor_cond *pmc);
+
 #endif /* SXE2_RX_H */
-- 
2.52.0


  parent reply	other threads:[~2026-06-27  4:13 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <220260625133139.207632-1-liujie5@linkdatatechnology.com>
2026-06-26  6:38 ` [PATCH v9 00/23] net/sxe2: added Linkdata sxe2 ethernet driver liujie5
2026-06-26 18:18   ` Stephen Hemminger
2026-06-26  6:38 ` [PATCH v9 01/23] net/sxe2: remove software statistics devargs liujie5
2026-06-26  6:39 ` [PATCH v9 02/23] net/sxe2: add Rx framework and packet types callback liujie5
2026-06-26  6:39 ` [PATCH v9 03/23] net/sxe2: support AVX512 vectorized path for Rx and Tx liujie5
2026-06-26  6:40 ` [PATCH v9 04/23] net/sxe2: add AVX2 vector data " liujie5
2026-06-26  6:40 ` [PATCH v9 05/23] net/sxe2: add link update callback liujie5
2026-06-26  6:41 ` [PATCH v9 06/23] net/sxe2: support L2 filtering and MAC config liujie5
2026-06-26  6:41 ` [PATCH v9 07/23] drivers: support RSS feature liujie5
2026-06-26  6:42 ` [PATCH v9 08/23] net/sxe2: support TM hierarchy and shaping liujie5
2026-06-26  6:42 ` [PATCH v9 09/23] net/sxe2: support IPsec inline protocol offload liujie5
2026-06-26  6:43 ` [PATCH v9 10/23] net/sxe2: support statistics and multi-process liujie5
2026-06-26  6:43 ` [PATCH v9 11/23] drivers: interrupt handling liujie5
2026-06-26  6:44 ` [PATCH v9 12/23] net/sxe2: add NEON vec Rx/Tx burst functions liujie5
2026-06-26  6:44 ` [PATCH v9 13/23] drivers: add support for VF representors liujie5
2026-06-26  6:45 ` [PATCH v9 14/23] net/sxe2: add support for custom UDP tunnel ports liujie5
2026-06-26  6:45 ` [PATCH v9 15/23] net/sxe2: support firmware version reading liujie5
2026-06-26  6:46 ` [PATCH v9 16/23] net/sxe2: implement get monitor address liujie5
2026-06-26  6:46 ` [PATCH v9 17/23] common/sxe2: add shared SFP module definitions liujie5
2026-06-26  6:47 ` [PATCH v9 18/23] net/sxe2: support SFP module info and EEPROM access liujie5
2026-06-26  6:47 ` [PATCH v9 19/23] net/sxe2: add mbuf validation in Tx debug mode liujie5
2026-06-26 18:21   ` Stephen Hemminger
2026-06-27  4:00     ` liujie5
2026-06-26  6:48 ` [PATCH v9 20/23] common/sxe2: add callback for memory event handling liujie5
2026-06-26  6:48 ` [PATCH v9 21/23] net/sxe2: add private devargs parsing liujie5
2026-06-26  6:49 ` [PATCH v9 22/23] net/sxe2: implement private dump info liujie5
2026-06-26  6:49 ` [PATCH v9 23/23] net/sxe2: update sxe2 feature matrix docs liujie5
2026-06-27  4:04   ` [PATCH v10 00/23] et/sxe2: added Linkdata sxe2 ethernet driver liujie5
2026-06-27  4:05   ` [PATCH v10 01/23] net/sxe2: remove software statistics devargs liujie5
2026-06-27  4:06   ` [PATCH v10 02/23] net/sxe2: add Rx framework and packet types callback liujie5
2026-06-27  4:06   ` [PATCH v10 03/23] net/sxe2: support AVX512 vectorized path for Rx and Tx liujie5
2026-06-27  4:07   ` [PATCH v10 04/23] net/sxe2: add AVX2 vector data " liujie5
2026-06-27  4:07   ` [PATCH v10 05/23] net/sxe2: add link update callback liujie5
2026-06-27  4:08   ` [PATCH v10 06/23] net/sxe2: support L2 filtering and MAC config liujie5
2026-06-27  4:08   ` [PATCH v10 07/23] drivers: support RSS feature liujie5
2026-06-27  4:09   ` [PATCH v10 08/23] net/sxe2: support TM hierarchy and shaping liujie5
2026-06-27  4:09   ` [PATCH v10 09/23] net/sxe2: support IPsec inline protocol offload liujie5
2026-06-27  4:10   ` [PATCH v10 10/23] net/sxe2: support statistics and multi-process liujie5
2026-06-27  4:10   ` [PATCH v10 11/23] drivers: interrupt handling liujie5
2026-06-27  4:11   ` [PATCH v10 12/23] net/sxe2: add NEON vec Rx/Tx burst functions liujie5
2026-06-27  4:11   ` [PATCH v10 13/23] drivers: add support for VF representors liujie5
2026-06-27  4:12   ` [PATCH v10 14/23] net/sxe2: add support for custom UDP tunnel ports liujie5
2026-06-27  4:12   ` [PATCH v10 15/23] net/sxe2: support firmware version reading liujie5
2026-06-27  4:13   ` liujie5 [this message]
2026-06-27  4:13   ` [PATCH v10 17/23] common/sxe2: add shared SFP module definitions liujie5
2026-06-27  4:14   ` [PATCH v10 18/23] net/sxe2: support SFP module info and EEPROM access liujie5
2026-06-27  4:14   ` [PATCH v10 19/23] net/sxe2: add mbuf validation in Tx debug mode liujie5
2026-06-27  4:15   ` [PATCH v10 20/23] common/sxe2: add callback for memory event handling liujie5
2026-06-27  4:15   ` [PATCH v10 21/23] net/sxe2: add private devargs parsing liujie5
2026-06-27  4:16   ` [PATCH v10 22/23] net/sxe2: implement private dump info liujie5
2026-06-27  4:16   ` [PATCH v10 23/23] net/sxe2: update sxe2 feature matrix docs liujie5

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=20260627041317.846560-1-liujie5@linkdatatechnology.com \
    --to=liujie5@linkdatatechnology.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    /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