drivers/crypto: move logtype variables to source files

Message ID 20200415062216.22220-1-l.wojciechow@partner.samsung.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series drivers/crypto: move logtype variables to source files |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/travis-robot warning Travis build: failed
ci/Intel-compilation success Compilation OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS

Commit Message

Lukasz Wojciechowski April 15, 2020, 6:22 a.m. UTC
  The four crypto drivers: kasumi, mvsam, snow3g and zuc define logtype
variables in their header file. As the header files are included
in more than one compilation unit, it might cause appearance
of multiple instances of the variable and a linker error.
Such situation can occur, when no common section is allowed
by the compiler settings and tentative definitions are placed
in BSS section.

Fixes: 2cba3814932e ("crypto/kasumi: add dynamic logging")
Cc: naga.sureshx.somarowthu@intel.com
Fixes: a05a450f42fd ("crypto/mvsam: add dynamic logging")
Cc: tdu@semihalf.com
Fixes: f3af5f9d1325 ("crypto/zuc: add dynamic logging")
Cc: agalyax.babu.radhakrishnan@intel.com
Fixes: a3277ad47feb ("cryptodev: remove crypto device driver name")
Cc: slawomirx.mrozowicz@intel.com
Cc: stable@dpdk.org

Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
---
 drivers/crypto/kasumi/kasumi_pmd_private.h | 2 +-
 drivers/crypto/kasumi/rte_kasumi_pmd.c     | 1 +
 drivers/crypto/mvsam/mrvl_pmd_private.h    | 2 +-
 drivers/crypto/mvsam/rte_mrvl_pmd.c        | 1 +
 drivers/crypto/snow3g/rte_snow3g_pmd.c     | 1 +
 drivers/crypto/snow3g/snow3g_pmd_private.h | 2 +-
 drivers/crypto/zuc/rte_zuc_pmd.c           | 1 +
 drivers/crypto/zuc/zuc_pmd_private.h       | 4 ++--
 8 files changed, 9 insertions(+), 5 deletions(-)
  

Comments

De Lara Guarch, Pablo April 17, 2020, 8:22 a.m. UTC | #1
> -----Original Message-----
> From: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
> Sent: Wednesday, April 15, 2020 7:22 AM
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Tomasz Duszynski
> <tdu@semihalf.com>; Michael Shamis <michaelsh@marvell.com>; Liron Himi
> <lironh@marvell.com>; Pattan, Reshma <reshma.pattan@intel.com>; Naga
> Suresh Somarowthu <naga.sureshx.somarowthu@intel.com>; Agalya Babu
> RadhaKrishnan <agalyax.babu.radhakrishnan@intel.com>; Mrozowicz,
> SlawomirX <slawomirx.mrozowicz@intel.com>; Doherty, Declan
> <declan.doherty@intel.com>
> Cc: dev@dpdk.org; Richardson, Bruce <bruce.richardson@intel.com>;
> stable@dpdk.org
> Subject: [PATCH] drivers/crypto: move logtype variables to source files
> 
> The four crypto drivers: kasumi, mvsam, snow3g and zuc define logtype
> variables in their header file. As the header files are included in more than one
> compilation unit, it might cause appearance of multiple instances of the variable
> and a linker error.
> Such situation can occur, when no common section is allowed by the compiler
> settings and tentative definitions are placed in BSS section.
> 
> Fixes: 2cba3814932e ("crypto/kasumi: add dynamic logging")
> Cc: naga.sureshx.somarowthu@intel.com
> Fixes: a05a450f42fd ("crypto/mvsam: add dynamic logging")
> Cc: tdu@semihalf.com
> Fixes: f3af5f9d1325 ("crypto/zuc: add dynamic logging")
> Cc: agalyax.babu.radhakrishnan@intel.com
> Fixes: a3277ad47feb ("cryptodev: remove crypto device driver name")
> Cc: slawomirx.mrozowicz@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>

Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
  
Akhil Goyal April 17, 2020, 9 p.m. UTC | #2
> > The four crypto drivers: kasumi, mvsam, snow3g and zuc define logtype
> > variables in their header file. As the header files are included in more than one
> > compilation unit, it might cause appearance of multiple instances of the
> variable
> > and a linker error.
> > Such situation can occur, when no common section is allowed by the compiler
> > settings and tentative definitions are placed in BSS section.
> >
> > Fixes: 2cba3814932e ("crypto/kasumi: add dynamic logging")
> > Cc: naga.sureshx.somarowthu@intel.com
> > Fixes: a05a450f42fd ("crypto/mvsam: add dynamic logging")
> > Cc: tdu@semihalf.com
> > Fixes: f3af5f9d1325 ("crypto/zuc: add dynamic logging")
> > Cc: agalyax.babu.radhakrishnan@intel.com
> > Fixes: a3277ad47feb ("cryptodev: remove crypto device driver name")
> > Cc: slawomirx.mrozowicz@intel.com
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
> 
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Applied to dpdk-next-crypto

Thanks.
  

Patch

diff --git a/drivers/crypto/kasumi/kasumi_pmd_private.h b/drivers/crypto/kasumi/kasumi_pmd_private.h
index 3b3a6958f..b7f1c428b 100644
--- a/drivers/crypto/kasumi/kasumi_pmd_private.h
+++ b/drivers/crypto/kasumi/kasumi_pmd_private.h
@@ -11,7 +11,7 @@ 
 /**< KASUMI PMD device name */
 
 /** KASUMI PMD LOGTYPE DRIVER */
-int kasumi_logtype_driver;
+extern int kasumi_logtype_driver;
 
 #define KASUMI_LOG(level, fmt, ...)  \
 	rte_log(RTE_LOG_ ## level, kasumi_logtype_driver,  \
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index baad5b4e7..d67264842 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -17,6 +17,7 @@ 
 #define KASUMI_MAX_BURST 4
 #define BYTE_LEN 8
 
+int kasumi_logtype_driver;
 static uint8_t cryptodev_driver_id;
 
 /** Get xform chain order. */
diff --git a/drivers/crypto/mvsam/mrvl_pmd_private.h b/drivers/crypto/mvsam/mrvl_pmd_private.h
index 09702b9e3..e575330ef 100644
--- a/drivers/crypto/mvsam/mrvl_pmd_private.h
+++ b/drivers/crypto/mvsam/mrvl_pmd_private.h
@@ -13,7 +13,7 @@ 
 /**< Marvell PMD device name */
 
 /** MRVL PMD LOGTYPE DRIVER */
-int mrvl_logtype_driver;
+extern int mrvl_logtype_driver;
 
 #define MRVL_LOG(level, fmt, ...) \
 	rte_log(RTE_LOG_ ## level, mrvl_logtype_driver, \
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd.c b/drivers/crypto/mvsam/rte_mrvl_pmd.c
index 3c0fe216f..63782ce97 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd.c
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd.c
@@ -19,6 +19,7 @@ 
 #define MRVL_PMD_MAX_NB_SESS_ARG		("max_nb_sessions")
 #define MRVL_PMD_DEFAULT_MAX_NB_SESSIONS	2048
 
+int mrvl_logtype_driver;
 static uint8_t cryptodev_driver_id;
 
 struct mrvl_pmd_init_params {
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index d72112b5f..8101eaaad 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -16,6 +16,7 @@ 
 #define SNOW3G_MAX_BURST 8
 #define BYTE_LEN 8
 
+int snow3g_logtype_driver;
 static uint8_t cryptodev_driver_id;
 
 /** Get xform chain order. */
diff --git a/drivers/crypto/snow3g/snow3g_pmd_private.h b/drivers/crypto/snow3g/snow3g_pmd_private.h
index 2074f3d17..23cf078a9 100644
--- a/drivers/crypto/snow3g/snow3g_pmd_private.h
+++ b/drivers/crypto/snow3g/snow3g_pmd_private.h
@@ -11,7 +11,7 @@ 
 /**< SNOW 3G PMD device name */
 
 /** SNOW 3G PMD LOGTYPE DRIVER */
-int snow3g_logtype_driver;
+extern int snow3g_logtype_driver;
 
 #define SNOW3G_LOG(level, fmt, ...)  \
 	rte_log(RTE_LOG_ ## level, snow3g_logtype_driver,  \
diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c
index 9e06ab7c9..f47a7880d 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd.c
+++ b/drivers/crypto/zuc/rte_zuc_pmd.c
@@ -14,6 +14,7 @@ 
 #define ZUC_MAX_BURST 16
 #define BYTE_LEN 8
 
+int zuc_logtype_driver;
 static uint8_t cryptodev_driver_id;
 
 /** Get xform chain order. */
diff --git a/drivers/crypto/zuc/zuc_pmd_private.h b/drivers/crypto/zuc/zuc_pmd_private.h
index 47a8b08dd..d8684891e 100644
--- a/drivers/crypto/zuc/zuc_pmd_private.h
+++ b/drivers/crypto/zuc/zuc_pmd_private.h
@@ -8,10 +8,10 @@ 
 #include <intel-ipsec-mb.h>
 
 #define CRYPTODEV_NAME_ZUC_PMD		crypto_zuc
-/**< KASUMI PMD device name */
+/**< ZUC PMD device name */
 
 /** ZUC PMD LOGTYPE DRIVER */
-int zuc_logtype_driver;
+extern int zuc_logtype_driver;
 #define ZUC_LOG(level, fmt, ...)  \
 	rte_log(RTE_LOG_ ## level, zuc_logtype_driver,  \
 			"%s()... line %u: " fmt "\n", __func__, __LINE__,  \