Commit Graph

13 Commits

Author SHA1 Message Date
Jesper Dangaard Brouer
635a2f3ca4 MTU-tests: BPF-helper did make it upstream and in libbpf
The BPF-helper is now defined in bpf_helper_defs.h header:
 lib/libbpf-install/usr/include/bpf/bpf_helper_defs.h

Update and keep comment as a help for people doing kernel
devel on BPF and want to test BPF-helpers not yet upstream.

Accepted in kernel v5.12
 - commit 34b2021cc616 ("bpf: Add BPF-helper for MTU checking")
 - https://git.kernel.org/torvalds/c/34b2021cc616

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2021-10-26 16:10:57 +02:00
Jesper Dangaard Brouer
76060f0cb8 Merge pull request #8 from xdp-project/cleanups02.public
Cleanups for bpf-examples V2
2021-01-14 14:05:42 +01:00
Jesper Dangaard Brouer
ae7b0948f9 MTU-tests: Makefile detect if TC have libbpf
Only strip BTF info when TC don't have libbpf support.

Signed-off-by: Jesper Dangaard Brouer <netoptimizer@brouer.com>
2021-01-13 18:09:06 +01:00
Jesper Dangaard Brouer
12dc740a1a MTU-tests: Add tc_mtu_enforce.c
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2020-12-16 11:39:16 +01:00
Jesper Dangaard Brouer
f2a13d942f MTU-tests: Cycle through different MTU packet sizes
Encode this statically via C/BPF-code switch statement, and
have global counter cycles through these.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2020-10-13 22:10:28 +02:00
Jesper Dangaard Brouer
7c2badedd4 MTU-tests: Fix stripping object file from .BTF section
Shot myself in the foot with stripping ELF obj file.
This was the reason I could not load BPF program with TC.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2020-10-13 17:08:42 +02:00
Jesper Dangaard Brouer
78788141e4 MTU-tests: Use map as counter
This doesn't work.  It compiles, but loading with tc breaks.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2020-10-13 16:25:03 +02:00
Jesper Dangaard Brouer
cbb2da1d05 MTU-tests: Loading via tc seems not to support global vars
This code only works because LLVM optimize it as a constant.
As soon at I try to use it as variable it breaks.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2020-10-13 15:58:15 +02:00
Jesper Dangaard Brouer
bfc08deedd MTU-tests: Add README
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2020-10-13 15:37:05 +02:00
Jesper Dangaard Brouer
4f8b36e569 MTU-tests: iproute2 'tc' tool doesn't understand BTF debug info
It still works when loading, but results in a huge warning
which is really annoying.

Add a Makefile hack to strip the object file.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2020-10-13 15:35:08 +02:00
Jesper Dangaard Brouer
5f3898ca61 MTU-tests: Add encap header after adjusting pkt room
This makes it easier to see/decode packets via tcpdump.

Borrowing part of ../encap-forward/encap.h.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2020-10-13 15:34:50 +02:00
Jesper Dangaard Brouer
00eaf20fae MTU-tests: Add tc_bpf program that increase packet size
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2020-10-13 15:34:37 +02:00
Jesper Dangaard Brouer
74bde6b32c MTU-tests: Add new MTU-tests directory and Makefile
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2020-10-13 15:04:22 +02:00