Skip to contentSkip to conversation

cryptodev and security ABI improvements

PATCH Superseded Akhil Goyal 10 participants 47 messages Jul 31, 2021 – Feb 14, 2023 Crypto API

lore
Share & tools
lore
#0 lore raw

cover cryptodev and security ABI improvements

This is a first series planned for ABI improvements in cryptodev and security library.

Other planned improvements under development.
- cryptodev: export driver interface as internal
- cryptodev: split and hide struct rte_cryptodev, struct rte_cryptodev_data
- cryptodev: hide struct rte_cryptodev_sym_session, rte_cryptodev_asym_session
- security: hide struct rte_security_session

Request everyone to review and contribute for the missing pieces to improve ABI stability.

Akhil Goyal (4):
cryptodev: remove LIST_END enumerators
cryptodev: promote asym APIs to stable
security: hide internal API
security: add reserved bitfields

 app/test/test_cryptodev_asym.c     |  4 ++--
 devtools/libabigail.abignore       |  4 ++++
 drivers/crypto/qat/qat_asym.c      |  2 +-
 lib/cryptodev/rte_crypto_asym.h    |  4 ----
 lib/cryptodev/rte_cryptodev.h      | 10 ----------
 lib/cryptodev/version.map          | 24 +++++++++++++-----------
 lib/security/rte_security.h        |  6 ++++++
 lib/security/rte_security_driver.h |  2 +-
 lib/security/version.map           |  7 ++++++-
 9 files changed, 33 insertions(+), 30 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/4 cryptodev: remove LIST_END enumerators

Remove *_LIST_END enumerators from asymmetric crypto lib to avoid ABI breakage for every new addition in enums.

---
 app/test/test_cryptodev_asym.c  | 4 ++--
 drivers/crypto/qat/qat_asym.c   | 2 +-
 lib/cryptodev/rte_crypto_asym.h | 4 ----
 3 files changed, 3 insertions(+), 7 deletions(-)
app/test/test_cryptodev_asym.c +2 -2
index 847b074a4f..afa0e91a45 100644
@@ -542,7 +542,7 @@ test_one_case(const void *test_case, int sessionless)
 		printf("  %u) TestCase %s %s\n", test_index++,
 			tc.modex.description, test_msg);
 	} else {
-		for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
+		for (i = 0; i <= RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE; i++) {
 			if (tc.modex.xform_type == RTE_CRYPTO_ASYM_XFORM_RSA) {
 				if (tc.rsa_data.op_type_flags & (1 << i)) {
 					if (tc.rsa_data.key_exp) {
@@ -1028,7 +1028,7 @@ static inline void print_asym_capa(
 			rte_crypto_asym_xform_strings[capa->xform_type]);
 	printf("operation supported -");
 
-	for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
+	for (i = 0; i <= RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE; i++) {
 		/* check supported operations */
 		if (rte_cryptodev_asym_xform_capability_check_optype(capa, i))
 			printf(" %s",
drivers/crypto/qat/qat_asym.c +1 -1
index 85973812a8..026625a4d2 100644
@@ -742,7 +742,7 @@ qat_asym_session_configure(struct rte_cryptodev *dev,
 			err = -EINVAL;
 			goto error;
 		}
-	} else if (xform->xform_type >= RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END
+	} else if (xform->xform_type > RTE_CRYPTO_ASYM_XFORM_ECPM
 			|| xform->xform_type <= RTE_CRYPTO_ASYM_XFORM_NONE) {
 		QAT_LOG(ERR, "Invalid asymmetric crypto xform");
 		err = -EINVAL;
lib/cryptodev/rte_crypto_asym.h +0 -4
index 9c866f553f..5edf658572 100644
@@ -94,8 +94,6 @@ enum rte_crypto_asym_xform_type {
 	 */
 	RTE_CRYPTO_ASYM_XFORM_ECPM,
 	/**< Elliptic Curve Point Multiplication */
-	RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END
-	/**< End of list */
 };
 
 /**
@@ -116,7 +114,6 @@ enum rte_crypto_asym_op_type {
 	/**< DH Public Key generation operation */
 	RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE,
 	/**< DH Shared Secret compute operation */
-	RTE_CRYPTO_ASYM_OP_LIST_END
 };
 
 /**
@@ -133,7 +130,6 @@ enum rte_crypto_rsa_padding_type {
 	/**< RSA PKCS#1 OAEP padding scheme */
 	RTE_CRYPTO_RSA_PADDING_PSS,
 	/**< RSA PKCS#1 PSS padding scheme */
-	RTE_CRYPTO_RSA_PADDING_TYPE_LIST_END
 };
 
 /**
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/4 cryptodev: promote asym APIs to stable

In reply to Akhil Goyal

Asymmetric crypto APIs have been stable from quite some time, hence moving them from experimental to stable in DPDK 21.11

---
 lib/cryptodev/rte_cryptodev.h | 10 ----------
 lib/cryptodev/version.map     | 24 +++++++++++++-----------
 2 files changed, 13 insertions(+), 21 deletions(-)
lib/cryptodev/rte_cryptodev.h +0 -10
index 11f4e6fdbf..425f459143 100644
@@ -247,7 +247,6 @@ rte_cryptodev_sym_capability_get(uint8_t dev_id,
  *   - Return description of the asymmetric crypto capability if exist.
  *   - Return NULL if the capability not exist.
  */
-__rte_experimental
 const struct rte_cryptodev_asymmetric_xform_capability *
 rte_cryptodev_asym_capability_get(uint8_t dev_id,
 		const struct rte_cryptodev_asym_capability_idx *idx);
@@ -317,7 +316,6 @@ rte_cryptodev_sym_capability_check_aead(
  *   - Return 1 if the op type is supported
  *   - Return 0 if unsupported
  */
-__rte_experimental
 int
 rte_cryptodev_asym_xform_capability_check_optype(
 	const struct rte_cryptodev_asymmetric_xform_capability *capability,
@@ -333,7 +331,6 @@ rte_cryptodev_asym_xform_capability_check_optype(
  *   - Return 0 if the parameters are in range of the capability.
  *   - Return -1 if the parameters are out of range of the capability.
  */
-__rte_experimental
 int
 rte_cryptodev_asym_xform_capability_check_modlen(
 	const struct rte_cryptodev_asymmetric_xform_capability *capability,
@@ -395,7 +392,6 @@ rte_cryptodev_get_aead_algo_enum(enum rte_crypto_aead_algorithm *algo_enum,
  * - Return -1 if string is not valid
  * - Return 0 if the string is valid
  */
-__rte_experimental
 int
 rte_cryptodev_asym_get_xform_enum(enum rte_crypto_asym_xform_type *xform_enum,
 		const char *xform_string);
@@ -1192,7 +1188,6 @@ rte_cryptodev_sym_session_create(struct rte_mempool *mempool);
  *  - On success return pointer to asym-session
  *  - On failure returns NULL
  */
-__rte_experimental
 struct rte_cryptodev_asym_session *
 rte_cryptodev_asym_session_create(struct rte_mempool *mempool);
 
@@ -1223,7 +1218,6 @@ rte_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *sess);
  *  - -EINVAL if session is NULL.
  *  - -EBUSY if not all device private data has been freed.
  */
-__rte_experimental
 int
 rte_cryptodev_asym_session_free(struct rte_cryptodev_asym_session *sess);
 
@@ -1264,7 +1258,6 @@ rte_cryptodev_sym_session_init(uint8_t dev_id,
  *  - -ENOTSUP if crypto device does not support the crypto transform.
  *  - -ENOMEM if the private session could not be allocated.
  */
-__rte_experimental
 int
 rte_cryptodev_asym_session_init(uint8_t dev_id,
 			struct rte_cryptodev_asym_session *sess,
@@ -1299,7 +1292,6 @@ rte_cryptodev_sym_session_clear(uint8_t dev_id,
  *  - 0 if successful.
  *  - -EINVAL if device is invalid or session is NULL.
  */
-__rte_experimental
 int
 rte_cryptodev_asym_session_clear(uint8_t dev_id,
 			struct rte_cryptodev_asym_session *sess);
@@ -1336,7 +1328,6 @@ rte_cryptodev_sym_get_existing_header_session_size(
  * @return
  *   Size of the asymmetric header session.
  */
-__rte_experimental
 unsigned int
 rte_cryptodev_asym_get_header_session_size(void);
 
@@ -1364,7 +1355,6 @@ rte_cryptodev_sym_get_private_session_size(uint8_t dev_id);
  *   - Size of the asymmetric private data, if successful
  *   - 0 if device is invalid or does not have private session
  */
-__rte_experimental
 unsigned int
 rte_cryptodev_asym_get_private_session_size(uint8_t dev_id);
 
lib/cryptodev/version.map +13 -11
index 9f04737aed..707a2e32d3 100644
@@ -1,4 +1,4 @@
-DPDK_21 {
+DPDK_22 {
 	global:
 
 	rte_crypto_aead_algorithm_strings;
@@ -9,6 +9,18 @@ DPDK_21 {
 	rte_crypto_cipher_operation_strings;
 	rte_crypto_op_pool_create;
 	rte_cryptodev_allocate_driver;
+
+	rte_cryptodev_asym_capability_get;
+	rte_cryptodev_asym_get_header_session_size;
+	rte_cryptodev_asym_get_private_session_size;
+	rte_cryptodev_asym_get_xform_enum;
+	rte_cryptodev_asym_session_clear;
+	rte_cryptodev_asym_session_create;
+	rte_cryptodev_asym_session_free;
+	rte_cryptodev_asym_session_init;
+	rte_cryptodev_asym_xform_capability_check_modlen;
+	rte_cryptodev_asym_xform_capability_check_optype;
+
 	rte_cryptodev_callback_register;
 	rte_cryptodev_callback_unregister;
 	rte_cryptodev_close;
@@ -61,16 +73,6 @@ DPDK_21 {
 EXPERIMENTAL {
 	global:
 
-	rte_cryptodev_asym_capability_get;
-	rte_cryptodev_asym_get_header_session_size;
-	rte_cryptodev_asym_get_private_session_size;
-	rte_cryptodev_asym_get_xform_enum;
-	rte_cryptodev_asym_session_clear;
-	rte_cryptodev_asym_session_create;
-	rte_cryptodev_asym_session_free;
-	rte_cryptodev_asym_session_init;
-	rte_cryptodev_asym_xform_capability_check_modlen;
-	rte_cryptodev_asym_xform_capability_check_optype;
 	rte_cryptodev_sym_cpu_crypto_process;
 	rte_cryptodev_sym_get_existing_header_session_size;
 	rte_cryptodev_sym_session_get_user_data;
Signature · 1 line
2.25.1
#3 lore raw

Re: [dpdk-dev] [PATCH 2/4] cryptodev: promote asym APIs to stable

Quoted 15 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Akhil Goyal
Sent: Saturday, July 31, 2021 8:13 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; De Lara Guarch, Pablo <[email protected]>; Trahe, Fiona <[email protected]>; Doherty, Declan <[email protected]>; [email protected]; [email protected]; Zhang, Roy Fan <[email protected]>; [email protected]; [email protected]; [email protected]; Akhil Goyal <[email protected]>
Subject: [dpdk-dev] [PATCH 2/4] cryptodev: promote asym APIs to stable

Hi Akhil,

I am not sure if this API is ready to be stable so I will add few comments here:

RSA:

	rte_crypto_param message;
	...
	 * - to be signed for RSA sign generation.

If this message is plaintext, then in case of:
1) PKCS1_1.5 padding:
Standard defines data to be signed as DER encoded struct of digestAlgorithm + digest
(few exceptions I am aware of were TLS prior to 1.2 or IKE version 1)
- There is no field to specify that, even if PMD would be correctly implemented it still would lack information about hash aglorithm.
- Currently what openssl pmd for example is doing is RSA_private_encrypt which omits this step (https://www.openssl.org/docs/man1.1.1/man3/RSA_private_encrypt.html - mentions this).
2) PADDING_NONE:
I cannot find what user is supposed to do in this case, and I think it may be quite common option for hw due to reliance on strong CSPRNG for PSS or OAEP.

DSA:

	struct rte_crypto_dsa_op_param {
	...

There is no 'k' parameter? I though I have added it, how hw with no CSRNG should work with DSA?

For ECDSA private key is in Op, for DSA is in xform. Where this inconsistency comes from?

/**< x: Private key of the signer in octet-string network
* byte order format.
* Used when app has pre-defined private key.
* Valid only when xform chain is DSA ONLY.
* if xform chain is DH private key generate + DSA, then DSA sign
* compute will use internally generated key.

And this one I cannot understand, there is DH and DSA in one line plus seems that private dsa key would be generated and used in the same operation. We want to create self-signed certificate here on the fly or something?

	RTE_CRYPTO_ASYM_OP_PRIVATE_KEY_GENERATE,
	/**< DH Private Key generation operation */

This is another interesting part (similar to 'k' in (EC)DSA, PSS, QAEO in RSA), there was no any type of hw random number generation concept for symmetric crypto (i.e. salt, IV, nonce) and here we have standalone Diffie Hellman private key generator.
And since it is no crypto computation but random number generation, maybe there should be another module to handle CSRNG or we could register randomness
source into cryptodev, like callback? Another option would be to predefine randomness source per device like (i.e. x86 RDRAND, /dev/random) for user to decide.

Additionally there is DH op but there is no ECDH (I know there is ECPM, but the same way there is MODEXP which creates another inconsistency). Optionally we can extend DH API to work with EC? EDDSA, EDDH needs to be implemented soon too.

Regards,
Arek

#4 lore raw

Re: [dpdk-dev] [PATCH 2/4] cryptodev: promote asym APIs to stable

Hi Arek,

Do you think all the asym APIs are not eligible for promoting it to stable APIs? I haven't seen any changes for quite some time and we cannot have it experimental Forever.
The APIs which you think are expected to change, we can leave them as experimental And mark the others as stable.

Can you post a patch for it? I will drop it from my series.

Also, could you review the other patches in the series as well.

Regards,
Akhil

Quoted 64 lines

Hi Akhil,

I am not sure if this API is ready to be stable so I will add few comments here:

RSA:

	rte_crypto_param message;
	...
	 * - to be signed for RSA sign generation.

If this message is plaintext, then in case of:
1) PKCS1_1.5 padding:
Standard defines data to be signed as DER encoded struct of digestAlgorithm
+ digest
(few exceptions I am aware of were TLS prior to 1.2 or IKE version 1)
- There is no field to specify that, even if PMD would be correctly
implemented it still would lack information about hash aglorithm.
- Currently what openssl pmd for example is doing is RSA_private_encrypt
which omits this step (https://www.openssl.org/docs/man1.1.1/man3/RSA_private_encrypt.html - mentions this).
2) PADDING_NONE:
I cannot find what user is supposed to do in this case, and I think it may be
quite common option for hw due to reliance on strong CSPRNG for PSS or
OAEP.

DSA:

	struct rte_crypto_dsa_op_param {
	...

There is no 'k' parameter? I though I have added it, how hw with no CSRNG should work with DSA?

For ECDSA private key is in Op, for DSA is in xform. Where this inconsistency comes from?

/**< x: Private key of the signer in octet-string network
* byte order format.
* Used when app has pre-defined private key.
* Valid only when xform chain is DSA ONLY.
* if xform chain is DH private key generate + DSA, then DSA sign
* compute will use internally generated key.

And this one I cannot understand, there is DH and DSA in one line plus seems that private dsa key would be generated and used in the same operation. We want to create self-signed certificate here on the fly or something?

	RTE_CRYPTO_ASYM_OP_PRIVATE_KEY_GENERATE,
	/**< DH Private Key generation operation */

This is another interesting part (similar to 'k' in (EC)DSA, PSS, QAEO in RSA), there was no any type of hw random number generation concept for symmetric crypto (i.e. salt, IV, nonce) and here we have standalone Diffie Hellman private key generator.
And since it is no crypto computation but random number generation, maybe there should be another module to handle CSRNG or we could register randomness
source into cryptodev, like callback? Another option would be to predefine randomness source per device like (i.e. x86 RDRAND, /dev/random) for user to decide.

Additionally there is DH op but there is no ECDH (I know there is ECPM, but the same way there is MODEXP which creates another inconsistency). Optionally we can extend DH API to work with EC?
EDDSA, EDDH needs to be implemented soon too.

Regards,
Arek

#5 lore raw

Re: [dpdk-dev] [PATCH 2/4] cryptodev: promote asym APIs to stable

Quoted 5 lines

Do you think all the asym APIs are not eligible for promoting it to stable APIs? I haven't seen any changes for quite some time and we cannot have it experimental Forever.
The APIs which you think are expected to change, we can leave them as experimental And mark the others as stable.

We could potentially make capability related functions stable but for others there are still some many uncertainties, another example:
Ecdsa op expects 'k' in "in the interval (1, n-1)", openssl pmd will not even have function that accepts 'k' (although optionally inverse of k yes), what should user put then here?

This API needs more attention I believe, I can send patches for it after 21.11 release. My opinion is that we should push all this by another year.

Quoted 76 lines

Can you post a patch for it? I will drop it from my series.

Also, could you review the other patches in the series as well.

Regards,
Akhil

Quoted 9 lines

Hi Akhil,

I am not sure if this API is ready to be stable so I will add few comments here:

RSA:

	rte_crypto_param message;
	...
	 * - to be signed for RSA sign generation.
Quoted 10 lines

If this message is plaintext, then in case of:
1) PKCS1_1.5 padding:
Standard defines data to be signed as DER encoded struct of digestAlgorithm
+ digest
(few exceptions I am aware of were TLS prior to 1.2 or IKE version 1)
- There is no field to specify that, even if PMD would be correctly implemented it still would lack information about hash aglorithm.
- Currently what openssl pmd for example is doing is RSA_private_encrypt which omits this step

(https://www.openssl.org/docs/man1.1.1/man3/RSA_private_encrypt.html - mentions this).

Quoted 21 lines

2) PADDING_NONE:
I cannot find what user is supposed to do in this case, and I think it may be quite common option for hw due to reliance on strong CSPRNG for PSS or OAEP.

DSA:

	struct rte_crypto_dsa_op_param {
	...

There is no 'k' parameter? I though I have added it, how hw with no CSRNG should work with DSA?

For ECDSA private key is in Op, for DSA is in xform. Where this inconsistency comes from?

/**< x: Private key of the signer in octet-string network
* byte order format.
* Used when app has pre-defined private key.
* Valid only when xform chain is DSA ONLY.
* if xform chain is DH private key generate + DSA, then DSA sign
* compute will use internally generated key.

Quoted 2 lines

And this one I cannot understand, there is DH and DSA in one line plus seems that private dsa key would be generated and used in the same

operation.

Quoted 15 lines

We want to create self-signed certificate here on the fly or something?

	RTE_CRYPTO_ASYM_OP_PRIVATE_KEY_GENERATE,
	/**< DH Private Key generation operation */

This is another interesting part (similar to 'k' in (EC)DSA, PSS, QAEO in RSA), there was no any type of hw random number generation concept for symmetric crypto (i.e. salt, IV, nonce) and here we have standalone Diffie Hellman private key generator.
And since it is no crypto computation but random number generation, maybe there should be another module to handle CSRNG or we could register randomness source into cryptodev, like callback? Another option would be to predefine randomness source per device like (i.e. x86 RDRAND, /dev/random) for user to decide.

Quoted 2 lines

Additionally there is DH op but there is no ECDH (I know there is ECPM, but the same way there is MODEXP which creates another

inconsistency).

Quoted 5 lines

Optionally we can extend DH API to work with EC?
EDDSA, EDDH needs to be implemented soon too.

Regards,
Arek

#6 lore raw

Re: [dpdk-dev] [PATCH 2/4] cryptodev: promote asym APIs to stable

Quoted 12 lines
Quoted 1 line

Do you think all the asym APIs are not eligible for promoting it to stable

APIs?

Quoted 4 lines

I haven't seen any changes for quite some time and we cannot have it experimental Forever.
The APIs which you think are expected to change, we can leave them as experimental And mark the others as stable.

We could potentially make capability related functions stable but for others there are still some many uncertainties, another example:
Ecdsa op expects 'k' in "in the interval (1, n-1)", openssl pmd will not even have function that accepts 'k' (although optionally inverse of k yes), what should user put then here?

Quoted 4 lines

This API needs more attention I believe, I can send patches for it after 21.11 release.
My opinion is that we should push all this by another year.

Ok will drop this patch for now.

#7 lore raw

Re: [dpdk-dev] [PATCH 2/4] cryptodev: promote asym APIs to stable

Folks,

Quoted 12 lines · Akhil Goyal
Quoted 12 lines
Quoted 1 line

Do you think all the asym APIs are not eligible for promoting it to stable

APIs?

Quoted 4 lines

I haven't seen any changes for quite some time and we cannot have it experimental Forever.
The APIs which you think are expected to change, we can leave them as experimental And mark the others as stable.

We could potentially make capability related functions stable but for others there are still some many uncertainties, another example:
Ecdsa op expects 'k' in "in the interval (1, n-1)", openssl pmd will not even have function that accepts 'k' (although optionally inverse of k yes), what should user put then here?

Quoted 6 lines
Quoted 4 lines

This API needs more attention I believe, I can send patches for it after 21.11 release.
My opinion is that we should push all this by another year.

Ok will drop this patch for now.

Look since everyone is in alignment here, I am going to ask the symbol bot to ignore the asym crypto APIs for the next year. Thanks for the diligence on this, and thanks to Fan for sending me an FYI.

Ray K

#8 lore raw

RE: [EXT] Re: [dpdk-dev] [PATCH 2/4] cryptodev: promote asym APIs to stable

Folks,

Can we promote the Asym APIs to stable now?

Regards,
Akhil

Quoted 28 lines · Akhil Goyal
Quoted 12 lines
Quoted 12 lines
Quoted 1 line

Do you think all the asym APIs are not eligible for promoting it to stable

APIs?

Quoted 4 lines

I haven't seen any changes for quite some time and we cannot have it experimental Forever.
The APIs which you think are expected to change, we can leave them as experimental And mark the others as stable.

We could potentially make capability related functions stable but for others there are still some many uncertainties, another example:
Ecdsa op expects 'k' in "in the interval (1, n-1)", openssl pmd will not even have function that accepts 'k' (although optionally inverse of k yes), what should user put then here?

Quoted 6 lines
Quoted 4 lines

This API needs more attention I believe, I can send patches for it after 21.11 release.
My opinion is that we should push all this by another year.

Ok will drop this patch for now.

Look since everyone is in alignment here, I am going to ask the symbol bot to ignore
the asym crypto APIs for the next year. Thanks for the diligence on this, and thanks to
Fan for sending me an FYI.

Ray K

#9 lore raw

RE: [EXT] Re: [dpdk-dev] [PATCH 2/4] cryptodev: promote asym APIs to stable

Hi Akhil

Quoted 2 lines

Can we promote the Asym APIs to stable now?

+1 for it

Quoted 31 lines

Regards,
Akhil

Quoted 27 lines · Akhil Goyal
Quoted 13 lines
Quoted 13 lines
Quoted 2 lines

Do you think all the asym APIs are not eligible for promoting it to stable

APIs?

Quoted 4 lines

I haven't seen any changes for quite some time and we cannot have it experimental Forever.
The APIs which you think are expected to change, we can leave them as experimental And mark the others as stable.

We could potentially make capability related functions stable but for others there are still some many uncertainties, another example:
Ecdsa op expects 'k' in "in the interval (1, n-1)", openssl pmd will not even have function that accepts 'k' (although optionally inverse of k yes), what should user put then here?

Quoted 6 lines
Quoted 4 lines

This API needs more attention I believe, I can send patches for it after 21.11 release.
My opinion is that we should push all this by another year.

Ok will drop this patch for now.

Look since everyone is in alignment here, I am going to ask the symbol bot to ignore the asym crypto APIs for the next year. Thanks for the diligence on this, and thanks to Fan for sending me an FYI.

Ray K

#10 lore raw

RE: [EXT] Re: [dpdk-dev] [PATCH 2/4] cryptodev: promote asym APIs to stable

In reply to Akhil Goyal
Quoted 16 lines

-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Thursday, February 2, 2023 11:49 AM
To: Kinsella, Ray <[email protected]>; Kusztal, ArkadiuszX <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Anoob Joseph <[email protected]>; De Lara Guarch, Pablo <[email protected]>; Trahe, Fiona <[email protected]>; Doherty, Declan <[email protected]>; [email protected]; [email protected]; Zhang, Roy Fan <[email protected]>; [email protected]; [email protected]; [email protected]; David Marchand <[email protected]>
Subject: RE: [EXT] Re: [dpdk-dev] [PATCH 2/4] cryptodev: promote asym APIs to stable

Quoted 3 lines

Folks,

Can we promote the Asym APIs to stable now?

Yes, I think we cannot keep it as experimental forever. Although there is still much work to be done starting with capabilities and tests, I will describe it in separate threads.

Quoted 31 lines

Regards,
Akhil

Quoted 27 lines · Akhil Goyal
Quoted 13 lines
Quoted 13 lines
Quoted 2 lines

Do you think all the asym APIs are not eligible for promoting it to stable

APIs?

Quoted 4 lines

I haven't seen any changes for quite some time and we cannot have it experimental Forever.
The APIs which you think are expected to change, we can leave them as experimental And mark the others as stable.

We could potentially make capability related functions stable but for others there are still some many uncertainties, another example:
Ecdsa op expects 'k' in "in the interval (1, n-1)", openssl pmd will not even have function that accepts 'k' (although optionally inverse of k yes), what should user put then here?

Quoted 6 lines
Quoted 4 lines

This API needs more attention I believe, I can send patches for it after 21.11 release.
My opinion is that we should push all this by another year.

Ok will drop this patch for now.

Look since everyone is in alignment here, I am going to ask the symbol bot to ignore the asym crypto APIs for the next year. Thanks for the diligence on this, and thanks to Fan for sending me an FYI.

Ray K

#11 lore raw

PATCH 3/4 security: hide internal API

In reply to Akhil Goyal

rte_security_dynfield_register() is an internal API to be used by the driver, hence moving it to internal.

---
 lib/security/rte_security_driver.h | 2 +-
 lib/security/version.map           | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)
lib/security/rte_security_driver.h +1 -1
index 938373205c..b0253e962e 100644
@@ -89,7 +89,7 @@ typedef int (*security_session_stats_get_t)(void *device,
 		struct rte_security_session *sess,
 		struct rte_security_stats *stats);
 
-__rte_experimental
+__rte_internal
 int rte_security_dynfield_register(void);
 
 /**
lib/security/version.map +6 -1
index 22775558c8..bd91d9a16c 100644
@@ -16,8 +16,13 @@ EXPERIMENTAL {
 	global:
 
 	rte_security_dynfield_offset;
-	rte_security_dynfield_register;
 	rte_security_get_userdata;
 	rte_security_session_stats_get;
 	rte_security_session_update;
 };
+
+INTERNAL {
+	global:
+
+	rte_security_dynfield_register;
+};
Signature · 1 line
2.25.1
Acked-by on v1 3/4
#12 lore raw

Re: [dpdk-dev] [PATCH 3/4] security: hide internal API

Quoted 34 lines

rte_security_dynfield_register() is an internal API to be used by the driver, hence moving it to internal.

---
 lib/security/rte_security_driver.h | 2 +-
 lib/security/version.map           | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)
lib/security/rte_security_driver.h +1 -1
index 938373205c..b0253e962e 100644
@@ -89,7 +89,7 @@ typedef int (*security_session_stats_get_t)(void *device,
 		struct rte_security_session *sess,
 		struct rte_security_stats *stats);
 
-__rte_experimental
+__rte_internal
 int rte_security_dynfield_register(void);
 
 /**
lib/security/version.map +0 -1
index 22775558c8..bd91d9a16c 100644
@@ -16,8 +16,13 @@ EXPERIMENTAL {
 	global:
 
 	rte_security_dynfield_offset;
-	rte_security_dynfield_register;
 	rte_security_get_userdata;

lib/security/version.map EXPERIMENTAL {

Quoted 10 lines
lib/security/version.map +6 -1
 	rte_security_session_stats_get;
 	rte_security_session_update;
 };
+
+INTERNAL {
+	global:
+
+	rte_security_dynfield_register;
+};
--
Quoted 1 line

2.25.1

#13 lore raw

PATCH 4/4 security: add reserved bitfields

In reply to Akhil Goyal

In struct rte_security_ipsec_sa_options, for every new option added, there is an ABI breakage, to avoid, a reserved_opts bitfield is added to for the remaining bits available in the structure.
Now for every new sa option, these reserved_opts can be reduced and new option can be added. A corresponding exception is also added in devtools/libabigail.abignore

---
 devtools/libabigail.abignore | 4 ++++
 lib/security/rte_security.h  | 6 ++++++
 2 files changed, 10 insertions(+)
devtools/libabigail.abignore +4 -0
index 93158405e0..5d8da28e55 100644
@@ -52,3 +52,7 @@
 ; https://sourceware.org/bugzilla/show_bug.cgi?id=28060
 [suppress_type]
 	name = rte_eth_dev_data
+
+; Ignore changes in reserved_opts bitfield of rte_security_ipsec_sa_options
+[suppress_variable]
+	name = reserved_opts
lib/security/rte_security.h +6 -0
index 88d31de0a6..4606425e8d 100644
@@ -181,6 +181,12 @@ struct rte_security_ipsec_sa_options {
 	 * * 0: Disable per session security statistics collection for this SA.
 	 */
 	uint32_t stats : 1;
+
+	/** Reserved bit fields for future extension
+	 *
+	 * Note: reduce number of bits in reserved_opts for every new option
+	 */
+	uint32_t reserved_opts : 24;
 };
 
 /** IPSec security association direction */
Signature · 1 line
2.25.1
Acked-by on v1 4/4
#14 lore raw

Re: [dpdk-dev] [PATCH 4/4] security: add reserved bitfields

Quoted 35 lines

In struct rte_security_ipsec_sa_options, for every new option added, there is an ABI breakage, to avoid, a reserved_opts bitfield is added to for the remaining bits available in the structure.
Now for every new sa option, these reserved_opts can be reduced and new option can be added. A corresponding exception is also added in devtools/libabigail.abignore

---
 devtools/libabigail.abignore | 4 ++++
 lib/security/rte_security.h  | 6 ++++++
 2 files changed, 10 insertions(+)
devtools/libabigail.abignore +4 -0
index 93158405e0..5d8da28e55 100644
@@ -52,3 +52,7 @@
 ; https://sourceware.org/bugzilla/show_bug.cgi?id=28060
 [suppress_type]
 	name = rte_eth_dev_data
+
+; Ignore changes in reserved_opts bitfield of rte_security_ipsec_sa_options
+[suppress_variable]
+	name = reserved_opts
lib/security/rte_security.h +0 -0
index 88d31de0a6..4606425e8d 100644
@@ -181,6 +181,12 @@ struct rte_security_ipsec_sa_options {
 	 * * 0: Disable per session security statistics collection for this SA.
 	 */
 	uint32_t stats : 1;

lib/security/rte_security.h struct rte_security_ipsec_sa_options {

Quoted 10 lines
lib/security/rte_security.h +6 -1
+
+	/** Reserved bit fields for future extension
+	 *
+	 * Note: reduce number of bits in reserved_opts for every new option
+	 */
+	uint32_t reserved_opts : 24;
 };
 
 /** IPSec security association direction */
--
Quoted 1 line

2.25.1

#15 lore raw

Re: [dpdk-dev] [PATCH 4/4] security: add reserved bitfields

In reply to Akhil Goyal
Quoted 7 lines · On Sat, 31 Jul 2021 23:43:27 +0530 Akhil Goyal <[email protected]> wrote:
lib/security/rte_security.h +0 -0
index 88d31de0a6..4606425e8d 100644
@@ -181,6 +181,12 @@ struct rte_security_ipsec_sa_options {
 	 * * 0: Disable per session security statistics collection for this SA.
 	 */

lib/security/rte_security.h struct rte_security_ipsec_sa_options { · line 192

Quoted 10 lines
lib/security/rte_security.h +6 -0
 	uint32_t stats : 1;
+
+	/** Reserved bit fields for future extension
+	 *
+	 * Note: reduce number of bits in reserved_opts for every new option
+	 */
+	uint32_t reserved_opts : 24;
 };
 
 /** IPSec security association direction */

You must add a check that these are 0 otherwise they are useless as being reserved later. You can't assume the old application will leave these bits as zero.

#16 lore raw
In reply to Akhil Goyal
Quoted 13 lines

Subject: [PATCH 0/4] cryptodev and security ABI improvements

This is a first series planned for ABI improvements in cryptodev and security library.

Other planned improvements under development.
- cryptodev: export driver interface as internal
- cryptodev: split and hide struct rte_cryptodev, struct rte_cryptodev_data
- cryptodev: hide struct rte_cryptodev_sym_session, rte_cryptodev_asym_session
- security: hide struct rte_security_session

Quoted 3 lines

Request everyone to review and contribute for the missing pieces to improve ABI stability.

Forgot to mention, this is an RFC series for DPDK 21.11

Quoted 19 lines

Akhil Goyal (4):
cryptodev: remove LIST_END enumerators
cryptodev: promote asym APIs to stable
security: hide internal API
security: add reserved bitfields

 app/test/test_cryptodev_asym.c     |  4 ++--
 devtools/libabigail.abignore       |  4 ++++
 drivers/crypto/qat/qat_asym.c      |  2 +-
 lib/cryptodev/rte_crypto_asym.h    |  4 ----
 lib/cryptodev/rte_cryptodev.h      | 10 ----------
 lib/cryptodev/version.map          | 24 +++++++++++++-----------
 lib/security/rte_security.h        |  6 ++++++
 lib/security/rte_security_driver.h |  2 +-
 lib/security/version.map           |  7 ++++++-
 9 files changed, 33 insertions(+), 30 deletions(-)

--
2.25.1

#17 lore raw

PATCH v2 1/3 cryptodev: remove LIST_END enumerators

In reply to Akhil Goyal

Remove *_LIST_END enumerators from asymmetric crypto lib to avoid ABI breakage for every new addition in enums.

---
v2: no change

 app/test/test_cryptodev_asym.c  | 4 ++--
 drivers/crypto/qat/qat_asym.c   | 2 +-
 lib/cryptodev/rte_crypto_asym.h | 4 ----
 3 files changed, 3 insertions(+), 7 deletions(-)
app/test/test_cryptodev_asym.c +2 -2
index 9d19a6d6d9..603b2e4609 100644
@@ -541,7 +541,7 @@ test_one_case(const void *test_case, int sessionless)
 		printf("  %u) TestCase %s %s\n", test_index++,
 			tc.modex.description, test_msg);
 	} else {
-		for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
+		for (i = 0; i <= RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE; i++) {
 			if (tc.modex.xform_type == RTE_CRYPTO_ASYM_XFORM_RSA) {
 				if (tc.rsa_data.op_type_flags & (1 << i)) {
 					if (tc.rsa_data.key_exp) {
@@ -1027,7 +1027,7 @@ static inline void print_asym_capa(
 			rte_crypto_asym_xform_strings[capa->xform_type]);
 	printf("operation supported -");
 
-	for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
+	for (i = 0; i <= RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE; i++) {
 		/* check supported operations */
 		if (rte_cryptodev_asym_xform_capability_check_optype(capa, i))
 			printf(" %s",
drivers/crypto/qat/qat_asym.c +1 -1
index 85973812a8..026625a4d2 100644
@@ -742,7 +742,7 @@ qat_asym_session_configure(struct rte_cryptodev *dev,
 			err = -EINVAL;
 			goto error;
 		}
-	} else if (xform->xform_type >= RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END
+	} else if (xform->xform_type > RTE_CRYPTO_ASYM_XFORM_ECPM
 			|| xform->xform_type <= RTE_CRYPTO_ASYM_XFORM_NONE) {
 		QAT_LOG(ERR, "Invalid asymmetric crypto xform");
 		err = -EINVAL;
lib/cryptodev/rte_crypto_asym.h +0 -4
index 9c866f553f..5edf658572 100644
@@ -94,8 +94,6 @@ enum rte_crypto_asym_xform_type {
 	 */
 	RTE_CRYPTO_ASYM_XFORM_ECPM,
 	/**< Elliptic Curve Point Multiplication */
-	RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END
-	/**< End of list */
 };
 
 /**
@@ -116,7 +114,6 @@ enum rte_crypto_asym_op_type {
 	/**< DH Public Key generation operation */
 	RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE,
 	/**< DH Shared Secret compute operation */
-	RTE_CRYPTO_ASYM_OP_LIST_END
 };
 
 /**
@@ -133,7 +130,6 @@ enum rte_crypto_rsa_padding_type {
 	/**< RSA PKCS#1 OAEP padding scheme */
 	RTE_CRYPTO_RSA_PADDING_PSS,
 	/**< RSA PKCS#1 PSS padding scheme */
-	RTE_CRYPTO_RSA_PADDING_TYPE_LIST_END
 };
 
 /**
Signature · 1 line
2.25.1
#18 lore raw

PATCH v2 2/3 security: hide internal API

rte_security_dynfield_register() is an internal API to be used by the driver, hence moving it to internal.

---
v2: no change

 lib/security/rte_security_driver.h | 2 +-
 lib/security/version.map           | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)
lib/security/rte_security_driver.h +1 -1
index 938373205c..b0253e962e 100644
@@ -89,7 +89,7 @@ typedef int (*security_session_stats_get_t)(void *device,
 		struct rte_security_session *sess,
 		struct rte_security_stats *stats);
 
-__rte_experimental
+__rte_internal
 int rte_security_dynfield_register(void);
 
 /**
lib/security/version.map +6 -1
index a1f46bfd27..edf4887e12 100644
@@ -16,7 +16,12 @@ EXPERIMENTAL {
 	__rte_security_get_userdata;
 	__rte_security_set_pkt_metadata;
 	rte_security_dynfield_offset;
-	rte_security_dynfield_register;
 	rte_security_session_stats_get;
 	rte_security_session_update;
 };
+
+INTERNAL {
+	global:
+
+	rte_security_dynfield_register;
+};
Signature · 1 line
2.25.1
Acked-by on v2 2/3
#19 lore raw

Re: [dpdk-dev] [PATCH v2 2/3] security: hide internal API

Quoted 34 lines · Akhil Goyal

rte_security_dynfield_register() is an internal API to be used by the driver, hence moving it to internal.

---
v2: no change

 lib/security/rte_security_driver.h | 2 +-
 lib/security/version.map           | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)
lib/security/rte_security_driver.h +1 -1
index 938373205c..b0253e962e 100644
@@ -89,7 +89,7 @@ typedef int (*security_session_stats_get_t)(void *device,
 		struct rte_security_session *sess,
 		struct rte_security_stats *stats);
 
-__rte_experimental
+__rte_internal
 int rte_security_dynfield_register(void);
 
 /**
lib/security/version.map +0 -0
index a1f46bfd27..edf4887e12 100644
@@ -16,7 +16,12 @@ EXPERIMENTAL {
 	__rte_security_get_userdata;
 	__rte_security_set_pkt_metadata;
 	rte_security_dynfield_offset;

lib/security/version.map EXPERIMENTAL { · line 27

Quoted 10 lines
lib/security/version.map +6 -1
-	rte_security_dynfield_register;
 	rte_security_session_stats_get;
 	rte_security_session_update;
 };
+
+INTERNAL {
+	global:
+
+	rte_security_dynfield_register;
+};
#20 lore raw

PATCH v2 3/3 security: add reserved bitfields

In reply to Akhil Goyal

In struct rte_security_ipsec_sa_options, for every new option added, there is an ABI breakage, to avoid, a reserved_opts bitfield is added to for the remaining bits available in the structure.
Now for every new sa option, these reserved_opts can be reduced and new option can be added.

---
v2: rebase and removed libabigail.abignore change.
Exception may be added when there is a need for change.

 lib/security/rte_security.h | 6 ++++++
 1 file changed, 6 insertions(+)
lib/security/rte_security.h +6 -0
index 7eb9f109ae..c0ea13892e 100644
@@ -258,6 +258,12 @@ struct rte_security_ipsec_sa_options {
 	 * PKT_TX_UDP_CKSUM or PKT_TX_L4_MASK in mbuf.
 	 */
 	uint32_t l4_csum_enable : 1;
+
+	/** Reserved bit fields for future extension
+	 *
+	 * Note: reduce number of bits in reserved_opts for every new option
+	 */
+	uint32_t reserved_opts : 18;
 };
 
 /** IPSec security association direction */
Signature · 1 line
2.25.1
#21 lore raw

Re: [dpdk-dev] [PATCH v2 3/3] security: add reserved bitfields

08/10/2021 22:45, Akhil Goyal:

Quoted 6 lines

In struct rte_security_ipsec_sa_options, for every new option added, there is an ABI breakage, to avoid, a reserved_opts bitfield is added to for the remaining bits available in the structure.
Now for every new sa option, these reserved_opts can be reduced and new option can be added.

How do you make sure this field is initialized to 0?

#22 lore raw

Re: [dpdk-dev] [EXT] Re: [PATCH v2 3/3] security: add reserved bitfields

Quoted 10 lines

08/10/2021 22:45, Akhil Goyal:

Quoted 6 lines

In struct rte_security_ipsec_sa_options, for every new option added, there is an ABI breakage, to avoid, a reserved_opts bitfield is added to for the remaining bits available in the structure.
Now for every new sa option, these reserved_opts can be reduced and new option can be added.

How do you make sure this field is initialized to 0?

Struct rte_security_ipsec_xform Is part of rte_security_capability as well As a configuration structure in session create.
User, should ensure that if a device support that option(in capability), then only these options will take into effect or else it will be don't care for the PMD. The initial values of capabilities are set by PMD statically based on the features that it support.
So if someone sets a bit in reserved_opts, it will work only if PMD support it And sets the corresponding field in capabilities.
But yes, if a new field is added in future, and user sets the reserved_opts by mistake And the PMD supports that feature as well, then that feature will be enabled. This may or may not create issue depending on the feature which is enabled.

Should I add a note in the comments to clarify that reserved_opts should be set as 0 And future releases may change this without notice(But reserved in itself suggest that)? Adding an explicit check in session_create does not make sense to me.
What do you suggest?

Regards,
Akhil

#23 lore raw

Re: [dpdk-dev] [EXT] Re: [PATCH v2 3/3] security: add reserved bitfields

Quoted 22 lines · On Mon, 11 Oct 2021 16:58:24 +0000 Akhil Goyal <[email protected]> wrote:
Quoted 10 lines

08/10/2021 22:45, Akhil Goyal:

Quoted 6 lines

In struct rte_security_ipsec_sa_options, for every new option added, there is an ABI breakage, to avoid, a reserved_opts bitfield is added to for the remaining bits available in the structure.
Now for every new sa option, these reserved_opts can be reduced and new option can be added.

How do you make sure this field is initialized to 0?

Struct rte_security_ipsec_xform Is part of rte_security_capability as well As a configuration structure in session create.
User, should ensure that if a device support that option(in capability), then only these options will take into effect or else it will be don't care for the PMD. The initial values of capabilities are set by PMD statically based on the features that it support.
So if someone sets a bit in reserved_opts, it will work only if PMD support it And sets the corresponding field in capabilities.
But yes, if a new field is added in future, and user sets the reserved_opts by mistake And the PMD supports that feature as well, then that feature will be enabled. This may or may not create issue depending on the feature which is enabled.

Quoted 8 lines

Should I add a note in the comments to clarify that reserved_opts should be set as 0 And future releases may change this without notice(But reserved in itself suggest that)? Adding an explicit check in session_create does not make sense to me.
What do you suggest?

Regards,
Akhil

The problem is if user creates an on stack variable and sets the unreserved fields to good values but other parts are garbage. This passes API/ABI unless you strictly enforce that all reserved fields are zero.

#24 lore raw

Re: [dpdk-dev] [EXT] Re: [PATCH v2 3/3] security: add reserved bitfields

Quoted 55 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Monday 11 October 2021 23:16
To: Akhil Goyal <[email protected]>
Cc: Thomas Monjalon <[email protected]>; [email protected]; [email protected]; [email protected]; Anoob Joseph <[email protected]>; De Lara Guarch, Pablo <[email protected]>; Trahe, Fiona <[email protected]>; Doherty, Declan <[email protected]>; [email protected]; [email protected]; Zhang, Roy Fan <[email protected]>; [email protected]; [email protected]; [email protected]; Ananyev, Konstantin <[email protected]>; Nicolau, Radu <[email protected]>; [email protected]; Nagadheeraj Rottela <[email protected]>; Ankur Dwivedi <[email protected]>; Power, Ciara <[email protected]>; Kinsella, Ray <[email protected]>; Richardson, Bruce <[email protected]>
Subject: Re: [EXT] Re: [PATCH v2 3/3] security: add reserved bitfields

Quoted 8 lines · On Mon, 11 Oct 2021 16:58:24 +0000 Akhil Goyal <[email protected]> wrote:
Quoted 8 lines

08/10/2021 22:45, Akhil Goyal:

Quoted 6 lines

In struct rte_security_ipsec_sa_options, for every new option added, there is an ABI breakage, to avoid, a reserved_opts bitfield is added to for the remaining bits available in the structure.
Now for every new sa option, these reserved_opts can be reduced and new option can be added.

Quoted 6 lines
Quoted 2 lines

How do you make sure this field is initialized to 0?

Struct rte_security_ipsec_xform Is part of rte_security_capability as well As a configuration structure in session create.
User, should ensure that if a device support that option(in capability), then only these options will take into effect or else it

will be don't care for the PMD.

Quoted 6 lines

The initial values of capabilities are set by PMD statically based on the features that it support.
So if someone sets a bit in reserved_opts, it will work only if PMD support it And sets the corresponding field in capabilities. But yes, if a new field is added in future, and user sets the reserved_opts by mistake And the PMD supports that feature as well,

then that feature will be enabled.

Quoted 1 line

This may or may not create issue depending on the feature which is

enabled.

Quoted 3 lines

Should I add a note in the comments to clarify that reserved_opts should be set as 0 And future releases may change this without

notice(But reserved in itself suggest that)?

Quoted 3 lines

Adding an explicit check in session_create does not make sense to me. What do you suggest?

Quoted 8 lines
Quoted 3 lines

Regards,
Akhil

The problem is if user creates an on stack variable and sets the unreserved fields to good values but other parts are garbage. This passes API/ABI unless you strictly enforce that all reserved fields are zero.

Right, but that is no better or worse than the current struct, in that respect, right? User case be careless there also - declare it on the stack and forget to memset.

struct rte_security_ipsec_sa_options {
     uint32_t esn : 1;
 
     uint32_t udp_encap : 1;
 
     uint32_t copy_dscp : 1;
 
     uint32_t copy_flabel : 1;
 
     uint32_t copy_df : 1;
 
     uint32_t dec_ttl : 1;
 
     uint32_t ecn : 1;
 
     uint32_t stats : 1;
 
     uint32_t iv_gen_disable : 1;
 
     uint32_t tunnel_hdr_verify : 2;

};

#25 lore raw

Re: [dpdk-dev] [EXT] Re: [PATCH v2 3/3] security: add reserved bitfields

In reply to Akhil Goyal

11/10/2021 18:58, Akhil Goyal:

Quoted 22 lines
Quoted 10 lines

08/10/2021 22:45, Akhil Goyal:

Quoted 6 lines

In struct rte_security_ipsec_sa_options, for every new option added, there is an ABI breakage, to avoid, a reserved_opts bitfield is added to for the remaining bits available in the structure.
Now for every new sa option, these reserved_opts can be reduced and new option can be added.

How do you make sure this field is initialized to 0?

Struct rte_security_ipsec_xform Is part of rte_security_capability as well As a configuration structure in session create.
User, should ensure that if a device support that option(in capability), then only these options will take into effect or else it will be don't care for the PMD. The initial values of capabilities are set by PMD statically based on the features that it support.
So if someone sets a bit in reserved_opts, it will work only if PMD support it And sets the corresponding field in capabilities.
But yes, if a new field is added in future, and user sets the reserved_opts by mistake And the PMD supports that feature as well, then that feature will be enabled. This may or may not create issue depending on the feature which is enabled.

Quoted 4 lines

Should I add a note in the comments to clarify that reserved_opts should be set as 0 And future releases may change this without notice(But reserved in itself suggest that)? Adding an explicit check in session_create does not make sense to me.
What do you suggest?

Yes at the minimum you should add a comment.
You could also initialize it in the lib, but it is not always possible.

#26 lore raw

Re: [dpdk-dev] [EXT] Re: [PATCH v2 3/3] security: add reserved bitfields

Quoted 23 lines · Thomas Monjalon

11/10/2021 18:58, Akhil Goyal:

Quoted 22 lines
Quoted 10 lines

08/10/2021 22:45, Akhil Goyal:

Quoted 6 lines

In struct rte_security_ipsec_sa_options, for every new option added, there is an ABI breakage, to avoid, a reserved_opts bitfield is added to for the remaining bits available in the structure.
Now for every new sa option, these reserved_opts can be reduced and new option can be added.

How do you make sure this field is initialized to 0?

Struct rte_security_ipsec_xform Is part of rte_security_capability as well As a configuration structure in session create.
User, should ensure that if a device support that option(in capability), then only these options will take into effect or else it will be don't care for the PMD. The initial values of capabilities are set by PMD statically based on the features that it support.
So if someone sets a bit in reserved_opts, it will work only if PMD support it And sets the corresponding field in capabilities.
But yes, if a new field is added in future, and user sets the reserved_opts by mistake And the PMD supports that feature as well, then that feature will be enabled. This may or may not create issue depending on the feature which is enabled.

Quoted 8 lines
Quoted 4 lines

Should I add a note in the comments to clarify that reserved_opts should be set as 0 And future releases may change this without notice(But reserved in itself suggest that)? Adding an explicit check in session_create does not make sense to me.
What do you suggest?

Yes at the minimum you should add a comment.
You could also initialize it in the lib, but it is not always possible.

Provide a macro for initialization perhaps ... but there would be no way to enforce using it.

Ray K

Acked-by on v2 3/3
#27 lore raw

Re: [dpdk-dev] [PATCH v2 3/3] security: add reserved bitfields

In reply to Akhil Goyal
Quoted 24 lines · Akhil Goyal

In struct rte_security_ipsec_sa_options, for every new option added, there is an ABI breakage, to avoid, a reserved_opts bitfield is added to for the remaining bits available in the structure.
Now for every new sa option, these reserved_opts can be reduced and new option can be added.

---
v2: rebase and removed libabigail.abignore change.
Exception may be added when there is a need for change.

 lib/security/rte_security.h | 6 ++++++
 1 file changed, 6 insertions(+)
lib/security/rte_security.h +0 -0
index 7eb9f109ae..c0ea13892e 100644
@@ -258,6 +258,12 @@ struct rte_security_ipsec_sa_options {
 	 * PKT_TX_UDP_CKSUM or PKT_TX_L4_MASK in mbuf.
 	 */

lib/security/rte_security.h struct rte_security_ipsec_sa_options { · line 269

Quoted 10 lines
lib/security/rte_security.h +6 -0
 	uint32_t l4_csum_enable : 1;
+
+	/** Reserved bit fields for future extension
+	 *
+	 * Note: reduce number of bits in reserved_opts for every new option
+	 */
+	uint32_t reserved_opts : 18;
 };
 
 /** IPSec security association direction */
Acked-by on v2 1/3
#28 lore raw

Re: [dpdk-dev] [PATCH v2 1/3] cryptodev: remove LIST_END enumerators

In reply to Akhil Goyal
Quoted 16 lines

-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Friday, October 8, 2021 9:45 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; De Lara Guarch, Pablo <[email protected]>; Trahe, Fiona <[email protected]>; Doherty, Declan <[email protected]>; [email protected]; [email protected]; Zhang, Roy Fan <[email protected]>; [email protected]; [email protected]; [email protected]; Ananyev, Konstantin <[email protected]>; Nicolau, Radu <[email protected]>; [email protected]; [email protected]; [email protected]; Power, Ciara <[email protected]>; Akhil Goyal <[email protected]>
Subject: [PATCH v2 1/3] cryptodev: remove LIST_END enumerators

Quoted 6 lines

Remove *_LIST_END enumerators from asymmetric crypto lib to avoid ABI breakage for every new addition in enums.

---

#29 lore raw

Re: [dpdk-dev] [PATCH v2 1/3] cryptodev: remove LIST_END enumerators

In reply to Akhil Goyal
Quoted 70 lines · Akhil Goyal

Remove *_LIST_END enumerators from asymmetric crypto lib to avoid ABI breakage for every new addition in enums.

---
v2: no change

 app/test/test_cryptodev_asym.c  | 4 ++--
 drivers/crypto/qat/qat_asym.c   | 2 +-
 lib/cryptodev/rte_crypto_asym.h | 4 ----
 3 files changed, 3 insertions(+), 7 deletions(-)
app/test/test_cryptodev_asym.c +2 -2
index 9d19a6d6d9..603b2e4609 100644
@@ -541,7 +541,7 @@ test_one_case(const void *test_case, int sessionless)
 		printf("  %u) TestCase %s %s\n", test_index++,
 			tc.modex.description, test_msg);
 	} else {
-		for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
+		for (i = 0; i <= RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE; i++) {
 			if (tc.modex.xform_type == RTE_CRYPTO_ASYM_XFORM_RSA) {
 				if (tc.rsa_data.op_type_flags & (1 << i)) {
 					if (tc.rsa_data.key_exp) {
@@ -1027,7 +1027,7 @@ static inline void print_asym_capa(
 			rte_crypto_asym_xform_strings[capa->xform_type]);
 	printf("operation supported -");
 
-	for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
+	for (i = 0; i <= RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE; i++) {
 		/* check supported operations */
 		if (rte_cryptodev_asym_xform_capability_check_optype(capa, i))
 			printf(" %s",
drivers/crypto/qat/qat_asym.c +1 -1
index 85973812a8..026625a4d2 100644
@@ -742,7 +742,7 @@ qat_asym_session_configure(struct rte_cryptodev *dev,
 			err = -EINVAL;
 			goto error;
 		}
-	} else if (xform->xform_type >= RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END
+	} else if (xform->xform_type > RTE_CRYPTO_ASYM_XFORM_ECPM
 			|| xform->xform_type <= RTE_CRYPTO_ASYM_XFORM_NONE) {
 		QAT_LOG(ERR, "Invalid asymmetric crypto xform");
 		err = -EINVAL;
lib/cryptodev/rte_crypto_asym.h +0 -3
index 9c866f553f..5edf658572 100644
@@ -94,8 +94,6 @@ enum rte_crypto_asym_xform_type {
 	 */
 	RTE_CRYPTO_ASYM_XFORM_ECPM,
 	/**< Elliptic Curve Point Multiplication */
-	RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END
-	/**< End of list */
 };
 
 /**
@@ -116,7 +114,6 @@ enum rte_crypto_asym_op_type {
 	/**< DH Public Key generation operation */
 	RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE,
 	/**< DH Shared Secret compute operation */
-	RTE_CRYPTO_ASYM_OP_LIST_END
 };
 
 /**

lib/cryptodev/rte_crypto_asym.h enum rte_crypto_rsa_padding_type { · line 135

Quoted 7 lines
lib/cryptodev/rte_crypto_asym.h +0 -1
@@ -133,7 +130,6 @@ enum rte_crypto_rsa_padding_type {
 	/**< RSA PKCS#1 OAEP padding scheme */
 	RTE_CRYPTO_RSA_PADDING_PSS,
 	/**< RSA PKCS#1 PSS padding scheme */
-	RTE_CRYPTO_RSA_PADDING_TYPE_LIST_END
 };
 
 /**

So I am not sure that this is an improvement.
The cryptodev issue we had, was that _LIST_END was being used to size arrays. And that broke when new algorithms got added. Is that an issue, in this case?

I am not sure that swapping out _LIST_END, and then littering the code with RTE_CRYPTO_ASYM_XFORM_ECPM and RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE, is an improvement here.

My 2c is that from an ABI PoV RTE_CRYPTO_ASYM_OP_LIST_END is not better or worse, than RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE?

Interested to hear other thoughts.

#30 lore raw

Re: [dpdk-dev] [EXT] Re: [PATCH v2 1/3] cryptodev: remove LIST_END enumerators

Quoted 88 lines · Akhil Goyal
Quoted 8 lines

Remove *_LIST_END enumerators from asymmetric crypto lib to avoid ABI breakage for every new addition in enums.

---
v2: no change

Review

Quoted 6 lines
 app/test/test_cryptodev_asym.c  | 4 ++--
 drivers/crypto/qat/qat_asym.c   | 2 +-
 lib/cryptodev/rte_crypto_asym.h | 4 ----
 3 files changed, 3 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/app/test/test_cryptodev_asym.c

app/test/test_cryptodev_asym.c test_one_case(const void *test_case, int

Quoted 4 lines

index 9d19a6d6d9..603b2e4609 100644

app/test/test_cryptodev_asym.c +0 -0
@@ -541,7 +541,7 @@ test_one_case(const void *test_case, int

sessionless)

app/test/test_cryptodev_asym.c test_one_case(const void *test_case, int sessionless)

Quoted 5 lines
app/test/test_cryptodev_asym.c +1 -1
 		printf("  %u) TestCase %s %s\n", test_index++,
 			tc.modex.description, test_msg);
 	} else {
-		for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
+		for (i = 0; i <=

RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE; i++) {

app/test/test_cryptodev_asym.c test_one_case(const void *test_case, int · line 545

Quoted 1 line
app/test/test_cryptodev_asym.c +0 -0
 			if (tc.modex.xform_type ==

RTE_CRYPTO_ASYM_XFORM_RSA) {

app/test/test_cryptodev_asym.c static inline void print_asym_capa( · line 1030

Quoted 8 lines
app/test/test_cryptodev_asym.c +1 -1
 				if (tc.rsa_data.op_type_flags & (1 << i)) {
 					if (tc.rsa_data.key_exp) {
@@ -1027,7 +1027,7 @@ static inline void print_asym_capa(
 			rte_crypto_asym_xform_strings[capa->xform_type]);
 	printf("operation supported -");
 
-	for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
+	for (i = 0; i <= RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE;

i++) {

app/test/test_cryptodev_asym.c static inline void print_asym_capa( · line 1032

Quoted 2 lines
app/test/test_cryptodev_asym.c +0 -0
 		/* check supported operations */
 		if

(rte_cryptodev_asym_xform_capability_check_optype(capa, i))

drivers/crypto/qat/qat_asym.c qat_asym_session_configure(struct rte_cryptodev

Quoted 6 lines
app/test/test_cryptodev_asym.c +0 -0
 			printf(" %s",
drivers/crypto/qat/qat_asym.c +0 -0
index 85973812a8..026625a4d2 100644
@@ -742,7 +742,7 @@ qat_asym_session_configure(struct rte_cryptodev

*dev,

drivers/crypto/qat/qat_asym.c qat_asym_session_configure(struct rte_cryptodev *dev,

Quoted 4 lines
drivers/crypto/qat/qat_asym.c +0 -1
 			err = -EINVAL;
 			goto error;
 		}
-	} else if (xform->xform_type >=

RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END

drivers/crypto/qat/qat_asym.c qat_asym_session_configure(struct rte_cryptodev · line 746

Quoted 2 lines
drivers/crypto/qat/qat_asym.c +1 -0
+	} else if (xform->xform_type > RTE_CRYPTO_ASYM_XFORM_ECPM
 			|| xform->xform_type <=

RTE_CRYPTO_ASYM_XFORM_NONE) {

Review

Quoted 3 lines
drivers/crypto/qat/qat_asym.c +0 -0
 		QAT_LOG(ERR, "Invalid asymmetric crypto xform");
 		err = -EINVAL;
(quoted diff) +0 -0

b/lib/cryptodev/rte_crypto_asym.h

Quoted 27 lines

index 9c866f553f..5edf658572 100644

lib/cryptodev/rte_crypto_asym.h +0 -4
@@ -94,8 +94,6 @@ enum rte_crypto_asym_xform_type {
 	 */
 	RTE_CRYPTO_ASYM_XFORM_ECPM,
 	/**< Elliptic Curve Point Multiplication */
-	RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END
-	/**< End of list */
 };
 
 /**
@@ -116,7 +114,6 @@ enum rte_crypto_asym_op_type {
 	/**< DH Public Key generation operation */
 	RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE,
 	/**< DH Shared Secret compute operation */
-	RTE_CRYPTO_ASYM_OP_LIST_END
 };
 
 /**
@@ -133,7 +130,6 @@ enum rte_crypto_rsa_padding_type {
 	/**< RSA PKCS#1 OAEP padding scheme */
 	RTE_CRYPTO_RSA_PADDING_PSS,
 	/**< RSA PKCS#1 PSS padding scheme */
-	RTE_CRYPTO_RSA_PADDING_TYPE_LIST_END
 };
 
Quoted 6 lines

lib/cryptodev/rte_crypto_asym.h enum rte_crypto_rsa_padding_type { · line 135

Quoted 1 line
lib/cryptodev/rte_crypto_asym.h +0 -0
 /**

So I am not sure that this is an improvement.
The cryptodev issue we had, was that _LIST_END was being used to size arrays.
And that broke when new algorithms got added. Is that an issue, in this case?

Yes we did this same exercise for symmetric crypto enums earlier. Asym enums were left as it was experimental at that point. They are still experimental, but thought of making this uniform throughout DPDK enums.

Quoted 11 lines

I am not sure that swapping out _LIST_END, and then littering the code with RTE_CRYPTO_ASYM_XFORM_ECPM and RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE, is an improvement here.

My 2c is that from an ABI PoV RTE_CRYPTO_ASYM_OP_LIST_END is not better or worse,
than RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE?

Interested to hear other thoughts.

I don’t have any better solution for avoiding ABI issues for now. The change is for avoiding ABI breakage. But we can drop this patch For now as asym is still experimental.

#31 lore raw

Re: [dpdk-dev] [EXT] Re: [PATCH v2 1/3] cryptodev: remove LIST_END enumerators

Hi Ray, Akhil,

Please see inline.

Thanks,
Anoob

Quoted 122 lines

-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Tuesday, October 12, 2021 3:49 PM
To: Kinsella, Ray <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Anoob Joseph <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nagadheeraj Rottela <[email protected]>; Ankur Dwivedi <[email protected]>; [email protected]; Stephen Hemminger <[email protected]>; Yigit, Ferruh <[email protected]>
Subject: RE: [EXT] Re: [dpdk-dev] [PATCH v2 1/3] cryptodev: remove LIST_END enumerators

Quoted 87 lines · Akhil Goyal
Quoted 7 lines

Remove *_LIST_END enumerators from asymmetric crypto lib to avoid ABI breakage for every new addition in enums.

---
v2: no change

Review

Quoted 6 lines
 app/test/test_cryptodev_asym.c  | 4 ++--
 drivers/crypto/qat/qat_asym.c   | 2 +-
 lib/cryptodev/rte_crypto_asym.h | 4 ----
 3 files changed, 3 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/app/test/test_cryptodev_asym.c

app/test/test_cryptodev_asym.c test_one_case(const void *test_case, int

Quoted 4 lines

index 9d19a6d6d9..603b2e4609 100644

app/test/test_cryptodev_asym.c +0 -0
@@ -541,7 +541,7 @@ test_one_case(const void *test_case, int

sessionless)

app/test/test_cryptodev_asym.c test_one_case(const void *test_case, int sessionless)

Quoted 5 lines
app/test/test_cryptodev_asym.c +1 -1
 		printf("  %u) TestCase %s %s\n", test_index++,
 			tc.modex.description, test_msg);
 	} else {
-		for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
+		for (i = 0; i <=

RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE; i++) {

app/test/test_cryptodev_asym.c test_one_case(const void *test_case, int · line 545

Quoted 1 line
app/test/test_cryptodev_asym.c +0 -0
 			if (tc.modex.xform_type ==

RTE_CRYPTO_ASYM_XFORM_RSA) {

app/test/test_cryptodev_asym.c static inline void print_asym_capa( · line 1030

Quoted 8 lines
app/test/test_cryptodev_asym.c +1 -1
 				if (tc.rsa_data.op_type_flags & (1 << i)) {
 					if (tc.rsa_data.key_exp) {
@@ -1027,7 +1027,7 @@ static inline void print_asym_capa(
 			rte_crypto_asym_xform_strings[capa->xform_type]);
 	printf("operation supported -");
 
-	for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
+	for (i = 0; i <= RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE;

i++) {

app/test/test_cryptodev_asym.c static inline void print_asym_capa( · line 1032

Quoted 2 lines
app/test/test_cryptodev_asym.c +0 -0
 		/* check supported operations */
 		if

(rte_cryptodev_asym_xform_capability_check_optype(capa, i))

drivers/crypto/qat/qat_asym.c qat_asym_session_configure(struct rte_cryptodev

Quoted 6 lines
app/test/test_cryptodev_asym.c +0 -0
 			printf(" %s",
(quoted diff) +0 -0

b/drivers/crypto/qat/qat_asym.c index 85973812a8..026625a4d2 100644

drivers/crypto/qat/qat_asym.c +0 -0
@@ -742,7 +742,7 @@ qat_asym_session_configure(struct rte_cryptodev

*dev,

drivers/crypto/qat/qat_asym.c qat_asym_session_configure(struct rte_cryptodev *dev,

Quoted 4 lines
drivers/crypto/qat/qat_asym.c +0 -1
 			err = -EINVAL;
 			goto error;
 		}
-	} else if (xform->xform_type >=

RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END

drivers/crypto/qat/qat_asym.c qat_asym_session_configure(struct rte_cryptodev · line 746

Quoted 2 lines
drivers/crypto/qat/qat_asym.c +1 -0
+	} else if (xform->xform_type > RTE_CRYPTO_ASYM_XFORM_ECPM
 			|| xform->xform_type <=

RTE_CRYPTO_ASYM_XFORM_NONE) {

Review

Quoted 3 lines
drivers/crypto/qat/qat_asym.c +0 -0
 		QAT_LOG(ERR, "Invalid asymmetric crypto xform");
 		err = -EINVAL;
(quoted diff) +0 -0

b/lib/cryptodev/rte_crypto_asym.h

Quoted 27 lines

index 9c866f553f..5edf658572 100644

lib/cryptodev/rte_crypto_asym.h +0 -4
@@ -94,8 +94,6 @@ enum rte_crypto_asym_xform_type {
 	 */
 	RTE_CRYPTO_ASYM_XFORM_ECPM,
 	/**< Elliptic Curve Point Multiplication */
-	RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END
-	/**< End of list */
 };
 
 /**
@@ -116,7 +114,6 @@ enum rte_crypto_asym_op_type {
 	/**< DH Public Key generation operation */
 	RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE,
 	/**< DH Shared Secret compute operation */
-	RTE_CRYPTO_ASYM_OP_LIST_END
 };
 
 /**
@@ -133,7 +130,6 @@ enum rte_crypto_rsa_padding_type {
 	/**< RSA PKCS#1 OAEP padding scheme */
 	RTE_CRYPTO_RSA_PADDING_PSS,
 	/**< RSA PKCS#1 PSS padding scheme */
-	RTE_CRYPTO_RSA_PADDING_TYPE_LIST_END
 };
 
Quoted 6 lines

lib/cryptodev/rte_crypto_asym.h enum rte_crypto_rsa_padding_type { · line 135

Quoted 1 line
lib/cryptodev/rte_crypto_asym.h +0 -0
 /**

So I am not sure that this is an improvement.
The cryptodev issue we had, was that _LIST_END was being used to size arrays.
And that broke when new algorithms got added. Is that an issue, in this case?

Yes we did this same exercise for symmetric crypto enums earlier. Asym enums were left as it was experimental at that point.
They are still experimental, but thought of making this uniform throughout DPDK enums.

Quoted 4 lines

I am not sure that swapping out _LIST_END, and then littering the code with RTE_CRYPTO_ASYM_XFORM_ECPM and RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE, is an improvement

here.

Quoted 1 line
Quoted 8 lines
Quoted 4 lines

My 2c is that from an ABI PoV RTE_CRYPTO_ASYM_OP_LIST_END is not better or worse, than RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE?

Interested to hear other thoughts.

I don’t have any better solution for avoiding ABI issues for now. The change is for avoiding ABI breakage. But we can drop this patch For now as asym is still experimental.

[Anoob] Having LIST_END would preclude new additions to asymmetric algos? If yes, then I would suggest we address it now.

Looking at the "problematic changes", we only have 2-3 application & PMD changes. For unit test application, we could may be do something like,

- for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
+ enum rte_crypto_asym_op_type types[] = {

+                               RTE_CRYPTO_ASYM_OP_ENCRYPT,
+                               RTE_CRYPTO_ASYM_OP_DECRYPT,
+                               RTE_CRYPTO_ASYM_OP_SIGN,
+                               RTE_CRYPTO_ASYM_OP_VERIFY,
+                               RTE_CRYPTO_ASYM_OP_PRIVATE_KEY_GENERATE,
+                               RTE_CRYPTO_ASYM_OP_PUBLIC_KEY_GENERATE,
+                               RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE,
+               };
+               for (i = 0; i <= RTE_DIM(types); i++) {
                        if (tc.modex.xform_type == RTE_CRYPTO_ASYM_XFORM_RSA) {
-                               if (tc.rsa_data.op_type_flags & (1 << i)) {
+                               if (tc.rsa_data.op_type_flags & (1 << types[i])) {
                                        if (tc.rsa_data.key_exp) {
                                                status = test_cryptodev_asym_op(
                                                        &testsuite_params, &tc,
-                                                       test_msg, sessionless, i,
+                                                       test_msg, sessionless, types[i],
                                                        RTE_RSA_KEY_TYPE_EXP);
                                        }
                                        if (status)
                                                break;
-                                       if (tc.rsa_data.key_qt && (i ==
+                                       if (tc.rsa_data.key_qt && (types[i] ==
                                                        RTE_CRYPTO_ASYM_OP_DECRYPT ||
-                                                       i == RTE_CRYPTO_ASYM_OP_SIGN)) {
+                                                       types[i] == RTE_CRYPTO_ASYM_OP_SIGN)) {
                                                status = test_cryptodev_asym_op(
                                                        &testsuite_params,
-                                                       &tc, test_msg, sessionless, i,
+                                                       &tc, test_msg, sessionless, types[i],
                                                        RTE_RSA_KET_TYPE_QT);
                                        }
                                        if (status)

This way, application would only use the ones which it is designed to work with. For QAT driver changes, we could have an overload if condition (if alg == x || alg = y || ...) to get the same effect.

#32 lore raw

Re: [dpdk-dev] [EXT] Re: [PATCH v2 1/3] cryptodev: remove LIST_END enumerators

Quoted 132 lines · Anoob Joseph

Hi Ray, Akhil,

Please see inline.

Thanks,
Anoob

Quoted 125 lines

-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Tuesday, October 12, 2021 3:49 PM
To: Kinsella, Ray <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Anoob Joseph <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nagadheeraj Rottela <[email protected]>; Ankur Dwivedi <[email protected]>; [email protected]; Stephen Hemminger <[email protected]>; Yigit, Ferruh <[email protected]>
Subject: RE: [EXT] Re: [dpdk-dev] [PATCH v2 1/3] cryptodev: remove LIST_END enumerators

Quoted 87 lines · Akhil Goyal
Quoted 7 lines

Remove *_LIST_END enumerators from asymmetric crypto lib to avoid ABI breakage for every new addition in enums.

---
v2: no change

Review

Quoted 6 lines
 app/test/test_cryptodev_asym.c  | 4 ++--
 drivers/crypto/qat/qat_asym.c   | 2 +-
 lib/cryptodev/rte_crypto_asym.h | 4 ----
 3 files changed, 3 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/app/test/test_cryptodev_asym.c

app/test/test_cryptodev_asym.c test_one_case(const void *test_case, int

Quoted 4 lines

index 9d19a6d6d9..603b2e4609 100644

app/test/test_cryptodev_asym.c +0 -0
@@ -541,7 +541,7 @@ test_one_case(const void *test_case, int

sessionless)

app/test/test_cryptodev_asym.c test_one_case(const void *test_case, int sessionless)

Quoted 5 lines
app/test/test_cryptodev_asym.c +1 -1
 		printf("  %u) TestCase %s %s\n", test_index++,
 			tc.modex.description, test_msg);
 	} else {
-		for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
+		for (i = 0; i <=

RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE; i++) {

app/test/test_cryptodev_asym.c test_one_case(const void *test_case, int · line 545

Quoted 1 line
app/test/test_cryptodev_asym.c +0 -0
 			if (tc.modex.xform_type ==

RTE_CRYPTO_ASYM_XFORM_RSA) {

app/test/test_cryptodev_asym.c static inline void print_asym_capa( · line 1030

Quoted 8 lines
app/test/test_cryptodev_asym.c +1 -1
 				if (tc.rsa_data.op_type_flags & (1 << i)) {
 					if (tc.rsa_data.key_exp) {
@@ -1027,7 +1027,7 @@ static inline void print_asym_capa(
 			rte_crypto_asym_xform_strings[capa->xform_type]);
 	printf("operation supported -");
 
-	for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
+	for (i = 0; i <= RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE;

i++) {

app/test/test_cryptodev_asym.c static inline void print_asym_capa( · line 1032

Quoted 2 lines
app/test/test_cryptodev_asym.c +0 -0
 		/* check supported operations */
 		if

(rte_cryptodev_asym_xform_capability_check_optype(capa, i))

drivers/crypto/qat/qat_asym.c qat_asym_session_configure(struct rte_cryptodev

Quoted 6 lines
app/test/test_cryptodev_asym.c +0 -0
 			printf(" %s",
(quoted diff) +0 -0

b/drivers/crypto/qat/qat_asym.c index 85973812a8..026625a4d2 100644

drivers/crypto/qat/qat_asym.c +0 -0
@@ -742,7 +742,7 @@ qat_asym_session_configure(struct rte_cryptodev

*dev,

drivers/crypto/qat/qat_asym.c qat_asym_session_configure(struct rte_cryptodev *dev,

Quoted 4 lines
drivers/crypto/qat/qat_asym.c +0 -1
 			err = -EINVAL;
 			goto error;
 		}
-	} else if (xform->xform_type >=

RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END

drivers/crypto/qat/qat_asym.c qat_asym_session_configure(struct rte_cryptodev · line 746

Quoted 2 lines
drivers/crypto/qat/qat_asym.c +1 -0
+	} else if (xform->xform_type > RTE_CRYPTO_ASYM_XFORM_ECPM
 			|| xform->xform_type <=

RTE_CRYPTO_ASYM_XFORM_NONE) {

Review

Quoted 3 lines
drivers/crypto/qat/qat_asym.c +0 -0
 		QAT_LOG(ERR, "Invalid asymmetric crypto xform");
 		err = -EINVAL;
(quoted diff) +0 -0

b/lib/cryptodev/rte_crypto_asym.h

Quoted 27 lines

index 9c866f553f..5edf658572 100644

lib/cryptodev/rte_crypto_asym.h +0 -4
@@ -94,8 +94,6 @@ enum rte_crypto_asym_xform_type {
 	 */
 	RTE_CRYPTO_ASYM_XFORM_ECPM,
 	/**< Elliptic Curve Point Multiplication */
-	RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END
-	/**< End of list */
 };
 
 /**
@@ -116,7 +114,6 @@ enum rte_crypto_asym_op_type {
 	/**< DH Public Key generation operation */
 	RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE,
 	/**< DH Shared Secret compute operation */
-	RTE_CRYPTO_ASYM_OP_LIST_END
 };
 
 /**
@@ -133,7 +130,6 @@ enum rte_crypto_rsa_padding_type {
 	/**< RSA PKCS#1 OAEP padding scheme */
 	RTE_CRYPTO_RSA_PADDING_PSS,
 	/**< RSA PKCS#1 PSS padding scheme */
-	RTE_CRYPTO_RSA_PADDING_TYPE_LIST_END
 };
 
Quoted 6 lines

lib/cryptodev/rte_crypto_asym.h enum rte_crypto_rsa_padding_type { · line 135

Quoted 1 line
lib/cryptodev/rte_crypto_asym.h +0 -0
 /**

So I am not sure that this is an improvement.
The cryptodev issue we had, was that _LIST_END was being used to size arrays.
And that broke when new algorithms got added. Is that an issue, in this case?

Yes we did this same exercise for symmetric crypto enums earlier. Asym enums were left as it was experimental at that point.
They are still experimental, but thought of making this uniform throughout DPDK enums.

Quoted 4 lines

I am not sure that swapping out _LIST_END, and then littering the code with RTE_CRYPTO_ASYM_XFORM_ECPM and RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE, is an improvement

here.

Quoted 4 lines

My 2c is that from an ABI PoV RTE_CRYPTO_ASYM_OP_LIST_END is not better or worse, than RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE?

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Interested to hear other thoughts.

I don’t have any better solution for avoiding ABI issues for now. The change is for avoiding ABI breakage. But we can drop this patch For now as asym is still experimental.

[Anoob] Having LIST_END would preclude new additions to asymmetric algos? If yes, then I would suggest we address it now.

Not at all - but it can be problematic, if two versions of DPDK disagree with the value of LIST_END.

Quoted 1 line

Looking at the "problematic changes", we only have 2-3 application & PMD changes. For unit test application, we could may be do something like,

The essental functionality not that different, I am just not sure that the verbosity below is helping. What you are really trying to guard against is people using LIST_END to size arrays.

Quoted 39 lines
(quoted diff) +15 -6
-               for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
+               enum rte_crypto_asym_op_type types[] = {
+                               RTE_CRYPTO_ASYM_OP_ENCRYPT,
+                               RTE_CRYPTO_ASYM_OP_DECRYPT,
+                               RTE_CRYPTO_ASYM_OP_SIGN,
+                               RTE_CRYPTO_ASYM_OP_VERIFY,
+                               RTE_CRYPTO_ASYM_OP_PRIVATE_KEY_GENERATE,
+                               RTE_CRYPTO_ASYM_OP_PUBLIC_KEY_GENERATE,
+                               RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE,
+               };
+               for (i = 0; i <= RTE_DIM(types); i++) {
                        if (tc.modex.xform_type == RTE_CRYPTO_ASYM_XFORM_RSA) {
-                               if (tc.rsa_data.op_type_flags & (1 << i)) {
+                               if (tc.rsa_data.op_type_flags & (1 << types[i])) {
                                        if (tc.rsa_data.key_exp) {
                                                status = test_cryptodev_asym_op(
                                                        &testsuite_params, &tc,
-                                                       test_msg, sessionless, i,
+                                                       test_msg, sessionless, types[i],
                                                        RTE_RSA_KEY_TYPE_EXP);
                                        }
                                        if (status)
                                                break;
-                                       if (tc.rsa_data.key_qt && (i ==
+                                       if (tc.rsa_data.key_qt && (types[i] ==
                                                        RTE_CRYPTO_ASYM_OP_DECRYPT ||
-                                                       i == RTE_CRYPTO_ASYM_OP_SIGN)) {
+                                                       types[i] == RTE_CRYPTO_ASYM_OP_SIGN)) {
                                                status = test_cryptodev_asym_op(
                                                        &testsuite_params,
-                                                       &tc, test_msg, sessionless, i,
+                                                       &tc, test_msg, sessionless, types[i],
                                                        RTE_RSA_KET_TYPE_QT);
                                        }
                                        if (status)

This way, application would only use the ones which it is designed to work with. For QAT driver changes, we could have an overload if condition (if alg == x || alg = y || ...) to get the same effect.

#33 lore raw

Re: [dpdk-dev] [EXT] Re: [PATCH v2 1/3] cryptodev: remove LIST_END enumerators

Hi Ray,

Please see inline.

Thanks,
Anoob

Quoted 166 lines

-----Original Message-----
From: Kinsella, Ray <[email protected]>
Sent: Tuesday, October 12, 2021 4:58 PM
To: Anoob Joseph <[email protected]>; Akhil Goyal <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nagadheeraj Rottela <[email protected]>; Ankur Dwivedi <[email protected]>; [email protected]; Stephen Hemminger <[email protected]>; Yigit, Ferruh <[email protected]>
Subject: Re: [EXT] Re: [dpdk-dev] [PATCH v2 1/3] cryptodev: remove LIST_END enumerators

Quoted 117 lines · Anoob Joseph

Hi Ray, Akhil,

Please see inline.

Thanks,
Anoob

Quoted 110 lines

-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Tuesday, October 12, 2021 3:49 PM
To: Kinsella, Ray <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Anoob Joseph <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nagadheeraj Rottela <[email protected]>; Ankur Dwivedi <[email protected]>; [email protected]; Stephen Hemminger <[email protected]>; Yigit, Ferruh <[email protected]>
Subject: RE: [EXT] Re: [dpdk-dev] [PATCH v2 1/3] cryptodev: remove LIST_END enumerators

Quoted 93 lines · Akhil Goyal
Quoted 7 lines

Remove *_LIST_END enumerators from asymmetric crypto lib to avoid ABI breakage for every new addition in enums.

---
v2: no change

Review

Quoted 6 lines
 app/test/test_cryptodev_asym.c  | 4 ++--
 drivers/crypto/qat/qat_asym.c   | 2 +-
 lib/cryptodev/rte_crypto_asym.h | 4 ----
 3 files changed, 3 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/app/test/test_cryptodev_asym.c

app/test/test_cryptodev_asym.c test_one_case(const void *test_case, int

Quoted 4 lines

index 9d19a6d6d9..603b2e4609 100644

app/test/test_cryptodev_asym.c +0 -0
@@ -541,7 +541,7 @@ test_one_case(const void *test_case, int

sessionless)

app/test/test_cryptodev_asym.c test_one_case(const void *test_case, int sessionless)

Quoted 5 lines
app/test/test_cryptodev_asym.c +1 -1
 		printf("  %u) TestCase %s %s\n", test_index++,
 			tc.modex.description, test_msg);
 	} else {
-		for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
+		for (i = 0; i <=

RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE; i++) {

app/test/test_cryptodev_asym.c test_one_case(const void *test_case, int · line 545

Quoted 1 line
app/test/test_cryptodev_asym.c +0 -0
 			if (tc.modex.xform_type ==

RTE_CRYPTO_ASYM_XFORM_RSA) {

app/test/test_cryptodev_asym.c static inline void print_asym_capa( · line 1030

Quoted 8 lines
app/test/test_cryptodev_asym.c +1 -1
 				if (tc.rsa_data.op_type_flags & (1 << i)) {
 					if (tc.rsa_data.key_exp) {
@@ -1027,7 +1027,7 @@ static inline void print_asym_capa(
 			rte_crypto_asym_xform_strings[capa->xform_type]);
 	printf("operation supported -");
 
-	for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
+	for (i = 0; i <= RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE;

i++) {

app/test/test_cryptodev_asym.c static inline void print_asym_capa( · line 1032

Quoted 2 lines
app/test/test_cryptodev_asym.c +0 -0
 		/* check supported operations */
 		if

(rte_cryptodev_asym_xform_capability_check_optype(capa, i))

drivers/crypto/qat/qat_asym.c qat_asym_session_configure(struct rte_cryptodev

Quoted 6 lines
app/test/test_cryptodev_asym.c +0 -0
 			printf(" %s",
(quoted diff) +0 -0

b/drivers/crypto/qat/qat_asym.c index 85973812a8..026625a4d2 100644

drivers/crypto/qat/qat_asym.c +0 -0
@@ -742,7 +742,7 @@ qat_asym_session_configure(struct rte_cryptodev

*dev,

drivers/crypto/qat/qat_asym.c qat_asym_session_configure(struct rte_cryptodev *dev,

Quoted 4 lines
drivers/crypto/qat/qat_asym.c +0 -1
 			err = -EINVAL;
 			goto error;
 		}
-	} else if (xform->xform_type >=

RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END

drivers/crypto/qat/qat_asym.c qat_asym_session_configure(struct rte_cryptodev · line 746

Quoted 2 lines
drivers/crypto/qat/qat_asym.c +1 -0
+	} else if (xform->xform_type > RTE_CRYPTO_ASYM_XFORM_ECPM
 			|| xform->xform_type <=

RTE_CRYPTO_ASYM_XFORM_NONE) {

Review

Quoted 3 lines
drivers/crypto/qat/qat_asym.c +0 -0
 		QAT_LOG(ERR, "Invalid asymmetric crypto xform");
 		err = -EINVAL;
(quoted diff) +0 -0

b/lib/cryptodev/rte_crypto_asym.h

Quoted 21 lines

index 9c866f553f..5edf658572 100644

lib/cryptodev/rte_crypto_asym.h +0 -3
@@ -94,8 +94,6 @@ enum rte_crypto_asym_xform_type {
 	 */
 	RTE_CRYPTO_ASYM_XFORM_ECPM,
 	/**< Elliptic Curve Point Multiplication */
-	RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END
-	/**< End of list */
 };
 
 /**
@@ -116,7 +114,6 @@ enum rte_crypto_asym_op_type {
 	/**< DH Public Key generation operation */
 	RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE,
 	/**< DH Shared Secret compute operation */
-	RTE_CRYPTO_ASYM_OP_LIST_END
 };
 
 /**

lib/cryptodev/rte_crypto_asym.h enum rte_crypto_rsa_padding_type { · line 135

Quoted 7 lines
lib/cryptodev/rte_crypto_asym.h +0 -1
@@ -133,7 +130,6 @@ enum rte_crypto_rsa_padding_type {
 	/**< RSA PKCS#1 OAEP padding scheme */
 	RTE_CRYPTO_RSA_PADDING_PSS,
 	/**< RSA PKCS#1 PSS padding scheme */
-	RTE_CRYPTO_RSA_PADDING_TYPE_LIST_END
 };
 
 /**

So I am not sure that this is an improvement.
The cryptodev issue we had, was that _LIST_END was being used to size arrays.
And that broke when new algorithms got added. Is that an issue, in this

case?

Quoted 7 lines
Quoted 7 lines

Yes we did this same exercise for symmetric crypto enums earlier. Asym enums were left as it was experimental at that point. They are still experimental, but thought of making this uniform throughout DPDK enums.

Quoted 1 line
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

I am not sure that swapping out _LIST_END, and then littering the code with RTE_CRYPTO_ASYM_XFORM_ECPM and RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE, is an improvement

here.

Quoted 3 lines

My 2c is that from an ABI PoV RTE_CRYPTO_ASYM_OP_LIST_END is not better or worse, than

RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE?

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Interested to hear other thoughts.

I don’t have any better solution for avoiding ABI issues for now. The change is for avoiding ABI breakage. But we can drop this patch For now as asym is still experimental.

[Anoob] Having LIST_END would preclude new additions to asymmetric algos?

If yes, then I would suggest we address it now.

Not at all - but it can be problematic, if two versions of DPDK disagree with the value of LIST_END.

Quoted 8 lines
Quoted 3 lines

Looking at the "problematic changes", we only have 2-3 application & PMD changes. For unit test application, we could may be do something like,

The essental functionality not that different, I am just not sure that the verbosity below is helping.
What you are really trying to guard against is people using LIST_END to size arrays.

[Anoob] Our problem is application using LIST_END (which comes from library) to determine the number of iterations for the loop. My suggestion is to modify the UT such that, we could use RTE_DIM(types) (which comes from application) to determine iterations of loop. This would solve the problem, right?

Quoted 47 lines
Quoted 43 lines
(quoted diff) +20 -6
-               for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
+               enum rte_crypto_asym_op_type types[] = {
+                               RTE_CRYPTO_ASYM_OP_ENCRYPT,
+                               RTE_CRYPTO_ASYM_OP_DECRYPT,
+                               RTE_CRYPTO_ASYM_OP_SIGN,
+                               RTE_CRYPTO_ASYM_OP_VERIFY,
+                               RTE_CRYPTO_ASYM_OP_PRIVATE_KEY_GENERATE,
+                               RTE_CRYPTO_ASYM_OP_PUBLIC_KEY_GENERATE,
+                               RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE,
+               };
+               for (i = 0; i <= RTE_DIM(types); i++) {
                        if (tc.modex.xform_type == RTE_CRYPTO_ASYM_XFORM_RSA) {
-                               if (tc.rsa_data.op_type_flags & (1 << i)) {
+                               if (tc.rsa_data.op_type_flags & (1 <<
+ types[i])) {
                                        if (tc.rsa_data.key_exp) {
                                                status = test_cryptodev_asym_op(
                                                        &testsuite_params, &tc,
-                                                       test_msg, sessionless, i,
+                                                       test_msg,
+ sessionless, types[i],
                                                        RTE_RSA_KEY_TYPE_EXP);
                                        }
                                        if (status)
                                                break;
-                                       if (tc.rsa_data.key_qt && (i ==
+                                       if (tc.rsa_data.key_qt &&
+ (types[i] ==
                                                        RTE_CRYPTO_ASYM_OP_DECRYPT ||
-                                                       i == RTE_CRYPTO_ASYM_OP_SIGN)) {
+                                                       types[i] ==
+ RTE_CRYPTO_ASYM_OP_SIGN)) {
                                                status = test_cryptodev_asym_op(
                                                        &testsuite_params,
-                                                       &tc, test_msg, sessionless, i,
+                                                       &tc, test_msg,
+ sessionless, types[i],
                                                        RTE_RSA_KET_TYPE_QT);
                                        }
                                        if (status)
Quoted 1 line

This way, application would only use the ones which it is designed to work

with. For QAT driver changes, we could have an overload if condition (if alg == x || alg = y || ...) to get the same effect.

Quoted 1 line
#34 lore raw

Re: [dpdk-dev] [EXT] Re: [PATCH v2 1/3] cryptodev: remove LIST_END enumerators

12/10/2021 13:34, Anoob Joseph:

Quoted 12 lines

From: Kinsella, Ray <[email protected]>

Quoted 11 lines · Anoob Joseph
Quoted 10 lines

From: Akhil Goyal <[email protected]>

Quoted 9 lines
Quoted 9 lines · Akhil Goyal

Review

Quoted 6 lines

Remove *_LIST_END enumerators from asymmetric crypto lib to avoid ABI breakage for every new addition in enums.

---

(quoted diff) +0 -1
-	} else if (xform->xform_type >=

RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END

Quoted 1 line
drivers/crypto/qat/qat_asym.c +1 -0
+	} else if (xform->xform_type > RTE_CRYPTO_ASYM_XFORM_ECPM

[...]

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

So I am not sure that this is an improvement.

Indeed, it is not an improvement.

Quoted 36 lines
Quoted 36 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

The cryptodev issue we had, was that _LIST_END was being used to size arrays.
And that broke when new algorithms got added. Is that an issue, in this

case?

Quoted 7 lines
Quoted 7 lines

Yes we did this same exercise for symmetric crypto enums earlier. Asym enums were left as it was experimental at that point. They are still experimental, but thought of making this uniform throughout DPDK enums.

Quoted 1 line
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

I am not sure that swapping out _LIST_END, and then littering the code with RTE_CRYPTO_ASYM_XFORM_ECPM and RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE, is an improvement

here.

Quoted 3 lines

My 2c is that from an ABI PoV RTE_CRYPTO_ASYM_OP_LIST_END is not better or worse, than

RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE?

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Interested to hear other thoughts.

I don’t have any better solution for avoiding ABI issues for now. The change is for avoiding ABI breakage. But we can drop this patch For now as asym is still experimental.

[Anoob] Having LIST_END would preclude new additions to asymmetric algos?

If yes, then I would suggest we address it now.

Not at all - but it can be problematic, if two versions of DPDK disagree with the value of LIST_END.

Quoted 3 lines

Looking at the "problematic changes", we only have 2-3 application & PMD changes. For unit test application, we could may be do something like,

Quoted 6 lines
Quoted 4 lines

The essental functionality not that different, I am just not sure that the verbosity below is helping.
What you are really trying to guard against is people using LIST_END to size arrays.

[Anoob] Our problem is application using LIST_END (which comes from library) to determine the number of iterations for the loop. My suggestion is to modify the UT such that, we could use RTE_DIM(types) (which comes from application) to determine iterations of loop. This would solve the problem, right?

The problem is not the application.
Are you asking the app to define DPDK types?

The problem is in DPDK API. We must not suggest a size for enums. If we really need a size, then it must be explicit and updated in the lib binary (through a function) when the size increases.

Quoted 44 lines
Quoted 44 lines
Quoted 41 lines
(quoted diff) +20 -6
-               for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
+               enum rte_crypto_asym_op_type types[] = {
+                               RTE_CRYPTO_ASYM_OP_ENCRYPT,
+                               RTE_CRYPTO_ASYM_OP_DECRYPT,
+                               RTE_CRYPTO_ASYM_OP_SIGN,
+                               RTE_CRYPTO_ASYM_OP_VERIFY,
+                               RTE_CRYPTO_ASYM_OP_PRIVATE_KEY_GENERATE,
+                               RTE_CRYPTO_ASYM_OP_PUBLIC_KEY_GENERATE,
+                               RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE,
+               };
+               for (i = 0; i <= RTE_DIM(types); i++) {
                        if (tc.modex.xform_type == RTE_CRYPTO_ASYM_XFORM_RSA) {
-                               if (tc.rsa_data.op_type_flags & (1 << i)) {
+                               if (tc.rsa_data.op_type_flags & (1 <<
+ types[i])) {
                                        if (tc.rsa_data.key_exp) {
                                                status = test_cryptodev_asym_op(
                                                        &testsuite_params, &tc,
-                                                       test_msg, sessionless, i,
+                                                       test_msg,
+ sessionless, types[i],
                                                        RTE_RSA_KEY_TYPE_EXP);
                                        }
                                        if (status)
                                                break;
-                                       if (tc.rsa_data.key_qt && (i ==
+                                       if (tc.rsa_data.key_qt &&
+ (types[i] ==
                                                        RTE_CRYPTO_ASYM_OP_DECRYPT ||
-                                                       i == RTE_CRYPTO_ASYM_OP_SIGN)) {
+                                                       types[i] ==
+ RTE_CRYPTO_ASYM_OP_SIGN)) {
                                                status = test_cryptodev_asym_op(
                                                        &testsuite_params,
-                                                       &tc, test_msg, sessionless, i,
+                                                       &tc, test_msg,
+ sessionless, types[i],
                                                        RTE_RSA_KET_TYPE_QT);
                                        }
                                        if (status)
Quoted 1 line

This way, application would only use the ones which it is designed to work

with. For QAT driver changes, we could have an overload if condition (if alg == x || alg = y || ...) to get the same effect.

#35 lore raw

Re: [dpdk-dev] [EXT] Re: [PATCH v2 1/3] cryptodev: remove LIST_END enumerators

Hi Thomas,

Please see inline.

Thanks,
Anoob

Quoted 81 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Tuesday, October 12, 2021 5:22 PM
To: Kinsella, Ray <[email protected]>; Akhil Goyal <[email protected]>; [email protected]; Anoob Joseph <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nagadheeraj Rottela <[email protected]>; Ankur Dwivedi <[email protected]>; [email protected]; Stephen Hemminger <[email protected]>; Yigit, Ferruh <[email protected]>
Subject: Re: [EXT] Re: [dpdk-dev] [PATCH v2 1/3] cryptodev: remove LIST_END enumerators

12/10/2021 13:34, Anoob Joseph:

Quoted 4 lines

From: Kinsella, Ray <[email protected]>

Quoted 3 lines · Anoob Joseph
Quoted 2 lines

From: Akhil Goyal <[email protected]>

Quoted 1 line
Quoted 1 line · Akhil Goyal
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Review

Quoted 6 lines

Remove *_LIST_END enumerators from asymmetric crypto lib to avoid ABI breakage for every new addition in enums.

---

(quoted diff) +0 -1
-	} else if (xform->xform_type >=

RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END

Review

Quoted 1 line
(quoted diff) +1 -0
+	} else if (xform->xform_type >

RTE_CRYPTO_ASYM_XFORM_ECPM
[...]

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

So I am not sure that this is an improvement.

Indeed, it is not an improvement.

Quoted 12 lines
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

The cryptodev issue we had, was that _LIST_END was being used to size arrays.
And that broke when new algorithms got added. Is that an issue, in this

case?

Quoted 7 lines
Quoted 7 lines

Yes we did this same exercise for symmetric crypto enums earlier. Asym enums were left as it was experimental at that point. They are still experimental, but thought of making this uniform throughout DPDK enums.

Quoted 1 line
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

I am not sure that swapping out _LIST_END, and then littering the code with RTE_CRYPTO_ASYM_XFORM_ECPM and RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE, is an

improvement

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines

here.

Quoted 3 lines

My 2c is that from an ABI PoV RTE_CRYPTO_ASYM_OP_LIST_END is not better or worse, than

RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE?

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Interested to hear other thoughts.

I don’t have any better solution for avoiding ABI issues for now. The change is for avoiding ABI breakage. But we can drop this patch For now as asym is still experimental.

[Anoob] Having LIST_END would preclude new additions to asymmetric

algos?

Quoted 14 lines
Quoted 13 lines

If yes, then I would suggest we address it now.

Not at all - but it can be problematic, if two versions of DPDK disagree with the value of LIST_END.

Quoted 3 lines

Looking at the "problematic changes", we only have 2-3 application & PMD changes. For unit test application, we could may be do something like,

The essental functionality not that different, I am just not sure that the verbosity below is helping.
What you are really trying to guard against is people using LIST_END to size arrays.

Quoted 7 lines
Quoted 1 line

[Anoob] Our problem is application using LIST_END (which comes from library)

to determine the number of iterations for the loop. My suggestion is to modify the UT such that, we could use RTE_DIM(types) (which comes from application) to determine iterations of loop. This would solve the problem, right?

The problem is not the application.
Are you asking the app to define DPDK types?

[Anoob] I didn't understand how you concluded that. The app is supposed to test "n" asymmetric features supported by DPDK. Currently, it does that by looping from 0 to LIST_END which happens to give you the first n features. Now, if we add any new asymmetric feature, LIST_END value would change. Isn't that the very reason why we removed LIST_END from symmetric library and applications?

Now coming to what I proposed, the app is supposed to test "n" asymmetric features. LIST_END helps in doing the loops. If we remove LIST_END, then application will not be in a position to do a loop. My suggestion is, we list the types that are supposed to be tested by the app, and let that array be used as feature list.

PS: Just to reiterate, my proposal is just a local array which would hold DPDK defined RTE enum values for the features that would be tested by this app/function.

Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

+ enum rte_crypto_asym_op_type types[] = {

The problem is in DPDK API. We must not suggest a size for enums.

[Anoob] So agreed that LIST_END should be removed?

Quoted 2 lines

If we really need a size, then it must be explicit and updated in the lib binary (through a function) when the size increases.

[Anoob] Precisely my thoughts. The loop with LIST_END done in application is not correct.

Quoted 55 lines
Quoted 15 lines
Quoted 15 lines
Quoted 5 lines
(quoted diff) +1 -1
-               for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
+               enum rte_crypto_asym_op_type types[] = {

Review

Quoted 10 lines
(quoted diff) +9 -0
+                               RTE_CRYPTO_ASYM_OP_ENCRYPT,
+                               RTE_CRYPTO_ASYM_OP_DECRYPT,
+                               RTE_CRYPTO_ASYM_OP_SIGN,
+                               RTE_CRYPTO_ASYM_OP_VERIFY,
+                               RTE_CRYPTO_ASYM_OP_PRIVATE_KEY_GENERATE,
+                               RTE_CRYPTO_ASYM_OP_PUBLIC_KEY_GENERATE,
+                               RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE,
+               };
+               for (i = 0; i <= RTE_DIM(types); i++) {
                        if (tc.modex.xform_type ==

RTE_CRYPTO_ASYM_XFORM_RSA) {

Quoted 36 lines
Quoted 36 lines
Quoted 31 lines
(quoted diff) +12 -5
-                               if (tc.rsa_data.op_type_flags & (1 << i)) {
+                               if (tc.rsa_data.op_type_flags & (1
+ <<
+ types[i])) {
                                        if (tc.rsa_data.key_exp) {
                                                status = test_cryptodev_asym_op(
                                                        &testsuite_params, &tc,
-                                                       test_msg, sessionless, i,
+                                                       test_msg,
+ sessionless, types[i],
                                                        RTE_RSA_KEY_TYPE_EXP);
                                        }
                                        if (status)
                                                break;
-                                       if (tc.rsa_data.key_qt && (i ==
+                                       if (tc.rsa_data.key_qt &&
+ (types[i] ==
                                                        RTE_CRYPTO_ASYM_OP_DECRYPT ||
-                                                       i == RTE_CRYPTO_ASYM_OP_SIGN)) {
+                                                       types[i]
+ ==
+ RTE_CRYPTO_ASYM_OP_SIGN)) {
                                                status = test_cryptodev_asym_op(
                                                        &testsuite_params,
-                                                       &tc, test_msg, sessionless, i,
+                                                       &tc,
+ test_msg, sessionless, types[i],
                                                        RTE_RSA_KET_TYPE_QT);
                                        }
                                        if (status)
Quoted 2 lines

This way, application would only use the ones which it is designed to work

with. For QAT driver changes, we could have an overload if condition (if alg == x
|| alg = y || ...) to get the same effect.

#36 lore raw

Re: [dpdk-dev] [EXT] Re: [PATCH v2 1/3] cryptodev: remove LIST_END enumerators

12/10/2021 15:38, Anoob Joseph:

Quoted 66 lines

From: Thomas Monjalon <[email protected]>

Quoted 65 lines

12/10/2021 13:34, Anoob Joseph:

Quoted 4 lines

From: Kinsella, Ray <[email protected]>

Quoted 3 lines · Anoob Joseph
Quoted 2 lines

From: Akhil Goyal <[email protected]>

Quoted 1 line
Quoted 1 line · Akhil Goyal
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Review

Quoted 6 lines

Remove *_LIST_END enumerators from asymmetric crypto lib to avoid ABI breakage for every new addition in enums.

---

(quoted diff) +0 -1
-	} else if (xform->xform_type >=

RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END

Review

Quoted 1 line
(quoted diff) +1 -0
+	} else if (xform->xform_type >

RTE_CRYPTO_ASYM_XFORM_ECPM
[...]

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

So I am not sure that this is an improvement.

Indeed, it is not an improvement.

Quoted 12 lines
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

The cryptodev issue we had, was that _LIST_END was being used to size arrays.
And that broke when new algorithms got added. Is that an issue, in this

case?

Quoted 7 lines
Quoted 7 lines

Yes we did this same exercise for symmetric crypto enums earlier. Asym enums were left as it was experimental at that point. They are still experimental, but thought of making this uniform throughout DPDK enums.

Quoted 1 line
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

I am not sure that swapping out _LIST_END, and then littering the code with RTE_CRYPTO_ASYM_XFORM_ECPM and RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE, is an

improvement

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines

here.

Quoted 3 lines

My 2c is that from an ABI PoV RTE_CRYPTO_ASYM_OP_LIST_END is not better or worse, than

RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE?

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Interested to hear other thoughts.

I don’t have any better solution for avoiding ABI issues for now. The change is for avoiding ABI breakage. But we can drop this patch For now as asym is still experimental.

[Anoob] Having LIST_END would preclude new additions to asymmetric

algos?

Quoted 15 lines
Quoted 5 lines

If yes, then I would suggest we address it now.

Not at all - but it can be problematic, if two versions of DPDK disagree with the value of LIST_END.

Quoted 8 lines
Quoted 3 lines

Looking at the "problematic changes", we only have 2-3 application & PMD changes. For unit test application, we could may be do something like,

The essental functionality not that different, I am just not sure that the verbosity below is helping.
What you are really trying to guard against is people using LIST_END to size arrays.

[Anoob] Our problem is application using LIST_END (which comes from library)

Quoted 8 lines
Quoted 6 lines

to determine the number of iterations for the loop. My suggestion is to modify the UT such that, we could use RTE_DIM(types) (which comes from application) to determine iterations of loop. This would solve the problem, right?

The problem is not the application.
Are you asking the app to define DPDK types?

[Anoob] I didn't understand how you concluded that.

Because you define a specific array in the test app.

Quoted 1 line

The app is supposed to test "n" asymmetric features supported by DPDK. Currently, it does that by looping from 0 to LIST_END which happens to give you the first n features. Now, if we add any new asymmetric feature, LIST_END value would change. Isn't that the very reason why we removed LIST_END from symmetric library and applications?

Yes

Quoted 3 lines

Now coming to what I proposed, the app is supposed to test "n" asymmetric features. LIST_END helps in doing the loops. If we remove LIST_END, then application will not be in a position to do a loop. My suggestion is, we list the types that are supposed to be tested by the app, and let that array be used as feature list.

PS: Just to reiterate, my proposal is just a local array which would hold DPDK defined RTE enum values for the features that would be tested by this app/function.

I am more concerned by the general case than the test app. I think a function returning a number is more app-friendly.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

+ enum rte_crypto_asym_op_type types[] = {

The problem is in DPDK API. We must not suggest a size for enums.

[Anoob] So agreed that LIST_END should be removed?

Yes

Quoted 56 lines
Quoted 2 lines

If we really need a size, then it must be explicit and updated in the lib binary (through a function) when the size increases.

[Anoob] Precisely my thoughts. The loop with LIST_END done in application is not correct.

Quoted 52 lines
Quoted 15 lines
Quoted 15 lines
Quoted 5 lines
(quoted diff) +1 -1
-               for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
+               enum rte_crypto_asym_op_type types[] = {

Review

Quoted 10 lines
(quoted diff) +9 -0
+                               RTE_CRYPTO_ASYM_OP_ENCRYPT,
+                               RTE_CRYPTO_ASYM_OP_DECRYPT,
+                               RTE_CRYPTO_ASYM_OP_SIGN,
+                               RTE_CRYPTO_ASYM_OP_VERIFY,
+                               RTE_CRYPTO_ASYM_OP_PRIVATE_KEY_GENERATE,
+                               RTE_CRYPTO_ASYM_OP_PUBLIC_KEY_GENERATE,
+                               RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE,
+               };
+               for (i = 0; i <= RTE_DIM(types); i++) {
                        if (tc.modex.xform_type ==

RTE_CRYPTO_ASYM_XFORM_RSA) {

Quoted 36 lines
Quoted 36 lines
Quoted 31 lines
(quoted diff) +12 -5
-                               if (tc.rsa_data.op_type_flags & (1 << i)) {
+                               if (tc.rsa_data.op_type_flags & (1
+ <<
+ types[i])) {
                                        if (tc.rsa_data.key_exp) {
                                                status = test_cryptodev_asym_op(
                                                        &testsuite_params, &tc,
-                                                       test_msg, sessionless, i,
+                                                       test_msg,
+ sessionless, types[i],
                                                        RTE_RSA_KEY_TYPE_EXP);
                                        }
                                        if (status)
                                                break;
-                                       if (tc.rsa_data.key_qt && (i ==
+                                       if (tc.rsa_data.key_qt &&
+ (types[i] ==
                                                        RTE_CRYPTO_ASYM_OP_DECRYPT ||
-                                                       i == RTE_CRYPTO_ASYM_OP_SIGN)) {
+                                                       types[i]
+ ==
+ RTE_CRYPTO_ASYM_OP_SIGN)) {
                                                status = test_cryptodev_asym_op(
                                                        &testsuite_params,
-                                                       &tc, test_msg, sessionless, i,
+                                                       &tc,
+ test_msg, sessionless, types[i],
                                                        RTE_RSA_KET_TYPE_QT);
                                        }
                                        if (status)
Quoted 2 lines

This way, application would only use the ones which it is designed to work

with. For QAT driver changes, we could have an overload if condition (if alg == x
|| alg = y || ...) to get the same effect.

#37 lore raw

Re: [dpdk-dev] [EXT] Re: [PATCH v2 1/3] cryptodev: remove LIST_END enumerators

Hi Thomas,

Please see inline.

Thanks,
Anoob

Quoted 112 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Tuesday, October 12, 2021 7:25 PM
To: Kinsella, Ray <[email protected]>; Akhil Goyal <[email protected]>; [email protected]; Anoob Joseph <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nagadheeraj Rottela <[email protected]>; Ankur Dwivedi <[email protected]>; [email protected]; Stephen Hemminger <[email protected]>; Yigit, Ferruh <[email protected]>; [email protected]
Subject: Re: [EXT] Re: [dpdk-dev] [PATCH v2 1/3] cryptodev: remove LIST_END enumerators

12/10/2021 15:38, Anoob Joseph:

Quoted 71 lines

From: Thomas Monjalon <[email protected]>

Quoted 70 lines

12/10/2021 13:34, Anoob Joseph:

Quoted 4 lines

From: Kinsella, Ray <[email protected]>

Quoted 3 lines · Anoob Joseph
Quoted 2 lines

From: Akhil Goyal <[email protected]>

Quoted 1 line
Quoted 1 line · Akhil Goyal
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Review

Quoted 6 lines

Remove *_LIST_END enumerators from asymmetric crypto lib to avoid ABI breakage for every new addition in enums.

---

(quoted diff) +0 -1
-	} else if (xform->xform_type >=

RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END

Review

Quoted 1 line
(quoted diff) +1 -0
+	} else if (xform->xform_type >

RTE_CRYPTO_ASYM_XFORM_ECPM
[...]

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

So I am not sure that this is an improvement.

Indeed, it is not an improvement.

Quoted 12 lines
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

The cryptodev issue we had, was that _LIST_END was being used to size arrays.
And that broke when new algorithms got added. Is that an issue, in this

case?

Quoted 7 lines
Quoted 7 lines

Yes we did this same exercise for symmetric crypto enums earlier. Asym enums were left as it was experimental at that point. They are still experimental, but thought of making this uniform throughout DPDK enums.

Quoted 1 line
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

I am not sure that swapping out _LIST_END, and then littering the code with RTE_CRYPTO_ASYM_XFORM_ECPM and RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE, is an

improvement

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines

here.

Quoted 3 lines

My 2c is that from an ABI PoV RTE_CRYPTO_ASYM_OP_LIST_END is not better or worse, than

RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE?

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Interested to hear other thoughts.

I don’t have any better solution for avoiding ABI issues for now. The change is for avoiding ABI breakage. But we can drop this patch For now as asym is still experimental.

[Anoob] Having LIST_END would preclude new additions to asymmetric

algos?

Quoted 9 lines
Quoted 9 lines

If yes, then I would suggest we address it now.

Not at all - but it can be problematic, if two versions of DPDK disagree with the value of LIST_END.

Quoted 3 lines

Looking at the "problematic changes", we only have 2-3 application & PMD changes. For unit test application, we could may be do something like,

Quoted 7 lines
Quoted 4 lines

The essental functionality not that different, I am just not sure that the verbosity below is helping.
What you are really trying to guard against is people using LIST_END to size arrays.

[Anoob] Our problem is application using LIST_END (which comes from library)

to determine the number of iterations for the loop. My suggestion is to modify the UT such that, we could use RTE_DIM(types) (which comes from application) to determine iterations of loop. This would solve the

problem, right?

Quoted 5 lines
Quoted 3 lines

The problem is not the application.
Are you asking the app to define DPDK types?

[Anoob] I didn't understand how you concluded that.

Because you define a specific array in the test app.

Quoted 1 line

The app is supposed to test "n" asymmetric features supported by DPDK.

Currently, it does that by looping from 0 to LIST_END which happens to give you the first n features. Now, if we add any new asymmetric feature, LIST_END value would change. Isn't that the very reason why we removed LIST_END from symmetric library and applications?

Yes

Quoted 1 line

Now coming to what I proposed, the app is supposed to test "n" asymmetric

features. LIST_END helps in doing the loops. If we remove LIST_END, then application will not be in a position to do a loop. My suggestion is, we list the types that are supposed to be tested by the app, and let that array be used as feature list.

Quoted 1 line
Quoted 6 lines
Quoted 1 line

PS: Just to reiterate, my proposal is just a local array which would hold DPDK

defined RTE enum values for the features that would be tested by this app/function.

I am more concerned by the general case than the test app. I think a function returning a number is more app-friendly.

[Anoob] Indeed. But there are 3 LIST_ENDs removed with this patch. Do you propose 3 new APIs to just get max number?

Quoted 70 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

+ enum rte_crypto_asym_op_type types[] = {

The problem is in DPDK API. We must not suggest a size for enums.

[Anoob] So agreed that LIST_END should be removed?

Yes

Quoted 4 lines
Quoted 2 lines

If we really need a size, then it must be explicit and updated in the lib binary (through a function) when the size increases.

[Anoob] Precisely my thoughts. The loop with LIST_END done in application is

not correct.

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines

Review

Quoted 12 lines
(quoted diff) +8 -1
-               for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
+               enum rte_crypto_asym_op_type types[] = {
+                               RTE_CRYPTO_ASYM_OP_ENCRYPT,
+                               RTE_CRYPTO_ASYM_OP_DECRYPT,
+                               RTE_CRYPTO_ASYM_OP_SIGN,
+                               RTE_CRYPTO_ASYM_OP_VERIFY,
+                               RTE_CRYPTO_ASYM_OP_PRIVATE_KEY_GENERATE,
+                               RTE_CRYPTO_ASYM_OP_PUBLIC_KEY_GENERATE,
+

RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE,

Quoted 40 lines
Quoted 40 lines
Quoted 3 lines
Quoted 3 lines

Review

Quoted 3 lines
(quoted diff) +2 -0
+               };
+               for (i = 0; i <= RTE_DIM(types); i++) {
                        if (tc.modex.xform_type ==

RTE_CRYPTO_ASYM_XFORM_RSA) {

Quoted 36 lines
Quoted 36 lines
Quoted 31 lines
(quoted diff) +12 -5
-                               if (tc.rsa_data.op_type_flags & (1 << i)) {
+                               if (tc.rsa_data.op_type_flags
+ & (1 <<
+ types[i])) {
                                        if (tc.rsa_data.key_exp) {
                                                status = test_cryptodev_asym_op(
                                                        &testsuite_params, &tc,
-                                                       test_msg, sessionless, i,
+
+ test_msg, sessionless, types[i],
                                                        RTE_RSA_KEY_TYPE_EXP);
                                        }
                                        if (status)
                                                break;
-                                       if (tc.rsa_data.key_qt && (i ==
+                                       if (tc.rsa_data.key_qt
+ && (types[i] ==
                                                        RTE_CRYPTO_ASYM_OP_DECRYPT ||
-                                                       i == RTE_CRYPTO_ASYM_OP_SIGN)) {
+
+ types[i] ==
+ RTE_CRYPTO_ASYM_OP_SIGN)) {
                                                status = test_cryptodev_asym_op(
                                                        &testsuite_params,
-                                                       &tc, test_msg, sessionless, i,
+                                                       &tc,
+ test_msg, sessionless, types[i],
                                                        RTE_RSA_KET_TYPE_QT);
                                        }
                                        if (status)
Quoted 2 lines

This way, application would only use the ones which it is designed to work

with. For QAT driver changes, we could have an overload if condition (if alg == x
|| alg = y || ...) to get the same effect.

#38 lore raw

Re: [dpdk-dev] [EXT] Re: [PATCH v2 1/3] cryptodev: remove LIST_END enumerators

Quoted 119 lines · Anoob Joseph

Hi Thomas,

Please see inline.

Thanks,
Anoob

Quoted 112 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Tuesday, October 12, 2021 7:25 PM
To: Kinsella, Ray <[email protected]>; Akhil Goyal <[email protected]>; [email protected]; Anoob Joseph <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nagadheeraj Rottela <[email protected]>; Ankur Dwivedi <[email protected]>; [email protected]; Stephen Hemminger <[email protected]>; Yigit, Ferruh <[email protected]>; [email protected]
Subject: Re: [EXT] Re: [dpdk-dev] [PATCH v2 1/3] cryptodev: remove LIST_END enumerators

12/10/2021 15:38, Anoob Joseph:

Quoted 71 lines

From: Thomas Monjalon <[email protected]>

Quoted 70 lines

12/10/2021 13:34, Anoob Joseph:

Quoted 4 lines

From: Kinsella, Ray <[email protected]>

Quoted 3 lines · Anoob Joseph
Quoted 2 lines

From: Akhil Goyal <[email protected]>

Quoted 1 line
Quoted 1 line · Akhil Goyal
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Review

Quoted 6 lines

Remove *_LIST_END enumerators from asymmetric crypto lib to avoid ABI breakage for every new addition in enums.

---

(quoted diff) +0 -1
-	} else if (xform->xform_type >=

RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END

Review

Quoted 1 line
(quoted diff) +1 -0
+	} else if (xform->xform_type >

RTE_CRYPTO_ASYM_XFORM_ECPM
[...]

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

So I am not sure that this is an improvement.

Indeed, it is not an improvement.

Quoted 12 lines
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

The cryptodev issue we had, was that _LIST_END was being used to size arrays.
And that broke when new algorithms got added. Is that an issue, in this

case?

Quoted 7 lines
Quoted 7 lines

Yes we did this same exercise for symmetric crypto enums earlier. Asym enums were left as it was experimental at that point. They are still experimental, but thought of making this uniform throughout DPDK enums.

Quoted 1 line
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

I am not sure that swapping out _LIST_END, and then littering the code with RTE_CRYPTO_ASYM_XFORM_ECPM and RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE, is an

improvement

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines

here.

Quoted 3 lines

My 2c is that from an ABI PoV RTE_CRYPTO_ASYM_OP_LIST_END is not better or worse, than

RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE?

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Interested to hear other thoughts.

I don’t have any better solution for avoiding ABI issues for now. The change is for avoiding ABI breakage. But we can drop this patch For now as asym is still experimental.

[Anoob] Having LIST_END would preclude new additions to asymmetric

algos?

Quoted 9 lines
Quoted 9 lines

If yes, then I would suggest we address it now.

Not at all - but it can be problematic, if two versions of DPDK disagree with the value of LIST_END.

Quoted 3 lines

Looking at the "problematic changes", we only have 2-3 application & PMD changes. For unit test application, we could may be do something like,

Quoted 7 lines
Quoted 4 lines

The essental functionality not that different, I am just not sure that the verbosity below is helping.
What you are really trying to guard against is people using LIST_END to size arrays.

[Anoob] Our problem is application using LIST_END (which comes from library)

to determine the number of iterations for the loop. My suggestion is to modify the UT such that, we could use RTE_DIM(types) (which comes from application) to determine iterations of loop. This would solve the

problem, right?

Quoted 5 lines
Quoted 3 lines

The problem is not the application.
Are you asking the app to define DPDK types?

[Anoob] I didn't understand how you concluded that.

Because you define a specific array in the test app.

Quoted 1 line

The app is supposed to test "n" asymmetric features supported by DPDK.

Currently, it does that by looping from 0 to LIST_END which happens to give you the first n features. Now, if we add any new asymmetric feature, LIST_END value would change. Isn't that the very reason why we removed LIST_END from symmetric library and applications?

Yes

Quoted 1 line

Now coming to what I proposed, the app is supposed to test "n" asymmetric

features. LIST_END helps in doing the loops. If we remove LIST_END, then application will not be in a position to do a loop. My suggestion is, we list the types that are supposed to be tested by the app, and let that array be used as feature list.

Quoted 1 line
Quoted 8 lines
Quoted 6 lines
Quoted 1 line

PS: Just to reiterate, my proposal is just a local array which would hold DPDK

defined RTE enum values for the features that would be tested by this app/function.

I am more concerned by the general case than the test app. I think a function returning a number is more app-friendly.

[Anoob] Indeed. But there are 3 LIST_ENDs removed with this patch. Do you propose 3 new APIs to just get max number?

1 API returning a single "info" structure perhaps - as being the most extensible?

Quoted 72 lines
Quoted 71 lines
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

+ enum rte_crypto_asym_op_type types[] = {

The problem is in DPDK API. We must not suggest a size for enums.

[Anoob] So agreed that LIST_END should be removed?

Yes

Quoted 4 lines
Quoted 2 lines

If we really need a size, then it must be explicit and updated in the lib binary (through a function) when the size increases.

[Anoob] Precisely my thoughts. The loop with LIST_END done in application is

not correct.

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines

Review

Quoted 12 lines
(quoted diff) +8 -1
-               for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
+               enum rte_crypto_asym_op_type types[] = {
+                               RTE_CRYPTO_ASYM_OP_ENCRYPT,
+                               RTE_CRYPTO_ASYM_OP_DECRYPT,
+                               RTE_CRYPTO_ASYM_OP_SIGN,
+                               RTE_CRYPTO_ASYM_OP_VERIFY,
+                               RTE_CRYPTO_ASYM_OP_PRIVATE_KEY_GENERATE,
+                               RTE_CRYPTO_ASYM_OP_PUBLIC_KEY_GENERATE,
+

RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE,

Quoted 40 lines
Quoted 40 lines
Quoted 3 lines
Quoted 3 lines

Review

Quoted 3 lines
(quoted diff) +2 -0
+               };
+               for (i = 0; i <= RTE_DIM(types); i++) {
                        if (tc.modex.xform_type ==

RTE_CRYPTO_ASYM_XFORM_RSA) {

Quoted 36 lines
Quoted 36 lines
Quoted 31 lines
(quoted diff) +12 -5
-                               if (tc.rsa_data.op_type_flags & (1 << i)) {
+                               if (tc.rsa_data.op_type_flags
+ & (1 <<
+ types[i])) {
                                        if (tc.rsa_data.key_exp) {
                                                status = test_cryptodev_asym_op(
                                                        &testsuite_params, &tc,
-                                                       test_msg, sessionless, i,
+
+ test_msg, sessionless, types[i],
                                                        RTE_RSA_KEY_TYPE_EXP);
                                        }
                                        if (status)
                                                break;
-                                       if (tc.rsa_data.key_qt && (i ==
+                                       if (tc.rsa_data.key_qt
+ && (types[i] ==
                                                        RTE_CRYPTO_ASYM_OP_DECRYPT ||
-                                                       i == RTE_CRYPTO_ASYM_OP_SIGN)) {
+
+ types[i] ==
+ RTE_CRYPTO_ASYM_OP_SIGN)) {
                                                status = test_cryptodev_asym_op(
                                                        &testsuite_params,
-                                                       &tc, test_msg, sessionless, i,
+                                                       &tc,
+ test_msg, sessionless, types[i],
                                                        RTE_RSA_KET_TYPE_QT);
                                        }
                                        if (status)
Quoted 2 lines

This way, application would only use the ones which it is designed to work

with. For QAT driver changes, we could have an overload if condition (if alg == x
|| alg = y || ...) to get the same effect.

#39 lore raw

Re: [dpdk-dev] [EXT] Re: [PATCH v2 1/3] cryptodev: remove LIST_END enumerators

12/10/2021 16:47, Kinsella, Ray:

Quoted 101 lines · Anoob Joseph
Quoted 100 lines

From: Thomas Monjalon <[email protected]>

Quoted 99 lines

12/10/2021 15:38, Anoob Joseph:

Quoted 71 lines

From: Thomas Monjalon <[email protected]>

Quoted 70 lines

12/10/2021 13:34, Anoob Joseph:

Quoted 4 lines

From: Kinsella, Ray <[email protected]>

Quoted 3 lines · Anoob Joseph
Quoted 2 lines

From: Akhil Goyal <[email protected]>

Quoted 1 line
Quoted 1 line · Akhil Goyal
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Review

Quoted 6 lines

Remove *_LIST_END enumerators from asymmetric crypto lib to avoid ABI breakage for every new addition in enums.

---

(quoted diff) +0 -1
-	} else if (xform->xform_type >=

RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END

Review

Quoted 1 line
(quoted diff) +1 -0
+	} else if (xform->xform_type >

RTE_CRYPTO_ASYM_XFORM_ECPM
[...]

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

So I am not sure that this is an improvement.

Indeed, it is not an improvement.

Quoted 12 lines
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

The cryptodev issue we had, was that _LIST_END was being used to size arrays.
And that broke when new algorithms got added. Is that an issue, in this

case?

Quoted 7 lines
Quoted 7 lines

Yes we did this same exercise for symmetric crypto enums earlier. Asym enums were left as it was experimental at that point. They are still experimental, but thought of making this uniform throughout DPDK enums.

Quoted 1 line
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

I am not sure that swapping out _LIST_END, and then littering the code with RTE_CRYPTO_ASYM_XFORM_ECPM and RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE, is an

improvement

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines

here.

Quoted 3 lines

My 2c is that from an ABI PoV RTE_CRYPTO_ASYM_OP_LIST_END is not better or worse, than

RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE?

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Interested to hear other thoughts.

I don’t have any better solution for avoiding ABI issues for now. The change is for avoiding ABI breakage. But we can drop this patch For now as asym is still experimental.

[Anoob] Having LIST_END would preclude new additions to asymmetric

algos?

Quoted 9 lines
Quoted 9 lines

If yes, then I would suggest we address it now.

Not at all - but it can be problematic, if two versions of DPDK disagree with the value of LIST_END.

Quoted 3 lines

Looking at the "problematic changes", we only have 2-3 application & PMD changes. For unit test application, we could may be do something like,

Quoted 7 lines
Quoted 4 lines

The essental functionality not that different, I am just not sure that the verbosity below is helping.
What you are really trying to guard against is people using LIST_END to size arrays.

[Anoob] Our problem is application using LIST_END (which comes from library)

to determine the number of iterations for the loop. My suggestion is to modify the UT such that, we could use RTE_DIM(types) (which comes from application) to determine iterations of loop. This would solve the

problem, right?

Quoted 5 lines
Quoted 3 lines

The problem is not the application.
Are you asking the app to define DPDK types?

[Anoob] I didn't understand how you concluded that.

Because you define a specific array in the test app.

Quoted 1 line

The app is supposed to test "n" asymmetric features supported by DPDK.

Currently, it does that by looping from 0 to LIST_END which happens to give you the first n features. Now, if we add any new asymmetric feature, LIST_END value would change. Isn't that the very reason why we removed LIST_END from symmetric library and applications?

Yes

Quoted 1 line

Now coming to what I proposed, the app is supposed to test "n" asymmetric

features. LIST_END helps in doing the loops. If we remove LIST_END, then application will not be in a position to do a loop. My suggestion is, we list the types that are supposed to be tested by the app, and let that array be used as feature list.

Quoted 2 lines

PS: Just to reiterate, my proposal is just a local array which would hold DPDK

defined RTE enum values for the features that would be tested by this app/function.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

I am more concerned by the general case than the test app. I think a function returning a number is more app-friendly.

[Anoob] Indeed. But there are 3 LIST_ENDs removed with this patch. Do you propose 3 new APIs to just get max number?

1 API returning a single "info" structure perhaps - as being the most extensible?

Or 3 iterators (foreach construct).
Instead of just returning a size, we can have an iterator for each enum which needs to be iterated.

Feel free to consider the alternative which fits the best in cryptodev.

#40 lore raw

Re: [dpdk-dev] [EXT] Re: [PATCH v2 1/3] cryptodev: remove LIST_END enumerators

Hi Thomas, Ray,

Please see inline.

Thanks,
Anoob

Quoted 131 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Tuesday, October 12, 2021 8:37 PM
To: Anoob Joseph <[email protected]>; Akhil Goyal <[email protected]>; [email protected]; Kinsella, Ray <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nagadheeraj Rottela <[email protected]>; Ankur Dwivedi <[email protected]>; [email protected]; Stephen Hemminger <[email protected]>; Yigit, Ferruh <[email protected]>; [email protected]
Subject: Re: [EXT] Re: [dpdk-dev] [PATCH v2 1/3] cryptodev: remove LIST_END enumerators

12/10/2021 16:47, Kinsella, Ray:

Quoted 10 lines · Anoob Joseph
Quoted 9 lines

From: Thomas Monjalon <[email protected]>

Quoted 8 lines

12/10/2021 15:38, Anoob Joseph:

Quoted 7 lines

From: Thomas Monjalon <[email protected]>

Quoted 6 lines

12/10/2021 13:34, Anoob Joseph:

Quoted 5 lines

From: Kinsella, Ray <[email protected]>

Quoted 4 lines · Anoob Joseph
Quoted 3 lines

From: Akhil Goyal <[email protected]>

Quoted 2 lines
Quoted 2 lines · Akhil Goyal
Quoted 1 line

Remove *_LIST_END enumerators from asymmetric crypto

lib to

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Review

Quoted 5 lines

avoid ABI breakage for every new addition in enums.

---

(quoted diff) +0 -1
-	} else if (xform->xform_type >=

RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END

Review

Quoted 1 line
(quoted diff) +1 -0
+	} else if (xform->xform_type >

RTE_CRYPTO_ASYM_XFORM_ECPM
[...]

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

So I am not sure that this is an improvement.

Indeed, it is not an improvement.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

The cryptodev issue we had, was that _LIST_END was being used to size arrays.
And that broke when new algorithms got added. Is that an issue, in this

case?

Quoted 2 lines
Quoted 2 lines

Yes we did this same exercise for symmetric crypto enums

earlier.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Asym enums were left as it was experimental at that point. They are still experimental, but thought of making this uniform throughout DPDK enums.

Quoted 1 line
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

I am not sure that swapping out _LIST_END, and then littering the code with RTE_CRYPTO_ASYM_XFORM_ECPM and RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE, is an

improvement

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

here.

Quoted 2 lines

My 2c is that from an ABI PoV

RTE_CRYPTO_ASYM_OP_LIST_END is

Quoted 34 lines
Quoted 34 lines
Quoted 34 lines
Quoted 26 lines
Quoted 26 lines
Quoted 11 lines
Quoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

not better or worse, than

RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE?

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

Interested to hear other thoughts.

I don’t have any better solution for avoiding ABI issues for now. The change is for avoiding ABI breakage. But we can drop this patch For now as asym is still experimental.

[Anoob] Having LIST_END would preclude new additions to asymmetric

algos?

Quoted 14 lines
Quoted 13 lines

If yes, then I would suggest we address it now.

Not at all - but it can be problematic, if two versions of DPDK disagree with the value of LIST_END.

Quoted 3 lines

Looking at the "problematic changes", we only have 2-3 application & PMD changes. For unit test application, we could may be do something like,

The essental functionality not that different, I am just not sure that the verbosity below is helping.
What you are really trying to guard against is people using LIST_END to size arrays.

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

[Anoob] Our problem is application using LIST_END (which comes from library)

to determine the number of iterations for the loop. My suggestion is to modify the UT such that, we could use RTE_DIM(types) (which comes from application) to determine iterations of loop. This would solve the

problem, right?

Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

The problem is not the application.
Are you asking the app to define DPDK types?

[Anoob] I didn't understand how you concluded that.

Because you define a specific array in the test app.

Quoted 1 line

The app is supposed to test "n" asymmetric features supported by

DPDK.

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines

Currently, it does that by looping from 0 to LIST_END which happens to give you the first n features. Now, if we add any new asymmetric feature, LIST_END value would change. Isn't that the very reason why we removed LIST_END from symmetric library and applications?

Yes

Quoted 2 lines

Now coming to what I proposed, the app is supposed to test "n" asymmetric

features. LIST_END helps in doing the loops. If we remove LIST_END, then application will not be in a position to do a loop. My suggestion is, we list the types that are supposed to be tested by the app, and let that array be used as feature list.

Quoted 3 lines

PS: Just to reiterate, my proposal is just a local array which would hold DPDK

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

defined RTE enum values for the features that would be tested by this app/function.

I am more concerned by the general case than the test app. I think a function returning a number is more app-friendly.

[Anoob] Indeed. But there are 3 LIST_ENDs removed with this patch. Do

Quoted 8 lines

you propose 3 new APIs to just get max number?

Quoted 2 lines

1 API returning a single "info" structure perhaps - as being the most

extensible?

Or 3 iterators (foreach construct).
Instead of just returning a size, we can have an iterator for each enum which needs to be iterated.

[Anoob] Something like this?

app/test/test_cryptodev_asym.c +1 -1
index 847b074a4f..68a6197851 100644
@@ -542,7 +542,7 @@ test_one_case(const void *test_case, int sessionless)
                printf("  %u) TestCase %s %s\n", test_index++,
                        tc.modex.description, test_msg);
        } else {
-               for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
+               RTE_CRYPTO_ASYM_FOREACH_OP_TYPE(i) {
                        if (tc.modex.xform_type == RTE_CRYPTO_ASYM_XFORM_RSA) {
                                if (tc.rsa_data.op_type_flags & (1 << i)) {
                                        if (tc.rsa_data.key_exp) {
lib/cryptodev/rte_crypto_asym.h +5 -0
index 9c866f553f..5627dcaff1 100644
@@ -119,6 +119,11 @@ enum rte_crypto_asym_op_type {
        RTE_CRYPTO_ASYM_OP_LIST_END
 };
 
+#define RTE_CRYPTO_ASYM_FOREACH_OP_TYPE(i) \
+       for (i = RTE_CRYPTO_ASYM_OP_ENCRYPT; \
+            i <= RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE; \
+            i++)
+
 /**
  * Padding types for RSA signature.
  */ 
#41 lore raw

Re: [dpdk-dev] [EXT] Re: [PATCH v2 1/3] cryptodev: remove LIST_END enumerators

13/10/2021 07:36, Anoob Joseph:

Quoted 143 lines

From: Thomas Monjalon <[email protected]>

Quoted 113 lines

12/10/2021 16:47, Kinsella, Ray:

Quoted 10 lines · Anoob Joseph
Quoted 9 lines

From: Thomas Monjalon <[email protected]>

Quoted 8 lines

12/10/2021 15:38, Anoob Joseph:

Quoted 7 lines

From: Thomas Monjalon <[email protected]>

Quoted 6 lines

12/10/2021 13:34, Anoob Joseph:

Quoted 5 lines

From: Kinsella, Ray <[email protected]>

Quoted 4 lines · Anoob Joseph
Quoted 3 lines

From: Akhil Goyal <[email protected]>

Quoted 2 lines
Quoted 2 lines · Akhil Goyal
Quoted 1 line

Remove *_LIST_END enumerators from asymmetric crypto

lib to

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

avoid ABI breakage for every new addition in enums.

Signed-off-by: Akhil Goyal <[email protected]>
---
- } else if (xform->xform_type >=

RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END

Quoted 1 line

+ } else if (xform->xform_type >

RTE_CRYPTO_ASYM_XFORM_ECPM
[...]

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

So I am not sure that this is an improvement.

Indeed, it is not an improvement.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

The cryptodev issue we had, was that _LIST_END was being used to size arrays.
And that broke when new algorithms got added. Is that an issue, in this

case?

Quoted 2 lines
Quoted 2 lines

Yes we did this same exercise for symmetric crypto enums

earlier.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Asym enums were left as it was experimental at that point. They are still experimental, but thought of making this uniform throughout DPDK enums.

Quoted 1 line
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

I am not sure that swapping out _LIST_END, and then littering the code with RTE_CRYPTO_ASYM_XFORM_ECPM and RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE, is an

improvement

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

here.

Quoted 2 lines

My 2c is that from an ABI PoV

RTE_CRYPTO_ASYM_OP_LIST_END is

Quoted 34 lines
Quoted 34 lines
Quoted 34 lines
Quoted 26 lines
Quoted 26 lines
Quoted 11 lines
Quoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

not better or worse, than

RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE?

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

Interested to hear other thoughts.

I don’t have any better solution for avoiding ABI issues for now. The change is for avoiding ABI breakage. But we can drop this patch For now as asym is still experimental.

[Anoob] Having LIST_END would preclude new additions to asymmetric

algos?

Quoted 14 lines
Quoted 13 lines

If yes, then I would suggest we address it now.

Not at all - but it can be problematic, if two versions of DPDK disagree with the value of LIST_END.

Quoted 3 lines

Looking at the "problematic changes", we only have 2-3 application & PMD changes. For unit test application, we could may be do something like,

The essental functionality not that different, I am just not sure that the verbosity below is helping.
What you are really trying to guard against is people using LIST_END to size arrays.

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

[Anoob] Our problem is application using LIST_END (which comes from library)

to determine the number of iterations for the loop. My suggestion is to modify the UT such that, we could use RTE_DIM(types) (which comes from application) to determine iterations of loop. This would solve the

problem, right?

Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

The problem is not the application.
Are you asking the app to define DPDK types?

[Anoob] I didn't understand how you concluded that.

Because you define a specific array in the test app.

Quoted 1 line

The app is supposed to test "n" asymmetric features supported by

DPDK.

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines

Currently, it does that by looping from 0 to LIST_END which happens to give you the first n features. Now, if we add any new asymmetric feature, LIST_END value would change. Isn't that the very reason why we removed LIST_END from symmetric library and applications?

Yes

Quoted 2 lines

Now coming to what I proposed, the app is supposed to test "n" asymmetric

features. LIST_END helps in doing the loops. If we remove LIST_END, then application will not be in a position to do a loop. My suggestion is, we list the types that are supposed to be tested by the app, and let that array be used as feature list.

Quoted 3 lines

PS: Just to reiterate, my proposal is just a local array which would hold DPDK

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

defined RTE enum values for the features that would be tested by this app/function.

I am more concerned by the general case than the test app. I think a function returning a number is more app-friendly.

[Anoob] Indeed. But there are 3 LIST_ENDs removed with this patch. Do

Quoted 8 lines

you propose 3 new APIs to just get max number?

Quoted 2 lines

1 API returning a single "info" structure perhaps - as being the most

extensible?

Or 3 iterators (foreach construct).
Instead of just returning a size, we can have an iterator for each enum which needs to be iterated.

[Anoob] Something like this?

app/test/test_cryptodev_asym.c +1 -1
index 847b074a4f..68a6197851 100644
@@ -542,7 +542,7 @@ test_one_case(const void *test_case, int sessionless)
                printf("  %u) TestCase %s %s\n", test_index++,
                        tc.modex.description, test_msg);
        } else {
-               for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
+               RTE_CRYPTO_ASYM_FOREACH_OP_TYPE(i) {
                        if (tc.modex.xform_type == RTE_CRYPTO_ASYM_XFORM_RSA) {
                                if (tc.rsa_data.op_type_flags & (1 << i)) {
                                        if (tc.rsa_data.key_exp) {
lib/cryptodev/rte_crypto_asym.h +0 -0
index 9c866f553f..5627dcaff1 100644

lib/cryptodev/rte_crypto_asym.h enum rte_crypto_asym_op_type { · line 125

Quoted 7 lines
lib/cryptodev/rte_crypto_asym.h +4 -0
@@ -119,6 +119,11 @@ enum rte_crypto_asym_op_type {
        RTE_CRYPTO_ASYM_OP_LIST_END
 };
 
+#define RTE_CRYPTO_ASYM_FOREACH_OP_TYPE(i) \
+       for (i = RTE_CRYPTO_ASYM_OP_ENCRYPT; \
+            i <= RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE; \
+            i++)

You must not use enum values in the .h, otherwise ABI compatibility is not ensured. Yes you can do a macro, but it must call functions, not using direct values.

#42 lore raw

Re: [dpdk-dev] [EXT] Re: [PATCH v2 1/3] cryptodev: remove LIST_END enumerators

Hi Akhil, Ray, Thomas,

Please see inline.

Thanks,
Anoob

Quoted 174 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Wednesday, October 13, 2021 12:32 PM
To: Akhil Goyal <[email protected]>; [email protected]; Kinsella, Ray <[email protected]>; Anoob Joseph <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nagadheeraj Rottela <[email protected]>; Ankur Dwivedi <[email protected]>; [email protected]; Stephen Hemminger <[email protected]>; Yigit, Ferruh <[email protected]>; [email protected]
Subject: Re: [EXT] Re: [dpdk-dev] [PATCH v2 1/3] cryptodev: remove LIST_END enumerators

13/10/2021 07:36, Anoob Joseph:

Quoted 12 lines

From: Thomas Monjalon <[email protected]>

Quoted 11 lines

12/10/2021 16:47, Kinsella, Ray:

Quoted 10 lines · Anoob Joseph
Quoted 9 lines

From: Thomas Monjalon <[email protected]>

Quoted 8 lines

12/10/2021 15:38, Anoob Joseph:

Quoted 7 lines

From: Thomas Monjalon <[email protected]>

Quoted 6 lines

12/10/2021 13:34, Anoob Joseph:

Quoted 5 lines

From: Kinsella, Ray <[email protected]>

Quoted 4 lines · Anoob Joseph
Quoted 3 lines

From: Akhil Goyal <[email protected]>

Quoted 2 lines
Quoted 2 lines · Akhil Goyal

Remove *_LIST_END enumerators from asymmetric

crypto

Quoted 22 lines
Quoted 22 lines

lib to

Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

avoid ABI breakage for every new addition in enums.

Signed-off-by: Akhil Goyal <[email protected]>
---
- } else if (xform->xform_type >=
RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END
+ } else if (xform->xform_type >

RTE_CRYPTO_ASYM_XFORM_ECPM
[...]

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

So I am not sure that this is an improvement.

Indeed, it is not an improvement.

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

The cryptodev issue we had, was that _LIST_END was being
used to size arrays.
And that broke when new algorithms got added. Is that an
issue, in this

case?

Quoted 2 lines
Quoted 2 lines

Yes we did this same exercise for symmetric crypto enums

Quoted 8 lines
Quoted 8 lines

earlier.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Asym enums were left as it was experimental at that point. They are still experimental, but thought of making this uniform throughout DPDK enums.

Quoted 3 lines

I am not sure that swapping out _LIST_END, and then
littering the code with RTE_CRYPTO_ASYM_XFORM_ECPM

and

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE, is an

improvement

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

here.

Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

My 2c is that from an ABI PoV

RTE_CRYPTO_ASYM_OP_LIST_END is

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

not better or worse, than

RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE?

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

Interested to hear other thoughts.

I don’t have any better solution for avoiding ABI issues for

now.

Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 20 lines
Quoted 20 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

The change is for avoiding ABI breakage. But we can drop this patch For now as asym is still experimental.

[Anoob] Having LIST_END would preclude new additions to asymmetric

algos?

Quoted 14 lines
Quoted 13 lines

If yes, then I would suggest we address it now.

Not at all - but it can be problematic, if two versions of DPDK disagree with the value of LIST_END.

Quoted 3 lines

Looking at the "problematic changes", we only have 2-3 application & PMD changes. For unit test application, we could may be do something like,

The essental functionality not that different, I am just not sure that the verbosity below is helping.
What you are really trying to guard against is people using LIST_END to size arrays.

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

[Anoob] Our problem is application using LIST_END (which comes from library)

to determine the number of iterations for the loop. My suggestion is to modify the UT such that, we could use RTE_DIM(types) (which comes from application) to determine iterations of loop. This would solve the

problem, right?

Quoted 5 lines
Quoted 3 lines

The problem is not the application.
Are you asking the app to define DPDK types?

[Anoob] I didn't understand how you concluded that.

Because you define a specific array in the test app.

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

The app is supposed to test "n" asymmetric features supported by

DPDK.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Currently, it does that by looping from 0 to LIST_END which happens to give you the first n features. Now, if we add any new asymmetric feature, LIST_END value would change. Isn't that the very reason why we removed LIST_END from symmetric library

and applications?

app/test/test_cryptodev_asym.c test_one_case(const void *test_case, int

Quoted 37 lines
Quoted 22 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines

Yes

Quoted 2 lines

Now coming to what I proposed, the app is supposed to test "n" asymmetric

features. LIST_END helps in doing the loops. If we remove LIST_END, then application will not be in a position to do a loop. My suggestion is, we list the types that are supposed to be tested by the app, and let that array be used as feature list.

Quoted 3 lines

PS: Just to reiterate, my proposal is just a local array which would hold DPDK

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

defined RTE enum values for the features that would be tested by this app/function.

I am more concerned by the general case than the test app. I think a function returning a number is more app-friendly.

[Anoob] Indeed. But there are 3 LIST_ENDs removed with this patch. Do

you propose 3 new APIs to just get max number?

Quoted 1 line
Quoted 7 lines
Quoted 2 lines

1 API returning a single "info" structure perhaps - as being the most

extensible?

Or 3 iterators (foreach construct).
Instead of just returning a size, we can have an iterator for each enum which needs to be iterated.

[Anoob] Something like this?

(quoted diff) +0 -0

b/app/test/test_cryptodev_asym.c index 847b074a4f..68a6197851 100644

app/test/test_cryptodev_asym.c +0 -0
@@ -542,7 +542,7 @@ test_one_case(const void *test_case, int

sessionless)

app/test/test_cryptodev_asym.c test_one_case(const void *test_case, int sessionless)

Quoted 6 lines
app/test/test_cryptodev_asym.c +1 -1
                printf("  %u) TestCase %s %s\n", test_index++,
                        tc.modex.description, test_msg);
        } else {
-               for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
+               RTE_CRYPTO_ASYM_FOREACH_OP_TYPE(i) {
                        if (tc.modex.xform_type == RTE_CRYPTO_ASYM_XFORM_RSA)

{

Quoted 10 lines
app/test/test_cryptodev_asym.c +0 -0
                                if (tc.rsa_data.op_type_flags & (1 << i)) {
                                        if (tc.rsa_data.key_exp) {
(quoted diff) +0 -0

b/lib/cryptodev/rte_crypto_asym.h index 9c866f553f..5627dcaff1 100644

lib/cryptodev/rte_crypto_asym.h +0 -0
@@ -119,6 +119,11 @@ enum rte_crypto_asym_op_type {
        RTE_CRYPTO_ASYM_OP_LIST_END
 };
 
Quoted 9 lines

lib/cryptodev/rte_crypto_asym.h enum rte_crypto_asym_op_type { · line 125

Quoted 4 lines
lib/cryptodev/rte_crypto_asym.h +4 -0
+#define RTE_CRYPTO_ASYM_FOREACH_OP_TYPE(i) \
+       for (i = RTE_CRYPTO_ASYM_OP_ENCRYPT; \
+            i <= RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE; \
+            i++)

You must not use enum values in the .h, otherwise ABI compatibility is not ensured.
Yes you can do a macro, but it must call functions, not using direct values.

[Anoob] Understood. Will do that.

@Ray, @Akhil, you are also in agreement, right?

#43 lore raw

Re: [dpdk-dev] [EXT] Re: [PATCH v2 1/3] cryptodev: remove LIST_END enumerators

Quoted 191 lines · Anoob Joseph

Hi Akhil, Ray, Thomas,

Please see inline.

Thanks,
Anoob

Quoted 174 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Wednesday, October 13, 2021 12:32 PM
To: Akhil Goyal <[email protected]>; [email protected]; Kinsella, Ray <[email protected]>; Anoob Joseph <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nagadheeraj Rottela <[email protected]>; Ankur Dwivedi <[email protected]>; [email protected]; Stephen Hemminger <[email protected]>; Yigit, Ferruh <[email protected]>; [email protected]
Subject: Re: [EXT] Re: [dpdk-dev] [PATCH v2 1/3] cryptodev: remove LIST_END enumerators

13/10/2021 07:36, Anoob Joseph:

Quoted 12 lines

From: Thomas Monjalon <[email protected]>

Quoted 11 lines

12/10/2021 16:47, Kinsella, Ray:

Quoted 10 lines · Anoob Joseph
Quoted 9 lines

From: Thomas Monjalon <[email protected]>

Quoted 8 lines

12/10/2021 15:38, Anoob Joseph:

Quoted 7 lines

From: Thomas Monjalon <[email protected]>

Quoted 6 lines

12/10/2021 13:34, Anoob Joseph:

Quoted 5 lines

From: Kinsella, Ray <[email protected]>

Quoted 4 lines · Anoob Joseph
Quoted 3 lines

From: Akhil Goyal <[email protected]>

Quoted 2 lines

On 08/10/2021 21:45, Akhil Goyal wrote:
Remove *_LIST_END enumerators from asymmetric

crypto

Quoted 22 lines
Quoted 22 lines

lib to

Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

avoid ABI breakage for every new addition in enums.

Signed-off-by: Akhil Goyal <[email protected]>
---
- } else if (xform->xform_type >=
RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END
+ } else if (xform->xform_type >

RTE_CRYPTO_ASYM_XFORM_ECPM
[...]

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

So I am not sure that this is an improvement.

Indeed, it is not an improvement.

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

The cryptodev issue we had, was that _LIST_END was being
used to size arrays.
And that broke when new algorithms got added. Is that an
issue, in this

case?

Quoted 2 lines
Quoted 2 lines

Yes we did this same exercise for symmetric crypto enums

Quoted 8 lines
Quoted 8 lines

earlier.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Asym enums were left as it was experimental at that point.
They are still experimental, but thought of making this
uniform throughout DPDK enums.

I am not sure that swapping out _LIST_END, and then
littering the code with RTE_CRYPTO_ASYM_XFORM_ECPM

and

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE, is an

improvement

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

here.

Quoted 8 lines
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

My 2c is that from an ABI PoV

RTE_CRYPTO_ASYM_OP_LIST_END is

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line

not better or worse, than

RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE?

Quoted 4 lines
Quoted 4 lines

Interested to hear other thoughts.

I don’t have any better solution for avoiding ABI issues for

now.

Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 20 lines
Quoted 20 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

The change is for avoiding ABI breakage. But we can drop
this patch For now as asym is still experimental.

[Anoob] Having LIST_END would preclude new additions to asymmetric

algos?

Quoted 14 lines
Quoted 13 lines

If yes, then I would suggest we address it now.

Not at all - but it can be problematic, if two versions of DPDK disagree with the value of LIST_END.

Quoted 3 lines

Looking at the "problematic changes", we only have 2-3 application & PMD changes. For unit test application, we could may be do something like,

The essental functionality not that different, I am just not sure that the verbosity below is helping.
What you are really trying to guard against is people using LIST_END to size arrays.

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

[Anoob] Our problem is application using LIST_END (which comes from library)

to determine the number of iterations for the loop. My suggestion is to modify the UT such that, we could use RTE_DIM(types) (which comes from application) to determine iterations of loop. This would solve the

problem, right?

Quoted 5 lines
Quoted 3 lines

The problem is not the application.
Are you asking the app to define DPDK types?

[Anoob] I didn't understand how you concluded that.

Because you define a specific array in the test app.

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

The app is supposed to test "n" asymmetric features supported by

DPDK.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Currently, it does that by looping from 0 to LIST_END which happens to give you the first n features. Now, if we add any new asymmetric feature, LIST_END value would change. Isn't that the very reason why we removed LIST_END from symmetric library

and applications?

app/test/test_cryptodev_asym.c test_one_case(const void *test_case, int

Quoted 37 lines
Quoted 22 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines

Yes

Quoted 2 lines

Now coming to what I proposed, the app is supposed to test "n" asymmetric

features. LIST_END helps in doing the loops. If we remove LIST_END, then application will not be in a position to do a loop. My suggestion is, we list the types that are supposed to be tested by the app, and let that array be used as feature list.

Quoted 3 lines

PS: Just to reiterate, my proposal is just a local array which would hold DPDK

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

defined RTE enum values for the features that would be tested by this app/function.

I am more concerned by the general case than the test app. I think a function returning a number is more app-friendly.

[Anoob] Indeed. But there are 3 LIST_ENDs removed with this patch. Do

you propose 3 new APIs to just get max number?

Quoted 1 line
Quoted 7 lines
Quoted 2 lines

1 API returning a single "info" structure perhaps - as being the most

extensible?

Or 3 iterators (foreach construct).
Instead of just returning a size, we can have an iterator for each enum which needs to be iterated.

[Anoob] Something like this?

(quoted diff) +0 -0

b/app/test/test_cryptodev_asym.c index 847b074a4f..68a6197851 100644

app/test/test_cryptodev_asym.c +0 -0
@@ -542,7 +542,7 @@ test_one_case(const void *test_case, int

sessionless)

app/test/test_cryptodev_asym.c test_one_case(const void *test_case, int sessionless)

Quoted 6 lines
app/test/test_cryptodev_asym.c +1 -1
                printf("  %u) TestCase %s %s\n", test_index++,
                        tc.modex.description, test_msg);
        } else {
-               for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
+               RTE_CRYPTO_ASYM_FOREACH_OP_TYPE(i) {
                        if (tc.modex.xform_type == RTE_CRYPTO_ASYM_XFORM_RSA)

{

Quoted 10 lines
app/test/test_cryptodev_asym.c +0 -0
                                if (tc.rsa_data.op_type_flags & (1 << i)) {
                                        if (tc.rsa_data.key_exp) {
(quoted diff) +0 -0

b/lib/cryptodev/rte_crypto_asym.h index 9c866f553f..5627dcaff1 100644

lib/cryptodev/rte_crypto_asym.h +0 -0
@@ -119,6 +119,11 @@ enum rte_crypto_asym_op_type {
        RTE_CRYPTO_ASYM_OP_LIST_END
 };
 
Quoted 9 lines

lib/cryptodev/rte_crypto_asym.h enum rte_crypto_asym_op_type { · line 125

Quoted 4 lines
lib/cryptodev/rte_crypto_asym.h +4 -0
+#define RTE_CRYPTO_ASYM_FOREACH_OP_TYPE(i) \
+       for (i = RTE_CRYPTO_ASYM_OP_ENCRYPT; \
+            i <= RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE; \
+            i++)

You must not use enum values in the .h, otherwise ABI compatibility is not ensured.
Yes you can do a macro, but it must call functions, not using direct values.

Quoted 4 lines

[Anoob] Understood. Will do that.

@Ray, @Akhil, you are also in agreement, right?

Yes - whether you use the MACRO or not less important.
In order to maintain the ABI ... you need to learn the array size through an API.

#44 lore raw

PATCH v3 1/2 security: hide internal API

In reply to Akhil Goyal

rte_security_dynfield_register() is an internal API to be used by the driver, hence moving it to internal.

---
 lib/security/rte_security_driver.h | 2 +-
 lib/security/version.map           | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)
lib/security/rte_security_driver.h +1 -1
index 938373205c..b0253e962e 100644
@@ -89,7 +89,7 @@ typedef int (*security_session_stats_get_t)(void *device,
 		struct rte_security_session *sess,
 		struct rte_security_stats *stats);
 
-__rte_experimental
+__rte_internal
 int rte_security_dynfield_register(void);
 
 /**
lib/security/version.map +6 -1
index a1f46bfd27..edf4887e12 100644
@@ -16,7 +16,12 @@ EXPERIMENTAL {
 	__rte_security_get_userdata;
 	__rte_security_set_pkt_metadata;
 	rte_security_dynfield_offset;
-	rte_security_dynfield_register;
 	rte_security_session_stats_get;
 	rte_security_session_update;
 };
+
+INTERNAL {
+	global:
+
+	rte_security_dynfield_register;
+};
Signature · 1 line
2.25.1
#45 lore raw

PATCH v3 2/2 security: add reserved bitfields

In struct rte_security_ipsec_sa_options, for every new option added, there is an ABI breakage, to avoid, a reserved_opts bitfield is added to for the remaining bits available in the structure.
Now for every new sa option, these reserved_opts can be reduced and new option can be added.

---
v3:
- added a comment for requesting user to clear reserved_opts.
- removed LIST_END enumerators patch. It will be handled separately.

 lib/security/rte_security.h | 9 +++++++++
 1 file changed, 9 insertions(+)
lib/security/rte_security.h +9 -0
index 17d0e95412..4c55dcd744 100644
@@ -263,6 +263,15 @@ struct rte_security_ipsec_sa_options {
 	 * PKT_TX_UDP_CKSUM or PKT_TX_L4_MASK in mbuf.
 	 */
 	uint32_t l4_csum_enable : 1;
+
+	/** Reserved bit fields for future extension
+	 *
+	 * User should ensure reserved_opts is cleared as it may change in
+	 * subsequent releases to support new options.
+	 *
+	 * Note: Reduce number of bits in reserved_opts for every new option.
+	 */
+	uint32_t reserved_opts : 18;
 };
 
 /** IPSec security association direction */
Signature · 1 line
2.25.1
#46 lore raw

Re: [dpdk-dev] [PATCH v3 2/2] security: add reserved bitfields

Quoted 7 lines

In struct rte_security_ipsec_sa_options, for every new option added, there is an ABI breakage, to avoid, a reserved_opts bitfield is added to for the remaining bits available in the structure.
Now for every new sa option, these reserved_opts can be reduced and new option can be added.

Quoted 8 lines

---
v3:
- added a comment for requesting user to clear reserved_opts.
- removed LIST_END enumerators patch. It will be handled separately.

Series applied to dpdk-next-crypto