Skip to content

Commit

Permalink
build: support building dpdk on arm64
Browse files Browse the repository at this point in the history
- build fm10k and sfc_efx pmd only for x86 due to arch dependent code
- fix dpdk machine name for arm64

To build seastar with dpdk on arm64:
$ ./configure.py --enable-dpdk --cflags=-march=armv8-a+crc+crypto ...

Message-Id: <[email protected]>
  • Loading branch information
cyb70289 authored and avikivity committed Jul 2, 2019
1 parent 44a300c commit aac05c3
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 36 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,7 @@ if (Seastar_DPDK)
set (Seastar_ARCH_FOR_wsm "westmere")
set (Seastar_ARCH_FOR_snb "sandybridge")
set (Seastar_ARCH_FOR_ivb "ivybridge")
set (Seastar_ARCH_FOR_armv8a "armv8-a")
set (Seastar_ARCH ${Seastar_ARCH_FOR_${Seastar_DPDK_MACHINE}})

if (NOT Seastar_ARCH)
Expand Down
91 changes: 57 additions & 34 deletions cmake/Finddpdk.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,37 +55,47 @@ find_library (dpdk_BUS_VDEV_LIBRARY rte_bus_vdev)

include (FindPackageHandleStandardArgs)

set (dpdk_REQUIRED
dpdk_INCLUDE_DIR
dpdk_PMD_VMXNET3_UIO_LIBRARY
dpdk_PMD_I40E_LIBRARY
dpdk_PMD_IXGBE_LIBRARY
dpdk_PMD_E1000_LIBRARY
dpdk_PMD_BNXT_LIBRARY
dpdk_PMD_RING_LIBRARY
dpdk_PMD_CXGBE_LIBRARY
dpdk_PMD_ENA_LIBRARY
dpdk_PMD_ENIC_LIBRARY
dpdk_PMD_NFP_LIBRARY
dpdk_PMD_QEDE_LIBRARY
dpdk_RING_LIBRARY
dpdk_KVARGS_LIBRARY
dpdk_MEMPOOL_LIBRARY
dpdk_MEMPOOL_RING_LIBRARY
dpdk_HASH_LIBRARY
dpdk_CMDLINE_LIBRARY
dpdk_MBUF_LIBRARY
dpdk_CFGFILE_LIBRARY
dpdk_EAL_LIBRARY
dpdk_ETHDEV_LIBRARY
dpdk_NET_LIBRARY
dpdk_TIMER_LIBRARY
dpdk_PCI_LIBRARY
dpdk_BUS_PCI_LIBRARY
dpdk_BUS_VDEV_LIBRARY)

# fm10k, sfc_efx driver can only build on x86
if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
set (dpdk_REQUIRED
${dpdk_REQUIRED}
dpdk_PMD_FM10K_LIBRARY
dpdk_PMD_SFC_EFX_LIBRARY)
endif()

find_package_handle_standard_args (dpdk
REQUIRED_VARS
dpdk_INCLUDE_DIR
dpdk_PMD_VMXNET3_UIO_LIBRARY
dpdk_PMD_I40E_LIBRARY
dpdk_PMD_IXGBE_LIBRARY
dpdk_PMD_E1000_LIBRARY
dpdk_PMD_BNXT_LIBRARY
dpdk_PMD_RING_LIBRARY
dpdk_PMD_CXGBE_LIBRARY
dpdk_PMD_ENA_LIBRARY
dpdk_PMD_ENIC_LIBRARY
dpdk_PMD_FM10K_LIBRARY
dpdk_PMD_NFP_LIBRARY
dpdk_PMD_QEDE_LIBRARY
dpdk_RING_LIBRARY
dpdk_KVARGS_LIBRARY
dpdk_MEMPOOL_LIBRARY
dpdk_MEMPOOL_RING_LIBRARY
dpdk_PMD_SFC_EFX_LIBRARY
dpdk_HASH_LIBRARY
dpdk_CMDLINE_LIBRARY
dpdk_MBUF_LIBRARY
dpdk_CFGFILE_LIBRARY
dpdk_EAL_LIBRARY
dpdk_ETHDEV_LIBRARY
dpdk_NET_LIBRARY
dpdk_TIMER_LIBRARY
dpdk_PCI_LIBRARY
dpdk_BUS_PCI_LIBRARY
dpdk_BUS_VDEV_LIBRARY)
${dpdk_REQUIRED}
)

if (dpdk_FOUND AND NOT (TARGET dpdk::dpdk))
set (dpdk_LIBRARIES
Expand All @@ -102,14 +112,22 @@ if (dpdk_FOUND AND NOT (TARGET dpdk::dpdk))
${dpdk_PMD_E1000_LIBRARY}
${dpdk_PMD_ENA_LIBRARY}
${dpdk_PMD_ENIC_LIBRARY}
${dpdk_PMD_FM10K_LIBRARY}
${dpdk_PMD_QEDE_LIBRARY}
${dpdk_PMD_I40E_LIBRARY}
${dpdk_PMD_IXGBE_LIBRARY}
${dpdk_PMD_NFP_LIBRARY}
${dpdk_PMD_RING_LIBRARY}
${dpdk_PMD_SFC_EFX_LIBRARY}
${dpdk_PMD_VMXNET3_UIO_LIBRARY}
${dpdk_PMD_VMXNET3_UIO_LIBRARY})

if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
set (dpdk_LIBRARIES
${dpdk_LIBRARIES}
${dpdk_PMD_FM10K_LIBRARY}
${dpdk_PMD_SFC_EFX_LIBRARY})
endif()

set (dpdk_LIBRARIES
${dpdk_LIBRARIES}
${dpdk_RING_LIBRARY}
${dpdk_NET_LIBRARY}
${dpdk_TIMER_LIBRARY}
Expand Down Expand Up @@ -449,13 +467,11 @@ if (dpdk_FOUND AND NOT (TARGET dpdk::dpdk))
dpdk::pmd_e1000
dpdk::pmd_ena
dpdk::pmd_enic
dpdk::pmd_fm10k
dpdk::pmd_qede
dpdk::pmd_i40e
dpdk::pmd_ixgbe
dpdk::pmd_nfp
dpdk::pmd_ring
dpdk::pmd_sfc_efx
dpdk::pmd_vmxnet3_uio
dpdk::ring
dpdk::net
Expand All @@ -464,6 +480,13 @@ if (dpdk_FOUND AND NOT (TARGET dpdk::dpdk))
dpdk::bus_pci
dpdk::bus_vdev)

if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
set (_dpdk_libraries
${_dpdk_libraries}
dpdk::pmd_fm10k
dpdk::pmd_sfc_efx)
endif()

set_target_properties (dpdk::dpdk
PROPERTIES
INTERFACE_LINK_LIBRARIES "${_dpdk_libraries}")
Expand Down
4 changes: 3 additions & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,18 @@ def infer_dpdk_machine(user_cflags):
arch = 'native'

# `-march` may be repeated, and we want the last one.
# strip features, leave only the arch: armv8-a+crc+crypto -> armv8-a
for flag in user_cflags.split():
if flag.startswith('-march'):
arch = flag[7:]
arch = flag[7:].split('+')[0]

MAPPING = {
'native': 'native',
'nehalem': 'nhm',
'westmere': 'wsm',
'sandybridge': 'snb',
'ivybridge': 'ivb',
'armv8-a': 'armv8a',
}

return MAPPING.get(arch, 'native')
Expand Down
6 changes: 5 additions & 1 deletion cooking_recipe.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,11 @@ cooking_ingredient (cryptopp

# Use the "native" profile that DPDK defines in `dpdk/config`, but in `dpdk_configure.cmake` we override
# CONFIG_RTE_MACHINE with `Seastar_DPDK_MACHINE`.
set (dpdk_quadruple ${CMAKE_SYSTEM_PROCESSOR}-native-linuxapp-gcc)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
set (dpdk_quadruple arm64-armv8a-linuxapp-gcc)
else()
set (dpdk_quadruple ${CMAKE_SYSTEM_PROCESSOR}-native-linuxapp-gcc)
endif()

set (dpdk_args
EXTRA_CFLAGS=-Wno-error
Expand Down

0 comments on commit aac05c3

Please sign in to comment.