DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Akhil Goyal" <gakhil@marvell.com>,
	"fengchengwen" <fengchengwen@huawei.com>, <dev@dpdk.org>
Cc: <thomas@monjalon.net>, <david.marchand@redhat.com>,
	<hemant.agrawal@nxp.com>, "Anoob Joseph" <anoobj@marvell.com>,
	<pablo.de.lara.guarch@intel.com>, <fiona.trahe@intel.com>,
	<declan.doherty@intel.com>, <matan@nvidia.com>, <g.singh@nxp.com>,
	<fanzhang.oss@gmail.com>, <jianjay.zhou@huawei.com>,
	<asomalap@amd.com>, <ruifeng.wang@arm.com>,
	<konstantin.v.ananyev@yandex.ru>, <radu.nicolau@intel.com>,
	<ajit.khaparde@broadcom.com>,
	"Nagadheeraj Rottela" <rnagadheeraj@marvell.com>, <mdr@ashroe.eu>
Subject: RE: [PATCH] [RFC] cryptodev: replace LIST_END enumerators with APIs
Date: Sun, 6 Oct 2024 13:10:16 +0200	[thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35E9F77E@smartserver.smartshare.dk> (raw)
In-Reply-To: <CO6PR18MB44841CF70E09D434F4DB6759D8712@CO6PR18MB4484.namprd18.prod.outlook.com>

> From: Akhil Goyal [mailto:gakhil@marvell.com]
> Sent: Thursday, 3 October 2024 09.01
> 
>  Hi Morten,
> >
> > Apologies for delayed response.
> > > Maybe a combination, returning the lowest end of the two versions
> of the list,
> > > would work...
> > >
> > > ----------------------------------
> > > Common header file (rte_common.h):
> > > ----------------------------------
> > >
> > > /* Add at end of enum list in the header file. */
> > > #define RTE_ENUM_LIST_END(name) \
> > > _ # name # _ENUM_LIST_END /**< @internal */
> > >
> > > /* Add somewhere in header file, preferably after the enum list. */
> > > #define rte_declare_enum_list_end(name) \
> > > /** @internal */ \
> > > int _# name # _enum_list_end(void); \
> > > \
> > > static int name # _enum_list_end(void) \
> > > { \
> > > 	static int cached = 0; \
> > > \
> > > 	if (likely(cached != 0)) \
> > > 		return cached; \
> > > \
> > > 	return cached = RTE_MIN( \
> > > 			RTE_ENUM_LIST_END(name), \
> > > 			_ # name # _enum_list_end()); \
> > > } \
> > > \
> > > int _# name # _enum_list_end(void)
> > >
> > > /* Add in the library/driver implementation. */
> > > #define rte_define_enum_list_end(name) \
> > > int _# name # _enum_list_end(void) \
> > > { \
> > > 	return RTE_ENUM_LIST_END(name); \
> > > } \
> > > \
> > > int _# name # _enum_list_end(void)
> > >
> > > --------------------
> > > Library header file:
> > > --------------------
> > >
> > > enum rte_crypto_asym_op_type {
> > > 	RTE_CRYPTO_ASYM_OP_VERIFY,
> > > 	/**< Signature Verification operation */
> > > 	RTE_ENUM_LIST_END(rte_crypto_asym_op)
> >
> > Will the ABI check be ok for adding anything in between
> > RTE_CRYPTO_ASYM_OP_VERIFY and
> > RTE_ENUM_LIST_END(rte_crypto_asym_op)?
> > Don’t we need to add exception for that if we somehow make it
> internal by
> > adding a comment only?
> > Library is actually not restricting the application to not use
> > RTE_ENUM_LIST_END(rte_crypto_asym_op) directly.
> >
> > Also we may need to expose the .c file internal function as
> experimental in
> > version.map
> >
> > > }
> > >
> > > rte_declare_enum_list_end(rte_crypto_asym_op);
> > >
> > > ---------------
> > > Library C file:
> > > ---------------
> > >
> > > rte_define_enum_list_end(rte_crypto_asym_op);
> >
> > If we want to make it a generic thing in rte_common.h
> > Will the below change be ok?
> > ----------------------------------
> > Common header file (rte_common.h):
> > ----------------------------------
> > #define rte_define_enum_list_end(name, last_value) \
> > static inline int name ## _enum_list_end(void) \
> > { \
> >        return last_value + 1; \
> > }
> >
> > ----------------
> > Lib header file
> > ----------------
> > //After the enum definition define the list end as below
> > rte_define_enum_list_end(rte_crypto_asym_op,
> > RTE_CRYPTO_ASYM_OP_VERIFY);
> >
> >
> > And wherever list end is needed use
> rte_crypto_asym_op_enum_list_end()?
> >
> > With this change, abi check will not complain for any new addition at
> the end of
> > enum.
> > And we do not need to expose any internal API in version.map.
> >
> Can we move forward with above suggestion?

Sorry about the late reply, Akhil.

It seems Ferruh and David have picked up this discussion with good arguments.

I have no preferences for a generic solution, especially if this is an isolated case. A generic solution can be added at any time later.


  reply	other threads:[~2024-10-06 11:10 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-05 10:14 Akhil Goyal
2024-09-05 15:09 ` Morten Brørup
2024-09-05 15:26   ` Kusztal, ArkadiuszX
2024-09-06  6:32   ` fengchengwen
2024-09-06  7:45     ` [EXTERNAL] " Akhil Goyal
2024-10-04  3:56       ` Ferruh Yigit
2024-09-06  7:54     ` Morten Brørup
2024-09-23 20:41       ` Akhil Goyal
2024-10-03  7:00         ` Akhil Goyal
2024-10-06 11:10           ` Morten Brørup [this message]
2024-10-09 11:21             ` Akhil Goyal
2024-10-04  4:00         ` Ferruh Yigit
2024-10-04 17:26           ` [EXTERNAL] " Akhil Goyal
2024-10-04  3:54 ` Ferruh Yigit
2024-10-04  7:04   ` David Marchand
2024-10-04 17:27     ` [EXTERNAL] " Akhil Goyal
2024-10-10  0:49     ` Ferruh Yigit
2024-10-10  6:18       ` [EXTERNAL] " Akhil Goyal
2024-10-04  9:38   ` Dodji Seketeli
2024-10-04 17:45     ` [EXTERNAL] " Akhil Goyal
2024-10-10  0:35     ` Ferruh Yigit
2024-10-09 11:24 ` [PATCH] cryptodev: remove unnecessary list end Akhil Goyal
2024-10-09 12:52   ` Morten Brørup
2024-10-09 20:38     ` Akhil Goyal
2024-10-09 14:06   ` Hemant Agrawal
2024-10-10  0:51   ` Ferruh Yigit

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=98CBD80474FA8B44BF855DF32C47DC35E9F77E@smartserver.smartshare.dk \
    --to=mb@smartsharesystems.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=anoobj@marvell.com \
    --cc=asomalap@amd.com \
    --cc=david.marchand@redhat.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=fanzhang.oss@gmail.com \
    --cc=fengchengwen@huawei.com \
    --cc=fiona.trahe@intel.com \
    --cc=g.singh@nxp.com \
    --cc=gakhil@marvell.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=jianjay.zhou@huawei.com \
    --cc=konstantin.v.ananyev@yandex.ru \
    --cc=matan@nvidia.com \
    --cc=mdr@ashroe.eu \
    --cc=pablo.de.lara.guarch@intel.com \
    --cc=radu.nicolau@intel.com \
    --cc=rnagadheeraj@marvell.com \
    --cc=ruifeng.wang@arm.com \
    --cc=thomas@monjalon.net \
    /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).