Release Notes:
- https://github.com/xdp-project/xdp-tools/releases/tag/v1.5.8
- https://github.com/xdp-project/xdp-tools/releases/tag/v1.5.7
- https://github.com/xdp-project/xdp-tools/releases/tag/v1.5.6
- https://github.com/xdp-project/xdp-tools/releases/tag/v1.5.5
- https://github.com/xdp-project/xdp-tools/releases/tag/v1.5.4
- https://github.com/xdp-project/xdp-tools/releases/tag/v1.5.3
- https://github.com/xdp-project/xdp-tools/releases/tag/v1.5.2
- https://github.com/xdp-project/xdp-tools/releases/tag/v1.5.1
- https://github.com/xdp-project/xdp-tools/releases/tag/v1.5.0
- https://github.com/xdp-project/xdp-tools/releases/tag/v1.4.3
Remove upstreamed:
- 010-configure-respect-LDFLAGS.patch
- 020-libxdp-Use-__noinline__-reserved-attribute-for-XDP-d.patch
- 024-lib-allow-overwriting-W-flags-via-BPF_CFLAGS.patch
- 025-Add-BPF_LDFLAGS-to-allow-overwriting-llc-s-march-arg.patch
Remove unnecessary patch:
- 022-xdp-dump-add-missing-perf_event-include-for-bpf-and-.patch
(The included headers were incorrect. Some musl toolchain headers
appeared in the BPF bytecode generation path, which should not
happen. This issue is resolved by overriding CFLAGS and LDFLAGS.)
Remove `PKG_FLAGS:=nonshared`. With this flag enabled, the package is
compiled separately for every target. Removing it limits compilation
to each CPU architecture instead, significantly reducing unnecessary
build overhead.
Add new tools:
- xdp-bench:
XDP-bench is a benchmarking utility for exercising the different operation modes
of XDP. It is intended to be a simple program demonstrating the various operating
modes; these include dropping packets, hairpin forwarding (using the XDP_TX return
code), and redirection using the various in-kernel packet redirection facilities.
- xdp-forward:
xdp-forward is an XDP forwarding plane, which will accelerate
packet forwarding using XDP. To use it, simply load it on
the set of interfaces to accelerate forwarding between.
- xdp-monitor:
XDP-monitor is a tool that monitors various XDP related statistics and
events using BPF tracepoints infrastructure, trying to be as low overhead
as possible.
- xdp-trafficgen:
XDP-trafficgen is a packet generator utilising the XDP kernel subsystem
to generate packets transmit them through a network interface.
Packets are dynamically generated and transmitted in the kernel,
allowing for high performance (millions of packets per second per core).
Co-Developed-by: Til Kaiser <mail@tk154.de>
Link: https://github.com/openwrt/openwrt/pull/20903
Signed-off-by: Nick Hainke <vincent@systemli.org>
PKG_NAME:=xdp-tools
PKG_RELEASE:=1
-PKG_VERSION:=1.4.3
-PKG_HASH:=6e727e2c7c079dec86575c5d0e7aac7ecd582aabe04b3b176d7ef50e653b60c0
+PKG_VERSION:=1.5.8
+PKG_HASH:=e7b9717074c511fef34aab6e22b16af55fb33307505a5785d25a82b542e596ae
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/xdp-project/xdp-tools/tar.gz/v$(PKG_VERSION)?
PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
-PKG_BUILD_DEPENDS:=bpf-headers
-PKG_FLAGS:=nonshared
+PKG_BUILD_DEPENDS:=bpf-headers bpftool/host
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/bpf.mk
DEPENDS:=+libxdp
endef
+
+define Package/xdp-bench
+$(call Package/xdp-tools/Default)
+ TITLE:=xdp-bench - an XDP benchmarking tool
+ DEPENDS+=@KERNEL_DEBUG_INFO_BTF @KERNEL_KPROBES
+endef
+
+define Package/xdp-bench/description
+XDP-bench is a benchmarking utility for exercising the different operation modes
+of XDP. It is intended to be a simple program demonstrating the various operating
+modes; these include dropping packets, hairpin forwarding (using the XDP_TX return
+code), and redirection using the various in-kernel packet redirection facilities.
+endef
+
+
define Package/xdp-filter
$(call Package/xdp-tools/Default)
TITLE:=xdp-filter - a simple XDP-powered packet filter
endef
+define Package/xdp-forward
+$(call Package/xdp-tools/Default)
+ TITLE:=xdp-forward - the XDP forwarding plane
+ DEPENDS+=@KERNEL_DEBUG_INFO_BTF
+endef
+
+define Package/xdp-forward/description
+xdp-forward is an XDP forwarding plane, which will accelerate
+packet forwarding using XDP. To use it, simply load it on
+the set of interfaces to accelerate forwarding between.
+
+The userspace component of xdp-forward will then configure and
+load XDP programs on those interfaces, and forward packets between
+them using XDP_REDIRECT, using the kernel routing table or
+netfilter flowtable to determine the destination for each packet.
+endef
+
+
define Package/xdp-loader
$(call Package/xdp-tools/Default)
TITLE:=xdp-loader - an XDP program loader
load and unload semantics exposed by the libxdp library.
endef
+
+define Package/xdp-monitor
+$(call Package/xdp-tools/Default)
+ TITLE:=xdp-monitor - a simple XDP tracepoint monitoring tool
+ DEPENDS+=@KERNEL_DEBUG_INFO_BTF @KERNEL_KPROBES
+endef
+
+define Package/xdp-monitor/description
+XDP-monitor is a tool that monitors various XDP related statistics and
+events using BPF tracepoints infrastructure, trying to be as low overhead
+as possible.
+endef
+
+
+define Package/xdp-trafficgen
+$(call Package/xdp-tools/Default)
+ TITLE:=xdp-trafficgen - an XDP-based packet generator
+ DEPENDS+=@KERNEL_DEBUG_INFO_BTF @KERNEL_KPROBES
+endef
+
+define Package/xdp-trafficgen/description
+XDP-trafficgen is a packet generator utilising the XDP kernel subsystem
+to generate packets transmit them through a network interface.
+Packets are dynamically generated and transmitted in the kernel,
+allowing for high performance (millions of packets per second per core).
+
+XDP-trafficgen supports generating UDP traffic with fixed or dynamic
+destination ports, and also has basic support for generating dummy
+TCP traffic on a single flow.
+endef
+
+
define Package/xdpdump
$(call Package/xdp-tools/Default)
TITLE:=xdpdump - tool for capturing packets at the XDP layer
xdpdump - a simple tcpdump like tool for capturing packets at the XDP layer
endef
+
TARGET_LDFLAGS += $(INTL_LDFLAGS)
CONFIGURE_VARS += \
CFLAGS="$(TARGET_CFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS)" \
CLANG="$(CLANG)" \
- BPF_TARGET="$(BPF_ARCH)-linux-gnu" \
- LLC="$(LLVM_LLC)" \
- BPF_LDFLAGS="-march=$(BPF_TARGET) -mcpu=v3" \
- BPFTOOL=""
+ BPFTOOL="$(STAGING_DIR_HOST)/usr/sbin/bpftool"
ifneq ($(findstring s,$(OPENWRT_VERBOSE)),)
MAKE_FLAGS+=V=1
MAKE_VARS += \
PREFIX=/usr \
- RUNDIR=/tmp/run
-
-define Build/Configure
- $(call Build/Configure/Default)
- echo "BPF_CFLAGS += $(BPF_CFLAGS) -Wno-error -fno-stack-protector" >> $(PKG_BUILD_DIR)/config.mk
-endef
+ RUNDIR=/tmp/run \
+ CFLAGS="$(TARGET_CFLAGS)" \
+ LDFLAGS="$(TARGET_LDFLAGS)"
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/xdp
$(1)/usr/lib/pkgconfig/libxdp.pc
endef
+define Package/xdp-bench/install
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/xdp-bench $(1)/usr/sbin
+endef
+
define Package/xdp-filter/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/xdp-filter $(1)/usr/sbin
endef
+define Package/xdp-forward/install
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/xdp-forward $(1)/usr/sbin
+endef
+
define Package/xdp-loader/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/xdp-loader $(1)/usr/sbin
endef
+define Package/xdp-monitor/install
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/xdp-monitor $(1)/usr/sbin
+endef
+
+define Package/xdp-trafficgen/install
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/xdp-trafficgen $(1)/usr/sbin
+endef
+
define Package/xdpdump/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/xdpdump $(1)/usr/sbin
endef
$(eval $(call BuildPackage,libxdp))
+$(eval $(call BuildPackage,xdp-bench))
$(eval $(call BuildPackage,xdp-filter))
+$(eval $(call BuildPackage,xdp-forward))
$(eval $(call BuildPackage,xdp-loader))
+$(eval $(call BuildPackage,xdp-monitor))
+$(eval $(call BuildPackage,xdp-trafficgen))
$(eval $(call BuildPackage,xdpdump))
+++ /dev/null
---- a/configure
-+++ b/configure
-@@ -191,7 +191,7 @@ int main(int argc, char **argv) {
- return 0;
- }
- EOF
-- libpcap_err=$($CC -o $TMPDIR/libpcaptest $TMPDIR/libpcaptest.c $LIBPCAP_CFLAGS $LIBPCAP_LDLIBS 2>&1)
-+ libpcap_err=$($CC -o $TMPDIR/libpcaptest $TMPDIR/libpcaptest.c $LIBPCAP_CFLAGS $LIBPCAP_LDLIBS $LDFLAGS 2>&1)
- if [ "$?" -eq "0" ]; then
- echo "HAVE_PCAP:=y" >>$CONFIG
- [ -n "$LIBPCAP_CFLAGS" ] && echo 'CFLAGS += ' $LIBPCAP_CFLAGS >> $CONFIG
-@@ -267,7 +267,7 @@ int main(int argc, char **argv) {
- return 0;
- }
- EOF
-- compile_cmd="$CC -o $TMPDIR/libbpftest $TMPDIR/libbpftest.c -Werror $LIBBPF_CFLAGS $LIBBPF_LDLIBS"
-+ compile_cmd="$CC -o $TMPDIR/libbpftest $TMPDIR/libbpftest.c -Werror $LIBBPF_CFLAGS $LIBBPF_LDLIBS $LDFLAGS"
- libbpf_err=$($compile_cmd 2>&1)
- if [ "$?" -eq "0" ]; then
- echo "HAVE_FEATURES+=${config_var}" >>"$CONFIG"
-@@ -345,7 +345,7 @@ int main(int argc, char **argv) {
- }
- EOF
-
-- libbpf_err=$($CC -o $TMPDIR/libbpftest $TMPDIR/libbpftest.c -Werror $LIBBPF_CFLAGS $LIBBPF_LDLIBS 2>&1)
-+ libbpf_err=$($CC -o $TMPDIR/libbpftest $TMPDIR/libbpftest.c -Werror $LIBBPF_CFLAGS $LIBBPF_LDLIBS $LDFLAGS 2>&1)
- if [ "$?" -eq "0" ]; then
- echo "SYSTEM_LIBBPF:=y" >>$CONFIG
- echo "LIBBPF_VERSION=$LIBBPF_VERSION" >>$CONFIG
+++ /dev/null
-From 1f160c287c14b4300c4248752e20da5981c9763e Mon Sep 17 00:00:00 2001
-From: Christian Marangi <ansuelsmth@gmail.com>
-Date: Wed, 18 Jan 2023 19:00:54 +0100
-Subject: [PATCH] libxdp: Use __noinline__ reserved attribute for XDP
- dispatcher
-
-The use of noinline is wrong as noline is not a reserved attribute and
-with gcc12 this became an error. Use the reserved __noinline__ attribute
-to fix compilation error.
-
-Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
-[a.heider: adapt lib/libxdp/protocol.org too]
-Signed-off-by: Andre Heider <a.heider@gmail.com>
----
- lib/libxdp/protocol.org | 2 +-
- lib/libxdp/xdp-dispatcher.c.in | 4 ++--
- 2 files changed, 3 insertions(+), 3 deletions(-)
-
---- a/lib/libxdp/protocol.org
-+++ b/lib/libxdp/protocol.org
-@@ -59,7 +59,7 @@ static volatile const struct xdp_dispatc
- /* The volatile return value prevents the compiler from assuming it knows the
- * return value and optimising based on that.
- */
--__attribute__ ((noinline))
-+__attribute__ ((__noinline__))
- int prog0(struct xdp_md *ctx) {
- volatile int ret = XDP_DISPATCHER_RETVAL;
-
---- a/lib/libxdp/xdp-dispatcher.c.in
-+++ b/lib/libxdp/xdp-dispatcher.c.in
-@@ -29,7 +29,7 @@ static volatile const struct xdp_dispatc
- * return value and optimising based on that.
- */
- forloop(`i', `0', NUM_PROGS,
--`__attribute__ ((noinline))
-+`__attribute__ ((__noinline__))
- int format(`prog%d', i)(struct xdp_md *ctx) {
- volatile int ret = XDP_DISPATCHER_RETVAL;
-
-@@ -39,7 +39,7 @@ int format(`prog%d', i)(struct xdp_md *c
- }
- ')
-
--__attribute__ ((noinline))
-+__attribute__ ((__noinline__))
- int compat_test(struct xdp_md *ctx) {
- volatile int ret = XDP_DISPATCHER_RETVAL;
-
+++ /dev/null
-From 0388d7447de027e0d2369d6b8a9c58ea0f8f027c Mon Sep 17 00:00:00 2001
-From: Christian Marangi <ansuelsmth@gmail.com>
-Date: Wed, 18 Jan 2023 20:37:12 +0100
-Subject: [PATCH] xdp-dump: add missing perf_event include for bpf and xdp
-
-Add missing perf_event include needed for struct perf_event_header for
-bpf and xdp.
-
-Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
----
- xdp-dump/xdpdump_bpf.c | 1 +
- xdp-dump/xdpdump_xdp.c | 1 +
- 2 files changed, 2 insertions(+)
-
---- a/xdp-dump/xdpdump_bpf.c
-+++ b/xdp-dump/xdpdump_bpf.c
-@@ -4,6 +4,7 @@
- * Include files
- *****************************************************************************/
- #include <stdbool.h>
-+#include <linux/perf_event.h>
- #include <linux/bpf.h>
- #include <bpf/bpf_helpers.h>
- #include <bpf/bpf_trace_helpers.h>
---- a/xdp-dump/xdpdump_xdp.c
-+++ b/xdp-dump/xdpdump_xdp.c
-@@ -4,6 +4,7 @@
- * Include files
- *****************************************************************************/
- #include <stdbool.h>
-+#include <linux/perf_event.h>
- #include <linux/bpf.h>
- #include <bpf/bpf_helpers.h>
- #include <bpf/bpf_trace_helpers.h>
+++ /dev/null
-From e2d8eae9477f6ba41ab75ad77202f235e34c04f7 Mon Sep 17 00:00:00 2001
-From: Andre Heider <a.heider@gmail.com>
-Date: Wed, 18 Jan 2023 22:30:23 +0100
-Subject: [PATCH] lib: allow overwriting -W* flags via BPF_CFLAGS
-
-The bpf header file situation is a mess, and the default warning
-compiler flags may not be suitable everywhere, especially with -Werror
-in the mix.
-
-Move BPF_CFLAGS further down, so these can be overwritten by builders.
-
-Signed-off-by: Andre Heider <a.heider@gmail.com>
----
- lib/common.mk | 2 +-
- lib/libxdp/Makefile | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
---- a/lib/common.mk
-+++ b/lib/common.mk
-@@ -111,12 +111,12 @@ $(XDP_OBJ): %.o: %.c $(KERN_USER_H) $(EX
- $(QUIET_CLANG)$(CLANG) -S \
- -target $(BPF_TARGET) \
- -D __BPF_TRACING__ \
-- $(BPF_CFLAGS) \
- -Wall \
- -Wno-unused-value \
- -Wno-pointer-sign \
- -Wno-compare-distinct-pointer-types \
- -Werror \
-+ $(BPF_CFLAGS) \
- -O2 -emit-llvm -c -g -o ${@:.o=.ll} $<
- $(QUIET_LLC)$(LLC) -march=$(BPF_TARGET) -filetype=obj -o $@ ${@:.o=.ll}
-
---- a/lib/libxdp/Makefile
-+++ b/lib/libxdp/Makefile
-@@ -138,12 +138,12 @@ $(XDP_OBJS): %.o: %.c $(BPF_HEADERS) $(L
- $(QUIET_CLANG)$(CLANG) -S \
- -target $(BPF_TARGET) \
- -D __BPF_TRACING__ \
-- $(BPF_CFLAGS) \
- -Wall \
- -Wno-unused-value \
- -Wno-pointer-sign \
- -Wno-compare-distinct-pointer-types \
- -Werror \
-+ $(BPF_CFLAGS) \
- -O2 -emit-llvm -c -g -o ${@:.o=.ll} $<
- $(QUIET_LLC)$(LLC) -march=$(BPF_TARGET) -filetype=obj -o $@ ${@:.o=.ll}
-
+++ /dev/null
-From 7b00d4a90af1d7bff50833ffe1216cf59592353a Mon Sep 17 00:00:00 2001
-From: Andre Heider <a.heider@gmail.com>
-Date: Wed, 18 Jan 2023 22:42:28 +0100
-Subject: [PATCH] Add BPF_LDFLAGS to allow overwriting llc's -march argument
-
-The argument to clang's -target isn't necessarily the same as to
-llc's -march.
-
-Analogue to BPF_CFLAGS, introduce BPF_LDFLAGS to allow e.g.:
-BPF_TARGET="mipsel-linux-gnu" BPF_LDFLAGS="-march=bpfel -mcpu=v3"
-
-Signed-off-by: Andre Heider <a.heider@gmail.com>
----
- configure | 2 ++
- lib/common.mk | 2 +-
- lib/libxdp/Makefile | 2 +-
- 3 files changed, 4 insertions(+), 2 deletions(-)
-
---- a/configure
-+++ b/configure
-@@ -17,10 +17,12 @@ check_opts()
- : ${DYNAMIC_LIBXDP:=0}
- : ${MAX_DISPATCHER_ACTIONS:=10}
- : ${BPF_TARGET:=bpf}
-+ : ${BPF_LDFLAGS:=-march=$(BPF_TARGET)}
- echo "PRODUCTION:=${PRODUCTION}" >>$CONFIG
- echo "DYNAMIC_LIBXDP:=${DYNAMIC_LIBXDP}" >>$CONFIG
- echo "MAX_DISPATCHER_ACTIONS:=${MAX_DISPATCHER_ACTIONS}" >>$CONFIG
- echo "BPF_TARGET:=${BPF_TARGET}" >>$CONFIG
-+ echo "BPF_LDFLAGS:=${BPF_LDFLAGS}" >>$CONFIG
- }
-
- find_tool()
---- a/lib/common.mk
-+++ b/lib/common.mk
-@@ -118,7 +118,7 @@ $(XDP_OBJ): %.o: %.c $(KERN_USER_H) $(EX
- -Werror \
- $(BPF_CFLAGS) \
- -O2 -emit-llvm -c -g -o ${@:.o=.ll} $<
-- $(QUIET_LLC)$(LLC) -march=$(BPF_TARGET) -filetype=obj -o $@ ${@:.o=.ll}
-+ $(QUIET_LLC)$(LLC) $(BPF_LDFLAGS) -filetype=obj -o $@ ${@:.o=.ll}
-
- $(BPF_SKEL_H): %.skel.h: %.bpf.o
- $(QUIET_GEN)$(BPFTOOL) gen skeleton $< name ${@:.skel.h=} > $@
---- a/lib/libxdp/Makefile
-+++ b/lib/libxdp/Makefile
-@@ -145,7 +145,7 @@ $(XDP_OBJS): %.o: %.c $(BPF_HEADERS) $(L
- -Werror \
- $(BPF_CFLAGS) \
- -O2 -emit-llvm -c -g -o ${@:.o=.ll} $<
-- $(QUIET_LLC)$(LLC) -march=$(BPF_TARGET) -filetype=obj -o $@ ${@:.o=.ll}
-+ $(QUIET_LLC)$(LLC) $(BPF_LDFLAGS) -filetype=obj -o $@ ${@:.o=.ll}
-
- .PHONY: man
- ifeq ($(EMACS),)