diff options
| -rw-r--r-- | CMakeLists.txt | 11 | ||||
| -rw-r--r-- | Makefile | 23 | ||||
| -rw-r--r-- | cmake/FindDPDK.cmake | 114 | ||||
| -rw-r--r-- | conf/CMakeLists.txt | 10 | ||||
| -rw-r--r-- | conf/dpdk-x86_64.conf.in | 1 | ||||
| -rw-r--r-- | conf/ixgbe.conf | 14 | ||||
| -rw-r--r-- | conf/ixgbe.conf.in | 16 | ||||
| -rw-r--r-- | conf/nl2fwd.conf | 62 | ||||
| -rw-r--r-- | driver/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | logreader/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | mk/config.mk | 257 | ||||
| -rw-r--r-- | mk/cpuflags.mk | 119 | ||||
| -rw-r--r-- | mk/debug-vars.mk | 10 | ||||
| -rw-r--r-- | mk/toolchain-compat.mk | 89 | ||||
| -rw-r--r-- | mk/vars.mk | 72 | ||||
| -rw-r--r-- | tools/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | tools/dpdk_intel | 57 | ||||
| -rw-r--r-- | tools/drv_monitor.sh | 3 | ||||
| -rw-r--r-- | tools/drv_start.sh | 17 | ||||
| -rw-r--r-- | worker/CMakeLists.txt | 2 |
20 files changed, 205 insertions, 677 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 9fdeb18..8c644c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,18 +9,22 @@ option(USE_STAT_RUNTIME "I/O Runtime Stat" OFF) option(USE_STAT_WORKER_DETAIL "Worker Runtime Detail Stat" ON) option(USE_UDPSTACK "UDP Stack" ON) option(USE_FASTRING "Fast Packet Transfer Rings" ON) +option(USE_RTE_SDK "Use DPDK RTE Dynamic Library, in DPDK2.2.0+" ON) # Project Options option(PROJECT_X09_REWRITE_HWADDR "Project X09 Output Packet Hwaddr Rewrite" OFF) - - configure_file(include/internal/mr_config.h.in ${CMAKE_SOURCE_DIR}/include/internal/mr_config.h) # Include Modules set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) -include(GetDPDKSupport) include(GetGitRevisionDescription) +if(USE_RTE_SDK) + find_package(DPDK REQUIRED) +else() + include(GetDPDKSupport) +endif() + # Project Version set(MARSIO_MAJOR_VERSION 3) set(MARSIO_MINOR_VERSION 1) @@ -51,5 +55,6 @@ add_subdirectory(${CMAKE_SOURCE_DIR}/conf) add_subdirectory(${CMAKE_SOURCE_DIR}/worker) add_subdirectory(${CMAKE_SOURCE_DIR}/include) add_subdirectory(${CMAKE_SOURCE_DIR}/test) +add_subdirectory(${CMAKE_SOURCE_DIR}/tools) message(STATUS "Packet I/O Middleware based on DPDK(Marsio), Version: ${MARSIO_VERSION}")
\ No newline at end of file @@ -1,11 +1,3 @@ -ifeq ($(RTE_SDK),) -$(error "Please define RTE_SDK environment variable") -endif - -ifeq ($(RTE_TARGET),) -$(error "Please define RTE_TARGET environment variable") -endif - BUILD_DIR = $(CURDIR)/build LOCAL_DIR = $(CURDIR) DEBUG_FLAGS = -DCMAKE_BUILD_TYPE=Debug @@ -16,6 +8,11 @@ DEBUG_FLAGS += -DCMAKE_INSTALL_PREFIX=$(INSTALL_PREFIX) REL_FLAGS += -DCMAKE_INSTALL_PREFIX=$(INSTALL_PREFIX) endif +ifneq ($(RTE_PREFIX),) +DEBUG_FLAGS += -DCMAKE_PREFIX_PATH=$(RTE_PREFIX) +REL_FLAGS += -DCMAKE_PREFIX_PATH=$(RTE_PREFIX) +endif + all: _make_build_dir _compile_rel PHONY: all _make_build_dir _compile_debug _compile_rel _install \ @@ -32,12 +29,14 @@ _compile_rel: _install: cd $(BUILD_DIR) && make install -_dpdk: - export EXTRA_CFLAGS="-g -fPIC" && cd $(RTE_SDK) && $(MAKE) install T=$(RTE_TARGET) - +_clean: + rm -rf $(BUILD_DIR) + # Release Version, No Debug Symbol and Optimized with -O2 build_release: _make_build_dir _compile_rel # Debug Version, Optimized with -O0 build_debug: _make_build_dir _compile_debug # Install -install: _install
\ No newline at end of file +install: _install +# Clean +clean: _clean
\ No newline at end of file diff --git a/cmake/FindDPDK.cmake b/cmake/FindDPDK.cmake new file mode 100644 index 0000000..326e029 --- /dev/null +++ b/cmake/FindDPDK.cmake @@ -0,0 +1,114 @@ +############################################################################# +# DPDK Envoirment Support based on CMake 2.6+ +# In DPDK2.2.0+, It supports compile as dynamic library and install In +# Systems. This file is used to support this. +# +# Author : Lu Qiuwen +# E-mail : [email protected] +# Date : 2016-01-03 +############################################################################# + +if(RTE_PREFIX) + set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${RTE_PREFIX}) +endif() + +find_path(DPDK_ROOT_DIR + NAMES include/dpdk/rte_config.h) +find_path(DPDK_INCLUDE_DIR + NAMES rte_config.h HINTS ${DPDK_ROOT_DIR}/include/dpdk) +find_library(DPDK_LIBRARY + NAMES dpdk HINTS ${DPDK_ROOT_DIR}/lib) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(DPDK DEFAULT_MSG + DPDK_ROOT_DIR DPDK_INCLUDE_DIR DPDK_LIBRARY) + +# DPDK CPU Flags +set(DPDK_MACHINE_FLAGS "-march=native") +exec_program(${CMAKE_C_COMPILER} ARGS "${DPDK_MACHINE_FLAGS} -dM -E - < /dev/null" OUTPUT_VARIABLE DPDK_AUTOFLAGS) + +if(DPDK_AUTOFLAGS MATCHES "__SSE__") + set(DPDK_CPUFLAGS ${DPDK_CPUFLAGS} SSE) +endif() + +if(DPDK_AUTOFLAGS MATCHES "__SSE2__") + set(DPDK_CPUFLAGS ${DPDK_CPUFLAGS} SSE2) +endif() + +if(DPDK_AUTOFLAGS MATCHES "__SSE3__") + set(DPDK_CPUFLAGS ${DPDK_CPUFLAGS} SSE3) +endif() + +if(DPDK_AUTOFLAGS MATCHES "__SSSE3__") + set(DPDK_CPUFLAGS ${DPDK_CPUFLAGS} SSSE3) +endif() + +if(DPDK_AUTOFLAGS MATCHES "__SSE4_1__") + set(DPDK_CPUFLAGS ${DPDK_CPUFLAGS} SSE4_1) +endif() + +if(DPDK_AUTOFLAGS MATCHES "__SSE4_2__") + set(DPDK_CPUFLAGS ${DPDK_CPUFLAGS} SSE4_2) +endif() + +if(DPDK_AUTOFLAGS MATCHES "__AES__") + set(DPDK_CPUFLAGS ${DPDK_CPUFLAGS} AES) +endif() + +if(DPDK_AUTOFLAGS MATCHES "__PCLMUL__") + set(DPDK_CPUFLAGS ${DPDK_CPUFLAGS} PCLMULQDQ) +endif() + +if(DPDK_AUTOFLAGS MATCHES "__AVX__") + set(DPDK_CPUFLAGS ${DPDK_CPUFLAGS} AVX) +endif() + +if(DPDK_AUTOFLAGS MATCHES "__RDRND__") + set(DPDK_CPUFLAGS ${DPDK_CPUFLAGS} RDRAND) +endif() + +if(DPDK_AUTOFLAGS MATCHES "__FSGSBASE__") + set(DPDK_CPUFLAGS ${DPDK_CPUFLAGS} FSGSBASE) +endif() + +if(DPDK_AUTOFLAGS MATCHES "__F16C__") + set(DPDK_CPUFLAGS ${DPDK_CPUFLAGS} F16C) +endif() + +if(DPDK_AUTOFLAGS MATCHES "__AVX2__") + set(DPDK_CPUFLAGS ${DPDK_CPUFLAGS} AVX2) +endif() + +foreach(LOOP_VAR ${DPDK_CPUFLAGS}) + set(DPDK_MACHINE_FLAGS ${DPDK_MACHINE_FLAGS} "-DRTE_MACHINE_CPUFLAG_${LOOP_VAR}") + set(DPDK_COMPILE_TIME_CPUFLAGS ${DPDK_COMPILE_TIME_CPUFLAGS} "RTE_CPUFLAG_${LOOP_VAR}") +endforeach() + +string(REPLACE ";" "," DPDK_COMPILE_TIME_CPUFLAGS_STR "${DPDK_COMPILE_TIME_CPUFLAGS}") +set(DPDK_MACHINE_FLAGS ${DPDK_MACHINE_FLAGS} "-DRTE_COMPILE_TIME_CPUFLAGS=${DPDK_COMPILE_TIME_CPUFLAGS_STR}") + +# Target Platform Detective +# Platform Bit + +if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") + set(DPDK_ARCH_FLAGS "-m64") +endif() + +if(CMAKE_SYSTEM_PROCESSOR MATCHES "i686") + set(DPDK_ARCH_FLAGS "-m32") +endif() + +# Force Include +set(DPDK_FORCE_INCLUDE "-include ${DPDK_INCLUDE_DIR}/rte_config.h") + +# Include Dir +set(DPDK_C_PREDEFINED ${DPDK_ARCH_FLAGS} ${DPDK_MACHINE_FLAGS} ${DPDK_FORCE_INCLUDE}) +set(DPDK_CXX_PREDEFINED ${DPDK_ARCH_FLAGS} ${DPDK_MACHINE_FLAGS} ${DPDK_FORCE_INCLUDE}) + +mark_as_advanced( + DPDK_ROOT_DIR + DPDK_INCLUDE_DIR + DPDK_LIBRARY + DPDK_C_PREDEFINED + DPDK_CXX_PREDEFINED +)
\ No newline at end of file diff --git a/conf/CMakeLists.txt b/conf/CMakeLists.txt index 98fdb79..2053f8b 100644 --- a/conf/CMakeLists.txt +++ b/conf/CMakeLists.txt @@ -1,4 +1,8 @@ -install(FILES ixgbe.conf DESTINATION etc COMPONENT Profile)
-install(FILES mlx4.conf DESTINATION etc COMPONENT Profile)
-install(FILES nl2fwd.conf DESTINATION etc COMPONENT Profile)
\ No newline at end of file +configure_file(dpdk-x86_64.conf.in ${CMAKE_SOURCE_DIR}/conf/dpdk-x86_64.conf)
+configure_file(ixgbe.conf.in ${CMAKE_SOURCE_DIR}/conf/ixgbe.conf)
+
+install(FILES ixgbe.conf DESTINATION /etc/ COMPONENT Profile)
+install(FILES mlx4.conf DESTINATION /etc/ COMPONENT Profile)
+install(FILES nl2fwd.conf DESTINATION /etc/ COMPONENT Profile)
+install(FILES dpdk-x86_64.conf DESTINATION /etc/ld.so.conf.d/ COMPONENT Profile)
\ No newline at end of file diff --git a/conf/dpdk-x86_64.conf.in b/conf/dpdk-x86_64.conf.in new file mode 100644 index 0000000..80fba58 --- /dev/null +++ b/conf/dpdk-x86_64.conf.in @@ -0,0 +1 @@ +@DPDK_ROOT_DIR@/lib
\ No newline at end of file diff --git a/conf/ixgbe.conf b/conf/ixgbe.conf deleted file mode 100644 index 281f5a8..0000000 --- a/conf/ixgbe.conf +++ /dev/null @@ -1,14 +0,0 @@ -# Configure File in Shell Format -# To configure mlx4 uio network drivers and dpdk env -# -# DPDK Envourment PATH - -export RTE_SDK=/home/driver/dpdk-2.0.0/ -export RTE_TARGET=x86_64-native-linuxapp-gcc - -# HUGEPAGES Count -HUGEPAGE_MEM=8000 - -# PCI Resource Address using IXGBE_UIO drivers -IXGBE_UIO=0000:07:00.0 - diff --git a/conf/ixgbe.conf.in b/conf/ixgbe.conf.in new file mode 100644 index 0000000..fdd4c9a --- /dev/null +++ b/conf/ixgbe.conf.in @@ -0,0 +1,16 @@ +# Configure File in Shell Format +# To configure mlx4 uio network drivers and dpdk env +# +# DPDK Envourment PATH + +DPDK_ROOT=@DPDK_ROOT_DIR@ + +# HUGEPAGES Count +HUGEPAGE_MEM=20000 + +# PCI Resource Address using IXGBE_UIO drivers +IXGBE_UIO=0000:06:00.0,0000:06:00.1,0000:0a:00.0,0000:0a:00.1 + +# Do not modified ! +DPDK_MODULES_DIR=$DPDK_ROOT/lib/modules/$(uname -r)/extra/dpdk +DPDK_TOOLS_DIR=$DPDK_ROOT/sbin
\ No newline at end of file diff --git a/conf/nl2fwd.conf b/conf/nl2fwd.conf index 7913228..21d23da 100644 --- a/conf/nl2fwd.conf +++ b/conf/nl2fwd.conf @@ -2,62 +2,60 @@ enable_spec_memc=1
n_mem_channel=4
[common]
-#nic_rx_ring_size=4096
-#nic_tx_ring_size=4096
-#nic_rx_ring_size=1024
-#nic_tx_ring_size=1024
-#ring_rx_size=65536
-#ring_tx_size=65536
-ring_rx_size=1024
-ring_tx_size=1024
-burst_size_io_rx_read=64
-burst_size_io_rx_write=64
-burst_size_io_tx_read=64
-burst_size_io_tx_write=64
-burst_size_worker_read=64
-burst_size_worker_write=64
+nic_rx_ring_size=512
+nic_tx_ring_size=512
+nic_rx_ring_size=512
+nic_tx_ring_size=512
+ring_rx_size=65536
+ring_tx_size=65536
+burst_size_io_rx_read=32
+burst_size_io_rx_write=32
+burst_size_io_tx_read=32
+burst_size_io_tx_write=32
+burst_size_worker_read=32
+burst_size_worker_write=32
#[pcap_compatibility]
#n_device=1
#[pcap_device_0]
#iface=lo
[rx_common]
-rx_count=4
+rx_count=2
[rx_0]
port=0
queue=0
-lcore=14
+lcore=0
[rx_1]
port=1
queue=0
-lcore=15
+lcore=1
[rx_2]
port=2
queue=0
-lcore=14
+lcore=2
[rx_3]
port=3
queue=0
-lcore=15
+lcore=3
[tx_common]
-tx_count=4
+tx_count=2
[tx_0]
port=0
-lcore=14
+lcore=0
nqueue=1
[tx_1]
port=1
-lcore=15
+lcore=1
nqueue=1
[tx_2]
port=2
-lcore=14
+lcore=2
nqueue=1
[tx_3]
port=3
-lcore=15
+lcore=3
nqueue=1
[worker]
-lcore=0,1,2,3,4,5,6,7,8,9,10,11,12,13
+lcore=2,3,4,5,6,7,8,9,10,11,12,13
#lcore=2
[map]
n_map=2
@@ -74,16 +72,13 @@ threshold_alert_do=10 threshold_normal_do=10
[stat]
enable=1
-print=1
+print=0
sample_time=1
[mempool]
#create_method=lcore
create_method=socket
-#mempool_buffers=524288
-#mempool_buffers=1024576
#mempool_buffers=4194304
#mempool_buffers=65535
-#mempool_mbuf_size=
#mempool_cache_size=2048
[energy]
enable=1
@@ -96,9 +91,10 @@ virtaddr=0x7f40c4a00000 [kni]
kni=0
[stack]
-Port2.IPv4=192.168.1.1/255.255.255.0
-Port2.MTU=2000
-Port3.IPv4=192.168.2.2/255.255.255.0
-Port3.MTU=2000
+#Port2.IPv4=192.168.1.1/255.255.255.0
+#Port2.MTU=2000
+#Port3.IPv4=192.168.2.2/255.255.255.0
+#Port3.MTU=2000
+[stack-arp]
#rewrite dst etheraddr to user-define value
#rewrite_hwaddr=ff:ff:ff:ff:ff:ff
\ No newline at end of file diff --git a/driver/CMakeLists.txt b/driver/CMakeLists.txt index a35f7ed..7a2235f 100644 --- a/driver/CMakeLists.txt +++ b/driver/CMakeLists.txt @@ -1,4 +1,5 @@ find_package(PCAP REQUIRED)
+find_package(DPDK REQUIRED)
include_directories(${CMAKE_SOURCE_DIR}/include)
include_directories(${CMAKE_SOURCE_DIR}/include/extern)
diff --git a/logreader/CMakeLists.txt b/logreader/CMakeLists.txt index 1462e5d..3b2e014 100644 --- a/logreader/CMakeLists.txt +++ b/logreader/CMakeLists.txt @@ -1,4 +1,4 @@ -
+find_package(DPDK REQUIRED)
include_directories(${CMAKE_SOURCE_DIR}/include)
include_directories(${CMAKE_SOURCE_DIR}/include/extern)
include_directories(${CMAKE_SOURCE_DIR}/include/internal)
diff --git a/mk/config.mk b/mk/config.mk deleted file mode 100644 index dc07036..0000000 --- a/mk/config.mk +++ /dev/null @@ -1,257 +0,0 @@ - -# Read the Config Variables from DPDK configure file - -ifeq ($(RTE_SDK),) -$(error "Please define RTE_SDK environment variable") -endif - -ifeq ($(RTE_TARGET),) -$(error "Please define RTE_TARGET environment variable") -endif - -MK_ROOT ?= ./ - -include $(MK_ROOT)/vars.mk -include $(MK_ROOT)/toolchain-compat.mk -include $(MK_ROOT)/cpuflags.mk - -RTE_CONFIG = config -CONFIG_ARCH = defconfig_$(RTE_TARGET) - -ifneq ($(findstring linuxapp,$(CONFIG_ARCH)),) -CONFIG_COMMON = common_linuxapp -endif - -ifneq ($(findstring bsdapp,$(CONFIG_ARCH)),) -CONFIG_COMMON = common_bsdapp -endif - -CONFIG_ARCH_PATH = $(RTE_SDK)/$(RTE_CONFIG)/$(CONFIG_ARCH) -CONFIG_COMMON_PATH = $(RTE_SDK)/$(RTE_CONFIG)/$(CONFIG_COMMON) - --include $(CONFIG_ARCH_PATH) --include $(CONFIG_COMMON_PATH) - -DPDK_INCLUDE = $(RTE_SDK)/$(RTE_TARGET)/include -DPDK_LIB_DIR = $(RTE_SDK)/$(RTE_TARGET)/lib -DPDK_CONFIG = $(RTE_SDK)/$(RTE_TARGET)/include/rte_config.h - -# DPDK Version -DPDK_VERSION_FILE = $(RTE_SDK)/$(RTE_TARGET)/include/rte_version.h -DPDK_MAJOR_VER = $(shell grep "define RTE_VER_MAJOR" $(DPDK_VERSION_FILE) | awk '{print $$3}') -DPDK_MINOR_VER = $(shell grep "define RTE_VER_MINOR" $(DPDK_VERSION_FILE) | awk '{print $$3}') - -# Version Tag : 2.1.0 -ifeq ($(DPDK_MAJOR_VER)$(DPDK_MINOR_VER),21) -DPDK_VERSION_TAG_2_1_0 = 21 -endif - -DPDK_LIB = --whole-archive -DPDK_LIB += --start-group - -# Compact with DPDK 1.5.2/1.6.0 -ifeq ($(CONFIG_RTE_LIBRTE_IGB_PMD),y) -CONFIG_RTE_LIBRTE_E1000_PMD=y -endif - -ifeq ($(CONFIG_RTE_LIBRTE_EM_PMD),y) -CONFIG_RTE_LIBRTE_E1000_PMD=y -endif - -ifeq ($(CONFIG_RTE_LIBRTE_DISTRIBUTOR),y) -DPDK_LIB += -lrte_distributor -endif - -ifeq ($(CONFIG_RTE_LIBRTE_REORDER),y) -DPDK_LIB += -lrte_reorder -endif - -ifeq ($(CONFIG_RTE_LIBRTE_KNI),y) -ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y) -DPDK_LIB += -lrte_kni -endif -endif - -ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y) -ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y) -DPDK_LIB += -lrte_ivshmem -endif -endif - -ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y) -DPDK_LIB += -lrte_pipeline -endif - -ifeq ($(CONFIG_RTE_LIBRTE_TABLE),y) -DPDK_LIB += -lrte_table -endif - -ifeq ($(CONFIG_RTE_LIBRTE_PORT),y) -DPDK_LIB += -lrte_port -endif - -ifeq ($(CONFIG_RTE_LIBRTE_TIMER),y) -DPDK_LIB += -lrte_timer -endif - -ifeq ($(CONFIG_RTE_LIBRTE_HASH),y) -DPDK_LIB += -lrte_hash -endif - -ifeq ($(CONFIG_RTE_LIBRTE_JOBSTATS),y) -DPDK_LIB += -lrte_jobstats -endif - -ifeq ($(CONFIG_RTE_LIBRTE_LPM),y) -DPDK_LIB += -lrte_lpm -endif - -ifeq ($(CONFIG_RTE_LIBRTE_POWER),y) -DPDK_LIB += -lrte_power -endif - -ifeq ($(CONFIG_RTE_LIBRTE_ACL),y) -DPDK_LIB += -lrte_acl -endif - -ifeq ($(CONFIG_RTE_LIBRTE_METER),y) -DPDK_LIB += -lrte_meter -endif - -ifeq ($(CONFIG_RTE_LIBRTE_SCHED),y) -DPDK_LIB += -lrte_sched -DPDK_LIB += -lm -DPDK_LIB += -lrt -endif - -ifeq ($(CONFIG_RTE_LIBRTE_VHOST), y) -DPDK_LIB += -lrte_vhost -endif - -ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y) -DPDK_LIB += -lpcap -endif - -ifeq ($(CONFIG_RTE_LIBRTE_VHOST)$(CONFIG_RTE_LIBRTE_VHOST_USER),yn) -DPDK_LIB += -lfuse -endif - -ifeq ($(CONFIG_RTE_LIBRTE_MLX4_PMD)$(CONFIG_RTE_LIBRTE_RSYS),y) -DPDK_LIB += -libverbs -endif - - -ifeq ($(CONFIG_RTE_LIBRTE_KVARGS),y) -DPDK_LIB += -lrte_kvargs -endif - -ifeq ($(CONFIG_RTE_LIBRTE_MBUF),y) -DPDK_LIB += -lrte_mbuf -endif - -ifeq ($(CONFIG_RTE_LIBRTE_IP_FRAG),y) -DPDK_LIB += -lrte_ip_frag -endif - -ifeq ($(CONFIG_RTE_LIBRTE_ETHER),y) -DPDK_LIB += -lethdev -endif - -ifeq ($(CONFIG_RTE_LIBRTE_MALLOC),y) -DPDK_LIB += -lrte_malloc -endif - -ifeq ($(CONFIG_RTE_LIBRTE_MEMPOOL),y) -DPDK_LIB += -lrte_mempool -endif - -ifeq ($(CONFIG_RTE_LIBRTE_RING),y) -DPDK_LIB += -lrte_ring -endif - -ifeq ($(CONFIG_RTE_LIBRTE_EAL),y) -DPDK_LIB += -lrte_eal -endif - -ifeq ($(CONFIG_RTE_LIBRTE_CMDLINE),y) -DPDK_LIB += -lrte_cmdline -endif - -ifeq ($(CONFIG_RTE_LIBRTE_CFGFILE),y) -DPDK_LIB += -lrte_cfgfile -endif - -ifeq ($(CONFIG_RTE_LIBRTE_PMD_BOND),y) -DPDK_LIB += -lrte_pmd_bond -endif - -ifeq ($(CONFIG_RTE_LIBRTE_PMD_XENVIRT),y) -DPDK_LIB += -lrte_pmd_xenvirt -DPDK_LIB += -lxenstore -endif - -ifeq ($(CONFIG_RTE_LIBRTE_VMXNET3_PMD),y) -DPDK_LIB += -lrte_pmd_vmxnet3_uio -endif - -ifdef ($(DPDK_VERSION_TAG_2_1_0)) -DPDK_LIB += -lrte_pmd_virtio -endif - -ifeq ($(DPDK_VERSION_TAG_2_1_0)$(CONFIG_RTE_LIBRTE_VIRTIO_PMD)$(CONFIG_RTE_LIBRTE_RSYS),y) -DPDK_LIB += -lrte_pmd_virtio_uio -endif - -ifeq ($(CONFIG_RTE_LIBRTE_VIRTIO_PMD)$(CONFIG_RTE_LIBRTE_RSYS),yy) -DPDK_LIB += -lrte_pmd_virtio -endif - -ifeq ($(CONFIG_RTE_LIBRTE_ENIC_PMD),y) -DPDK_LIB += -lrte_pmd_enic -endif - -ifeq ($(CONFIG_RTE_LIBRTE_I40E_PMD),y) -DPDK_LIB += -lrte_pmd_i40e -endif - -ifeq ($(CONFIG_RTE_LIBRTE_FM10K_PMD),y) -DPDK_LIB += -lrte_pmd_fm10k -endif - -ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y) -DPDK_LIB += -lrte_pmd_ixgbe -endif - -ifeq ($(CONFIG_RTE_LIBRTE_E1000_PMD),y) -DPDK_LIB += -lrte_pmd_e1000 -endif - -ifeq ($(CONFIG_RTE_LIBRTE_MLX4_PMD),y) -DPDK_LIB += -lrte_pmd_mlx4 -endif - -ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y) -DPDK_LIB += -lrte_pmd_ring -endif - -ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y) -DPDK_LIB += -lrte_pmd_pcap -endif - -ifeq ($(CONFIG_RTE_LIBRTE_PMD_AF_PACKET),y) -DPDK_LIB += -lrte_pmd_af_packet -endif - -DPDK_LIB += --end-group -DPDK_LIB += --no-whole-archive - -comma := , -linkerprefix = $(subst -Wl$(comma)-L,-L,$(addprefix -Wl$(comma),$1)) - -DPDK_LDFLAGS = $(MACHINE_LDFLAGS) -L$(DPDK_LIB_DIR) $(call linkerprefix,$(DPDK_LIB)) -DPDK_CFLAGS = $(MACHINE_CFLAGS) -I$(DPDK_INCLUDE) -include $(DPDK_CONFIG) - -ifeq ($(CONFIG_RTE_LIBRTE_MLX4_PMD)$(CONFIG_RTE_LIBRTE_RSYS),y) -DPDK_LDFLAGS += -L$(RTE_IBV_INSTALL)/usr/local/lib -DPDK_CFLAGS += -I$(RTE_IBV_INSTALL)/usr/local/include -endif diff --git a/mk/cpuflags.mk b/mk/cpuflags.mk deleted file mode 100644 index de69768..0000000 --- a/mk/cpuflags.mk +++ /dev/null @@ -1,119 +0,0 @@ -# BSD LICENSE -# -# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Intel Corporation nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# this makefile is called from the generic rte.vars.mk and is -# used to set the RTE_CPUFLAG_* environment variables giving details -# of what instruction sets the target cpu supports. - -CC ?= gcc - -AUTO_CPUFLAGS := $(shell $(CC) $(MACHINE_CFLAGS) -dM -E - < /dev/null) - -# adding flags to CPUFLAGS - -ifneq ($(filter $(AUTO_CPUFLAGS),__SSE__),) -CPUFLAGS += SSE -endif - -ifneq ($(filter $(AUTO_CPUFLAGS),__SSE2__),) -CPUFLAGS += SSE2 -endif - -ifneq ($(filter $(AUTO_CPUFLAGS),__SSE3__),) -CPUFLAGS += SSE3 -endif - -ifneq ($(filter $(AUTO_CPUFLAGS),__SSSE3__),) -CPUFLAGS += SSSE3 -endif - -ifneq ($(filter $(AUTO_CPUFLAGS),__SSE4_1__),) -CPUFLAGS += SSE4_1 -endif - -ifneq ($(filter $(AUTO_CPUFLAGS),__SSE4_2__),) -CPUFLAGS += SSE4_2 -endif - -ifneq ($(filter $(AUTO_CPUFLAGS),__AES__),) -CPUFLAGS += AES -endif - -ifneq ($(filter $(AUTO_CPUFLAGS),__PCLMUL__),) -CPUFLAGS += PCLMULQDQ -endif - -ifneq ($(filter $(AUTO_CPUFLAGS),__AVX__),) -CPUFLAGS += AVX -endif - -ifneq ($(filter $(AUTO_CPUFLAGS),__RDRND__),) -CPUFLAGS += RDRAND -endif - -ifneq ($(filter $(AUTO_CPUFLAGS),__FSGSBASE__),) -CPUFLAGS += FSGSBASE -endif - -ifneq ($(filter $(AUTO_CPUFLAGS),__F16C__),) -CPUFLAGS += F16C -endif - -ifneq ($(filter $(AUTO_CPUFLAGS),__AVX2__),) -CPUFLAGS += AVX2 -endif - -# IBM Power CPU flags -ifneq ($(filter $(AUTO_CPUFLAGS),__PPC64__),) -CPUFLAGS += PPC64 -endif - -ifneq ($(filter $(AUTO_CPUFLAGS),__PPC32__),) -CPUFLAGS += PPC32 -endif - -ifneq ($(filter $(AUTO_CPUFLAGS),__vector),) -CPUFLAGS += ALTIVEC -endif - -ifneq ($(filter $(AUTO_CPUFLAGS),__builtin_vsx_xvnmaddadp),) -CPUFLAGS += VSX -endif - -MACHINE_CFLAGS += $(addprefix -DRTE_MACHINE_CPUFLAG_,$(CPUFLAGS)) - -# To strip whitespace -comma:= , -empty:= -space:= $(empty) $(empty) -CPUFLAGSTMP1 := $(addprefix RTE_CPUFLAG_,$(CPUFLAGS)) -CPUFLAGSTMP2 := $(subst $(space),$(comma),$(CPUFLAGSTMP1)) -MACHINE_CFLAGS += -DRTE_COMPILE_TIME_CPUFLAGS=$(CPUFLAGSTMP2) diff --git a/mk/debug-vars.mk b/mk/debug-vars.mk deleted file mode 100644 index a01e1de..0000000 --- a/mk/debug-vars.mk +++ /dev/null @@ -1,10 +0,0 @@ - - -%: - @echo '$*=$($*)' -d-%: - @echo '$*=$($*)' - @echo ' origin = $(origin $*)' - @echo ' value = $(value $*)' - @echo ' flavor = $(flavor $*)' - diff --git a/mk/toolchain-compat.mk b/mk/toolchain-compat.mk deleted file mode 100644 index 62bb0ad..0000000 --- a/mk/toolchain-compat.mk +++ /dev/null @@ -1,89 +0,0 @@ -# BSD LICENSE -# -# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Intel Corporation nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# -# CPUID-related options -# -# This was added to support compiler versions which might not support all the -# flags we need -# - -#find out GCC version - -CC ?= gcc - -GCC_VERSION = $(subst .,,$(shell $(CC) -dumpversion | cut -f1-2 -d.)) - -# if GCC is older than 4.x -ifeq ($(shell test $(GCC_VERSION) -lt 40 && echo 1), 1) - MACHINE_CFLAGS = -$(warning You are using GCC < 4.x. This is neither supported, nor tested.) - - -else -# GCC graceful degradation -# GCC 4.2.x - added support for generic target -# GCC 4.3.x - added support for core2, ssse3, sse4.1, sse4.2 -# GCC 4.4.x - added support for avx, aes, pclmul -# GCC 4.5.x - added support for atom -# GCC 4.6.x - added support for corei7, corei7-avx -# GCC 4.7.x - added support for fsgsbase, rdrnd, f16c, core-avx-i, core-avx2 - - ifeq ($(shell test $(GCC_VERSION) -le 47 && echo 1), 1) - MACHINE_CFLAGS := $(patsubst -march=core-avx-i,-march=corei7-avx,$(MACHINE_CFLAGS)) - MACHINE_CFLAGS := $(patsubst -march=core-avx2,-march=core-avx2,$(MACHINE_CFLAGS)) - endif - ifeq ($(shell test $(GCC_VERSION) -lt 46 && echo 1), 1) - MACHINE_CFLAGS := $(patsubst -march=corei7-avx,-march=core2 -maes -mpclmul -mavx,$(MACHINE_CFLAGS)) - MACHINE_CFLAGS := $(patsubst -march=corei7,-march=core2 -maes -mpclmul,$(MACHINE_CFLAGS)) - endif - ifeq ($(shell test $(GCC_VERSION) -lt 45 && echo 1), 1) - MACHINE_CFLAGS := $(patsubst -march=atom,-march=core2 -mssse3,$(MACHINE_CFLAGS)) - endif - ifeq ($(shell test $(GCC_VERSION) -lt 44 && echo 1), 1) - MACHINE_CFLAGS := $(filter-out -mavx -mpclmul -maes,$(MACHINE_CFLAGS)) - ifneq ($(findstring SSE4_2, $(CPUFLAGS)),) - MACHINE_CFLAGS += -msse4.2 - endif - ifneq ($(findstring SSE4_1, $(CPUFLAGS)),) - MACHINE_CFLAGS += -msse4.1 - endif - endif - ifeq ($(shell test $(GCC_VERSION) -lt 43 && echo 1), 1) - MACHINE_CFLAGS := $(filter-out -msse% -mssse%,$(MACHINE_CFLAGS)) - MACHINE_CFLAGS := $(patsubst -march=core2,-march=generic,$(MACHINE_CFLAGS)) - MACHINE_CFLAGS += -msse3 - endif - ifeq ($(shell test $(GCC_VERSION) -lt 42 && echo 1), 1) - MACHINE_CFLAGS := $(filter-out -march% -mtune% -msse%,$(MACHINE_CFLAGS)) - endif -endif - diff --git a/mk/vars.mk b/mk/vars.mk deleted file mode 100644 index 7b82285..0000000 --- a/mk/vars.mk +++ /dev/null @@ -1,72 +0,0 @@ -# BSD LICENSE -# -# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Intel Corporation nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# -# machine: -# -# - can define ARCH variable (overriden by cmdline value) -# - can define CROSS variable (overriden by cmdline value) -# - define MACHINE_CFLAGS variable (overriden by cmdline value) -# - define MACHINE_LDFLAGS variable (overriden by cmdline value) -# - define MACHINE_ASFLAGS variable (overriden by cmdline value) -# - can define CPU_CFLAGS variable (overriden by cmdline value) that -# overrides the one defined in arch. -# - can define CPU_LDFLAGS variable (overriden by cmdline value) that -# overrides the one defined in arch. -# - can define CPU_ASFLAGS variable (overriden by cmdline value) that -# overrides the one defined in arch. -# - may override any previously defined variable -# - -# ARCH = -# CROSS = -# MACHINE_CFLAGS = -# MACHINE_LDFLAGS = -# MACHINE_ASFLAGS = -# CPU_CFLAGS = -# CPU_LDFLAGS = -# CPU_ASFLAGS = -# - -CC ?= gcc -MACHINE_CFLAGS = -march=native - -# On FreeBSD systems, sometimes the correct CPU type is not picked up. -# To get everything to compile, we need SSE4.2 support, so check if that is -# reported by compiler. If not, check if the CPU actually supports it, and if -# so, set the compilation target to be a corei7, minimum target with SSE4.2. -SSE42_SUPPORT=$(shell $(CC) -march=native -dM -E - </dev/null | grep SSE4_2) -ifeq ($(SSE42_SUPPORT),) - CPU_SSE42_SUPPORT = $(shell grep SSE4\.2 /var/run/dmesg.boot 2>/dev/null) - ifneq ($(CPU_SSE42_SUPPORT),) - MACHINE_CFLAGS = -march=corei7 - endif -endif diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt new file mode 100644 index 0000000..cd1eb4d --- /dev/null +++ b/tools/CMakeLists.txt @@ -0,0 +1,2 @@ +install(FILES dpdk_intel DESTINATION /etc/init.d/ PERMISSIONS WORLD_EXECUTE)
+install(FILES dpdk_mlx4 DESTINATION /etc/init.d/ PERMISSIONS WORLD_EXECUTE)
\ No newline at end of file diff --git a/tools/dpdk_intel b/tools/dpdk_intel index 0dcb79f..5357f5a 100644 --- a/tools/dpdk_intel +++ b/tools/dpdk_intel @@ -55,12 +55,6 @@ remove_igb_uio_module() # load_igb_uio_module() { - if [ ! -f $RTE_SDK/$RTE_TARGET/kmod/igb_uio.ko ];then - echo "## ERROR: Target does not have the DPDK UIO Kernel Module." - echo " To fix, please try to rebuild target." - return - fi - remove_igb_uio_module /sbin/lsmod | grep -s uio > /dev/null @@ -76,7 +70,7 @@ load_igb_uio_module() # be loaded. echo "Loading DPDK UIO module" - /sbin/insmod $RTE_SDK/$RTE_TARGET/kmod/igb_uio.ko + /sbin/insmod $DPDK_MODULES_DIR/igb_uio.ko if [ $? -ne 0 ] ; then echo "## ERROR: Could not load kmod/igb_uio.ko." quit @@ -100,19 +94,12 @@ remove_kni_module() # load_kni_module() { - # Check that the KNI module is already built. - if [ ! -f $RTE_SDK/$RTE_TARGET/kmod/rte_kni.ko ];then - echo "## ERROR: Target does not have the DPDK KNI Module." - echo " To fix, please try to rebuild target." - return - fi - # Unload existing version if present. remove_kni_module # Now try load the KNI module. echo "Loading DPDK KNI module" - /sbin/insmod $RTE_SDK/$RTE_TARGET/kmod/rte_kni.ko + /sbin/insmod $DPDK_MODULES_DIR/rte_kni.ko if [ $? -ne 0 ] ; then echo "## ERROR: Could not load kmod/rte_kni.ko." quit @@ -152,32 +139,6 @@ set_non_numa_pages() } # -# Creates hugepages on specific NUMA nodes. -# -set_numa_pages() -{ - clear_huge_pages - - echo "" - echo " Input the number of 2MB pages for each node" - echo " Example: to have 128MB of hugepages available per node," - echo " enter '64' to reserve 64 * 2MB pages on each node" - - echo > .echo_tmp - for d in /sys/devices/system/node/node? ; do - node=$(basename $d) - echo -n "Number of pages for $node: " - read Pages - echo "echo $Pages > $d/hugepages/hugepages-2048kB/nr_hugepages" >> .echo_tmp - done - echo "Reserving hugepages" - sh .echo_tmp - rm -f .echo_tmp - - create_mnt_huge -} - -# # Uses dpdk_nic_bind.py to move devices to work with igb_uio # bind_nics_to_igb_uio() @@ -185,7 +146,7 @@ bind_nics_to_igb_uio() oldIFS=$IFS IFS=, for PCI_PATH in $IXGBE_UIO; do - ${RTE_SDK}/tools/dpdk_nic_bind.py -b igb_uio $PCI_PATH + $DPDK_TOOLS_DIR/dpdk_nic_bind -b igb_uio $PCI_PATH done IFS=$oldIFS } @@ -196,15 +157,13 @@ bind_nics_to_igb_uio() unbind_nics() { oldIFS=$IFS - IFS=, - - for PCI_PATH in $IXGBE_UIO; do - sudo ${RTE_SDK}/tools/dpdk_nic_bind.py -b ixgbe $PCI_PATH - done - IFS=$oldIFS + IFS=, + for PCI_PATH in $IXGBE_UIO; do + $DPDK_TOOLS_DIR/dpdk_nic_bind -b ixgbe $PCI_PATH + done + IFS=$oldIFS } - load_config_file() { if [ ! -f $config ] ; then diff --git a/tools/drv_monitor.sh b/tools/drv_monitor.sh index 728c877..4903da3 100644 --- a/tools/drv_monitor.sh +++ b/tools/drv_monitor.sh @@ -28,8 +28,7 @@ do if [ $nb_worker -ge 1 ] && [ $nb_driver -eq 0 ] then - pid=$(ps -ef | grep $worker_proc_name | grep -v grep | awk '{print $2}') - kill $pid + pkill -f $worker_proc_name fi done diff --git a/tools/drv_start.sh b/tools/drv_start.sh index 723118a..8e75d58 100644 --- a/tools/drv_start.sh +++ b/tools/drv_start.sh @@ -1,6 +1,6 @@ #!/bin/sh -DRV_PROG=./driver +DRV_PROG=/usr/local/bin/marsio DRV_MONITOR=./drv_monitor.sh sh $DRV_MONITOR & @@ -10,19 +10,12 @@ while [ 1 ]; do echo $count if [ $count -lt 6 ] then - echo "set unlimited" ulimit -c unlimited else ulimit -c 0 fi - - $DRV_PROG - -# ./start >> start.`date +"%Y-%m-%d_%H-%M"`.log - echo $DRV_PROG crashed, restart at `date +"%w %Y/%m/%d, %H:%M:%S"` >> RESTART.log + + $DRV_PROG >> marsio.$(date +"%Y-%m-%d_%H-%M").log + echo $DRV_PROG crashed, restart at $(date +"%w %Y/%m/%d, %H:%M:%S") >> RESTART.log sleep 5 -done - -#./start -#echo program crashed, reboot at `date +"%w %Y/%m/%d, %H:%M:%S"` >> REBOOT.log -#reboot +done
\ No newline at end of file diff --git a/worker/CMakeLists.txt b/worker/CMakeLists.txt index 228242b..b352d5e 100644 --- a/worker/CMakeLists.txt +++ b/worker/CMakeLists.txt @@ -1,4 +1,4 @@ -
+find_package(DPDK REQUIRED)
find_package(PCAP REQUIRED)
find_package(LIBNET REQUIRED)
|
