ethdev: add simple power management API

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 <liang.j.ma@intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
This commit is contained in:
Liang Ma 2021-01-14 14:46:08 +00:00 committed by Thomas Monjalon
parent 55243435f5
commit 1fe3eef5e9
6 changed files with 88 additions and 0 deletions

View File

@ -7,3 +7,7 @@
symbol_version = INTERNAL symbol_version = INTERNAL
[suppress_variable] [suppress_variable]
symbol_version = INTERNAL symbol_version = INTERNAL
; Explicit ignore for driver-only ABI
[suppress_type]
name = eth_dev_ops

View File

@ -55,6 +55,11 @@ New Features
Also, make sure to start the actual text at the margin. Also, make sure to start the actual text at the margin.
======================================================= =======================================================
* **Added new ethdev API for PMD power management.**
Added ``rte_eth_get_monitor_addr()``, to be used in conjunction with
``rte_power_monitor()`` to enable automatic power management for PMDs.
* **Updated Broadcom bnxt driver.** * **Updated Broadcom bnxt driver.**
Updated the Broadcom bnxt driver with fixes and improvements, including: Updated the Broadcom bnxt driver with fixes and improvements, including:

View File

@ -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)); 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 int
rte_eth_dev_set_mc_addr_list(uint16_t port_id, rte_eth_dev_set_mc_addr_list(uint16_t port_id,
struct rte_ether_addr *mc_addr_set, struct rte_ether_addr *mc_addr_set,

View File

@ -157,6 +157,7 @@ extern "C" {
#include <rte_common.h> #include <rte_common.h>
#include <rte_config.h> #include <rte_config.h>
#include <rte_ether.h> #include <rte_ether.h>
#include <rte_power_intrinsics.h>
#include "rte_ethdev_trace_fp.h" #include "rte_ethdev_trace_fp.h"
#include "rte_dev_info.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, int rte_eth_tx_burst_mode_get(uint16_t port_id, uint16_t queue_id,
struct rte_eth_burst_mode *mode); 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 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 * Retrieve device registers and register attributes (number of registers and
* register size) * register size)

View File

@ -763,6 +763,26 @@ typedef int (*eth_hairpin_queue_peer_unbind_t)
(struct rte_eth_dev *dev, uint16_t cur_queue, uint32_t direction); (struct rte_eth_dev *dev, uint16_t cur_queue, uint32_t direction);
/**< @internal Unbind peer queue from the current queue. */ /**< @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. * @internal A structure containing the functions exported by an Ethernet driver.
*/ */
@ -917,6 +937,9 @@ struct eth_dev_ops {
/**< Set up the connection between the pair of hairpin queues. */ /**< Set up the connection between the pair of hairpin queues. */
eth_hairpin_queue_peer_unbind_t hairpin_queue_peer_unbind; eth_hairpin_queue_peer_unbind_t hairpin_queue_peer_unbind;
/**< Disconnect the hairpin queues of a pair from each other. */ /**< 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. */
}; };
/** /**

View File

@ -240,6 +240,9 @@ EXPERIMENTAL {
rte_flow_get_restore_info; rte_flow_get_restore_info;
rte_flow_tunnel_action_decap_release; rte_flow_tunnel_action_decap_release;
rte_flow_tunnel_item_release; rte_flow_tunnel_item_release;
# added in 21.02
rte_eth_get_monitor_addr;
}; };
INTERNAL { INTERNAL {