The question for the modification against (lib/cryptodev/rte_cryptodev.h) in commit 719834a6
Hi, experts,
My C++ program calls some functions defined in lib/cryptodev/rte_cryptodev.h. After upgrading dpdk from 23.11 to 24.11, my C++ program failed to be complied. It looks like that the cimmit 719834a6 caused my issue.
It seems that the commit 719834a6 intends to exclude all head files from the
#ifdef __cplusplus
extern "C" {
#endif
......
#ifdef __cplusplus
}
#endif
Unfortunately some function declarations are also excluded wrongly since these declarations are before the last head file. Below picture is an example. The function in the red circle can't be linked by C++ complier. Would you please help to check this issue?
Best regards!
Hu Zhigang
[cid:bbf5bf01-e72e-42b0-8b1a-fc627fbb1dc5]
PATCH 1/1 cryptodev: fix C++ include
Some cryptodev functions were not included in the extern "C" block, so it is moved to start before.
An include is also moved to avoid being part of this block.
--- .mailmap | 1 + lib/cryptodev/rte_cryptodev.h | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-)
.mailmap +1 -0
@@ -1794,6 +1794,7 @@ Zhenghua Zhou <[email protected]> Zhenning Xiao <[email protected]> Zhe Tao <[email protected]> Zhichao Zeng <[email protected]> +Zhigang Hu <[email protected]> Zhigang Lu <[email protected]> Zhiguang He <[email protected]> Zhihong Peng <[email protected]>
lib/cryptodev/rte_cryptodev.h +5 -5
@@ -21,6 +21,11 @@#include <rte_rcu_qsbr.h> #include "rte_cryptodev_trace_fp.h" +#include "rte_cryptodev_core.h" + +#ifdef __cplusplus +extern "C" { +#endif /** * @internal Logtype used for cryptodev related messages.
@@ -1928,11 +1933,6 @@ int rte_cryptodev_remove_deq_callback(uint8_t dev_id,uint16_t qp_id, struct rte_cryptodev_cb *cb); -#include <rte_cryptodev_core.h> - -#ifdef __cplusplus -extern "C" { -#endif /** * * Dequeue a burst of processed crypto operations from a queue on the crypto
Signature · 1 line
2.47.1
RE: [EXTERNAL] [PATCH] cryptodev: fix C++ include
Quoted 32 lines
Some cryptodev functions were not included in the extern "C" block, so it is moved to start before.
An include is also moved to avoid being part of this block.
Fixes 719834a6849e ("use C linkage where appropriate in headers")Reported-by Zhigang Hu <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>--- .mailmap | 1 + lib/cryptodev/rte_cryptodev.h | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-).mailmap +1
-0@@ -1794,6 +1794,7 @@ Zhenghua Zhou <[email protected]> Zhenning Xiao <[email protected]> Zhe Tao <[email protected]> Zhichao Zeng <[email protected]> +Zhigang Hu <[email protected]> Zhigang Lu <[email protected]> Zhiguang He <[email protected]> Zhihong Peng <[email protected]>lib/cryptodev/rte_cryptodev.h +0
-0
lib/cryptodev/rte_cryptodev.h line 24
Quoted 4 lines
lib/cryptodev/rte_cryptodev.h +1
-0@@ -21,6 +21,11 @@#include <rte_rcu_qsbr.h> #include "rte_cryptodev_trace_fp.h" +#include "rte_cryptodev_core.h"
Fix is ok but rte_cryptodev_core.h should not be moved up. It is added in the middle to segregate the fast path APIs. And it is an internal header which cannot be included by app directly. I think the same schema is followed in ethdev as well.
Quoted 22 lines
lib/cryptodev/rte_cryptodev.h +4
-5+ +#ifdef __cplusplus +extern "C" { +#endif /** * @internal Logtype used for cryptodev related messages. @@ -1928,11 +1933,6 @@ int rte_cryptodev_remove_deq_callback(uint8_t dev_id, uint16_t qp_id, struct rte_cryptodev_cb *cb); -#include <rte_cryptodev_core.h> - -#ifdef __cplusplus -extern "C" { -#endif /** * * Dequeue a burst of processed crypto operations from a queue on the crypto
--
2.47.1
Re: [EXTERNAL] [PATCH] cryptodev: fix C++ include
19/12/2024 13:24, Akhil Goyal:
Quoted 4 lines
Quoted 4 lines
Some cryptodev functions were not included in the extern "C" block, so it is moved to start before.
An include is also moved to avoid being part of this block.
[...]
Quoted 5 lines
Quoted 5 lines
lib/cryptodev/rte_cryptodev.h +0
-0@@ -21,6 +21,11 @@#include <rte_rcu_qsbr.h>
Quoted 7 lines
lib/cryptodev/rte_cryptodev.h line 24
Quoted 2 lines
lib/cryptodev/rte_cryptodev.h +1
-0#include "rte_cryptodev_trace_fp.h" +#include "rte_cryptodev_core.h" Fix is ok but
rte_cryptodev_core.hshould not be moved up. It is added in the middle to segregate the fast path APIs. And it is an internal header which cannot be included by app directly. I think the same schema is followed in ethdev as well.
Indeed, this is how it's done in ethdev:
#ifdef __cplusplus
}
#endif
#include <rte_ethdev_core.h>
#ifdef __cplusplus
extern "C" {
#endif
I'll do the same in v2.
19/12/2024 11:41, Hu, Zhigang:
Quoted 3 lines
Hi, experts,
My C++ program calls some functions defined in
lib/cryptodev/rte_cryptodev.h. After upgrading dpdk from 23.11 to 24.11, my C++ program failed to be complied. It looks like that the cimmit719834a6caused my issue.
Yes, you're right.
Thanks for reporting.
Please could you try this fix?
https://patches.dpdk.org/project/dpdk/patch/[email protected]/
Hi Thomas,
Thank you for your quick response.
Your v1 patch works fine in my test. We are looking forward to your v2 patch.
Best Regards,
Zhigang
________________________________
From: Thomas Monjalon <[email protected]>
Sent: Thursday, December 19, 2024 7:48 PM
To: Hu, Zhigang <[email protected]>
Cc: [email protected] <[email protected]>; Dong, Yao <[email protected]>; Richardson, Bruce <[email protected]>; [email protected] <[email protected]>
Subject: Re: The question for the modification against (lib/cryptodev/rte_cryptodev.h) in commit 719834a6
19/12/2024 11:41, Hu, Zhigang:
Quoted 3 lines
Hi, experts,
My C++ program calls some functions defined in
lib/cryptodev/rte_cryptodev.h. After upgrading dpdk from 23.11 to 24.11, my C++ program failed to be complied. It looks like that the cimmit719834a6caused my issue.
Yes, you're right.
Thanks for reporting.
Please could you try this fix?
https://patches.dpdk.org/project/dpdk/patch/[email protected]/
Hi Thomas,
Sorry for my mistake. I see the v2 patch.
Best regards,
Hu Zhigang
________________________________
From: Hu, Zhigang <[email protected]>
Sent: Friday, December 20, 2024 10:17 AM
To: Thomas Monjalon <[email protected]>
Cc: [email protected] <[email protected]>; Dong, Yao <[email protected]>; Richardson, Bruce <[email protected]>; [email protected] <[email protected]>; Liu1, Kai <[email protected]>; Chautru, Nicolas <[email protected]>
Subject: Re: The question for the modification against (lib/cryptodev/rte_cryptodev.h) in commit 719834a6
Hi Thomas,
Thank you for your quick response.
Your v1 patch works fine in my test. We are looking forward to your v2 patch.
Best Regards,
Zhigang
________________________________
From: Thomas Monjalon <[email protected]>
Sent: Thursday, December 19, 2024 7:48 PM
To: Hu, Zhigang <[email protected]>
Cc: [email protected] <[email protected]>; Dong, Yao <[email protected]>; Richardson, Bruce <[email protected]>; [email protected] <[email protected]>
Subject: Re: The question for the modification against (lib/cryptodev/rte_cryptodev.h) in commit 719834a6
19/12/2024 11:41, Hu, Zhigang:
Quoted 3 lines
Hi, experts,
My C++ program calls some functions defined in
lib/cryptodev/rte_cryptodev.h. After upgrading dpdk from 23.11 to 24.11, my C++ program failed to be complied. It looks like that the cimmit719834a6caused my issue.
Yes, you're right.
Thanks for reporting.
Please could you try this fix?
https://patches.dpdk.org/project/dpdk/patch/[email protected]/
PATCH v2 1/1 cryptodev: fix C++ include
In reply to Hu, ZhigangSome cryptodev functions were not included in an extern "C" block.
There are 2 blocks, the second one being fast path inline functions, preceded with an include of the required rte_cryptodev_core.h file.
---
v2: keep rte_cryptodev_core.h include at the same place
--- .mailmap | 1 + lib/cryptodev/rte_cryptodev.h | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-)
.mailmap +1 -0
@@ -1794,6 +1794,7 @@ Zhenghua Zhou <[email protected]> Zhenning Xiao <[email protected]> Zhe Tao <[email protected]> Zhichao Zeng <[email protected]> +Zhigang Hu <[email protected]> Zhigang Lu <[email protected]> Zhiguang He <[email protected]> Zhihong Peng <[email protected]>
lib/cryptodev/rte_cryptodev.h +10 -2
@@ -22,6 +22,10 @@#include "rte_cryptodev_trace_fp.h" +#ifdef __cplusplus +extern "C" { +#endif +/** * @internal Logtype used for cryptodev related messages. */
@@ -1928,11 +1932,16 @@ int rte_cryptodev_remove_deq_callback(uint8_t dev_id,uint16_t qp_id, struct rte_cryptodev_cb *cb); -#include <rte_cryptodev_core.h> +#ifdef __cplusplus +} +#endif + +#include "rte_cryptodev_core.h" #ifdef __cplusplusextern "C" {#endif +/** * * Dequeue a burst of processed crypto operations from a queue on the crypto
@@ -2125,7 +2134,6 @@ rte_cryptodev_qp_depth_used(uint8_t dev_id, uint16_t qp_id)return rc; } - #ifdef __cplusplus }#endif
Signature · 1 line
2.47.1
Re: [PATCH v2] cryptodev: fix C++ include
Quoted 11 lines · Thomas Monjalon
Some cryptodev functions were not included in an extern "C" block.
There are 2 blocks, the second one being fast path inline functions, preceded with an include of the required
rte_cryptodev_core.hfile.Fixes 719834a6849e ("use C linkage where appropriate in headers")Reported-by Zhigang Hu <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>
I wonder if there is also an issue with lib/cryptodev/rte_crypto_asym.h, for symbols rte_crypto_asym_ke_strings and rte_crypto_asym_op_strings. But at least this patch looks fine to me.
Signature · 1 line
David Marchand
Re: [PATCH v2] cryptodev: fix C++ include
Quoted 10 lines · David Marchand
Quoted 9 lines · Thomas Monjalon
Some cryptodev functions were not included in an extern "C" block.
There are 2 blocks, the second one being fast path inline functions, preceded with an include of the required
rte_cryptodev_core.hfile.Fixes 719834a6849e ("use C linkage where appropriate in headers")
Quoted 6 lines
Quoted 2 lines
Reported-by Zhigang Hu <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>I wonder if there is also an issue with
lib/cryptodev/rte_crypto_asym.h, for symbolsrte_crypto_asym_ke_stringsandrte_crypto_asym_op_strings.
+1
Quoted 5 lines
But at least this patch looks fine to me.
Reviewed-by David Marchand <[email protected]>
Re: [PATCH v2] cryptodev: fix C++ include
In reply to Thomas MonjalonQuoted 63 lines · Thomas Monjalon
Some cryptodev functions were not included in an extern "C" block.
There are 2 blocks, the second one being fast path inline functions, preceded with an include of the required
rte_cryptodev_core.hfile.Fixes 719834a6849e ("use C linkage where appropriate in headers")Reported-by Zhigang Hu <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>---
v2: keeprte_cryptodev_core.hinclude at the same place--- .mailmap | 1 + lib/cryptodev/rte_cryptodev.h | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-).mailmap +1
-0@@ -1794,6 +1794,7 @@ Zhenghua Zhou <[email protected]> Zhenning Xiao <[email protected]> Zhe Tao <[email protected]> Zhichao Zeng <[email protected]> +Zhigang Hu <[email protected]> Zhigang Lu <[email protected]> Zhiguang He <[email protected]> Zhihong Peng <[email protected]>lib/cryptodev/rte_cryptodev.h +10
-1@@ -22,6 +22,10 @@#include "rte_cryptodev_trace_fp.h" +#ifdef __cplusplus +extern "C" { +#endif +/** * @internal Logtype used for cryptodev related messages. */ @@ -1928,11 +1932,16 @@ int rte_cryptodev_remove_deq_callback(uint8_t dev_id,uint16_t qp_id, struct rte_cryptodev_cb *cb); -#include <rte_cryptodev_core.h> +#ifdef __cplusplus +} +#endif + +#include "rte_cryptodev_core.h" #ifdef __cplusplusextern "C" {#endif +/** * * Dequeue a burst of processed crypto operations from a queue on the crypto
lib/cryptodev/rte_cryptodev.h rte_cryptodev_qp_depth_used(uint8_t dev_id, uint16_t qp_id) · line 2139
Quoted 7 lines
lib/cryptodev/rte_cryptodev.h +0
-1@@ -2125,7 +2134,6 @@ rte_cryptodev_qp_depth_used(uint8_t dev_id, uint16_t qp_id)return rc; } - #ifdef __cplusplus }#endif
Akhil Goyal
AppliedRE: [EXTERNAL] Re: [PATCH v2] cryptodev: fix C++ include
Quoted 9 lines · Thomas Monjalon
Quoted 8 lines
Some cryptodev functions were not included in an extern "C" block.
There are 2 blocks, the second one being fast path inline functions, preceded with an include of the required
rte_cryptodev_core.hfile.Fixes 719834a6849e ("use C linkage where appropriate in headers")
Quoted 6 lines
Quoted 4 lines
Reported-by Zhigang Hu <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>---
v2: keeprte_cryptodev_core.hinclude at the same placeReviewed-by Mattias Rönnblom <[email protected]>
Applied to dpdk-next-crypto
Thanks.