> -----Original Message-----
> From: Akhil Goyal <gak...@marvell.com>
> Sent: Wednesday, May 29, 2024 2:05 PM
> To: Kundapura, Ganapati <ganapati.kundap...@intel.com>; dev@dpdk.org;
> Ferruh Yigit <ferruh.yi...@amd.com>; tho...@monjalon.net; Richardson,
> Bruce <bruce.richard...@intel.com>
> Cc: Gujjar, Abhinandan S <abhinandan.guj...@intel.com>;
> ciara.po...@intel.com; fanzhang....@gmail.com
> Subject: RE: [EXTERNAL] [PATCH v1] crypto: fix build issues on crypto 
> callbacks
> macro undefined
> 
> > Crypto callbacks macro is defined with value 1 and being used with
> > ifdef, on config value is changed to 0 to disable, crypto callback
> > changes still being compiled.
> 
> I believe we can use #if instead of ifdefs.
> It seems convenient to enable/disable in my opinion.
> We can use both, but whatever we use should be same as that for ethdev
> callbacks.
> 
Using #if requires check for equality like
#if RTE_CRYPTO_CALLBACKS == 1 for a macro defined with value 1

> The same issue would be for ethdev callbacks too.
> Ferruh, can you check?
> 
> >
> > Defined crypto callbacks macro without value, undef to disable
> >
> > Wrapped crypto callback changes with RTE_CRYPTO_CALLBACKS macro to fix
> > build issues when macro is undefined.
> >
> > As callback head nodes have valid pointer, this patch checks the next
> > node from the head if callbacks registered.
> >
> > Fixes: 1c3ffb9 ("cryptodev: add enqueue and dequeue callbacks")
> > Fixes: 5523a75 ("test/crypto: add case for enqueue/dequeue callbacks")
> >
> > Signed-off-by: Ganapati Kundapura <ganapati.kundap...@intel.com>
> 
> 
> > diff --git a/config/rte_config.h b/config/rte_config.h index
> > dd7bb0d35b..b647a69ba8 100644
> > --- a/config/rte_config.h
> > +++ b/config/rte_config.h
> > @@ -72,7 +72,7 @@
> >  /* cryptodev defines */
> >  #define RTE_CRYPTO_MAX_DEVS 64
> >  #define RTE_CRYPTODEV_NAME_LEN 64
> > -#define RTE_CRYPTO_CALLBACKS 1
> > +#define RTE_CRYPTO_CALLBACKS       /* No Value, undef/comment out to
> > disable */
> >
> >  /* compressdev defines */
> >  #define RTE_COMPRESS_MAX_DEVS 64
> 
> 
> > diff --git a/lib/cryptodev/rte_cryptodev.h
> > b/lib/cryptodev/rte_cryptodev.h index 00ba6a234a..b811b458d5 100644
> > --- a/lib/cryptodev/rte_cryptodev.h
> > +++ b/lib/cryptodev/rte_cryptodev.h
> > @@ -1910,7 +1910,7 @@ rte_cryptodev_dequeue_burst(uint8_t dev_id,
> > uint16_t qp_id,
> >     nb_ops = fp_ops->dequeue_burst(qp, ops, nb_ops);
> >
> >  #ifdef RTE_CRYPTO_CALLBACKS
> > -   if (unlikely(fp_ops->qp.deq_cb != NULL)) {
> > +   if (unlikely(fp_ops->qp.deq_cb[qp_id].next != NULL)) {
> >             struct rte_cryptodev_cb_rcu *list;
> >             struct rte_cryptodev_cb *cb;
> >
> > @@ -1977,7 +1977,7 @@ rte_cryptodev_enqueue_burst(uint8_t dev_id,
> > uint16_t qp_id,
> >     fp_ops = &rte_crypto_fp_ops[dev_id];
> >     qp = fp_ops->qp.data[qp_id];
> >  #ifdef RTE_CRYPTO_CALLBACKS
> > -   if (unlikely(fp_ops->qp.enq_cb != NULL)) {
> > +   if (unlikely(fp_ops->qp.enq_cb[qp_id].next != NULL)) {
> >             struct rte_cryptodev_cb_rcu *list;
> >             struct rte_cryptodev_cb *cb;
> >
> This is a separate issue. Please create a separate patch.
ok

Reply via email to