From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 2C1097CAC for ; Sun, 2 Jul 2017 15:41:26 +0200 (CEST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Jul 2017 06:41:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,297,1496127600"; d="scan'208";a="103708292" Received: from silpixa00399464.ir.intel.com (HELO silpixa00399464.ger.corp.intel.com) ([10.237.222.157]) by orsmga004.jf.intel.com with ESMTP; 02 Jul 2017 06:41:23 -0700 From: Pablo de Lara To: declan.doherty@intel.com, zbigniew.bodek@caviumnetworks.com, jerin.jacob@caviumnetworks.com, akhil.goyal@nxp.com, hemant.agrawal@nxp.com, fiona.trahe@intel.com, john.griffin@intel.com, deepak.k.jain@intel.com Cc: dev@dpdk.org, Pablo de Lara Date: Sun, 2 Jul 2017 06:41:07 +0100 Message-Id: <20170702054127.75610-7-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170702054127.75610-1-pablo.de.lara.guarch@intel.com> References: <20170629113521.5560-1-pablo.de.lara.guarch@intel.com> <20170702054127.75610-1-pablo.de.lara.guarch@intel.com> Subject: [dpdk-dev] [PATCH v4 06/26] cryptodev: add crypto op helper macros X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jul 2017 13:41:27 -0000 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: Akhil Goyal Acked-by: Fiona Trahe --- lib/librte_cryptodev/rte_cryptodev.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h index 4e318f0..91f3375 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 */ -- 2.9.4