[04/10] crypto/octeontx: fix global variable multiple definitions
Checks
Commit Message
'cpt_logtype' & 'otx_cryptodev_driver_id' global variables are defined
in a header file which was causing multiple definitions of the
variables, fixed it by moving them to the .c file.
Issue has been detected by '-fno-common' gcc flag.
Fixes: bfe2ae495ee2 ("crypto/octeontx: add PMD skeleton")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
drivers/common/cpt/cpt_pmd_logs.h | 2 +-
drivers/crypto/octeontx/otx_cryptodev.c | 2 ++
drivers/crypto/octeontx/otx_cryptodev.h | 2 +-
3 files changed, 4 insertions(+), 2 deletions(-)
Comments
Hi Ferruh,
This patch could be problematic as our new PMD(crypto_octeontx2) also makes use of some of these. I will propose a new patch with the required changes so that you wouldn't see the mentioned issue. Does that sound ok?
Thanks,
Anoob
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Thursday, September 5, 2019 8:23 PM
> To: Anoob Joseph <anoobj@marvell.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: [EXT] [PATCH 04/10] crypto/octeontx: fix global variable multiple
> definitions
>
> External Email
>
> ----------------------------------------------------------------------
> 'cpt_logtype' & 'otx_cryptodev_driver_id' global variables are defined in a
> header file which was causing multiple definitions of the variables, fixed it by
> moving them to the .c file.
>
> Issue has been detected by '-fno-common' gcc flag.
>
> Fixes: bfe2ae495ee2 ("crypto/octeontx: add PMD skeleton")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
> drivers/common/cpt/cpt_pmd_logs.h | 2 +-
> drivers/crypto/octeontx/otx_cryptodev.c | 2 ++
> drivers/crypto/octeontx/otx_cryptodev.h | 2 +-
> 3 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/common/cpt/cpt_pmd_logs.h
> b/drivers/common/cpt/cpt_pmd_logs.h
> index 4cbec4e36..2681d1286 100644
> --- a/drivers/common/cpt/cpt_pmd_logs.h
> +++ b/drivers/common/cpt/cpt_pmd_logs.h
> @@ -45,6 +45,6 @@
> * cpt_logtype will be used for common logging. This field would be initialized
> * by otx_* driver routines during PCI probe.
> */
> -int cpt_logtype;
> +extern int cpt_logtype;
>
> #endif /* _CPT_PMD_LOGS_H_ */
> diff --git a/drivers/crypto/octeontx/otx_cryptodev.c
> b/drivers/crypto/octeontx/otx_cryptodev.c
> index fc64a5f30..604dc2cdb 100644
> --- a/drivers/crypto/octeontx/otx_cryptodev.c
> +++ b/drivers/crypto/octeontx/otx_cryptodev.c
> @@ -16,6 +16,8 @@
> #include "otx_cryptodev_ops.h"
>
> static int otx_cryptodev_logtype;
> +int cpt_logtype;
> +uint8_t otx_cryptodev_driver_id;
>
> static struct rte_pci_id pci_id_cpt_table[] = {
> {
> diff --git a/drivers/crypto/octeontx/otx_cryptodev.h
> b/drivers/crypto/octeontx/otx_cryptodev.h
> index 6c2871d71..0b204320a 100644
> --- a/drivers/crypto/octeontx/otx_cryptodev.h
> +++ b/drivers/crypto/octeontx/otx_cryptodev.h
> @@ -15,6 +15,6 @@
> /*
> * Crypto device driver ID
> */
> -uint8_t otx_cryptodev_driver_id;
> +extern uint8_t otx_cryptodev_driver_id;
>
> #endif /* _OTX_CRYPTODEV_H_ */
> --
> 2.21.0
On 9/26/2019 12:20 PM, Anoob Joseph wrote:
> Hi Ferruh,
>
> This patch could be problematic as our new PMD(crypto_octeontx2) also makes use of some of these. I will propose a new patch with the required changes so that you wouldn't see the mentioned issue. Does that sound ok?
Sure, no problem.
>
> Thanks,
> Anoob
>
>> -----Original Message-----
>> From: Ferruh Yigit <ferruh.yigit@intel.com>
>> Sent: Thursday, September 5, 2019 8:23 PM
>> To: Anoob Joseph <anoobj@marvell.com>
>> Cc: dev@dpdk.org; stable@dpdk.org
>> Subject: [EXT] [PATCH 04/10] crypto/octeontx: fix global variable multiple
>> definitions
>>
>> External Email
>>
>> ----------------------------------------------------------------------
>> 'cpt_logtype' & 'otx_cryptodev_driver_id' global variables are defined in a
>> header file which was causing multiple definitions of the variables, fixed it by
>> moving them to the .c file.
>>
>> Issue has been detected by '-fno-common' gcc flag.
>>
>> Fixes: bfe2ae495ee2 ("crypto/octeontx: add PMD skeleton")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
>> ---
>> drivers/common/cpt/cpt_pmd_logs.h | 2 +-
>> drivers/crypto/octeontx/otx_cryptodev.c | 2 ++
>> drivers/crypto/octeontx/otx_cryptodev.h | 2 +-
>> 3 files changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/common/cpt/cpt_pmd_logs.h
>> b/drivers/common/cpt/cpt_pmd_logs.h
>> index 4cbec4e36..2681d1286 100644
>> --- a/drivers/common/cpt/cpt_pmd_logs.h
>> +++ b/drivers/common/cpt/cpt_pmd_logs.h
>> @@ -45,6 +45,6 @@
>> * cpt_logtype will be used for common logging. This field would be initialized
>> * by otx_* driver routines during PCI probe.
>> */
>> -int cpt_logtype;
>> +extern int cpt_logtype;
>>
>> #endif /* _CPT_PMD_LOGS_H_ */
>> diff --git a/drivers/crypto/octeontx/otx_cryptodev.c
>> b/drivers/crypto/octeontx/otx_cryptodev.c
>> index fc64a5f30..604dc2cdb 100644
>> --- a/drivers/crypto/octeontx/otx_cryptodev.c
>> +++ b/drivers/crypto/octeontx/otx_cryptodev.c
>> @@ -16,6 +16,8 @@
>> #include "otx_cryptodev_ops.h"
>>
>> static int otx_cryptodev_logtype;
>> +int cpt_logtype;
>> +uint8_t otx_cryptodev_driver_id;
>>
>> static struct rte_pci_id pci_id_cpt_table[] = {
>> {
>> diff --git a/drivers/crypto/octeontx/otx_cryptodev.h
>> b/drivers/crypto/octeontx/otx_cryptodev.h
>> index 6c2871d71..0b204320a 100644
>> --- a/drivers/crypto/octeontx/otx_cryptodev.h
>> +++ b/drivers/crypto/octeontx/otx_cryptodev.h
>> @@ -15,6 +15,6 @@
>> /*
>> * Crypto device driver ID
>> */
>> -uint8_t otx_cryptodev_driver_id;
>> +extern uint8_t otx_cryptodev_driver_id;
>>
>> #endif /* _OTX_CRYPTODEV_H_ */
>> --
>> 2.21.0
>
@@ -45,6 +45,6 @@
* cpt_logtype will be used for common logging. This field would be initialized
* by otx_* driver routines during PCI probe.
*/
-int cpt_logtype;
+extern int cpt_logtype;
#endif /* _CPT_PMD_LOGS_H_ */
@@ -16,6 +16,8 @@
#include "otx_cryptodev_ops.h"
static int otx_cryptodev_logtype;
+int cpt_logtype;
+uint8_t otx_cryptodev_driver_id;
static struct rte_pci_id pci_id_cpt_table[] = {
{
@@ -15,6 +15,6 @@
/*
* Crypto device driver ID
*/
-uint8_t otx_cryptodev_driver_id;
+extern uint8_t otx_cryptodev_driver_id;
#endif /* _OTX_CRYPTODEV_H_ */