On Wed, Jan 4, 2023 at 3:15 PM Andrii Nakryiko <andrii.nakryiko@xxxxxxxxx> wrote: > > On Wed, Jan 4, 2023 at 4:19 AM Magnus Karlsson > <magnus.karlsson@xxxxxxxxx> wrote: > > > > From: Magnus Karlsson <magnus.karlsson@xxxxxxxxx> > > > > Get rid of the built-in XDP program that was part of the old libbpf > > code in xsk.c and replace it with an eBPF program build using the > > framework by all the other bpf selftests. This will form the base for > > adding more programs in later commits. > > > > Signed-off-by: Magnus Karlsson <magnus.karlsson@xxxxxxxxx> > > --- > > tools/testing/selftests/bpf/Makefile | 2 +- > > .../selftests/bpf/progs/xsk_xdp_progs.c | 19 ++++ > > tools/testing/selftests/bpf/xsk.c | 88 ++++--------------- > > tools/testing/selftests/bpf/xsk.h | 6 +- > > tools/testing/selftests/bpf/xskxceiver.c | 72 ++++++++------- > > tools/testing/selftests/bpf/xskxceiver.h | 7 +- > > 6 files changed, 88 insertions(+), 106 deletions(-) > > create mode 100644 tools/testing/selftests/bpf/progs/xsk_xdp_progs.c > > > > diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile > > index 205e8c3c346a..a0193a8f9da6 100644 > > --- a/tools/testing/selftests/bpf/Makefile > > +++ b/tools/testing/selftests/bpf/Makefile > > @@ -240,7 +240,7 @@ $(OUTPUT)/flow_dissector_load: $(TESTING_HELPERS) > > $(OUTPUT)/test_maps: $(TESTING_HELPERS) > > $(OUTPUT)/test_verifier: $(TESTING_HELPERS) $(CAP_HELPERS) > > $(OUTPUT)/xsk.o: $(BPFOBJ) > > shouldn't $(OUTPUT)/xsk_xdp_progs.skel.h be added as a dependency > here, at .o file? Not sure we can: xsk.o is a 'generic' library and xsk_xdp_progs.skel.h is xskxceiver-specific. I was trying to see how it works for the other cases where we depend on the headers and saw the following: $(OUTPUT)/test_verifier: test_verifier.c verifier/tests.h $(BPFOBJ) | $(OUTPUT) $(call msg,BINARY,,$@) $(Q)$(CC) $(CFLAGS) $(filter %.a %.o %.c,$^) $(LDLIBS) -o $@ So at least for test_verifier, we explicitly filter out anything non-.[aoc]. Presumably because of the same issue? Should we do the same for xskxceiver? I've sent similar changes for my xdp_hw_metadata binary about an hour ago.. > > -$(OUTPUT)/xskxceiver: $(OUTPUT)/xsk.o > > +$(OUTPUT)/xskxceiver: $(OUTPUT)/xsk.o $(OUTPUT)/xsk_xdp_progs.skel.h > > and not here. Is that why we have this clang compilation failure? > > > > > BPFTOOL ?= $(DEFAULT_BPFTOOL) > > $(DEFAULT_BPFTOOL): $(wildcard $(BPFTOOLDIR)/*.[ch] $(BPFTOOLDIR)/Makefile) \ > > [...]