1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2021 HiSilicon Limited
5 #ifndef RTE_DMADEV_PMD_H
6 #define RTE_DMADEV_PMD_H
11 * DMA Device PMD interface
13 * Driver facing interface for a DMA device. These are not to be called directly
17 #include "rte_dmadev.h"
24 * Possible states of a DMA device.
26 * @see struct rte_dma_dev::state
28 enum rte_dma_dev_state {
29 RTE_DMA_DEV_UNUSED = 0, /**< Device is unused. */
30 /** Device is registered, but not ready to be used. */
31 RTE_DMA_DEV_REGISTERED,
32 /** Device is ready for use. This is set by the PMD. */
38 * The generic data structure associated with each DMA device.
41 char dev_name[RTE_DEV_NAME_MAX_LEN]; /**< Unique identifier name */
42 int16_t dev_id; /**< Device [external] identifier. */
43 int16_t numa_node; /**< Local NUMA memory ID. -1 if unknown. */
44 void *dev_private; /**< PMD-specific private data. */
45 /** Device info which supplied during device initialization. */
46 struct rte_device *device;
47 enum rte_dma_dev_state state; /**< Flag indicating the device state. */
48 uint64_t reserved[2]; /**< Reserved for future fields. */
49 } __rte_cache_aligned;
51 extern struct rte_dma_dev *rte_dma_devices;
55 * Allocate a new dmadev slot for an DMA device and return the pointer to that
56 * slot for the driver to use.
61 * Driver's private data's NUMA node.
62 * @param private_data_size
63 * Driver's private data size.
66 * A pointer to the DMA device slot case of success,
70 struct rte_dma_dev *rte_dma_pmd_allocate(const char *name, int numa_node,
71 size_t private_data_size);
75 * Release the specified dmadev.
81 * - 0 on success, negative on error.
84 int rte_dma_pmd_release(const char *name);
90 #endif /* RTE_DMADEV_PMD_H */