[dpdk-dev] [PATCH] lib/librte_sched: Fix compile with gcc 4.3.4

Michael Qiu michael.qiu at intel.com
Thu Nov 26 11:49:57 CET 2015


gcc 4.3.4 does not include "immintrin.h", and will post below error:
    lib/librte_sched/rte_sched.c:56:23: error:
    immintrin.h: No such file or directory

To avoid this issue, a gcc version check is need and a flag to indicate
vector ablility.

Signed-off-by: Michael Qiu <michael.qiu at intel.com>
---
 lib/librte_sched/rte_sched.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
index d47cfc2..780b314 100644
--- a/lib/librte_sched/rte_sched.c
+++ b/lib/librte_sched/rte_sched.c
@@ -53,7 +53,21 @@
 #endif
 
 #ifdef RTE_SCHED_VECTOR
+
+#if (defined(__ICC) || (__GNUC__ == 4 &&  __GNUC_MINOR__ < 4))
+
+#if defined(__AVX__)
 #include <immintrin.h>
+#define SCHED_VECTOR_ENABLE
+#endif
+
+#else
+
+#include <x86intrin.h>
+#define SCHED_VECTOR_ENABLE
+
+#endif
+
 #endif
 
 #define RTE_SCHED_TB_RATE_CONFIG_ERR          (1e-7)
@@ -1667,7 +1681,7 @@ grinder_schedule(struct rte_sched_port *port, uint32_t pos)
 	return 1;
 }
 
-#ifdef RTE_SCHED_VECTOR
+#ifdef SCHED_VECTOR_ENABLE
 
 static inline int
 grinder_pipe_exists(struct rte_sched_port *port, uint32_t base_pipe)
-- 
1.9.3



More information about the dev mailing list