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 A488CA0A02; Thu, 14 Jan 2021 15:47:20 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5F729141324; Thu, 14 Jan 2021 15:46:35 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 3EC3214131D for ; Thu, 14 Jan 2021 15:46:34 +0100 (CET) IronPort-SDR: 7bvdvYR5fYasNEoRqDFQ7S0TPXVRiGuUd5BbVT7/2cookfZiKb9hxtGl2Isc5YWPz3Ql5ilMNb ruoVZ/UgNYjw== X-IronPort-AV: E=McAfee;i="6000,8403,9863"; a="174870295" X-IronPort-AV: E=Sophos;i="5.79,347,1602572400"; d="scan'208";a="174870295" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jan 2021 06:46:33 -0800 IronPort-SDR: VGlcytSEYntk31Od4AUzPCiExRBlIBteBzS4xwf3DrcZAGno0KjcstrqjN8e/QZ7n4ys8sSv67 LqGjXKSs1Fqg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,347,1602572400"; d="scan'208";a="465271345" Received: from silpixa00399498.ir.intel.com (HELO silpixa00399498.ger.corp.intel.com) ([10.237.222.179]) by fmsmga001.fm.intel.com with ESMTP; 14 Jan 2021 06:46:31 -0800 From: Anatoly Burakov To: dev@dpdk.org Cc: Liang Ma , Ray Kinsella , Neil Horman , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko , konstantin.ananyev@intel.com, timothy.mcdaniel@intel.com, david.hunt@intel.com, bruce.richardson@intel.com, chris.macnamara@intel.com Date: Thu, 14 Jan 2021 14:46:08 +0000 Message-Id: <299417d0dc7c063461ed4ebec4d5bc9d0cf5afbd.1610635488.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v17 06/11] ethdev: add simple power management API 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 Sender: "dev" From: Liang Ma Add a simple API to allow getting the monitor conditions for power-optimized monitoring of the Rx queues from the PMD, as well as release notes information. Signed-off-by: Liang Ma Signed-off-by: Anatoly Burakov Acked-by: Andrew Rybchenko --- Notes: v17: - Added libabigail ignore for driver-only ABI in ethdev as suggested by David v13: - Fix typos and issues raised by Andrew devtools/libabigail.abignore | 3 +++ doc/guides/rel_notes/release_21_02.rst | 5 +++++ lib/librte_ethdev/rte_ethdev.c | 28 ++++++++++++++++++++++++++ lib/librte_ethdev/rte_ethdev.h | 25 +++++++++++++++++++++++ lib/librte_ethdev/rte_ethdev_driver.h | 22 ++++++++++++++++++++ lib/librte_ethdev/version.map | 3 +++ 6 files changed, 86 insertions(+) diff --git a/devtools/libabigail.abignore b/devtools/libabigail.abignore index 025f2c01bc..1c16114dce 100644 --- a/devtools/libabigail.abignore +++ b/devtools/libabigail.abignore @@ -7,3 +7,6 @@ symbol_version = INTERNAL [suppress_variable] symbol_version = INTERNAL +; Explicit ignore for driver-only ABI +[suppress_type] + name = eth_dev_ops diff --git a/doc/guides/rel_notes/release_21_02.rst b/doc/guides/rel_notes/release_21_02.rst index 706cbf8f0c..ec9958a141 100644 --- a/doc/guides/rel_notes/release_21_02.rst +++ b/doc/guides/rel_notes/release_21_02.rst @@ -55,6 +55,11 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **ethdev: added new API for PMD power management** + + * ``rte_eth_get_monitor_addr()``, to be used in conjunction with + ``rte_power_monitor()`` to enable automatic power management for PMD's. + Removed Items ------------- diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 17ddacc78d..e19dbd838b 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -5115,6 +5115,34 @@ rte_eth_tx_burst_mode_get(uint16_t port_id, uint16_t queue_id, dev->dev_ops->tx_burst_mode_get(dev, queue_id, mode)); } +int +rte_eth_get_monitor_addr(uint16_t port_id, uint16_t queue_id, + struct rte_power_monitor_cond *pmc) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + + dev = &rte_eth_devices[port_id]; + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_monitor_addr, -ENOTSUP); + + if (queue_id >= dev->data->nb_rx_queues) { + RTE_ETHDEV_LOG(ERR, "Invalid Rx queue_id=%u\n", queue_id); + return -EINVAL; + } + + if (pmc == NULL) { + RTE_ETHDEV_LOG(ERR, "Invalid power monitor condition=%p\n", + pmc); + return -EINVAL; + } + + return eth_err(port_id, + dev->dev_ops->get_monitor_addr(dev->data->rx_queues[queue_id], + pmc)); +} + int rte_eth_dev_set_mc_addr_list(uint16_t port_id, struct rte_ether_addr *mc_addr_set, diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index f5f8919186..ca0f91312e 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -157,6 +157,7 @@ extern "C" { #include #include #include +#include #include "rte_ethdev_trace_fp.h" #include "rte_dev_info.h" @@ -4334,6 +4335,30 @@ __rte_experimental int rte_eth_tx_burst_mode_get(uint16_t port_id, uint16_t queue_id, struct rte_eth_burst_mode *mode); +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Retrieve the monitor condition for a given receive queue. + * + * @param port_id + * The port identifier of the Ethernet device. + * @param queue_id + * The Rx queue on the Ethernet device for which information + * will be retrieved. + * @param pmc + * The pointer point to power-optimized monitoring condition structure. + * + * @return + * - 0: Success. + * -ENOTSUP: Operation not supported. + * -EINVAL: Invalid parameters. + * -ENODEV: Invalid port ID. + */ +__rte_experimental +int rte_eth_get_monitor_addr(uint16_t port_id, uint16_t queue_id, + struct rte_power_monitor_cond *pmc); + /** * Retrieve device registers and register attributes (number of registers and * register size) diff --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h index 0eacfd8425..3b3b0ec1a0 100644 --- a/lib/librte_ethdev/rte_ethdev_driver.h +++ b/lib/librte_ethdev/rte_ethdev_driver.h @@ -763,6 +763,26 @@ typedef int (*eth_hairpin_queue_peer_unbind_t) (struct rte_eth_dev *dev, uint16_t cur_queue, uint32_t direction); /**< @internal Unbind peer queue from the current queue. */ +/** + * @internal + * Get address of memory location whose contents will change whenever there is + * new data to be received on an Rx queue. + * + * @param rxq + * Ethdev queue pointer. + * @param pmc + * The pointer to power-optimized monitoring condition structure. + * @return + * Negative errno value on error, 0 on success. + * + * @retval 0 + * Success + * @retval -EINVAL + * Invalid parameters + */ +typedef int (*eth_get_monitor_addr_t)(void *rxq, + struct rte_power_monitor_cond *pmc); + /** * @internal A structure containing the functions exported by an Ethernet driver. */ @@ -917,6 +937,8 @@ struct eth_dev_ops { /**< Set up the connection between the pair of hairpin queues. */ eth_hairpin_queue_peer_unbind_t hairpin_queue_peer_unbind; /**< Disconnect the hairpin queues of a pair from each other. */ + eth_get_monitor_addr_t get_monitor_addr; + /**< Get power monitoring condition for Rx queue. */ }; /** diff --git a/lib/librte_ethdev/version.map b/lib/librte_ethdev/version.map index d3f5410806..a124e1e370 100644 --- a/lib/librte_ethdev/version.map +++ b/lib/librte_ethdev/version.map @@ -240,6 +240,9 @@ EXPERIMENTAL { rte_flow_get_restore_info; rte_flow_tunnel_action_decap_release; rte_flow_tunnel_item_release; + + # added in 21.02 + rte_eth_get_monitor_addr; }; INTERNAL { -- 2.25.1