cryptodev: allow use of global variables from C++

Message ID 20241219163523.164992-1-mattias.ronnblom@ericsson.com (mailing list archive)
State New
Delegated to: akhil goyal
Headers
Series cryptodev: allow use of global variables from C++ |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-marvell-Functional success Functional Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS

Commit Message

Mattias Rönnblom Dec. 19, 2024, 4:35 p.m. UTC
Avoid C++ name mangling of the two global variables being exported
from <rte_crypto_asym.h>.

Suggested-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
---
 lib/cryptodev/rte_crypto_asym.h | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Comments

Akhil Goyal Jan. 8, 2025, 9:55 a.m. UTC | #1
> Avoid C++ name mangling of the two global variables being exported
> from <rte_crypto_asym.h>.
> 
> Suggested-by: David Marchand <david.marchand@redhat.com>
> Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> ---
>  lib/cryptodev/rte_crypto_asym.h | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/lib/cryptodev/rte_crypto_asym.h b/lib/cryptodev/rte_crypto_asym.h
> index aeb46e688e..9787b710e7 100644
> --- a/lib/cryptodev/rte_crypto_asym.h
> +++ b/lib/cryptodev/rte_crypto_asym.h
> @@ -25,6 +25,10 @@
> 
>  struct rte_cryptodev_asym_session;
> 
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
>  /** asym key exchange operation type name strings */
>  extern const char *
>  rte_crypto_asym_ke_strings[];
> @@ -33,6 +37,10 @@ rte_crypto_asym_ke_strings[];
>  extern const char *
>  rte_crypto_asym_op_strings[];
> 
> +#ifdef __cplusplus
> +}
> +#endif
> +
>  #define RTE_CRYPTO_ASYM_FLAG_PUB_KEY_NO_PADDING
> 	RTE_BIT32(0)

It seems only these two variables are causing problem,
but shouldn't it be better to have this change for the complete file
like rte_crypto_sym.h.
This will avoid issues with any future additions.
  

Patch

diff --git a/lib/cryptodev/rte_crypto_asym.h b/lib/cryptodev/rte_crypto_asym.h
index aeb46e688e..9787b710e7 100644
--- a/lib/cryptodev/rte_crypto_asym.h
+++ b/lib/cryptodev/rte_crypto_asym.h
@@ -25,6 +25,10 @@ 
 
 struct rte_cryptodev_asym_session;
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** asym key exchange operation type name strings */
 extern const char *
 rte_crypto_asym_ke_strings[];
@@ -33,6 +37,10 @@  rte_crypto_asym_ke_strings[];
 extern const char *
 rte_crypto_asym_op_strings[];
 
+#ifdef __cplusplus
+}
+#endif
+
 #define RTE_CRYPTO_ASYM_FLAG_PUB_KEY_NO_PADDING		RTE_BIT32(0)
 /**<
  * Flag to denote public key will be returned without leading zero bytes