[dpdk-dev] [PATCH v2 15/16] mlx5: fix compilation error with GCC < 4.6

Adrien Mazarguil adrien.mazarguil at 6wind.com
Fri Oct 30 19:55:18 CET 2015


From: Yaacov Hazan <yaacovh at mellanox.com>

Seen with GCC < 4.6:

 error: unknown field ‘tcp_udp’ specified in initializer
 error: extra brace group at end of initializer

Static initialization of anonymous structs/unions is a C11 feature
properly supported only since GCC 4.6.

Work around compilation errors with older versions by expanding
struct ibv_exp_flow_spec into struct hash_rxq_init.

Signed-off-by: Yaacov Hazan <yaacovh at mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil at 6wind.com>
---
 drivers/net/mlx5/mlx5_rxtx.h | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
index 25e256f..15c4bc8 100644
--- a/drivers/net/mlx5/mlx5_rxtx.h
+++ b/drivers/net/mlx5/mlx5_rxtx.h
@@ -153,7 +153,18 @@ struct hash_rxq_init {
 	uint64_t hash_fields; /* Fields that participate in the hash. */
 	uint64_t dpdk_rss_hf; /* Matching DPDK RSS hash fields. */
 	unsigned int flow_priority; /* Flow priority to use. */
-	struct ibv_exp_flow_spec flow_spec; /* Flow specification template. */
+	union {
+		struct {
+			enum ibv_exp_flow_spec_type type;
+			uint16_t size;
+		} hdr;
+		struct ibv_exp_flow_spec_tcp_udp tcp_udp;
+		struct ibv_exp_flow_spec_ipv4 ipv4;
+#ifdef HAVE_FLOW_SPEC_IPV6
+		struct ibv_exp_flow_spec_ipv6 ipv6;
+#endif /* HAVE_FLOW_SPEC_IPV6 */
+		struct ibv_exp_flow_spec_eth eth;
+	} flow_spec; /* Flow specification template. */
 	const struct hash_rxq_init *underlayer; /* Pointer to underlayer. */
 };
 
-- 
2.1.0



More information about the dev mailing list