]> git.droids-corp.org - dpdk.git/commitdiff
power: add get/set empty-poll maximum API
authorKevin Laatz <kevin.laatz@intel.com>
Thu, 2 Jun 2022 15:13:36 +0000 (16:13 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Sat, 4 Jun 2022 20:37:47 +0000 (22:37 +0200)
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>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
Tested-by: David Hunt <david.hunt@intel.com>
doc/guides/prog_guide/power_man.rst
lib/power/rte_power_pmd_mgmt.c
lib/power/rte_power_pmd_mgmt.h
lib/power/version.map

index 4484a94dc8c90f5f956170a631762613da0b1d09..5d345f6eb9780733967396435d5475ac82159bbc 100644 (file)
@@ -252,6 +252,12 @@ API Overview for Ethernet PMD Power Management
 
 * **Queue Disable**: Disable power scheme for certain queue/port/core.
 
+* **Get Emptypoll Max**: Get the configured number of empty polls to wait before
+  entering sleep state.
+
+* **Set Emptypoll Max**: Set the number of empty polls to wait before entering
+  sleep state.
+
 References
 ----------
 
index 39a2b4cd23a2a23ae73aadbd2e8da595d7707027..dfb7ca91877b3ce086a7432c53adadf0838df4e3 100644 (file)
@@ -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;
 }
index 444e7b8a66354ebe9de3c1810674613f5d93b5ff..d5a94f818720815439d88196d16dc38f208da20c 100644 (file)
@@ -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
index 6ec6d5d96d71ee1725ffb5c39ac1bde5c0873f7a..812843c3f3fe7b873fd05ca6cde9ac04877d5ddd 100644 (file)
@@ -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_get_emptypoll_max;
+       rte_power_pmd_mgmt_set_emptypoll_max;
 };