From 2e348d8fe382d55a12afa105069a862a6d8c0a23 Mon Sep 17 00:00:00 2001 From: Bruce Richardson Date: Wed, 13 Oct 2021 16:17:33 +0100 Subject: [PATCH] dmadev: add flag for error handling support Due to HW or driver limitations, not all dmadevs may support full error handling e.g. safely managing and reporting an invalid address to a copy operation. The skeleton dmadev, for example, being pure software will always seg-fault if passed an invalid address. To indicate the availability of safe error handling by a device, we add a capability flag for it. Signed-off-by: Bruce Richardson Reviewed-by: Conor Walsh Reviewed-by: Kevin Laatz --- lib/dmadev/rte_dmadev.c | 1 + lib/dmadev/rte_dmadev.h | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c index b6647e6ff8..182d32aedb 100644 --- a/lib/dmadev/rte_dmadev.c +++ b/lib/dmadev/rte_dmadev.c @@ -722,6 +722,7 @@ dma_capability_name(uint64_t capability) { RTE_DMA_CAPA_DEV_TO_DEV, "dev2dev" }, { RTE_DMA_CAPA_SVA, "sva" }, { RTE_DMA_CAPA_SILENT, "silent" }, + { RTE_DMA_CAPA_HANDLES_ERRORS, "handles_errors" }, { RTE_DMA_CAPA_OPS_COPY, "copy" }, { RTE_DMA_CAPA_OPS_COPY_SG, "copy_sg" }, { RTE_DMA_CAPA_OPS_FILL, "fill" }, diff --git a/lib/dmadev/rte_dmadev.h b/lib/dmadev/rte_dmadev.h index bf78748b0c..f5d23017b1 100644 --- a/lib/dmadev/rte_dmadev.h +++ b/lib/dmadev/rte_dmadev.h @@ -262,6 +262,14 @@ int16_t rte_dma_next_dev(int16_t start_dev_id); * @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. -- 2.20.1