Re: [PATCH v2 2/2] cryptodev: change burst API to be crypto op oriented
From: Trahe, Fiona <hidden>
Date: 2016-02-22 18:56:49
Subsystem:
library code, the rest · Maintainers:
Andrew Morton, Linus Torvalds
Hi Declan, Bug + fix below
-----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>
diff --git a/lib/librte_cryptodev/rte_crypto.h b/lib/librte_cryptodev/rte_crypto.h//snip
+ * Returns a pointer to the private data of a crypto operation if
+ * that operation has enough capacity for requested size.
+ *
+ * @param op crypto operation.
+ * @param size size of space requested in private data.
+ *
+ * @returns
+ * - if sufficient space available returns pointer to start of private data
+ * - if insufficient space returns NULL
+ */
+static inline void *
+__rte_crypto_op_get_priv_data(struct rte_crypto_op *op, uint32_t size)
+{
+ uint32_t priv_size;
+
+ if (likely(op->mempool != NULL)) {
+ priv_size = __rte_crypto_op_get_priv_data_size(op->mempool);
+
+ if (likely(priv_size >= size))
+ return (void *)((op + 1) +
+ sizeof(struct rte_crypto_sym_op));
Jumping by rte_crypto_op increments, should be byte increments, i.e.
return (void *)((uint8_t *)(op + 1) +
sizeof(struct rte_crypto_sym_op));
+ }
+
+ return NULL;
+}