mlx5: fix build with GCC < 4.6
authorYaacov Hazan <yaacovh@mellanox.com>
Fri, 30 Oct 2015 18:55:18 +0000 (19:55 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Sun, 1 Nov 2015 10:23:45 +0000 (11:23 +0100)
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@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
drivers/net/mlx5/mlx5_rxtx.h

index 25e256f..15c4bc8 100644 (file)
@@ -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. */
 };