All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ray Kinsella <mdr@ashroe.eu>
To: Thomas Monjalon <thomas@monjalon.net>
Cc: Nicolas Chautru <nicolas.chautru@intel.com>,
	dev@dpdk.org, maxime.coquelin@redhat.com, trix@redhat.com,
	bruce.richardson@intel.com, hemant.agrawal@nxp.com,
	david.marchand@redhat.com, stephen@networkplumber.org,
	techboard@dpdk.org
Subject: Re: [PATCH v1] bbdev: allow operation type enum for growth
Date: Thu, 23 Jun 2022 17:09:20 +0100	[thread overview]
Message-ID: <871qvf4au1.fsf@mdr78.vserver.site> (raw)
In-Reply-To: <6579285.Sb9uPGUboI@thomas>


Thomas Monjalon <thomas@monjalon.net> writes:

> This solution is what I proposed to the techboard some years ago,
> but the preference was to completely remove the MAX values.


I am mindful we don't have an explicit guidance in the documentation.
I am including to add something to the abi_versioning document, that
basically says

1. Try not to use _MAX values with enumerations.
2. If you have to use _MAX values with enumeration, consider giving
yourself some headroom along with rigourous checking?

>
>
> 13/06/2022 20:24, Nicolas Chautru:
>> Updating the last enum for rte_bbdev_op_type
>> to allow for enum insertion.
>
> Please explain that the reason is to keep ABI compatible,
> and you want to keep the MAX value for array needs.
>
>> --- a/lib/bbdev/rte_bbdev.c
>> +++ b/lib/bbdev/rte_bbdev.c
>> @@ -1122,7 +1122,10 @@ struct rte_mempool *
>>  		"RTE_BBDEV_OP_TURBO_DEC",
>>  		"RTE_BBDEV_OP_TURBO_ENC",
>>  		"RTE_BBDEV_OP_LDPC_DEC",
>> -		"RTE_BBDEV_OP_LDPC_ENC",
>> +		"RTE_BBDEV_OP_RESERVED_1",
>> +		"RTE_BBDEV_OP_RESERVED_2",
>> +		"RTE_BBDEV_OP_RESERVED_3",
>> +		"RTE_BBDEV_OP_RESERVED_4",
>
> As Stephen said, you should make sure that using these values
> with the API functions will lead to a clear and expected error.
>
>> @@ -748,7 +748,7 @@ enum rte_bbdev_op_type {
>>  	RTE_BBDEV_OP_TURBO_ENC,  /**< Turbo encode */
>>  	RTE_BBDEV_OP_LDPC_DEC,  /**< LDPC decode */
>>  	RTE_BBDEV_OP_LDPC_ENC,  /**< LDPC encode */
>> -	RTE_BBDEV_OP_TYPE_COUNT,  /**< Count of different op types */
>> +	RTE_BBDEV_OP_TYPE_COUNT = 8,  /**< Count of different op types */
>
> You must update the comment to explain there may be a padding,
> it is not exactly the count.
> Maybe "MAX" is a better fit than "COUNT" in this case.


-- 
Regards, Ray K

      parent reply	other threads:[~2022-06-23 16:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-13 18:24 [PATCH v1] bbdev: allow operation type enum for growth Nicolas Chautru
2022-06-13 18:24 ` Nicolas Chautru
2022-06-13 19:48   ` Stephen Hemminger
2022-06-13 20:19     ` Chautru, Nicolas
2022-06-17  8:21   ` Thomas Monjalon
2022-06-17 16:12     ` Chautru, Nicolas
2022-06-23 16:09     ` Ray Kinsella [this message]

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=871qvf4au1.fsf@mdr78.vserver.site \
    --to=mdr@ashroe.eu \
    --cc=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=nicolas.chautru@intel.com \
    --cc=stephen@networkplumber.org \
    --cc=techboard@dpdk.org \
    --cc=thomas@monjalon.net \
    --cc=trix@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.