From: Yaacov Hazan <yaac...@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 | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
index 4018ac1..422730d 100644
--- a/drivers/net/mlx5/mlx5_rxtx.h
+++ b/drivers/net/mlx5/mlx5_rxtx.h
@@ -150,7 +150,15 @@ 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;
+               struct ibv_exp_flow_spec_eth eth;
+       } flow_spec; /* Flow specification template. */
        const struct hash_rxq_init *underlayer; /* Pointer to underlayer. */
 };

-- 
2.1.0

Reply via email to