Re: [dpdk-dev] [PATCH v2] dmadev: introduce DMA device library
From: Bruce Richardson <hidden>
Date: 2021-07-13 14:29:02
On Tue, Jul 13, 2021 at 03:19:39PM +0100, Ananyev, Konstantin wrote:
quoted
+#include "rte_dmadev_core.h" + +/** + * DMA flags to augment operation preparation. + * Used as the 'flags' parameter of rte_dmadev_copy/copy_sg/fill/fill_sg. + */ +#define RTE_DMA_FLAG_FENCE (1ull << 0) +/**< DMA fence flag + * It means the operation with this flag must be processed only after all + * previous operations are completed. + * + * @see rte_dmadev_copy() + * @see rte_dmadev_copy_sg() + * @see rte_dmadev_fill() + * @see rte_dmadev_fill_sg() + */ + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Enqueue a copy operation onto the virtual DMA channel. + * + * This queues up a copy operation to be performed by hardware, but does not + * trigger hardware to begin that operation. + * + * @param dev_id + * The identifier of the device. + * @param vchan + * The identifier of virtual DMA channel. + * @param src + * The address of the source buffer. + * @param dst + * The address of the destination buffer. + * @param length + * The length of the data to be copied. + * @param flags + * An flags for this operation. + * + * @return + * - 0..UINT16_MAX: index of enqueued copy job. + * - <0: Error code returned by the driver copy function. + */ +__rte_experimental +static inline int +rte_dmadev_copy(uint16_t dev_id, uint16_t vchan, rte_iova_t src, rte_iova_t dst, + uint32_t length, uint64_t flags) +{ + struct rte_dmadev *dev = &rte_dmadevices[dev_id];One question I have - did you guys consider hiding definitions of struct rte_dmadev and rte_dmadevices[] into .c straight from the start? Probably no point to repeat our famous ABI ethdev/cryptodev/... pitfalls here.
I considered it, but I found even moving one operation (the doorbell one) to be non-inline made a small but noticable perf drop. Until we get all the drivers done and more testing in various scenarios, I'd rather err on the side of getting the best performance.