eventdev/eth_rx: add event port get API

This patch introduces new api for retrieving event port id
of eth rx adapter.

Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
This commit is contained in:
Naga Harish K S V 2022-01-22 11:14:20 -06:00 committed by Jerin Jacob
parent 2e94304c84
commit 6ff2363130
4 changed files with 47 additions and 0 deletions

View File

@ -55,6 +55,10 @@ New Features
Also, make sure to start the actual text at the margin.
=======================================================
* **Added an API to retrieve event port id of ethdev Rx adapter.**
The new API ``rte_event_eth_rx_adapter_event_port_get()`` was added.
Removed Items
-------------

View File

@ -3123,6 +3123,26 @@ rte_event_eth_rx_adapter_service_id_get(uint8_t id, uint32_t *service_id)
return rx_adapter->service_inited ? 0 : -ESRCH;
}
int
rte_event_eth_rx_adapter_event_port_get(uint8_t id, uint8_t *event_port_id)
{
struct event_eth_rx_adapter *rx_adapter;
if (rxa_memzone_lookup())
return -ENOMEM;
RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
rx_adapter = rxa_id_to_adapter(id);
if (rx_adapter == NULL || event_port_id == NULL)
return -EINVAL;
if (rx_adapter->service_inited)
*event_port_id = rx_adapter->event_port_id;
return rx_adapter->service_inited ? 0 : -ESRCH;
}
int
rte_event_eth_rx_adapter_cb_register(uint8_t id,
uint16_t eth_dev_id,

View File

@ -37,6 +37,7 @@
* - rte_event_eth_rx_adapter_queue_conf_get()
* - rte_event_eth_rx_adapter_queue_stats_get()
* - rte_event_eth_rx_adapter_queue_stats_reset()
* - rte_event_eth_rx_adapter_event_port_get()
*
* The application creates an ethernet to event adapter using
* rte_event_eth_rx_adapter_create_ext() or rte_event_eth_rx_adapter_create()
@ -684,6 +685,25 @@ rte_event_eth_rx_adapter_queue_stats_reset(uint8_t id,
uint16_t eth_dev_id,
uint16_t rx_queue_id);
/**
* Retrieve the event port ID of an adapter. If the adapter doesn't use
* a rte_service function, this function returns -ESRCH.
*
* @param id
* Adapter identifier.
*
* @param [out] event_port_id
* A pointer to a uint8_t, to be filled in with the port id.
*
* @return
* - 0: Success
* - <0: Error code on failure, if the adapter doesn't use a rte_service
* function, this function returns -ESRCH.
*/
__rte_experimental
int
rte_event_eth_rx_adapter_event_port_get(uint8_t id, uint8_t *event_port_id);
#ifdef __cplusplus
}
#endif

View File

@ -105,6 +105,9 @@ EXPERIMENTAL {
rte_event_eth_rx_adapter_queue_conf_get;
rte_event_eth_rx_adapter_queue_stats_get;
rte_event_eth_rx_adapter_queue_stats_reset;
# added in 22.03
rte_event_eth_rx_adapter_event_port_get;
};
INTERNAL {