Skip to contentSkip to conversation

Compile fixes in SUSE11 SP3 i686 platform

PATCH Superseded Michael Qiu 4 participants 8 messages Mar 25, 2016 – Mar 31, 2016 Crypto API

lore
Share & tools
lore
#0 lore raw

cover Compile fixes in SUSE11 SP3 i686 platform

In SUSE11 SP3 i686 platform with gcc version 4.5.1, there is some compile issues. This patch set is try to fix them.

Michael Qiu (2):
lib/librte_lpm: Fix anonymous union initialization issue drivers/crypto: Fix anonymous union initialization in crypto

 drivers/crypto/null/null_crypto_pmd_ops.c | 16 ++++++++--------
 lib/librte_lpm/rte_lpm.c                  | 14 +++++++-------
 2 files changed, 15 insertions(+), 15 deletions(-)
Signature · 1 line
1.9.3
#4 lore raw

PATCH 2/2 drivers/crypto: Fix anonymous union initialization in crypto

In SUSE11-SP3 i686 platform, with gcc 4.5.1, there is a compile issue:
null_crypto_pmd_ops.c:44:3: error:
unknown field ‘sym’ specified in initializer
cc1: warnings being treated as errors

The member in anonymous union initialization should be inside '{}', otherwise it will report an error.

Fixes 26c2e4ad5ad4 ("cryptodev: add capabilities discovery")
---
 drivers/crypto/null/null_crypto_pmd_ops.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/crypto/null/null_crypto_pmd_ops.c +8 -8
index 39f8088..b7470c0 100644
@@ -41,9 +41,9 @@
 static const struct rte_cryptodev_capabilities null_crypto_pmd_capabilities[] = {
 	{	/* NULL (AUTH) */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
-		.sym = {
+		{.sym = {
 			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
-			.auth = {
+			{.auth = {
 				.algo = RTE_CRYPTO_AUTH_NULL,
 				.block_size = 1,
 				.key_size = {
@@ -57,14 +57,14 @@ static const struct rte_cryptodev_capabilities null_crypto_pmd_capabilities[] =
 					.increment = 0
 				},
 				.aad_size = { 0 }
-			}
-		}
+			}, },
+		}, },
 	},
 	{	/* NULL (CIPHER) */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
-		.sym = {
+		{.sym = {
 			.xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
-			.cipher = {
+			{.cipher = {
 				.algo = RTE_CRYPTO_CIPHER_NULL,
 				.block_size = 1,
 				.key_size = {
@@ -77,8 +77,8 @@ static const struct rte_cryptodev_capabilities null_crypto_pmd_capabilities[] =
 					.max = 0,
 					.increment = 0
 				}
-			}
-		}
+			}, },
+		}, },
 	},
 	RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
 };
Signature · 1 line
1.9.3
#1 lore raw

PATCH 1/2 lib/librte_lpm: Fix anonymous union initialization issue

In reply to Michael Qiu

In SUSE11-SP3 i686 platform, with gcc 4.5.1, there is a compile issue:
rte_lpm.c: In function ‘add_depth_small_v20’:
rte_lpm.c:778:7: error: unknown field ‘next_hop’
specified in initializer
cc1: warnings being treated as errors
The root casue is gcc only allow anonymous union initialized according to the field it is defined. But next_hop is defined in different field when in different platform(Endian).

One solution is add if define in the code to avoid this issue, but there is a simple way, initialize it separately later.

Fixes afc5c914a083 ("lpm: fix big endian support")
---
 lib/librte_lpm/rte_lpm.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
lib/librte_lpm/rte_lpm.c +7 -7
index af5811c..efd507e 100644
@@ -744,11 +744,11 @@ add_depth_small_v20(struct rte_lpm_v20 *lpm, uint32_t ip, uint8_t depth,
 				lpm->tbl24[i].depth <= depth)) {
 
 			struct rte_lpm_tbl_entry_v20 new_tbl24_entry = {
-				{ .next_hop = next_hop, },
 				.valid = VALID,
 				.valid_group = 0,
 				.depth = depth,
 			};
+			new_tbl24_entry.next_hop = next_hop;
 
 			/* Setting tbl24 entry in one go to avoid race
 			 * conditions
@@ -775,8 +775,8 @@ add_depth_small_v20(struct rte_lpm_v20 *lpm, uint32_t ip, uint8_t depth,
 						.valid = VALID,
 						.valid_group = VALID,
 						.depth = depth,
-						.next_hop = next_hop,
 					};
+					new_tbl8_entry.next_hop=next_hop;
 
 					/*
 					 * Setting tbl8 entry in one go to avoid
@@ -975,10 +975,9 @@ add_depth_big_v20(struct rte_lpm_v20 *lpm, uint32_t ip_masked, uint8_t depth,
 				struct rte_lpm_tbl_entry_v20 new_tbl8_entry = {
 					.valid = VALID,
 					.depth = depth,
-					.next_hop = next_hop,
 					.valid_group = lpm->tbl8[i].valid_group,
 				};
-
+				new_tbl8_entry.next_hop = next_hop;
 				/*
 				 * Setting tbl8 entry in one go to avoid race
 				 * condition
@@ -1375,9 +1374,9 @@ delete_depth_small_v20(struct rte_lpm_v20 *lpm, uint32_t ip_masked,
 			.valid = VALID,
 			.valid_group = VALID,
 			.depth = sub_rule_depth,
-			.next_hop = lpm->rules_tbl
-			[sub_rule_index].next_hop,
 		};
+		new_tbl8_entry.next_hop =
+				lpm->rules_tbl[sub_rule_index].next_hop;
 
 		for (i = tbl24_index; i < (tbl24_index + tbl24_range); i++) {
 
@@ -1639,9 +1638,10 @@ delete_depth_big_v20(struct rte_lpm_v20 *lpm, uint32_t ip_masked,
 			.valid = VALID,
 			.depth = sub_rule_depth,
 			.valid_group = lpm->tbl8[tbl8_group_start].valid_group,
-			.next_hop = lpm->rules_tbl[sub_rule_index].next_hop,
 		};
 
+		new_tbl8_entry.next_hop =
+				lpm->rules_tbl[sub_rule_index].next_hop;
 		/*
 		 * Loop through the range of entries on tbl8 for which the
 		 * rule_to_delete must be modified.
Signature · 1 line
1.9.3
#5 lore raw

Re: [PATCH 2/2] drivers/crypto: Fix anonymous union initialization in crypto

In reply to Michael Qiu
Quoted 15 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Michael Qiu
Sent: Friday, March 25, 2016 7:20 AM
To: [email protected]
Cc: Qiu, Michael
Subject: [dpdk-dev] [PATCH 2/2] drivers/crypto: Fix anonymous union initialization in crypto

In SUSE11-SP3 i686 platform, with gcc 4.5.1, there is a compile issue:
null_crypto_pmd_ops.c:44:3: error:
unknown field ‘sym’ specified in initializer
cc1: warnings being treated as errors

Quoted 6 lines

The member in anonymous union initialization should be inside '{}', otherwise it will report an error.

Fixes 26c2e4ad5ad4 ("cryptodev: add capabilities discovery")

Initialisation in QAT PMD has same issue, possibly also other PMDs. I'll extend this fix where needed.

Quoted 55 lines
---
 drivers/crypto/null/null_crypto_pmd_ops.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/crypto/null/null_crypto_pmd_ops.c +2 -2
index 39f8088..b7470c0 100644
@@ -41,9 +41,9 @@
 static const struct rte_cryptodev_capabilities null_crypto_pmd_capabilities[] = {
 	{	/* NULL (AUTH) */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
-		.sym = {
+		{.sym = {
 			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
-			.auth = {
+			{.auth = {
 				.algo = RTE_CRYPTO_AUTH_NULL,
 				.block_size = 1,
 				.key_size = {
@@ -57,14 +57,14 @@ static const struct rte_cryptodev_capabilities

null_crypto_pmd_capabilities[] =

drivers/crypto/null/null_crypto_pmd_ops.c +4 -4
 					.increment = 0
 				},
 				.aad_size = { 0 }
-			}
-		}
+			}, },
+		}, },
 	},
 	{	/* NULL (CIPHER) */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
-		.sym = {
+		{.sym = {
 			.xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
-			.cipher = {
+			{.cipher = {
 				.algo = RTE_CRYPTO_CIPHER_NULL,
 				.block_size = 1,
 				.key_size = {
@@ -77,8 +77,8 @@ static const struct rte_cryptodev_capabilities

null_crypto_pmd_capabilities[] =

drivers/crypto/null/null_crypto_pmd_ops.c +2 -3
 					.max = 0,
 					.increment = 0
 				}
-			}
-		}
+			}, },
+		}, },
 	},
 	RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
 };
--

1.9.3

#2 lore raw

Re: [PATCH 1/2] lib/librte_lpm: Fix anonymous union initialization issue

In reply to Michael Qiu

Making code run with picky compilers is good, as long as it doesn't break other (more modern) compilers.

lib/librte_lpm/rte_lpm.c add_depth_small_v20(struct rte_lpm_v20 *lpm, uint32_t ip, uint8_t depth, · line 779

Quoted 1 line
lib/librte_lpm/rte_lpm.c +1 -0
+					new_tbl8_entry.next_hop=next_hop;

Please run your patches through checkpatch, it will warn about missing whitespace like this.

#3 lore raw

PATCH v2 1/2 lib/librte_lpm: Fix anonymous union initialization issue

In reply to Michael Qiu

In SUSE11-SP3 i686 platform, with gcc 4.5.1, there is a compile issue:
rte_lpm.c: In function ‘add_depth_small_v20’:
rte_lpm.c:778:7: error: unknown field ‘next_hop’
specified in initializer
cc1: warnings being treated as errors
The root casue is gcc only allow anonymous union initialized according to the field it is defined. But next_hop is defined in different field when in different platform(Endian).

One solution is add if define in the code to avoid this issue, but there is a simple way, initialize it separately later.

Fixes afc5c914a083 ("lpm: fix big endian support")

---
v2 --> v1:
Fixes whilespace issue around "="

 lib/librte_lpm/rte_lpm.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
lib/librte_lpm/rte_lpm.c +7 -7
index af5811c..efd507e 100644
@@ -744,11 +744,11 @@ add_depth_small_v20(struct rte_lpm_v20 *lpm, uint32_t ip, uint8_t depth,
 				lpm->tbl24[i].depth <= depth)) {
 
 			struct rte_lpm_tbl_entry_v20 new_tbl24_entry = {
-				{ .next_hop = next_hop, },
 				.valid = VALID,
 				.valid_group = 0,
 				.depth = depth,
 			};
+			new_tbl24_entry.next_hop = next_hop;
 
 			/* Setting tbl24 entry in one go to avoid race
 			 * conditions
@@ -775,8 +775,8 @@ add_depth_small_v20(struct rte_lpm_v20 *lpm, uint32_t ip, uint8_t depth,
 						.valid = VALID,
 						.valid_group = VALID,
 						.depth = depth,
-						.next_hop = next_hop,
 					};
+					new_tbl8_entry.next_hop = next_hop;
 
 					/*
 					 * Setting tbl8 entry in one go to avoid
@@ -975,10 +975,9 @@ add_depth_big_v20(struct rte_lpm_v20 *lpm, uint32_t ip_masked, uint8_t depth,
 				struct rte_lpm_tbl_entry_v20 new_tbl8_entry = {
 					.valid = VALID,
 					.depth = depth,
-					.next_hop = next_hop,
 					.valid_group = lpm->tbl8[i].valid_group,
 				};
-
+				new_tbl8_entry.next_hop = next_hop;
 				/*
 				 * Setting tbl8 entry in one go to avoid race
 				 * condition
@@ -1375,9 +1374,9 @@ delete_depth_small_v20(struct rte_lpm_v20 *lpm, uint32_t ip_masked,
 			.valid = VALID,
 			.valid_group = VALID,
 			.depth = sub_rule_depth,
-			.next_hop = lpm->rules_tbl
-			[sub_rule_index].next_hop,
 		};
+		new_tbl8_entry.next_hop =
+				lpm->rules_tbl[sub_rule_index].next_hop;
 
 		for (i = tbl24_index; i < (tbl24_index + tbl24_range); i++) {
 
@@ -1639,9 +1638,10 @@ delete_depth_big_v20(struct rte_lpm_v20 *lpm, uint32_t ip_masked,
 			.valid = VALID,
 			.depth = sub_rule_depth,
 			.valid_group = lpm->tbl8[tbl8_group_start].valid_group,
-			.next_hop = lpm->rules_tbl[sub_rule_index].next_hop,
 		};
 
+		new_tbl8_entry.next_hop =
+				lpm->rules_tbl[sub_rule_index].next_hop;
 		/*
 		 * Loop through the range of entries on tbl8 for which the
 		 * rule_to_delete must be modified.
Signature · 1 line
1.9.3
#6 lore raw

PATCH v2 1/1 drivers/crypto: Fix anonymous union initialization in crypto PMDs

In reply to Michael Qiu

In SUSE11-SP3 i686 platform, with gcc 4.5.1, there are compile issues, e.g:
null_crypto_pmd_ops.c:44:3: error:
unknown field 'sym' specified in initializer
cc1: warnings being treated as errors

The member in anonymous union initialization should be inside '{}', otherwise it will report an error.

Fixes 26c2e4ad5ad4 ("cryptodev: add capabilities discovery")

v2:
- extends fix to cover all crypto pmds.

---
 drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c   | 16 +++---
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 64 +++++++++++-----------
 drivers/crypto/null/null_crypto_pmd_ops.c      | 16 +++---
 drivers/crypto/qat/qat_crypto.c                | 74 +++++++++++++-------------
 drivers/crypto/snow3g/rte_snow3g_pmd_ops.c     | 16 +++---
 5 files changed, 93 insertions(+), 93 deletions(-)
drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c +8 -8
index 387f8d1..4dec8dd 100644
@@ -41,9 +41,9 @@
 static const struct rte_cryptodev_capabilities aesni_gcm_pmd_capabilities[] = {
 	{	/* AES GCM (AUTH) */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
-		.sym = {
+		{.sym = {
 			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
-			.auth = {
+			{.auth = {
 				.algo = RTE_CRYPTO_AUTH_AES_GCM,
 				.block_size = 16,
 				.key_size = {
@@ -61,14 +61,14 @@ static const struct rte_cryptodev_capabilities aesni_gcm_pmd_capabilities[] = {
 					.max = 12,
 					.increment = 4
 				}
-			}
-		}
+			}, }
+		}, }
 	},
 	{	/* AES GCM (CIPHER) */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
-		.sym = {
+		{.sym = {
 			.xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
-			.cipher = {
+			{.cipher = {
 				.algo = RTE_CRYPTO_CIPHER_AES_GCM,
 				.block_size = 16,
 				.key_size = {
@@ -81,8 +81,8 @@ static const struct rte_cryptodev_capabilities aesni_gcm_pmd_capabilities[] = {
 					.max = 16,
 					.increment = 0
 				}
-			}
-		}
+			}, }
+		}, }
 	},
 	RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
 };
drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c +32 -32

147 lines not on this page · raw message

drivers/crypto/null/null_crypto_pmd_ops.c +8 -8
index 39f8088..cf1a519 100644
@@ -41,9 +41,9 @@
 static const struct rte_cryptodev_capabilities null_crypto_pmd_capabilities[] = {
 	{	/* NULL (AUTH) */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
-		.sym = {
+		{.sym = {
 			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
-			.auth = {
+			{.auth = {
 				.algo = RTE_CRYPTO_AUTH_NULL,
 				.block_size = 1,
 				.key_size = {
@@ -57,14 +57,14 @@ static const struct rte_cryptodev_capabilities null_crypto_pmd_capabilities[] =
 					.increment = 0
 				},
 				.aad_size = { 0 }
-			}
-		}
+			}, },
+		}, },
 	},
 	{	/* NULL (CIPHER) */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
-		.sym = {
+		{.sym = {
 			.xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
-			.cipher = {
+			{.cipher = {
 				.algo = RTE_CRYPTO_CIPHER_NULL,
 				.block_size = 1,
 				.key_size = {
@@ -77,8 +77,8 @@ static const struct rte_cryptodev_capabilities null_crypto_pmd_capabilities[] =
 					.max = 0,
 					.increment = 0
 				}
-			}
-		}
+			}, },
+		}, }
 	},
 	RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
 };
drivers/crypto/qat/qat_crypto.c +37 -37

167 lines not on this page · raw message

drivers/crypto/snow3g/rte_snow3g_pmd_ops.c +8 -8
index 74eee23..6f00b06 100644
@@ -41,9 +41,9 @@
 static const struct rte_cryptodev_capabilities snow3g_pmd_capabilities[] = {
 	{	/* SNOW3G (UIA2) */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
-		.sym = {
+		{.sym = {
 			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
-			.auth = {
+			{.auth = {
 				.algo = RTE_CRYPTO_AUTH_SNOW3G_UIA2,
 				.block_size = 16,
 				.key_size = {
@@ -61,14 +61,14 @@ static const struct rte_cryptodev_capabilities snow3g_pmd_capabilities[] = {
 					.max = 16,
 					.increment = 0
 				}
-			}
-		}
+			}, }
+		}, }
 	},
 	{	/* SNOW3G (UEA2) */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
-		.sym = {
+		{.sym = {
 			.xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
-			.cipher = {
+			{.cipher = {
 				.algo = RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
 				.block_size = 16,
 				.key_size = {
@@ -81,8 +81,8 @@ static const struct rte_cryptodev_capabilities snow3g_pmd_capabilities[] = {
 					.max = 16,
 					.increment = 0
 				}
-			}
-		}
+			}, }
+		}, }
 	},
 	RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
 };
Signature · 1 line
2.1.0
#7 lore raw
In reply to Michael Qiu

2016-03-25 15:20, Michael Qiu:

Quoted 6 lines

In SUSE11 SP3 i686 platform with gcc version 4.5.1, there is some compile issues. This patch set is try to fix them.

Michael Qiu (2):
lib/librte_lpm: Fix anonymous union initialization issue drivers/crypto: Fix anonymous union initialization in crypto

v2 of each patch applied, thanks