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

Message ID 20230801054457.1184208-1-ganapati.kundapura@intel.com (mailing list archive)
State Changes Requested, archived
Delegated to: Jerin Jacob
Headers
Series [v1] eventdev/crypto: flush ops when circ buffer is full |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/github-robot: build success github build: passed
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-unit-testing success Testing PASS
ci/iol-aarch-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS

Commit Message

Ganapati Kundapura Aug. 1, 2023, 5:44 a.m. UTC
  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@intel.com>
  

Comments

Jerin Jacob Aug. 2, 2023, 4:17 p.m. UTC | #1
Addressed
On Tue, Aug 1, 2023 at 11:15 AM Ganapati Kundapura
<ganapati.kundapura@intel.com> wrote:
>
> 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.


Since it is bug, Please add Fixes: tag , Also change description accordingly.

> 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
>
  
Ganapati Kundapura Aug. 3, 2023, 8:34 a.m. UTC | #2
Hi Jerin,

> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: Wednesday, August 2, 2023 9:47 PM
> To: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> Cc: jerinj@marvell.com; Jayatheerthan, Jay <jay.jayatheerthan@intel.com>;
> Naga Harish K, S V <s.v.naga.harish.k@intel.com>; Gujjar, Abhinandan S
> <abhinandan.gujjar@intel.com>; dev@dpdk.org
> Subject: Re: [PATCH v1] eventdev/crypto: flush ops when circ buffer is full
> 
> On Tue, Aug 1, 2023 at 11:15 AM Ganapati Kundapura
> <ganapati.kundapura@intel.com> wrote:
> >
> > 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.
> 
> 
> Since it is bug, Please add Fixes: tag , Also change description accordingly.
> 
Updated in v2
> > 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
> >
  

Patch

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,