Skip to content

Commit

Permalink
Use xdp-loader from xdp-tools
Browse files Browse the repository at this point in the history
Signed-off-by: Donald Hunter <[email protected]>
  • Loading branch information
donaldh committed Mar 3, 2023
1 parent 6ba85ab commit 0ded568
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 123 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Mkfile.old
dkms.conf

# Userspace programs
xdp-loader
xdp_loader
xdp_stats
xdp_pass_user
Expand Down
21 changes: 13 additions & 8 deletions common/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ COMMON_DIR ?= ../common
LIB_DIR ?= ../lib

COPY_LOADER ?=
LOADER_DIR ?= $(COMMON_DIR)/../basic-solutions
LOADER_DIR ?= $(LIB_DIR)/xdp-tools/xdp-loader
STATS_DIR ?= $(COMMON_DIR)/../basic-solutions

COMMON_OBJS += $(COMMON_DIR)/common_params.o
include $(LIB_DIR)/defines.mk
Expand All @@ -48,18 +49,22 @@ all: llvm-check $(USER_TARGETS) $(XDP_OBJ) $(COPY_LOADER) $(COPY_STATS)
.PHONY: clean $(CLANG) $(LLC)

clean:
$(Q)rm -f $(USER_TARGETS) $(BPF_OBJ) $(USER_OBJ) $(USER_GEN) $(USER_TARGETS_OBJS) *.ll
$(Q)rm -f $(USER_TARGETS) $(XDP_OBJ) $(USER_OBJ) $(COPY_LOADER) $(COPY_STATS) *.ll

ifdef COPY_LOADER
$(COPY_LOADER): $(LOADER_DIR)/${COPY_LOADER:=.c} $(COMMON_H)
make -C $(LOADER_DIR) $(COPY_LOADER)
cp $(LOADER_DIR)/$(COPY_LOADER) $(COPY_LOADER)
$(LOADER_DIR)/$(COPY_LOADER):
$(Q)make -C $(LOADER_DIR)

$(COPY_LOADER): $(LOADER_DIR)/$(COPY_LOADER)
$(QUIET_COPY)cp $(LOADER_DIR)/$(COPY_LOADER) $(COPY_LOADER)
endif

ifdef COPY_STATS
$(COPY_STATS): $(LOADER_DIR)/${COPY_STATS:=.c} $(COMMON_H)
make -C $(LOADER_DIR) $(COPY_STATS)
cp $(LOADER_DIR)/$(COPY_STATS) $(COPY_STATS)
$(STATS_DIR)/$(COPY_STATS): $(STATS_DIR)/${COPY_STATS:=.c} $(COMMON_H)
$(Q)make -C $(STATS_DIR) $(COPY_STATS)

$(COPY_STATS): $(STATS_DIR)/$(COPY_STATS)
$(QUIET_COPY)cp $(STATS_DIR)/$(COPY_STATS) $(COPY_STATS)
# Needing xdp_stats imply depending on header files:
EXTRA_DEPS += $(COMMON_DIR)/xdp_stats_kern.h $(COMMON_DIR)/xdp_stats_kern_user.h
endif
Expand Down
1 change: 1 addition & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ ifeq (\$(VERBOSE), 0)
QUIET_LINK = @echo ' LINK '\$@;
QUIET_INSTALL = @echo ' INSTALL '\$@;
QUIET_GEN = @echo ' GEN '\$@;
QUIET_COPY = @echo ' COPY '\$@;
endif
EOF
}
Expand Down
2 changes: 1 addition & 1 deletion experiment01-tailgrow/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ XDP_TARGETS += xdp_prog_fail3

COMMON_DIR = ../common

COPY_LOADER := xdp_loader
COPY_LOADER := xdp-loader
COPY_STATS := xdp_stats
EXTRA_DEPS := $(COMMON_DIR)/parsing_helpers.h

Expand Down
109 changes: 0 additions & 109 deletions lib/common.mk

This file was deleted.

2 changes: 1 addition & 1 deletion packet-solutions/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ USER_TARGETS := xdp_prog_user

COMMON_DIR = ../common

COPY_LOADER := xdp_loader
COPY_LOADER := xdp-loader
COPY_STATS := xdp_stats
EXTRA_DEPS += $(COMMON_DIR)/parsing_helpers.h

Expand Down
2 changes: 1 addition & 1 deletion packet01-parsing/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ USER_TARGETS :=

COMMON_DIR = ../common

COPY_LOADER := xdp_loader
COPY_LOADER := xdp-loader
COPY_STATS := xdp_stats

include $(COMMON_DIR)/common.mk
2 changes: 1 addition & 1 deletion packet02-rewriting/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ USER_TARGETS :=

COMMON_DIR = ../common

COPY_LOADER := xdp_loader
COPY_LOADER := xdp-loader
COPY_STATS := xdp_stats
EXTRA_DEPS := $(COMMON_DIR)/parsing_helpers.h

Expand Down
2 changes: 1 addition & 1 deletion packet03-redirecting/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ USER_TARGETS := xdp_prog_user

COMMON_DIR = ../common

COPY_LOADER := xdp_loader
COPY_LOADER := xdp-loader
COPY_STATS := xdp_stats
EXTRA_DEPS := $(COMMON_DIR)/parsing_helpers.h

Expand Down
2 changes: 1 addition & 1 deletion tracing03-xdp-debug-print/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
XDP_TARGETS := xdp_prog_kern
USER_TARGETS := trace_read

COPY_LOADER = xdp_loader
COPY_LOADER = xdp-loader

LLC ?= llc
CLANG ?= clang
Expand Down

0 comments on commit 0ded568

Please sign in to comment.