Re: [PATCH v2 2/2] cryptodev: change burst API to be crypto op oriented
From: Trahe, Fiona <hidden>
Date: 2016-02-22 18:23:17
Hi Declan,
-----Original Message----- From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Declan Doherty Sent: Friday, February 19, 2016 11:01 AM To: dev@dpdk.org Subject: [dpdk-dev] [PATCH v2 2/2] cryptodev: change burst API to be crypto op oriented This patch modifies the crypto burst enqueue/dequeue APIs to operate on bursts rte_crypto_op's rather than the current implementation which operates on rte_mbuf bursts, this simplifies the burst processing in the crypto PMDs and the use of crypto operations in general. This change set also continues the separation of the symmetric operation parameters from the more general operation parameters, this will simplify the integration of asymmetric crypto operations in the future. As well as the changes to the crypto APIs this patch adds functions for managing rte_crypto_op pools to the cryptodev API. It modifies the existing PMDs, unit tests and sample application to work with the modified APIs. Finally this change set removes the now unused rte_mbuf_offload library. Signed-off-by: Declan Doherty <redacted> ---
Delete unused fn below.
quoted hunk ↗ jump to hunk
diff --git a/lib/librte_cryptodev/rte_crypto.h b/lib/librte_cryptodev/rte_crypto.h index df0c0b8..489314b 100644 --- a/lib/librte_cryptodev/rte_crypto.h +++ b/lib/librte_cryptodev/rte_crypto.h + +/** + * Allocate a symmetric crypto operation in the private data of an mbuf. + * + * @param m mbuf which is associated with the crypto operation, the + * operation will be allocated in the private data of that + * mbuf. + * + * @returns + * - On success returns a pointer to the crypto operation. + * - On failure returns NULL. + */ +static inline struct rte_crypto_op * +rte_crypto_sym_op_alloc_from_mbuf_priv_data(struct rte_mbuf *m) +{ + if (unlikely(m == NULL)) + return NULL; + + /* + * check that the mbuf's private data size is sufficient to contain a + * crypto operation + */ + if (unlikely(m->priv_size < (sizeof(struct rte_crypto_op) + + sizeof(struct rte_crypto_sym_op)))) + return NULL; + + /* private data starts immediately after the mbuf header in the mbuf. */ + struct rte_crypto_op *op = (struct rte_crypto_op *)(m + 1); + + __rte_crypto_op_reset(op, RTE_CRYPTO_OP_TYPE_SYMMETRIC); + + op->mempool = NULL; + op->sym->m_src = m; + + return op; +}