DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kevin Laatz <kevin.laatz@intel.com>
To: dev@dpdk.org
Cc: Kevin Laatz <kevin.laatz@intel.com>,
	David Hunt <david.hunt@intel.com>, Ray Kinsella <mdr@ashroe.eu>
Subject: [PATCH 1/4] lib/power: add get and set API for emptypoll max
Date: Fri,  8 Apr 2022 15:08:44 +0100	[thread overview]
Message-ID: <20220408140847.1319312-2-kevin.laatz@intel.com> (raw)
In-Reply-To: <20220408140847.1319312-1-kevin.laatz@intel.com>

Add new get/set APIs to configure emptypoll max which is used to
determine when a queue can go into sleep state.

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
---
 lib/power/rte_power_pmd_mgmt.c | 21 ++++++++++++++++++---
 lib/power/rte_power_pmd_mgmt.h | 27 +++++++++++++++++++++++++++
 lib/power/version.map          |  4 ++++
 3 files changed, 49 insertions(+), 3 deletions(-)

diff --git a/lib/power/rte_power_pmd_mgmt.c b/lib/power/rte_power_pmd_mgmt.c
index 39a2b4cd23..dfb7ca9187 100644
--- a/lib/power/rte_power_pmd_mgmt.c
+++ b/lib/power/rte_power_pmd_mgmt.c
@@ -11,7 +11,7 @@
 
 #include "rte_power_pmd_mgmt.h"
 
-#define EMPTYPOLL_MAX  512
+unsigned int emptypoll_max;
 
 /* store some internal state */
 static struct pmd_conf_data {
@@ -206,7 +206,7 @@ queue_can_sleep(struct pmd_core_cfg *cfg, struct queue_list_entry *qcfg)
 	qcfg->n_empty_polls++;
 
 	/* if we haven't reached threshold for empty polls, we can't sleep */
-	if (qcfg->n_empty_polls <= EMPTYPOLL_MAX)
+	if (qcfg->n_empty_polls <= emptypoll_max)
 		return false;
 
 	/*
@@ -290,7 +290,7 @@ clb_umwait(uint16_t port_id, uint16_t qidx, struct rte_mbuf **pkts __rte_unused,
 	/* this callback can't do more than one queue, omit multiqueue logic */
 	if (unlikely(nb_rx == 0)) {
 		queue_conf->n_empty_polls++;
-		if (unlikely(queue_conf->n_empty_polls > EMPTYPOLL_MAX)) {
+		if (unlikely(queue_conf->n_empty_polls > emptypoll_max)) {
 			struct rte_power_monitor_cond pmc;
 			int ret;
 
@@ -661,6 +661,18 @@ rte_power_ethdev_pmgmt_queue_disable(unsigned int lcore_id,
 	return 0;
 }
 
+void
+rte_power_pmd_mgmt_set_emptypoll_max(unsigned int max)
+{
+	emptypoll_max = max;
+}
+
+unsigned int
+rte_power_pmd_mgmt_get_emptypoll_max(void)
+{
+	return emptypoll_max;
+}
+
 RTE_INIT(rte_power_ethdev_pmgmt_init) {
 	size_t i;
 
@@ -669,4 +681,7 @@ RTE_INIT(rte_power_ethdev_pmgmt_init) {
 		struct pmd_core_cfg *cfg = &lcore_cfgs[i];
 		TAILQ_INIT(&cfg->head);
 	}
+
+	/* initialize config defaults */
+	emptypoll_max = 512;
 }
diff --git a/lib/power/rte_power_pmd_mgmt.h b/lib/power/rte_power_pmd_mgmt.h
index 444e7b8a66..d5a94f8187 100644
--- a/lib/power/rte_power_pmd_mgmt.h
+++ b/lib/power/rte_power_pmd_mgmt.h
@@ -90,6 +90,33 @@ int
 rte_power_ethdev_pmgmt_queue_disable(unsigned int lcore_id,
 		uint16_t port_id, uint16_t queue_id);
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice.
+ *
+ * Set a emptypoll_max to specified value. Used to specify the number of empty
+ * polls to wait before entering sleep state.
+ *
+ * @param max
+ *   The value to set emptypoll_max to.
+ */
+__rte_experimental
+void
+rte_power_pmd_mgmt_set_emptypoll_max(unsigned int max);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice.
+ *
+ * Get the current value of emptypoll_max.
+ *
+ * @return
+ *   The current emptypoll_max value
+ */
+__rte_experimental
+unsigned int
+rte_power_pmd_mgmt_get_emptypoll_max(void);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/power/version.map b/lib/power/version.map
index 6ec6d5d96d..8bcd497e06 100644
--- a/lib/power/version.map
+++ b/lib/power/version.map
@@ -38,4 +38,8 @@ EXPERIMENTAL {
 	# added in 21.02
 	rte_power_ethdev_pmgmt_queue_disable;
 	rte_power_ethdev_pmgmt_queue_enable;
+
+	# added in 22.07
+	rte_power_pmd_mgmt_set_emptypoll_max;
+	rte_power_pmd_mgmt_get_emptypoll_max;
 };
-- 
2.31.1


  reply	other threads:[~2022-04-08 14:09 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-08 14:08 [PATCH 0/4] Add APIs for configurable power options Kevin Laatz
2022-04-08 14:08 ` Kevin Laatz [this message]
2022-04-15 14:43   ` [PATCH 1/4] lib/power: add get and set API for emptypoll max Ray Kinsella
2022-04-19 11:25     ` Kevin Laatz
2022-04-08 14:08 ` [PATCH 2/4] lib/power: add get and set API for pause duration Kevin Laatz
2022-04-08 14:08 ` [PATCH 3/4] lib/power: add get and set API for scaling freq min and max with pstate mode Kevin Laatz
2022-04-08 14:08 ` [PATCH 4/4] examples/l3fwd_power: add cli for configurable options Kevin Laatz
2022-04-19 11:24 ` [PATCH v2 0/4] Add APIs for configurable power options Kevin Laatz
2022-04-19 11:24   ` [PATCH v2 1/4] lib/power: add get and set API for emptypoll max Kevin Laatz
2022-04-19 15:42     ` Ray Kinsella
2022-04-19 11:24   ` [PATCH v2 2/4] lib/power: add get and set API for pause duration Kevin Laatz
2022-04-19 15:42     ` Ray Kinsella
2022-05-18  8:58     ` Burakov, Anatoly
2022-04-19 11:25   ` [PATCH v2 3/4] lib/power: add get and set API for scaling freq min and max with pstate mode Kevin Laatz
2022-04-19 15:43     ` Ray Kinsella
2022-05-18  9:05     ` Burakov, Anatoly
2022-05-23 16:25       ` Kevin Laatz
2022-04-19 11:25   ` [PATCH v2 4/4] examples/l3fwd_power: add cli for configurable options Kevin Laatz
2022-05-18  9:11     ` Burakov, Anatoly
2022-05-23 16:54       ` Kevin Laatz
2022-05-23 20:21   ` [PATCH v3 0/4] Add APIs for configurable power options Kevin Laatz
2022-05-23 20:21     ` [PATCH v3 1/4] lib/power: add get and set API for emptypoll max Kevin Laatz
2022-05-24 13:45       ` Ray Kinsella
2022-05-23 20:21     ` [PATCH v3 2/4] lib/power: add get and set API for pause duration Kevin Laatz
2022-05-23 20:21     ` [PATCH v3 3/4] lib/power: add get and set API for scaling freq min and max with pstate mode Kevin Laatz
2022-05-24 10:00       ` Burakov, Anatoly
2022-05-23 20:21     ` [PATCH v3 4/4] examples/l3fwd_power: add cli for configurable options Kevin Laatz
2022-05-24 10:03       ` Burakov, Anatoly
2022-05-24 13:14 ` [PATCH v4 0/4] Add APIs for configurable power options Kevin Laatz
2022-05-24 13:14   ` [PATCH v4 1/4] lib/power: add get and set API for emptypoll max Kevin Laatz
2022-05-24 14:40     ` David Hunt
2022-05-24 13:14   ` [PATCH v4 2/4] lib/power: add get and set API for pause duration Kevin Laatz
2022-05-24 14:39     ` David Hunt
2022-05-24 13:14   ` [PATCH v4 3/4] lib/power: add get and set API for scaling freq min and max with pstate mode Kevin Laatz
2022-05-24 14:39     ` David Hunt
2022-05-24 13:14   ` [PATCH v4 4/4] examples/l3fwd_power: add cli for configurable options Kevin Laatz
2022-05-24 14:38     ` David Hunt
2022-05-27 16:04   ` [PATCH v4 0/4] Add APIs for configurable power options Burakov, Anatoly
2022-05-31  9:59 ` [PATCH v5 " Kevin Laatz
2022-05-31  9:59   ` [PATCH v5 1/4] lib/power: add get and set API for emptypoll max Kevin Laatz
2022-05-31  9:59   ` [PATCH v5 2/4] lib/power: add get and set API for pause duration Kevin Laatz
2022-06-02 14:01     ` Burakov, Anatoly
2022-06-02 14:53       ` Kevin Laatz
2022-05-31  9:59   ` [PATCH v5 3/4] lib/power: add get and set API for scaling freq min and max with pstate mode Kevin Laatz
2022-05-31  9:59   ` [PATCH v5 4/4] examples/l3fwd_power: add cli for configurable options Kevin Laatz
2022-06-02 15:13 ` [PATCH v6 0/4] Add APIs for configurable power options Kevin Laatz
2022-06-02 15:13   ` [PATCH v6 1/4] lib/power: add get and set API for emptypoll max Kevin Laatz
2022-06-02 15:13   ` [PATCH v6 2/4] lib/power: add get and set API for pause duration Kevin Laatz
2022-06-02 15:13   ` [PATCH v6 3/4] lib/power: add get and set API for scaling freq min and max with pstate mode Kevin Laatz
2022-06-02 15:13   ` [PATCH v6 4/4] examples/l3fwd_power: add cli for configurable options Kevin Laatz
2022-06-04 20:43   ` [PATCH v6 0/4] Add APIs for configurable power options Thomas Monjalon

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=20220408140847.1319312-2-kevin.laatz@intel.com \
    --to=kevin.laatz@intel.com \
    --cc=david.hunt@intel.com \
    --cc=dev@dpdk.org \
    --cc=mdr@ashroe.eu \
    /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).