On Wed, Jul 13, 2022 at 4:15 AM Toke Høiland-Jørgensen <toke@xxxxxxxxxx> wrote: > > This adds selftests for both variants of the generic PIFO map type, and for > the dequeue program type. The XDP test uses bpf_prog_run() to run an XDP > program that puts packets into a PIFO map, and then adds tests that pull > them back out again through bpf_prog_run() of a dequeue program, as well as > by attaching a dequeue program to a veth device and scheduling transmission > there. > > Signed-off-by: Toke Høiland-Jørgensen <toke@xxxxxxxxxx> > --- > .../selftests/bpf/prog_tests/pifo_map.c | 125 ++++++++++++++ > .../bpf/prog_tests/xdp_pifo_test_run.c | 154 ++++++++++++++++++ > tools/testing/selftests/bpf/progs/pifo_map.c | 54 ++++++ > .../selftests/bpf/progs/test_xdp_pifo.c | 110 +++++++++++++ > 4 files changed, 443 insertions(+) > create mode 100644 tools/testing/selftests/bpf/prog_tests/pifo_map.c > create mode 100644 tools/testing/selftests/bpf/prog_tests/xdp_pifo_test_run.c > create mode 100644 tools/testing/selftests/bpf/progs/pifo_map.c > create mode 100644 tools/testing/selftests/bpf/progs/test_xdp_pifo.c > [...] > +__u16 pkt_count = 0; > +__u16 drop_above = 2; > + > +SEC("dequeue") "dequeue" seems like a way too generic term, why not "xdp_dequeue" or something like that? Isn't this XDP specific program? > +void *dequeue_pifo(struct dequeue_ctx *ctx) > +{ > + __u64 prio = 0, pkt_prio = 0; > + void *data, *data_end; > + struct xdp_md *pkt; > + struct ethhdr *eth; > + [...]