> From: Kundapura, Ganapati [mailto:ganapati.kundap...@intel.com]
> Sent: Thursday, 30 May 2024 13.42
> 
> Hi,
> 
> > From: Morten Brørup <m...@smartsharesystems.com>
> > Sent: Thursday, May 30, 2024 4:44 PM
> >
> > > From: Akhil Goyal [mailto:gak...@marvell.com]
> > > Sent: Thursday, 30 May 2024 13.02
> > >
> > > ++ Morten for comment on #if vs #ifdef
> > >
> > > > > Subject: [EXTERNAL] [PATCH v2 1/2] crypto: fix build issues on
> > > > > unsetting
> > > crypto
> > > > > callbacks macro
> > > > >
> > > > > 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.
> > > > >
> > > > > Used #if instead of #ifdef and also wrapped crypto callback
> > > > > changes under RTE_CRYPTO_CALLBACKS macro to fix build issues when
> > > > > macro is unset.
> > > > >
> > > > > Fixes: 1c3ffb95595e ("cryptodev: add enqueue and dequeue
> > > > > callbacks")
> > > > > Fixes: 5523a75af539 ("test/crypto: add case for enqueue/dequeue
> > > callbacks")
> > > > >
> > > > > Signed-off-by: Ganapati Kundapura <ganapati.kundap...@intel.com>
> > > > > ---
> > > > > v2:
> > > > > * Used #if instead of #ifdef and restored macro definition in
> > > > > config
> > > > > * Split callback registration check in a seperate patch
> >
> > The DPDK convention is #ifdef, not #if.
> > Ethdev also uses #ifdef, e.g.:
> > https://elixir.bootlin.com/dpdk/v24.03/source/lib/ethdev/rte_ethdev.h#L61
> > 12
> >
> > PS: Personally, I prefer #if too. But we should set personal preferences
> aside,
> > and follow the existing convention in DPDK and use #ifdef.
> Irrespective of RTE_CRYPTO_CALLBACKS value set to 0/1,
> #ifdef RTE_CRYPTO_CALLBACKS returns true always.

Yes, because it is defined in both cases.

So according to the #ifdef convention, rte_config.h must contain either:
#define RTE_CRYPTO_CALLBACKS 1
Or:
/* RTE_CRYPTO_CALLBACKS is not set */

Reply via email to