The ixgbe vector receive code uses the sse4.2 intrinsics directly.  Instead of
requiring that they be enabled at build time for the entire dpdk library, just
enable sse4.2 for the ixgbe_rxtx_vec.c file, and test for support at runtime
when using it

Signed-off-by: Neil Horman <nhorman at tuxdriver.com>
CC: Thomas Monjalon <thomas.monjalon at 6wind.com>
---
 lib/librte_pmd_ixgbe/Makefile         | 6 ++++++
 lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 5 +++++
 2 files changed, 11 insertions(+)

diff --git a/lib/librte_pmd_ixgbe/Makefile b/lib/librte_pmd_ixgbe/Makefile
index 00ccedb..c002239 100644
--- a/lib/librte_pmd_ixgbe/Makefile
+++ b/lib/librte_pmd_ixgbe/Makefile
@@ -39,6 +39,12 @@ LIB = librte_pmd_ixgbe.a
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)

+#
+# the vectorized recieve functions need sse4.2 instruction 
+# intrinsics, make sure we emit them from the compiler
+#
+CFLAGS_ixgbe_rxtx_vec.o += -msse4.2
+
 ifeq ($(CC), icc)
 #
 # CFLAGS for icc
diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c 
b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c
index 09e19a3..18e8bfe 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c
@@ -34,6 +34,7 @@
 #include <stdint.h>
 #include <rte_ethdev.h>
 #include <rte_malloc.h>
+#include <rte_cpuflags.h>

 #include "ixgbe_ethdev.h"
 #include "ixgbe_rxtx.h"
@@ -679,6 +680,10 @@ int ixgbe_rx_vec_condition_check(struct rte_eth_dev *dev)
        struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
        struct rte_fdir_conf *fconf = &dev->data->dev_conf.fdir_conf;

+       if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_SSE4_2)) {
+               RTE_LOG(ERR, PMD, "ixgbe vector rx needs sse4.2!\n");
+               return -1;
+       }
 #ifndef RTE_IXGBE_RX_OLFLAGS_ENABLE
        /* whithout rx ol_flags, no VP flag report */
        if (rxmode->hw_vlan_strip != 0 ||
-- 
1.8.3.1

Reply via email to