From: Ganapati Kundapura <ganapati.kundapura@intel.com>
To: jerinj@marvell.com, abhinandan.gujjar@intel.com, dev@dpdk.org
Cc: s.v.naga.harish.k@intel.com, jay.jayatheerthan@intel.com
Subject: [PATCH v1] eventdev/crypto: refactor circular buffer size
Date: Tue, 18 Apr 2023 04:16:15 -0500 [thread overview]
Message-ID: <20230418091616.1388517-1-ganapati.kundapura@intel.com> (raw)
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>
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
next reply other threads:[~2023-04-18 9:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-18 9:16 Ganapati Kundapura [this message]
2023-05-17 4:53 ` Gujjar, Abhinandan S
2023-05-17 14:49 ` 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=20230418091616.1388517-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).