[PATCH v1] eventdev/crypto: flush ops when circ buffer is full

Ganapati Kundapura ganapati.kundapura at intel.com
Tue Aug 1 07:44:57 CEST 2023


crypto ops from the circ buffer are not getting flushed
to crypto dev when crypto dev becomes busy and circ buffer
gets full.

This patch flushes ops from circ buffer when circ buffer is full
instead of returning without flushing.

Signed-off-by: Ganapati Kundapura <ganapati.kundapura at intel.com>

diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index 52a28e5..1b435c9 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -248,9 +248,18 @@ eca_circular_buffer_flush_to_cdev(struct crypto_ops_circular_buffer *bufp,
 		n = *tailp - *headp;
 	else if (*tailp < *headp)
 		n = bufp->size - *headp;
-	else {
-		*nb_ops_flushed = 0;
-		return 0;  /* buffer empty */
+	else { /* head == tail case */
+		/* when head == tail,
+		 * circ buff is either full(tail pointer roll over) or empty
+		 */
+		if (bufp->count != 0) {
+			/* circ buffer is full */
+			n = bufp->count;
+		} else {
+			/* circ buffer is empty */
+			*nb_ops_flushed = 0;
+			return 0;  /* buffer empty */
+		}
 	}
 
 	*nb_ops_flushed = rte_cryptodev_enqueue_burst(cdev_id, qp_id,
-- 
2.6.4



More information about the dev mailing list