DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ganapati Kundapura <ganapati.kundapura@intel.com>
To: jerinj@marvell.com, jay.jayatheerthan@intel.com,
	s.v.naga.harish.k@intel.com, abhinandan.gujjar@intel.com,
	dev@dpdk.org
Subject: [PATCH v2] eventdev/crypto: fix circular buffer full case
Date: Thu,  3 Aug 2023 03:32:29 -0500	[thread overview]
Message-ID: <20230803083229.2340918-1-ganapati.kundapura@intel.com> (raw)
In-Reply-To: <20230801054457.1184208-1-ganapati.kundapura@intel.com>

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

Fix it by flushing ops from circular buffer when circ buffer is full
instead of returning without flushing.

Fixes: 2ae84b39ae7b ("eventdev/crypto: store operations in circular buffer")
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@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


  parent reply	other threads:[~2023-08-03  8:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-01  5:44 [PATCH v1] eventdev/crypto: flush ops when circ buffer is full Ganapati Kundapura
2023-08-02 16:17 ` Jerin Jacob
2023-08-03  8:34   ` Kundapura, Ganapati
2023-08-03  8:32 ` Ganapati Kundapura [this message]
2023-08-08 12:59   ` [PATCH v2] eventdev/crypto: fix circular buffer full case Jerin Jacob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230803083229.2340918-1-ganapati.kundapura@intel.com \
    --to=ganapati.kundapura@intel.com \
    --cc=abhinandan.gujjar@intel.com \
    --cc=dev@dpdk.org \
    --cc=jay.jayatheerthan@intel.com \
    --cc=jerinj@marvell.com \
    --cc=s.v.naga.harish.k@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).