X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Fdmadev%2Frte_dmadev.h;h=f5d23017b161a994a54750b0a8ca7e71a843265d;hb=28dde5da503ed09f10cdfb295e390b114df7330a;hp=e35aca7d1c7c9d2d2cf436cfca85e4342f4c8b83;hpb=5e0f85912754bf0d50c940165c40cac68e7c762f;p=dpdk.git diff --git a/lib/dmadev/rte_dmadev.h b/lib/dmadev/rte_dmadev.h index e35aca7d1c..f5d23017b1 100644 --- a/lib/dmadev/rte_dmadev.h +++ b/lib/dmadev/rte_dmadev.h @@ -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 */ @@ -244,6 +262,14 @@ uint16_t rte_dma_count_avail(void); * @see struct rte_dma_conf::silent_mode */ #define RTE_DMA_CAPA_SILENT RTE_BIT64(5) +/** Supports error handling + * + * With this bit set, invalid input addresses will be reported as operation failures + * to the user but other operations can continue. + * Without this bit set, invalid data is not handled by either HW or driver, so user + * must ensure that all memory addresses are valid and accessible by HW. + */ +#define RTE_DMA_CAPA_HANDLES_ERRORS RTE_BIT64(6) /** Support copy operation. * This capability start with index of 32, so that it could leave gap between * normal capability and ops capability. @@ -1076,6 +1102,35 @@ rte_dma_completed_status(int16_t dev_id, uint16_t vchan, last_idx, status); } +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Check remaining capacity in descriptor ring for the current burst. + * + * @param dev_id + * The identifier of the device. + * @param vchan + * The identifier of virtual DMA channel. + * + * @return + * - Remaining space in the descriptor ring for the current burst. + * - 0 on error + */ +__rte_experimental +static inline uint16_t +rte_dma_burst_capacity(int16_t dev_id, uint16_t vchan) +{ + struct rte_dma_fp_object *obj = &rte_dma_fp_objs[dev_id]; + +#ifdef RTE_DMADEV_DEBUG + if (!rte_dma_is_valid(dev_id)) + return 0; + RTE_FUNC_PTR_OR_ERR_RET(*obbj->burst_capacity, 0); +#endif + return (*obj->burst_capacity)(obj->dev_private, vchan); +} + #ifdef __cplusplus } #endif