dmadev: add device iterator
Add a function and wrapper macro to iterate over all DMA devices. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Reviewed-by: Conor Walsh <conor.walsh@intel.com> Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
This commit is contained in:
parent
ea8cf0f853
commit
190f7e84c3
@ -49,6 +49,19 @@ rte_dma_dev_max(size_t dev_max)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int16_t
|
||||
rte_dma_next_dev(int16_t start_dev_id)
|
||||
{
|
||||
int16_t dev_id = start_dev_id;
|
||||
while (dev_id < dma_devices_max && rte_dma_devices[dev_id].state == RTE_DMA_DEV_UNUSED)
|
||||
dev_id++;
|
||||
|
||||
if (dev_id < dma_devices_max)
|
||||
return dev_id;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
dma_check_name(const char *name)
|
||||
{
|
||||
|
@ -220,6 +220,24 @@ bool rte_dma_is_valid(int16_t dev_id);
|
||||
__rte_experimental
|
||||
uint16_t rte_dma_count_avail(void);
|
||||
|
||||
/**
|
||||
* Iterates over valid dmadev instances.
|
||||
*
|
||||
* @param start_dev_id
|
||||
* The id of the next possible dmadev.
|
||||
* @return
|
||||
* Next valid dmadev, UINT16_MAX if there is none.
|
||||
*/
|
||||
__rte_experimental
|
||||
int16_t rte_dma_next_dev(int16_t start_dev_id);
|
||||
|
||||
/** Utility macro to iterate over all available dmadevs */
|
||||
#define RTE_DMA_FOREACH_DEV(p) \
|
||||
for (p = rte_dma_next_dev(0); \
|
||||
p != -1; \
|
||||
p = rte_dma_next_dev(p + 1))
|
||||
|
||||
|
||||
/**@{@name DMA capability
|
||||
* @see struct rte_dma_info::dev_capa
|
||||
*/
|
||||
|
@ -15,6 +15,7 @@ EXPERIMENTAL {
|
||||
rte_dma_get_dev_id_by_name;
|
||||
rte_dma_info_get;
|
||||
rte_dma_is_valid;
|
||||
rte_dma_next_dev;
|
||||
rte_dma_start;
|
||||
rte_dma_stats_get;
|
||||
rte_dma_stats_reset;
|
||||
|
Loading…
Reference in New Issue
Block a user