1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2021 HiSilicon Limited 3 * Copyright(c) 2021 Intel Corporation 4 */ 5 6 #ifndef RTE_DMADEV_CORE_H 7 #define RTE_DMADEV_CORE_H 8 9 /** 10 * @file 11 * 12 * DMA Device internal header. 13 * 14 * This header contains internal data types which are used by dataplane inline 15 * function. 16 * 17 * Applications should not use these functions directly. 18 */ 19 20 /** @internal Used to enqueue a copy operation. */ 21 typedef int (*rte_dma_copy_t)(void *dev_private, uint16_t vchan, 22 rte_iova_t src, rte_iova_t dst, 23 uint32_t length, uint64_t flags); 24 25 /** @internal Used to enqueue a scatter-gather list copy operation. */ 26 typedef int (*rte_dma_copy_sg_t)(void *dev_private, uint16_t vchan, 27 const struct rte_dma_sge *src, 28 const struct rte_dma_sge *dst, 29 uint16_t nb_src, uint16_t nb_dst, 30 uint64_t flags); 31 32 /** @internal Used to enqueue a fill operation. */ 33 typedef int (*rte_dma_fill_t)(void *dev_private, uint16_t vchan, 34 uint64_t pattern, rte_iova_t dst, 35 uint32_t length, uint64_t flags); 36 37 /** @internal Used to trigger hardware to begin working. */ 38 typedef int (*rte_dma_submit_t)(void *dev_private, uint16_t vchan); 39 40 /** @internal Used to return number of successful completed operations. */ 41 typedef uint16_t (*rte_dma_completed_t)(void *dev_private, 42 uint16_t vchan, const uint16_t nb_cpls, 43 uint16_t *last_idx, bool *has_error); 44 45 /** @internal Used to return number of completed operations. */ 46 typedef uint16_t (*rte_dma_completed_status_t)(void *dev_private, 47 uint16_t vchan, const uint16_t nb_cpls, 48 uint16_t *last_idx, enum rte_dma_status_code *status); 49 50 /** @internal Used to check the remaining space in descriptor ring. */ 51 typedef uint16_t (*rte_dma_burst_capacity_t)(const void *dev_private, uint16_t vchan); 52 53 /** 54 * @internal 55 * Fast-path dmadev functions and related data are hold in a flat array. 56 * One entry per dmadev. 57 * 58 * This structure occupy exactly 128B which reserve space for future IO 59 * functions. 60 * 61 * The 'dev_private' field was placed in the first cache line to optimize 62 * performance because the PMD mainly depends on this field. 63 */ 64 struct __rte_cache_aligned rte_dma_fp_object { 65 /** PMD-specific private data. The driver should copy 66 * rte_dma_dev.data->dev_private to this field during initialization. 67 */ 68 void *dev_private; 69 rte_dma_copy_t copy; 70 rte_dma_copy_sg_t copy_sg; 71 rte_dma_fill_t fill; 72 rte_dma_submit_t submit; 73 rte_dma_completed_t completed; 74 rte_dma_completed_status_t completed_status; 75 rte_dma_burst_capacity_t burst_capacity; 76 }; 77 78 extern struct rte_dma_fp_object *rte_dma_fp_objs; 79 80 #endif /* RTE_DMADEV_CORE_H */ 81