From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C74BAA0542; Tue, 31 May 2022 11:58:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1718540E64; Tue, 31 May 2022 11:58:27 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 165B3400D6 for ; Tue, 31 May 2022 11:58:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653991105; x=1685527105; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3KFf6SRK02/0sK2bPowc/+xxiYkl09X2bql+NtAMQ9c=; b=WZHOmsEcotISMIvynRe7E65eYuQ3TS9X4t6pOUoqBXYLmw0nRL430gxr dj0ofrsy8rw4UMoFfkuJUPwsAMFaEVC3c9Cy1mlhPrmt9LoUWwx5LJwHs AVDtYoyujrrxB25ApzQT2I7lNixnp2n0913GrrFNrw5ye0JuXV/zMI587 /8P65WeVJsVrE9qVvnbDlFb/88za3azP40/7GN7jMOssPQgCeDWMAyhlD msiWYYy3I8KVIRdUUhkhpacvQiVs/kQFeUunHMJwxozJ8fya1hh3ZhnWB 9MSnQB/v9h8Xnhl7wARwmybjJr0z2ccanTB4VYxd+169rzNfrg2Pcmnsy w==; X-IronPort-AV: E=McAfee;i="6400,9594,10363"; a="338248408" X-IronPort-AV: E=Sophos;i="5.91,264,1647327600"; d="scan'208";a="338248408" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 May 2022 02:58:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,264,1647327600"; d="scan'208";a="679507629" Received: from silpixa00401122.ir.intel.com ([10.237.213.29]) by fmsmga002.fm.intel.com with ESMTP; 31 May 2022 02:58:23 -0700 From: Kevin Laatz To: dev@dpdk.org Cc: anatoly.burakov@intel.com, Kevin Laatz , Ray Kinsella , David Hunt Subject: [PATCH v5 1/4] lib/power: add get and set API for emptypoll max Date: Tue, 31 May 2022 10:59:33 +0100 Message-Id: <20220531095936.1965727-2-kevin.laatz@intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220531095936.1965727-1-kevin.laatz@intel.com> References: <20220408140847.1319312-1-kevin.laatz@intel.com> <20220531095936.1965727-1-kevin.laatz@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 Acked-by: Ray Kinsella Tested-by: David Hunt --- v5: add doc entry for new API --- doc/guides/prog_guide/power_man.rst | 6 ++++++ lib/power/rte_power_pmd_mgmt.c | 21 ++++++++++++++++++--- lib/power/rte_power_pmd_mgmt.h | 27 +++++++++++++++++++++++++++ lib/power/version.map | 4 ++++ 4 files changed, 55 insertions(+), 3 deletions(-) diff --git a/doc/guides/prog_guide/power_man.rst b/doc/guides/prog_guide/power_man.rst index 4484a94dc8..5d345f6eb9 100644 --- a/doc/guides/prog_guide/power_man.rst +++ b/doc/guides/prog_guide/power_man.rst @@ -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 ---------- 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..812843c3f3 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_get_emptypoll_max; + rte_power_pmd_mgmt_set_emptypoll_max; }; -- 2.31.1