drivers: fix gcc 10 errors due to logtype var in header
PATCH 1/1 drivers: fix gcc 10 errors due to logtype var in header
The zlib compression driver, as well as the aesni-gcm, aesni-mb and openssl crypto drivers all defined the logtype variable in the header file directly. This gives errors with gcc 10, due to -fno-common being the default, so we need to apply the same fix in all cases:
* move the variable definition to a suitable .c file
* mark the forward declaration of the variable in the header as "extern"
--- drivers/compress/zlib/zlib_pmd.c | 2 ++ drivers/compress/zlib/zlib_pmd_private.h | 2 +- drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 2 ++ drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h | 2 +- drivers/crypto/aesni_mb/aesni_mb_pmd_private.h | 2 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 2 ++ drivers/crypto/openssl/openssl_pmd_private.h | 2 +- drivers/crypto/openssl/rte_openssl_pmd.c | 1 + 8 files changed, 11 insertions(+), 4 deletions(-)
drivers/compress/zlib/zlib_pmd.c +2 -0
@@ -7,6 +7,8 @@#include "zlib_pmd_private.h" +int zlib_logtype_driver; +/** Compute next mbuf in the list, assign data buffer and length, * returns 0 if mbuf is NULL */
drivers/compress/zlib/zlib_pmd_private.h +1 -1
@@ -14,7 +14,7 @@#define DEF_MEM_LEVEL 8 -int zlib_logtype_driver; +extern int zlib_logtype_driver; #define ZLIB_PMD_LOG(level, fmt, args...) \ rte_log(RTE_LOG_ ## level, zlib_logtype_driver, "%s(): "fmt "\n", \ __func__, ##args)
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c +2 -0
@@ -13,6 +13,8 @@#include "aesni_gcm_pmd_private.h" +int aesni_gcm_logtype_driver; +static uint8_t cryptodev_driver_id;/* setup session handlers */
drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h +1 -1
@@ -20,7 +20,7 @@/**< AES-NI GCM PMD device name */ /** AES-NI GCM PMD LOGTYPE DRIVER */ -int aesni_gcm_logtype_driver; +extern int aesni_gcm_logtype_driver;#define AESNI_GCM_LOG (level, fmt, ...) \ rte_log(RTE_LOG_ ## level, aesni_gcm_logtype_driver, \ "%s() line %u: "fmt "\n", __func__, __LINE__, \
drivers/crypto/aesni_mb/aesni_mb_pmd_private.h +1 -1
@@ -19,7 +19,7 @@ enum aesni_mb_vector_mode {/**< AES-NI Multi buffer PMD device name */ /** AESNI_MB PMD LOGTYPE DRIVER */ -int aesni_mb_logtype_driver; +extern int aesni_mb_logtype_driver;#define AESNI_MB_LOG (level, fmt, ...) \ rte_log(RTE_LOG_ ## level, aesni_mb_logtype_driver, \
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +2 -0
@@ -14,6 +14,8 @@#include "aesni_mb_pmd_private.h" +int aesni_mb_logtype_driver; +#define AES_CCM_DIGEST_MIN_LEN 4#define AES_CCM_DIGEST_MAX_LEN 16#define HMAC_MAX_BLOCK_SIZE 128
drivers/crypto/openssl/openssl_pmd_private.h +1 -1
@@ -16,7 +16,7 @@/**< Open SSL Crypto PMD device name */ /** OPENSSL PMD LOGTYPE DRIVER */ -int openssl_logtype_driver; +extern int openssl_logtype_driver;#define OPENSSL_LOG (level, fmt, ...) \ rte_log(RTE_LOG_ ## level, openssl_logtype_driver, \ "%s() line %u: " fmt "\n", __func__, __LINE__, \
drivers/crypto/openssl/rte_openssl_pmd.c +1 -0
@@ -18,6 +18,7 @@#define DES_BLOCK_SIZE 8 +int openssl_logtype_driver;static uint8_t cryptodev_driver_id;#if (OPENSSL_VERSION_NUMBER <0x10100000L )
Signature · 1 line
2.20.1
PATCH 1/1 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.
--- 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(-)
drivers/crypto/kasumi/kasumi_pmd_private.h +1 -1
@@ -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, \
drivers/crypto/kasumi/rte_kasumi_pmd.c +1 -0
@@ -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. */
drivers/crypto/mvsam/mrvl_pmd_private.h +1 -1
@@ -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, \
drivers/crypto/mvsam/rte_mrvl_pmd.c +1 -0
@@ -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 {
drivers/crypto/snow3g/rte_snow3g_pmd.c +1 -0
@@ -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. */
drivers/crypto/snow3g/snow3g_pmd_private.h +1 -1
@@ -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, \
drivers/crypto/zuc/rte_zuc_pmd.c +1 -0
@@ -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. */
drivers/crypto/zuc/zuc_pmd_private.h +2 -2
@@ -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__, \
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH] drivers/crypto: move logtype variables to source files
Quoted 33 lines
-----Original Message-----
From: Lukasz Wojciechowski <[email protected]>
Sent: Wednesday, April 15, 2020 7:22 AM
To: De Lara Guarch, Pablo <[email protected]>; Tomasz Duszynski <[email protected]>; Michael Shamis <[email protected]>; Liron Himi <[email protected]>; Pattan, Reshma <[email protected]>; Naga Suresh Somarowthu <[email protected]>; Agalya Babu RadhaKrishnan <[email protected]>; Mrozowicz, SlawomirX <[email protected]>; Doherty, Declan <[email protected]>
Cc: [email protected]; Richardson, Bruce <[email protected]>; [email protected]
Subject: [PATCH]drivers/crypto: move logtype variables to source filesThe 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")Fixes a05a450f42fd ("crypto/mvsam: add dynamic logging")Fixes f3af5f9d1325 ("crypto/zuc: add dynamic logging")Fixes a3277ad47feb ("cryptodev: remove crypto device driver name")
Quoted 1 line
Signed-off-by Lukasz Wojciechowski <[email protected]>
Akhil Goyal
AppliedRe: [dpdk-dev] [PATCH] drivers/crypto: move logtype variables to source files
Quoted 18 lines
Quoted 3 lines
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
Quoted 14 lines
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")Fixes a05a450f42fd ("crypto/mvsam: add dynamic logging")Fixes f3af5f9d1325 ("crypto/zuc: add dynamic logging")Fixes a3277ad47feb ("cryptodev: remove crypto device driver name")
Quoted 3 lines
Quoted 1 line
Signed-off-by Lukasz Wojciechowski <[email protected]>Acked-by Pablo de Lara <[email protected]>
Applied to dpdk-next-crypto
Thanks.
W dniu 10.04.2020 o 19:27, Bruce Richardson pisze:
Quoted 125 lines
The zlib compression driver, as well as the aesni-gcm, aesni-mb and openssl crypto drivers all defined the logtype variable in the header file directly. This gives errors with gcc 10, due to -fno-common being the default, so we need to apply the same fix in all cases:
* move the variable definition to a suitable .c file
* mark the forward declaration of the variable in the header as "extern"Fixes 0c4e4c16b004 ("compress/zlib: introduce zlib PMD")Fixes 90c8a2d02a31 ("crypto/aesni_gcm: add dynamic logging")Fixes 276624ae2ef6 ("crypto/aesni_mb: add dynamic logging")Fixes 094b2386f461 ("crypto/openssl: add dynamic logging")Signed-off-by Bruce Richardson <[email protected]>--- drivers/compress/zlib/zlib_pmd.c | 2 ++ drivers/compress/zlib/zlib_pmd_private.h | 2 +- drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 2 ++ drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h | 2 +- drivers/crypto/aesni_mb/aesni_mb_pmd_private.h | 2 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 2 ++ drivers/crypto/openssl/openssl_pmd_private.h | 2 +- drivers/crypto/openssl/rte_openssl_pmd.c | 1 + 8 files changed, 11 insertions(+), 4 deletions(-)drivers/compress/zlib/zlib_pmd.c +2
-0@@ -7,6 +7,8 @@#include "zlib_pmd_private.h" +int zlib_logtype_driver; +/** Compute next mbuf in the list, assign data buffer and length, * returns 0 if mbuf is NULL */ drivers/compress/zlib/zlib_pmd_private.h +1
-1@@ -14,7 +14,7 @@#define DEF_MEM_LEVEL 8 -int zlib_logtype_driver; +extern int zlib_logtype_driver; #define ZLIB_PMD_LOG(level, fmt, args...) \ rte_log(RTE_LOG_ ## level, zlib_logtype_driver, "%s(): "fmt "\n", \ __func__, ##args)drivers/crypto/aesni_gcm/aesni_gcm_pmd.c +2
-0@@ -13,6 +13,8 @@#include "aesni_gcm_pmd_private.h" +int aesni_gcm_logtype_driver; +static uint8_t cryptodev_driver_id;/* setup session handlers */ drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h +1
-1@@ -20,7 +20,7 @@/**< AES-NI GCM PMD device name */ /** AES-NI GCM PMD LOGTYPE DRIVER */ -int aesni_gcm_logtype_driver; +extern int aesni_gcm_logtype_driver;#define AESNI_GCM_LOG (level, fmt, ...) \ rte_log(RTE_LOG_ ## level, aesni_gcm_logtype_driver, \ "%s() line %u: "fmt "\n", __func__, __LINE__, \drivers/crypto/aesni_mb/aesni_mb_pmd_private.h +1
-1@@ -19,7 +19,7 @@ enum aesni_mb_vector_mode {/**< AES-NI Multi buffer PMD device name */ /** AESNI_MB PMD LOGTYPE DRIVER */ -int aesni_mb_logtype_driver; +extern int aesni_mb_logtype_driver;#define AESNI_MB_LOG (level, fmt, ...) \ rte_log(RTE_LOG_ ## level, aesni_mb_logtype_driver, \drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +2
-0@@ -14,6 +14,8 @@#include "aesni_mb_pmd_private.h" +int aesni_mb_logtype_driver; +#define AES_CCM_DIGEST_MIN_LEN 4#define AES_CCM_DIGEST_MAX_LEN 16#define HMAC_MAX_BLOCK_SIZE 128drivers/crypto/openssl/openssl_pmd_private.h +1
-1@@ -16,7 +16,7 @@/**< Open SSL Crypto PMD device name */ /** OPENSSL PMD LOGTYPE DRIVER */ -int openssl_logtype_driver; +extern int openssl_logtype_driver;#define OPENSSL_LOG (level, fmt, ...) \ rte_log(RTE_LOG_ ## level, openssl_logtype_driver, \ "%s() line %u: " fmt "\n", __func__, __LINE__, \drivers/crypto/openssl/rte_openssl_pmd.c +0
-0
drivers/crypto/openssl/rte_openssl_pmd.c line 24
Quoted 7 lines
drivers/crypto/openssl/rte_openssl_pmd.c +1
-0@@ -18,6 +18,7 @@#define DES_BLOCK_SIZE 8 +int openssl_logtype_driver;static uint8_t cryptodev_driver_id;#if (OPENSSL_VERSION_NUMBER <0x10100000L )
Patch looks good. I added myself one more as a follow up, that fixes 4 more drivers. It's up to you if you want to squash them together.
Signature · 7 lines
Lukasz Wojciechowski Principal Software Engineer Samsung R&D Institute Poland Samsung Electronics Office +48 22 377 88 25 [email protected]
Quoted 130 lines · Lukasz Wojciechowski
W dniu 10.04.2020 o 19:27, Bruce Richardson pisze:
Quoted 128 lines
The zlib compression driver, as well as the aesni-gcm, aesni-mb and openssl crypto drivers all defined the logtype variable in the header file directly. This gives errors with gcc 10, due to -fno-common being the default, so we need to apply the same fix in all cases:
* move the variable definition to a suitable .c file
* mark the forward declaration of the variable in the header as "extern"Fixes 0c4e4c16b004 ("compress/zlib: introduce zlib PMD")Fixes 90c8a2d02a31 ("crypto/aesni_gcm: add dynamic logging")Fixes 276624ae2ef6 ("crypto/aesni_mb: add dynamic logging")Fixes 094b2386f461 ("crypto/openssl: add dynamic logging")Signed-off-by Bruce Richardson <[email protected]>--- drivers/compress/zlib/zlib_pmd.c | 2 ++ drivers/compress/zlib/zlib_pmd_private.h | 2 +- drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 2 ++ drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h | 2 +- drivers/crypto/aesni_mb/aesni_mb_pmd_private.h | 2 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 2 ++ drivers/crypto/openssl/openssl_pmd_private.h | 2 +- drivers/crypto/openssl/rte_openssl_pmd.c | 1 + 8 files changed, 11 insertions(+), 4 deletions(-)drivers/compress/zlib/zlib_pmd.c +2
-0@@ -7,6 +7,8 @@#include "zlib_pmd_private.h" +int zlib_logtype_driver; +/** Compute next mbuf in the list, assign data buffer and length, * returns 0 if mbuf is NULL */ drivers/compress/zlib/zlib_pmd_private.h +1
-1@@ -14,7 +14,7 @@#define DEF_MEM_LEVEL 8 -int zlib_logtype_driver; +extern int zlib_logtype_driver; #define ZLIB_PMD_LOG(level, fmt, args...) \ rte_log(RTE_LOG_ ## level, zlib_logtype_driver, "%s(): "fmt "\n", \ __func__, ##args)drivers/crypto/aesni_gcm/aesni_gcm_pmd.c +2
-0@@ -13,6 +13,8 @@#include "aesni_gcm_pmd_private.h" +int aesni_gcm_logtype_driver; +static uint8_t cryptodev_driver_id;/* setup session handlers */ drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h +1
-1@@ -20,7 +20,7 @@/**< AES-NI GCM PMD device name */ /** AES-NI GCM PMD LOGTYPE DRIVER */ -int aesni_gcm_logtype_driver; +extern int aesni_gcm_logtype_driver;#define AESNI_GCM_LOG (level, fmt, ...) \ rte_log(RTE_LOG_ ## level, aesni_gcm_logtype_driver, \ "%s() line %u: "fmt "\n", __func__, __LINE__, \drivers/crypto/aesni_mb/aesni_mb_pmd_private.h +1
-1@@ -19,7 +19,7 @@ enum aesni_mb_vector_mode {/**< AES-NI Multi buffer PMD device name */ /** AESNI_MB PMD LOGTYPE DRIVER */ -int aesni_mb_logtype_driver; +extern int aesni_mb_logtype_driver;#define AESNI_MB_LOG (level, fmt, ...) \ rte_log(RTE_LOG_ ## level, aesni_mb_logtype_driver, \drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +2
-0@@ -14,6 +14,8 @@#include "aesni_mb_pmd_private.h" +int aesni_mb_logtype_driver; +#define AES_CCM_DIGEST_MIN_LEN 4#define AES_CCM_DIGEST_MAX_LEN 16#define HMAC_MAX_BLOCK_SIZE 128drivers/crypto/openssl/openssl_pmd_private.h +1
-1@@ -16,7 +16,7 @@/**< Open SSL Crypto PMD device name */ /** OPENSSL PMD LOGTYPE DRIVER */ -int openssl_logtype_driver; +extern int openssl_logtype_driver;#define OPENSSL_LOG (level, fmt, ...) \ rte_log(RTE_LOG_ ## level, openssl_logtype_driver, \ "%s() line %u: " fmt "\n", __func__, __LINE__, \drivers/crypto/openssl/rte_openssl_pmd.c +0
-0@@ -18,6 +18,7 @@#define DES_BLOCK_SIZE 8
Quoted 8 lines
drivers/crypto/openssl/rte_openssl_pmd.c line 24
Quoted 4 lines
drivers/crypto/openssl/rte_openssl_pmd.c +1
-0+int openssl_logtype_driver;static uint8_t cryptodev_driver_id;#if (OPENSSL_VERSION_NUMBER <0x10100000L )Patch looks good. I added myself one more as a follow up, that fixes 4 more drivers. It's up to you if you want to squash them together.
Thanks Lukasz, I missed those on my system as my IPSec library version was too old to have them compile.
Quoted 13 lines
Signature · 7 lines
Lukasz Wojciechowski Principal Software Engineer Samsung R&D Institute Poland Samsung Electronics Office +48 22 377 88 25 [email protected]
Akhil Goyal
AppliedQuoted 4 lines
Quoted 4 lines
--
Applied to dpdk-next-crypto
Thanks.