Skip to content

Commit

Permalink
msg/async: add dpdk stack plugin
Browse files Browse the repository at this point in the history
Signed-off-by: Haomai Wang <[email protected]>
  • Loading branch information
yuyuyu101 committed Nov 9, 2016
1 parent 252479d commit eae7d5a
Show file tree
Hide file tree
Showing 50 changed files with 10,338 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@
[submodule "src/boost"]
path = src/boost
url = https://github.com/boostorg/boost.git
[submodule "src/dpdk"]
path = src/dpdk
url = https://github.com/yuyuyu101/dpdk
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,12 @@ if(WITH_XIO)
set(HAVE_XIO ${XIO_FOUND})
endif(WITH_XIO)

option(WITH_DPDK "Enable DPDK messaging" OFF)
if(WITH_DPDK)
find_package(dpdk)
set(HAVE_DPDK ${DPDK_FOUND})
endif(WITH_DPDK)

#option for RGW
option(WITH_RADOSGW "Rados Gateway is enabled" ON)
if(WITH_RADOSGW)
Expand Down
64 changes: 53 additions & 11 deletions cmake/modules/Finddpdk.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Try to find spdk
# Try to find dpdk
#
# Once done, this will define
#
Expand All @@ -8,26 +8,68 @@

find_path(DPDK_INCLUDE_DIR rte_config.h
PATH_SUFFIXES dpdk)
find_library(DPDK_rte_eal_LIBRARY rte_eal)
find_library(DPDK_rte_hash_LIBRARY rte_hash)
find_library(DPDK_rte_kvargs_LIBRARY rte_kvargs)
find_library(DPDK_rte_mbuf_LIBRARY rte_mbuf)
find_library(DPDK_ethdev_LIBRARY ethdev)
find_library(DPDK_rte_mempool_LIBRARY rte_mempool)
find_library(DPDK_rte_ring_LIBRARY rte_ring)
find_library(DPDK_rte_eal_LIBRARY rte_eal)
find_library(DPDK_rte_cmdline_LIBRARY rte_cmdline)
find_library(DPDK_rte_pmd_bond_LIBRARY rte_pmd_bond)
find_library(DPDK_rte_pmd_vmxnet3_uio_LIBRARY rte_pmd_vmxnet3_uio)
find_library(DPDK_rte_pmd_ixgbe_LIBRARY rte_pmd_ixgbe)
find_library(DPDK_rte_pmd_i40e_LIBRARY rte_pmd_i40e)
find_library(DPDK_rte_pmd_ring_LIBRARY rte_pmd_ring)
find_library(DPDK_rte_pmd_af_packet_LIBRARY rte_pmd_af_packet)

set(check_LIBRARIES
${DPDK_rte_hash_LIBRARY}
${DPDK_rte_kvargs_LIBRARY}
${DPDK_rte_mbuf_LIBRARY}
${DPDK_ethdev_LIBRARY}
${DPDK_rte_mempool_LIBRARY}
${DPDK_rte_ring_LIBRARY}
${DPDK_rte_eal_LIBRARY}
${DPDK_rte_cmdline_LIBRARY}
${DPDK_rte_pmd_bond_LIBRARY}
${DPDK_rte_pmd_vmxnet3_uio_LIBRARY}
${DPDK_rte_pmd_ixgbe_LIBRARY}
${DPDK_rte_pmd_i40e_LIBRARY}
${DPDK_rte_pmd_ring_LIBRARY}
${DPDK_rte_pmd_af_packet_LIBRARY})

mark_as_advanced(DPDK_INCLUDE_DIR
DPDK_rte_eal_LIBRARY
DPDK_rte_hash_LIBRARY
DPDK_rte_kvargs_LIBRARY
DPDK_rte_mbuf_LIBRARY
DPDK_ethdev_LIBRARY
DPDK_rte_mempool_LIBRARY
DPDK_rte_ring_LIBRARY)
DPDK_rte_ring_LIBRARY
DPDK_rte_eal_LIBRARY
DPDK_rte_cmdline_LIBRARY
DPDK_rte_pmd_bond_LIBRARY
DPDK_rte_pmd_vmxnet3_uio_LIBRARY
DPDK_rte_pmd_ixgbe_LIBRARY
DPDK_rte_pmd_i40e_LIBRARY
DPDK_rte_pmd_ring_LIBRARY
DPDK_rte_pmd_af_packet_LIBRARY)

if (EXISTS ${WITH_DPDK_MLX5})
find_library(DPDK_rte_pmd_mlx5_LIBRARY rte_pmd_mlx5)
list(APPEND check_LIBRARIES ${DPDK_rte_pmd_mlx5_LIBRARY})
mark_as_advanced(DPDK_rte_pmd_mlx5_LIBRARY)
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(dpdk DEFAULT_MSG
DPDK_INCLUDE_DIR
DPDK_rte_eal_LIBRARY
DPDK_rte_mempool_LIBRARY
DPDK_rte_ring_LIBRARY)
check_LIBRARIES)

if(DPDK_FOUND)
if (EXISTS ${WITH_DPDK_MLX5})
list(APPEND check_LIBRARIES -libverbs)
endif()
set(DPDK_LIBRARIES
${DPDK_rte_eal_LIBRARY}
${DPDK_rte_mempool_LIBRARY}
${DPDK_rte_ring_LIBRARY})
-Wl,--whole-archive ${check_LIBRARIES} -Wl,--no-whole-archive)
endif(DPDK_FOUND)

28 changes: 28 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,15 @@ if(HAVE_RDMA)
list(APPEND EXTRALIBS ${RDMA_LIBRARIES} pthread rt)
endif(HAVE_RDMA)

if(HAVE_DPDK)
set(CMAKE_CXX_FLAGS "-march=native ${CMAKE_CXX_FLAGS} -I${DPDK_INCLUDE_DIR}")
list(APPEND EXTRALIBS ${DPDK_LIBRARY})
if(NOT USE_CRYPTOPP)
message(FATAL_ERROR "CRYPTOPP must be supported when enable DPDK.")
endif(NOT USE_CRYPTOPP)
list(APPEND EXTRALIBS ${DPDK_LIBRARIES})
endif(HAVE_DPDK)

# sort out which allocator to use
if(ALLOCATOR STREQUAL "tcmalloc")
set(ALLOC_LIBS ${GPERFTOOLS_TCMALLOC_LIBRARY})
Expand Down Expand Up @@ -325,6 +334,24 @@ if(HAVE_RDMA)
msg/async/rdma/RDMAStack.cc)
endif(HAVE_RDMA)

set(dpdk_common_srcs)
if(HAVE_DPDK)
list(APPEND dpdk_common_srcs
msg/async/dpdk/ARP.cc
msg/async/dpdk/DPDK.cc
msg/async/dpdk/dpdk_rte.cc
msg/async/dpdk/DPDKStack.cc
msg/async/dpdk/EventDPDK.cc
msg/async/dpdk/IP.cc
msg/async/dpdk/net.cc
msg/async/dpdk/IPChecksum.cc
msg/async/dpdk/Packet.cc
msg/async/dpdk/TCP.cc
msg/async/dpdk/UserspaceEvent.cc
msg/async/dpdk/ethernet.cc)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${DPDK_INCLUDE_DIR}")
endif(HAVE_DPDK)

if(HAVE_GOOD_YASM_ELF64)
set(yasm_srcs
common/crc32c_intel_fast_asm.S
Expand Down Expand Up @@ -411,6 +438,7 @@ set(libcommon_files
msg/async/net_handler.cc
${xio_common_srcs}
${async_rdma_common_srcs}
${dpdk_common_srcs}
msg/msg_types.cc
common/hobject.cc
osd/OSDMap.cc
Expand Down
Loading

0 comments on commit eae7d5a

Please sign in to comment.