[v1] eventdev/crypto: refactor circular buffer size

Message ID 20230418091616.1388517-1-ganapati.kundapura@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series [v1] eventdev/crypto: refactor circular buffer size |

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/Intel-compilation success Compilation OK
ci/github-robot: build success github build: passed
ci/intel-Testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/intel-Functional success Functional PASS

Commit Message

Ganapati Kundapura April 18, 2023, 9:16 a.m. UTC
  In case of CRYPTO_ADAPTER_OPS_BUFFER_SZ is modified,
eca_circular_buffer_space_for_batch() also needs to be updated
to check maximum number of crypto ops can be accommodated in
circular buffer when CPM becomes busy.

Defined MAX_OPS_IN_BUFFER which contains size for batch of dequeued events
and redefined CRYPTO_ADAPTER_OPS_BUFFER_SZ in terms of MAX_OPS_IN_BUFFER.

This patch makes eca_circular_buffer_space_for_batch() independent of
circular buffer changes.

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

Comments

Gujjar, Abhinandan S May 17, 2023, 4:53 a.m. UTC | #1
> -----Original Message-----
> From: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> Sent: Tuesday, April 18, 2023 2:46 PM
> To: jerinj@marvell.com; Gujjar, Abhinandan S
> <abhinandan.gujjar@intel.com>; dev@dpdk.org
> Cc: Naga Harish K, S V <s.v.naga.harish.k@intel.com>; Jayatheerthan, Jay
> <jay.jayatheerthan@intel.com>
> Subject: [PATCH v1] eventdev/crypto: refactor circular buffer size
> 
> In case of CRYPTO_ADAPTER_OPS_BUFFER_SZ is modified,
> eca_circular_buffer_space_for_batch() also needs to be updated to check
> maximum number of crypto ops can be accommodated in circular buffer
> when CPM becomes busy.
> 
> Defined MAX_OPS_IN_BUFFER which contains size for batch of dequeued
> events and redefined CRYPTO_ADAPTER_OPS_BUFFER_SZ in terms of
> MAX_OPS_IN_BUFFER.
> 
> This patch makes eca_circular_buffer_space_for_batch() independent of
> circular buffer changes.
> 
> Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>

Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>

> 
> diff --git a/lib/eventdev/rte_event_crypto_adapter.c
> b/lib/eventdev/rte_event_crypto_adapter.c
> index f6c1e53..52a28e5 100644
> --- a/lib/eventdev/rte_event_crypto_adapter.c
> +++ b/lib/eventdev/rte_event_crypto_adapter.c
> @@ -25,7 +25,14 @@
>  #define CRYPTO_ADAPTER_MEM_NAME_LEN 32
>  #define CRYPTO_ADAPTER_MAX_EV_ENQ_RETRIES 100
> 
> -#define CRYPTO_ADAPTER_OPS_BUFFER_SZ (BATCH_SIZE + BATCH_SIZE)
> +/* MAX_OPS_IN_BUFFER contains size for  batch of dequeued events */
> +#define MAX_OPS_IN_BUFFER BATCH_SIZE
> +
> +/* CRYPTO_ADAPTER_OPS_BUFFER_SZ to accommodate
> MAX_OPS_IN_BUFFER +
> + * additional space for one batch
> + */
> +#define CRYPTO_ADAPTER_OPS_BUFFER_SZ (MAX_OPS_IN_BUFFER +
> BATCH_SIZE)
> +
>  #define CRYPTO_ADAPTER_BUFFER_SZ 1024
> 
>  /* Flush an instance's enqueue buffers every
> CRYPTO_ENQ_FLUSH_THRESHOLD @@ -188,7 +195,8 @@
> eca_circular_buffer_batch_ready(struct crypto_ops_circular_buffer *bufp)
> static inline bool  eca_circular_buffer_space_for_batch(struct
> crypto_ops_circular_buffer *bufp)  {
> -	return (bufp->size - bufp->count) >= BATCH_SIZE;
> +	/* circular buffer can have atmost MAX_OPS_IN_BUFFER */
> +	return (bufp->size - bufp->count) >= MAX_OPS_IN_BUFFER;
>  }
> 
>  static inline void
> --
> 2.6.4
  
Jerin Jacob May 17, 2023, 2:49 p.m. UTC | #2
On Wed, May 17, 2023 at 10:23 AM Gujjar, Abhinandan S
<abhinandan.gujjar@intel.com> wrote:
>
>
> > -----Original Message-----
> > From: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> > Sent: Tuesday, April 18, 2023 2:46 PM
> > To: jerinj@marvell.com; Gujjar, Abhinandan S
> > <abhinandan.gujjar@intel.com>; dev@dpdk.org
> > Cc: Naga Harish K, S V <s.v.naga.harish.k@intel.com>; Jayatheerthan, Jay
> > <jay.jayatheerthan@intel.com>
> > Subject: [PATCH v1] eventdev/crypto: refactor circular buffer size
> >
> > In case of CRYPTO_ADAPTER_OPS_BUFFER_SZ is modified,
> > eca_circular_buffer_space_for_batch() also needs to be updated to check
> > maximum number of crypto ops can be accommodated in circular buffer
> > when CPM becomes busy.
> >
> > Defined MAX_OPS_IN_BUFFER which contains size for batch of dequeued
> > events and redefined CRYPTO_ADAPTER_OPS_BUFFER_SZ in terms of
> > MAX_OPS_IN_BUFFER.
> >
> > This patch makes eca_circular_buffer_space_for_batch() independent of
> > circular buffer changes.
> >
> > Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
>
> Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>

Applied to dpdk-next-net-eventdev/for-main. Thanks


>
> >
> > diff --git a/lib/eventdev/rte_event_crypto_adapter.c
> > b/lib/eventdev/rte_event_crypto_adapter.c
> > index f6c1e53..52a28e5 100644
> > --- a/lib/eventdev/rte_event_crypto_adapter.c
> > +++ b/lib/eventdev/rte_event_crypto_adapter.c
> > @@ -25,7 +25,14 @@
> >  #define CRYPTO_ADAPTER_MEM_NAME_LEN 32
> >  #define CRYPTO_ADAPTER_MAX_EV_ENQ_RETRIES 100
> >
> > -#define CRYPTO_ADAPTER_OPS_BUFFER_SZ (BATCH_SIZE + BATCH_SIZE)
> > +/* MAX_OPS_IN_BUFFER contains size for  batch of dequeued events */
> > +#define MAX_OPS_IN_BUFFER BATCH_SIZE
> > +
> > +/* CRYPTO_ADAPTER_OPS_BUFFER_SZ to accommodate
> > MAX_OPS_IN_BUFFER +
> > + * additional space for one batch
> > + */
> > +#define CRYPTO_ADAPTER_OPS_BUFFER_SZ (MAX_OPS_IN_BUFFER +
> > BATCH_SIZE)
> > +
> >  #define CRYPTO_ADAPTER_BUFFER_SZ 1024
> >
> >  /* Flush an instance's enqueue buffers every
> > CRYPTO_ENQ_FLUSH_THRESHOLD @@ -188,7 +195,8 @@
> > eca_circular_buffer_batch_ready(struct crypto_ops_circular_buffer *bufp)
> > static inline bool  eca_circular_buffer_space_for_batch(struct
> > crypto_ops_circular_buffer *bufp)  {
> > -     return (bufp->size - bufp->count) >= BATCH_SIZE;
> > +     /* circular buffer can have atmost MAX_OPS_IN_BUFFER */
> > +     return (bufp->size - bufp->count) >= MAX_OPS_IN_BUFFER;
> >  }
> >
> >  static inline void
> > --
> > 2.6.4
>
  

Patch

diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index f6c1e53..52a28e5 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -25,7 +25,14 @@ 
 #define CRYPTO_ADAPTER_MEM_NAME_LEN 32
 #define CRYPTO_ADAPTER_MAX_EV_ENQ_RETRIES 100
 
-#define CRYPTO_ADAPTER_OPS_BUFFER_SZ (BATCH_SIZE + BATCH_SIZE)
+/* MAX_OPS_IN_BUFFER contains size for  batch of dequeued events */
+#define MAX_OPS_IN_BUFFER BATCH_SIZE
+
+/* CRYPTO_ADAPTER_OPS_BUFFER_SZ to accommodate MAX_OPS_IN_BUFFER +
+ * additional space for one batch
+ */
+#define CRYPTO_ADAPTER_OPS_BUFFER_SZ (MAX_OPS_IN_BUFFER + BATCH_SIZE)
+
 #define CRYPTO_ADAPTER_BUFFER_SZ 1024
 
 /* Flush an instance's enqueue buffers every CRYPTO_ENQ_FLUSH_THRESHOLD
@@ -188,7 +195,8 @@  eca_circular_buffer_batch_ready(struct crypto_ops_circular_buffer *bufp)
 static inline bool
 eca_circular_buffer_space_for_batch(struct crypto_ops_circular_buffer *bufp)
 {
-	return (bufp->size - bufp->count) >= BATCH_SIZE;
+	/* circular buffer can have atmost MAX_OPS_IN_BUFFER */
+	return (bufp->size - bufp->count) >= MAX_OPS_IN_BUFFER;
 }
 
 static inline void