From: Kevin Laatz <kevin.laatz@intel.com>
To: dev@dpdk.org
Cc: anatoly.burakov@intel.com, Kevin Laatz <kevin.laatz@intel.com>,
Ray Kinsella <mdr@ashroe.eu>, David Hunt <david.hunt@intel.com>
Subject: [PATCH v6 2/4] lib/power: add get and set API for pause duration
Date: Thu, 2 Jun 2022 16:13:37 +0100 [thread overview]
Message-ID: <20220602151339.86968-3-kevin.laatz@intel.com> (raw)
In-Reply-To: <20220602151339.86968-1-kevin.laatz@intel.com>
Add new get/set API for configuring 'pause_duration' which used to adjust
the pause mode callback duration.
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: David Hunt <david.hunt@intel.com>
---
v6: fix unit of pause duration in doc
v5: add doc entry for new API
v3: changed printf to RTE_LOG
---
doc/guides/prog_guide/power_man.rst | 6 ++++++
lib/power/rte_power_pmd_mgmt.c | 25 +++++++++++++++++++++--
lib/power/rte_power_pmd_mgmt.h | 31 +++++++++++++++++++++++++++++
lib/power/version.map | 2 ++
4 files changed, 62 insertions(+), 2 deletions(-)
diff --git a/doc/guides/prog_guide/power_man.rst b/doc/guides/prog_guide/power_man.rst
index 5d345f6eb9..266c7544e5 100644
--- a/doc/guides/prog_guide/power_man.rst
+++ b/doc/guides/prog_guide/power_man.rst
@@ -258,6 +258,12 @@ API Overview for Ethernet PMD Power Management
* **Set Emptypoll Max**: Set the number of empty polls to wait before entering
sleep state.
+* **Get Pause Duration**: Get the configured duration (microseconds) to be used
+ in the Pause callback.
+
+* **Set Pause Duration**: Set the duration of the pause (microseconds) used in
+ the Pause mode callback.
+
References
----------
diff --git a/lib/power/rte_power_pmd_mgmt.c b/lib/power/rte_power_pmd_mgmt.c
index dfb7ca9187..1374cc213d 100644
--- a/lib/power/rte_power_pmd_mgmt.c
+++ b/lib/power/rte_power_pmd_mgmt.c
@@ -12,6 +12,7 @@
#include "rte_power_pmd_mgmt.h"
unsigned int emptypoll_max;
+unsigned int pause_duration;
/* store some internal state */
static struct pmd_conf_data {
@@ -315,6 +316,7 @@ clb_pause(uint16_t port_id __rte_unused, uint16_t qidx __rte_unused,
struct queue_list_entry *queue_conf = arg;
struct pmd_core_cfg *lcore_conf;
const bool empty = nb_rx == 0;
+ uint32_t pause_duration = rte_power_pmd_mgmt_get_pause_duration();
lcore_conf = &lcore_cfgs[lcore];
@@ -334,11 +336,11 @@ clb_pause(uint16_t port_id __rte_unused, uint16_t qidx __rte_unused,
if (global_data.intrinsics_support.power_pause) {
const uint64_t cur = rte_rdtsc();
const uint64_t wait_tsc =
- cur + global_data.tsc_per_us;
+ cur + global_data.tsc_per_us * pause_duration;
rte_power_pause(wait_tsc);
} else {
uint64_t i;
- for (i = 0; i < global_data.pause_per_us; i++)
+ for (i = 0; i < global_data.pause_per_us * pause_duration; i++)
rte_pause();
}
}
@@ -673,6 +675,24 @@ rte_power_pmd_mgmt_get_emptypoll_max(void)
return emptypoll_max;
}
+int
+rte_power_pmd_mgmt_set_pause_duration(unsigned int duration)
+{
+ if (duration == 0) {
+ RTE_LOG(ERR, POWER, "Pause duration must be greater than 0, value unchanged");
+ return -EINVAL;
+ }
+ pause_duration = duration;
+
+ return 0;
+}
+
+unsigned int
+rte_power_pmd_mgmt_get_pause_duration(void)
+{
+ return pause_duration;
+}
+
RTE_INIT(rte_power_ethdev_pmgmt_init) {
size_t i;
@@ -684,4 +704,5 @@ RTE_INIT(rte_power_ethdev_pmgmt_init) {
/* initialize config defaults */
emptypoll_max = 512;
+ pause_duration = 1;
}
diff --git a/lib/power/rte_power_pmd_mgmt.h b/lib/power/rte_power_pmd_mgmt.h
index d5a94f8187..18a9c3abb5 100644
--- a/lib/power/rte_power_pmd_mgmt.h
+++ b/lib/power/rte_power_pmd_mgmt.h
@@ -117,6 +117,37 @@ __rte_experimental
unsigned int
rte_power_pmd_mgmt_get_emptypoll_max(void);
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice.
+ *
+ * Set the pause_duration. Used to adjust the pause mode callback duration.
+ *
+ * @note Duration must be greater than zero.
+ *
+ * @param duration
+ * The value to set pause_duration to.
+ * @return
+ * 0 on success
+ * <0 on error
+ */
+__rte_experimental
+int
+rte_power_pmd_mgmt_set_pause_duration(unsigned int duration);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice.
+ *
+ * Get the current value of pause_duration.
+ *
+ * @return
+ * The current pause_duration value.
+ */
+__rte_experimental
+unsigned int
+rte_power_pmd_mgmt_get_pause_duration(void);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/power/version.map b/lib/power/version.map
index 812843c3f3..4673b719f9 100644
--- a/lib/power/version.map
+++ b/lib/power/version.map
@@ -41,5 +41,7 @@ EXPERIMENTAL {
# added in 22.07
rte_power_pmd_mgmt_get_emptypoll_max;
+ rte_power_pmd_mgmt_get_pause_duration;
rte_power_pmd_mgmt_set_emptypoll_max;
+ rte_power_pmd_mgmt_set_pause_duration;
};
--
2.31.1
next prev parent reply other threads:[~2022-06-02 15:12 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 ` [PATCH 1/4] lib/power: add get and set API for emptypoll max Kevin Laatz
2022-04-15 14:43 ` 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 ` Kevin Laatz [this message]
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=20220602151339.86968-3-kevin.laatz@intel.com \
--to=kevin.laatz@intel.com \
--cc=anatoly.burakov@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).