From: Pablo de Lara Date: Sun, 2 Jul 2017 05:41:07 +0000 (+0100) Subject: cryptodev: add crypto op helper macros X-Git-Tag: spdx-start~2693 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=d5404055abb97cd4238d62d59a1b375945af8d5f;p=dpdk.git cryptodev: add crypto op helper macros In order to facilitate the access to the private data, after the crypto operation, two new macros have been implemented: - rte_crypto_op_ctod_offset(c,t,o), which returns a pointer to "o" bytes after the start of the crypto operation (rte_crypto_op) - rte_crypto_op_ctophys_offset(c, o), which returns the physical address of the data "o" bytes after the start of the crypto operation (rte_crypto_op) Signed-off-by: Pablo de Lara Acked-by: Declan Doherty Acked-by: Akhil Goyal Acked-by: Fiona Trahe --- diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h index 4e318f0184..91f33751fe 100644 --- a/lib/librte_cryptodev/rte_cryptodev.h +++ b/lib/librte_cryptodev/rte_cryptodev.h @@ -119,6 +119,38 @@ extern const char **rte_cyptodev_names; #define CDEV_PMD_TRACE(...) (void)0 #endif + + +/** + * A macro that points to an offset from the start + * of the crypto operation structure (rte_crypto_op) + * + * The returned pointer is cast to type t. + * + * @param c + * The crypto operation. + * @param o + * The offset from the start of the crypto operation. + * @param t + * The type to cast the result into. + */ +#define rte_crypto_op_ctod_offset(c, t, o) \ + ((t)((char *)(c) + (o))) + +/** + * A macro that returns the physical address that points + * to an offset from the start of the crypto operation + * (rte_crypto_op) + * + * @param c + * The crypto operation. + * @param o + * The offset from the start of the crypto operation + * to calculate address from. + */ +#define rte_crypto_op_ctophys_offset(c, o) \ + (phys_addr_t)((c)->phys_addr + (o)) + /** * Crypto parameters range description */