[dpdk-dev] [PATCH 1/2] ixgbe: test sse4.2 support at runtime for vectorized receive operations

Neil Horman nhorman at tuxdriver.com
Tue Jul 29 22:24:25 CEST 2014


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 | 3 +++
 2 files changed, 9 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..ae615bc 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,8 @@ 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))
+		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



More information about the dev mailing list