Skip to content

Commit

Permalink
Add DPDK 21.05 support for Armv7 based platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
coolsnowwolf committed Jun 14, 2021
1 parent 77181ee commit bb23907
Show file tree
Hide file tree
Showing 2 changed files with 143 additions and 0 deletions.
52 changes: 52 additions & 0 deletions package/network/utils/dpdk/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# SPDX-License-Identifier: GPL-2.0-only
#

include $(TOPDIR)/rules.mk

PKG_NAME := dpdk
PKG_VERSION := 21.05

PKG_SOURCE := dpdk-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL := http://static.dpdk.org/rel
PKG_MD5SUM := a78bba290b11d9717d1272cc6bfaf7c3

PKG_BUILD_DEPENDS:= meson/host ninja/host
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/host-build.mk
include ../../../feeds/packages/meson/meson.mk
include ../../../feeds/packages/ninja/ninja.mk

ifeq ($(CONFIG_LIBC),"glibc")
PKG_CONFIG := $(PKG_BUILD_DIR)/config/arm/arm_armv7a_linux_glibc_gcc
else
PKG_CONFIG := $(PKG_BUILD_DIR)/config/arm/arm_armv7a_linux_musl_gcc
endif

TARGET_CFLAGS += -D_GNU_SOURCE -Wno-unused-result -Wno-format-nonliteral

define Package/dpdk
SECTION := net
CATEGORY := Network
TITLE := Data Plane Development Kit (DPDK)
DEPENDS := @(arm) +librt +libpthread +libbpf +libpcap
endef

define Package/dpdk/description
DPDK consists of libraries to accelerate packet processing
workloads running on a wide variety of CPU architectures.
endef

define Build/Configure
$(call Build/Configure/Meson) --cross-file $(PKG_CONFIG)
endef

define Package/dpdk/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/bin/dpdk-testpmd $(1)/usr/bin/
$(CP) $(PKG_INSTALL_DIR)/usr/bin/dpdk-proc-info $(1)/usr/bin/
$(CP) $(PKG_INSTALL_DIR)/usr/bin/dpdk-test-flow-perf $(1)/usr/bin/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib* $(1)/usr/lib/
endef

$(eval $(call BuildPackage,dpdk))
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
From e8fa8aa186644e797ca1df457f5bbe146e901bad Mon Sep 17 00:00:00 2001
From: Chandrakant Sharpa <[email protected]>
Date: Wed, 9 Jun 2021 14:07:10 +0530
Subject: [PATCH] Add DPDK support for Armv7

Signed-off-by: Chandrakant Sharpa <[email protected]>
---
config/arm/arm_armv7a_linux_glibc_gcc | 17 +++++++++++++++++
config/arm/arm_armv7a_linux_musl_gcc | 17 +++++++++++++++++
lib/eal/linux/eal_debug.c | 2 ++
3 files changed, 36 insertions(+)
create mode 100644 config/arm/arm_armv7a_linux_glibc_gcc
create mode 100644 config/arm/arm_armv7a_linux_musl_gcc

diff --git a/config/arm/arm_armv7a_linux_glibc_gcc b/config/arm/arm_armv7a_linux_glibc_gcc
new file mode 100644
index 000000000..5981a5b9f
--- /dev/null
+++ b/config/arm/arm_armv7a_linux_glibc_gcc
@@ -0,0 +1,17 @@
+[binaries]
+c = 'arm-openwrt-linux-gnueabi-gcc'
+cpp = 'arm-openwrt-linux-gnueabi-cpp'
+ar = 'arm-openwrt-linux-gnueabi-ar'
+strip = 'arm-openwrt-linux-gnueabi-strip'
+pkgconfig = 'arm-openwrt-linux-gnueabi-pkg-config'
+pcap-config = ''
+
+[host_machine]
+system = 'linux'
+cpu_family = 'arm'
+cpu = 'armv7-a'
+endian = 'little'
+
+[properties]
+# Generate binaries that are portable across all Armv7 machines
+platform = 'generic'
diff --git a/config/arm/arm_armv7a_linux_musl_gcc b/config/arm/arm_armv7a_linux_musl_gcc
new file mode 100644
index 000000000..9b4a5dd1e
--- /dev/null
+++ b/config/arm/arm_armv7a_linux_musl_gcc
@@ -0,0 +1,17 @@
+[binaries]
+c = 'arm-openwrt-linux-muslgnueabi-gcc'
+cpp = 'arm-openwrt-linux-muslgnueabi-cpp'
+ar = 'arm-openwrt-linux-muslgnueabi-ar'
+strip = 'arm-openwrt-linux-muslgnueabi-strip'
+pkgconfig = 'arm-openwrt-linux-muslgnueabi-pkg-config'
+pcap-config = ''
+
+[host_machine]
+system = 'linux'
+cpu_family = 'arm'
+cpu = 'armv7-a'
+endian = 'little'
+
+[properties]
+# Generate binaries that are portable across all Armv7 machines
+platform = 'generic'
diff --git a/lib/eal/linux/eal_debug.c b/lib/eal/linux/eal_debug.c
index 64dab4e0d..3dbf42248 100644
--- a/lib/eal/linux/eal_debug.c
+++ b/lib/eal/linux/eal_debug.c
@@ -2,9 +2,12 @@
* Copyright(c) 2010-2014 Intel Corporation
*/

+#ifdef __GLIBC__
#ifdef RTE_BACKTRACE
#include <execinfo.h>
#endif
+#endif
+
#include <stdarg.h>
#include <signal.h>
#include <stdlib.h>
@@ -26,8 +26,10 @@ void rte_dump_stack(void)
char **symb = NULL;
int size;

+#ifdef __GLIBC__
size = backtrace(func, BACKTRACE_SIZE);
symb = backtrace_symbols(func, size);
+#endif

if (symb == NULL)
return;
--
2.17.1

0 comments on commit bb23907

Please sign in to comment.