[PATCH bpf-next v3 4/6] selftests/bpf: refactor xdp_context_functional test and bpf program

2025-02-24 Thread Marcus Wichelmann
p the testing code short. Signed-off-by: Marcus Wichelmann --- .../bpf/prog_tests/xdp_context_test_run.c | 99 +++ .../selftests/bpf/progs/test_xdp_meta.c | 56 ++- 2 files changed, 112 insertions(+), 43 deletions(-) diff --git a/tools/testing/selftests/b

[PATCH bpf-next v3 5/6] selftests/bpf: add test for XDP metadata support in tun driver

2025-02-24 Thread Marcus Wichelmann
the previous commit ("selftests/bpf: refactor xdp_context_functional test and bpf program") for details about the test design. Signed-off-by: Marcus Wichelmann --- .../bpf/prog_tests/xdp_context_test_run.c | 64 +++ 1 file changed, 64 insertions(+) diff --git a/too

[PATCH bpf-next v3 6/6] selftests/bpf: fix file descriptor assertion in open_tuntap helper

2025-02-24 Thread Marcus Wichelmann
n(/dev/net/tun) unexpected open(/dev/net/tun): actual 0 <= expected 0 Signed-off-by: Marcus Wichelmann --- tools/testing/selftests/bpf/network_helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/network_helpers.c b/tools/testing/self

[PATCH bpf-next v3 3/6] selftests/bpf: move open_tuntap to network helpers

2025-02-24 Thread Marcus Wichelmann
To test the XDP metadata functionality of the tun driver, it's necessary to create a new tap device first. A helper function for this already exists in lwt_helpers.h. Move it to the common network helpers header, so it can be reused in other tests. Signed-off-by: Marcus Wichelmann ---

[PATCH bpf-next v3 0/6] XDP metadata support for tun driver

2025-02-24 Thread Marcus Wichelmann
-patches/bpf/actions/runs/13449071153/job/37580497963 Setting the NOARP flag on the interfaces should fix this race condition. Successful pipeline: https://github.com/kernel-patches/bpf/actions/runs/13500667544 Signed-off-by: Marcus Wichelmann Acked-by: Jason Wang Reviewed-by: Willem de Bruijn

[PATCH bpf-next v3 1/6] net: tun: enable XDP metadata support

2025-02-24 Thread Marcus Wichelmann
t driver is the only one using TUN_MSG_PTR and it already initializes the xdp_buffs with metadata support and sufficient headroom. But the tun driver disables it again, so the xdp_set_data_meta_invalid call has to be removed. Signed-off-by: Marcus Wichelmann --- drivers/net/tun.c | 3 +-- 1

[PATCH bpf-next v3 2/6] net: tun: enable transfer of XDP metadata to skb

2025-02-24 Thread Marcus Wichelmann
More information about this feature can be found in the commit message of commit de8f3a83b0a0 ("bpf: add meta pointer for direct access"). Signed-off-by: Marcus Wichelmann --- drivers/net/tun.c | 25 ++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/dri

Re: [PATCH bpf-next v3 4/6] selftests/bpf: refactor xdp_context_functional test and bpf program

2025-02-26 Thread Marcus Wichelmann
Am 25.02.25 um 19:23 schrieb Willem de Bruijn: Marcus Wichelmann wrote: Am 24.02.25 um 16:29 schrieb Marcus Wichelmann: [...] + /* By default, Linux sends IPv6 multicast listener reports which +* interfere with this test. Set the IFF_NOARP flag to ensure +* silence on the

Re: [PATCH bpf-next v3 5/6] selftests/bpf: add test for XDP metadata support in tun driver

2025-02-26 Thread Marcus Wichelmann
Am 24.02.25 um 18:14 schrieb Stanislav Fomichev: On 02/24, Marcus Wichelmann wrote: Add a selftest that creates a tap device, attaches XDP and TC programs, writes a packet with a test payload into the tap device and checks the test result. This test ensures that the XDP metadata support in the

Re: [PATCH bpf-next v3 5/6] selftests/bpf: add test for XDP metadata support in tun driver

2025-02-26 Thread Marcus Wichelmann
Am 26.02.25 um 20:00 schrieb Stanislav Fomichev: On 02/26, Marcus Wichelmann wrote: Am 24.02.25 um 18:14 schrieb Stanislav Fomichev: On 02/24, Marcus Wichelmann wrote: [...] +void test_xdp_context_tuntap(void) tap0 is already used by lwt tests, so there is a chance this new test will

Re: [PATCH bpf-next v3 4/6] selftests/bpf: refactor xdp_context_functional test and bpf program

2025-02-26 Thread Marcus Wichelmann
Am 24.02.25 um 18:12 schrieb Stanislav Fomichev: On 02/24, Marcus Wichelmann wrote: [..] +int send_test_packet(int ifindex) nit: static? same for assert_test_result below Yeah why not. Will change it. Thanks!

Re: [PATCH bpf-next v3 4/6] selftests/bpf: refactor xdp_context_functional test and bpf program

2025-02-26 Thread Marcus Wichelmann
Am 25.02.25 um 19:32 schrieb Willem de Bruijn: Marcus Wichelmann wrote: The existing XDP metadata test works by creating a veth pair and attaching XDP & TC programs that drop the packet when the condition of the test isn't fulfilled. The test then pings through the veth pair and succ

Re: [PATCH bpf-next v3 4/6] selftests/bpf: refactor xdp_context_functional test and bpf program

2025-02-25 Thread Marcus Wichelmann
Am 24.02.25 um 16:29 schrieb Marcus Wichelmann: [...] + /* By default, Linux sends IPv6 multicast listener reports which +* interfere with this test. Set the IFF_NOARP flag to ensure +* silence on the interface. +*/ + SYS(close, "ip link set dev &quo

Re: [PATCH bpf-next v3 0/6] XDP metadata support for tun driver

2025-02-25 Thread Marcus Wichelmann
Am 25.02.25 um 15:55 schrieb Willem de Bruijn: Marcus Wichelmann wrote: [...] Signed-off-by: Marcus Wichelmann Acked-by: Jason Wang Reviewed-by: Willem de Bruijn Please don't add tags, unless a person has explicitly added them. And they are only sticky when the code has not been ch

[PATCH bpf-next v2 5/6] selftests/bpf: add test for XDP metadata support in tun driver

2025-02-17 Thread Marcus Wichelmann
the previous commit ("selftests/bpf: refactor xdp_context_functional test and bpf program") for details about the test design. Signed-off-by: Marcus Wichelmann --- .../bpf/prog_tests/xdp_context_test_run.c | 59 +++ 1 file changed, 59 insertions(+) diff --git a/too

[PATCH bpf-next v2 2/6] net: tun: enable transfer of XDP metadata to skb

2025-02-17 Thread Marcus Wichelmann
More information about this feature can be found in the commit message of commit de8f3a83b0a0 ("bpf: add meta pointer for direct access"). Signed-off-by: Marcus Wichelmann --- drivers/net/tun.c | 21 ++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/dri

[PATCH bpf-next v2 6/6] selftests/bpf: fix file descriptor assertion in open_tuntap helper

2025-02-17 Thread Marcus Wichelmann
n(/dev/net/tun) unexpected open(/dev/net/tun): actual 0 <= expected 0 Signed-off-by: Marcus Wichelmann --- tools/testing/selftests/bpf/network_helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/network_helpers.c b/tools/testing/self

[PATCH bpf-next v2 3/6] selftests/bpf: move open_tuntap to network helpers

2025-02-17 Thread Marcus Wichelmann
To test the XDP metadata functionality of the tun driver, it's necessary to create a new tap device first. A helper function for this already exists in lwt_helpers.h. Move it to the common network helpers header, so it can be reused in other tests. Signed-off-by: Marcus Wichelmann ---

[PATCH bpf-next v2 0/6] XDP metadata support for tun driver

2025-02-17 Thread Marcus Wichelmann
0130171614.1657224-1-marcus.wichelm...@hetzner-cloud.de/ Marcus Wichelmann (6): net: tun: enable XDP metadata support net: tun: enable transfer of XDP metadata to skb selftests/bpf: move open_tuntap to network helpers selftests/bpf: refactor xdp_context_functional test and bpf program selftests/b

[PATCH bpf-next v2 4/6] selftests/bpf: refactor xdp_context_functional test and bpf program

2025-02-17 Thread Marcus Wichelmann
p the testing code short. Signed-off-by: Marcus Wichelmann --- .../bpf/prog_tests/xdp_context_test_run.c | 93 +++ .../selftests/bpf/progs/test_xdp_meta.c | 56 ++- 2 files changed, 106 insertions(+), 43 deletions(-) diff --git a/tools/testing/selftests/b

[PATCH bpf-next v2 1/6] net: tun: enable XDP metadata support

2025-02-17 Thread Marcus Wichelmann
t driver is the only one using TUN_MSG_PTR and it already initializes the xdp_buffs with metadata support and sufficient headroom. But the tun driver disables it again, so the xdp_set_data_meta_invalid call has to be removed. Signed-off-by: Marcus Wichelmann --- drivers/net/tun.c | 3 +-- 1

Re: [PATCH bpf-next v2 2/6] net: tun: enable transfer of XDP metadata to skb

2025-02-19 Thread Marcus Wichelmann
Am 18.02.25 um 02:47 schrieb Willem de Bruijn: Marcus Wichelmann wrote: [...] + metasize = max(xdp->data - xdp->data_meta, 0); Can xdp->data_meta ever be greater than xdp->data? When an xdp_buff has no metadata support, then this is marked by setting xdp->data_meta t

Re: [PATCH bpf-next v2 6/6] selftests/bpf: fix file descriptor assertion in open_tuntap helper

2025-02-19 Thread Marcus Wichelmann
Am 18.02.25 um 02:56 schrieb Willem de Bruijn: Marcus Wichelmann wrote: [...] When running the BPF selftests locally, this incorrect assertion was not an issue, but the BPF kernel-patches CI failed because of this: open_tuntap:FAIL:open(/dev/net/tun) unexpected open(/dev/net/tun): actual

Re: [PATCH bpf-next v2 2/6] net: tun: enable transfer of XDP metadata to skb

2025-02-19 Thread Marcus Wichelmann
Am 19.02.25 um 16:06 schrieb Willem de Bruijn: Marcus Wichelmann wrote: Am 18.02.25 um 02:47 schrieb Willem de Bruijn: [...] This is pointer comparison, which is tricky wrt type. It likely is ptrdiff_t and thus signed. But may want to use max_t(long int, ..) to make this explicit. Ah, I see

Re: [PATCH bpf-next v4 0/6] XDP metadata support for tun driver

2025-02-28 Thread Marcus Wichelmann
cting commit (now with proper formatting, hopefully). The conflict was just about a section that was removed right below my added line in network_helpers.h, so no functional change. --- From c7182e5a4d21696b9e8cd25f92e64e28129e2c6e Mon Sep 17 00:00:00 2001 From: Marcus Wichelmann Date: Thu, 13 F

Re: [PATCH bpf-next v4 2/6] net: tun: enable transfer of XDP metadata to skb

2025-03-03 Thread Marcus Wichelmann
Am 28.02.25 um 20:49 schrieb Martin KaFai Lau: > On 2/27/25 6:23 AM, Marcus Wichelmann wrote: >> When the XDP metadata area was used, it is expected that the same >> metadata can also be accessed from TC, as can be read in the description >> of the bpf_xdp_adjust_meta helper

Re: [PATCH bpf-next v4 0/6] XDP metadata support for tun driver

2025-02-28 Thread Marcus Wichelmann
low my added line in network_helpers.h, so no functional change. --- From c7182e5a4d21696b9e8cd25f92e64e28129e2c6e Mon Sep 17 00:00:00 2001 From: Marcus Wichelmann Date: Thu, 13 Feb 2025 16:28:19 + Subject: [PATCH] selftests/bpf: move open_tuntap to network helpers To test the XDP metadata func

[PATCH bpf-next v4 3/6] selftests/bpf: move open_tuntap to network helpers

2025-02-27 Thread Marcus Wichelmann
To test the XDP metadata functionality of the tun driver, it's necessary to create a new tap device first. A helper function for this already exists in lwt_helpers.h. Move it to the common network helpers header, so it can be reused in other tests. Signed-off-by: Marcus Wichelmann Review

[PATCH bpf-next v4 4/6] selftests/bpf: refactor xdp_context_functional test and bpf program

2025-02-27 Thread Marcus Wichelmann
nger requires the veth interfaces to have IP addresses assigned, therefore these were removed. Signed-off-by: Marcus Wichelmann --- .../bpf/prog_tests/xdp_context_test_run.c | 79 +-- .../selftests/bpf/progs/test_xdp_meta.c | 53 + 2 files changed, 110 inse

[PATCH bpf-next v4 2/6] net: tun: enable transfer of XDP metadata to skb

2025-02-27 Thread Marcus Wichelmann
More information about this feature can be found in the commit message of commit de8f3a83b0a0 ("bpf: add meta pointer for direct access"). Signed-off-by: Marcus Wichelmann Reviewed-by: Willem de Bruijn Acked-by: Jason Wang --- drivers/net/tun.c | 25 ++--- 1 file change

[PATCH bpf-next v4 5/6] selftests/bpf: add test for XDP metadata support in tun driver

2025-02-27 Thread Marcus Wichelmann
run test in it"). This provides some extra safety against conflicting interface names. Signed-off-by: Marcus Wichelmann --- .../bpf/prog_tests/xdp_context_test_run.c | 59 +++ 1 file changed, 59 insertions(+) diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_context

[PATCH bpf-next v4 0/6] XDP metadata support for tun driver

2025-02-27 Thread Marcus Wichelmann
ommits and improved commit messages - remove redundant metasize check and add clarifying comment instead - use max() instead of ternary operator - add selftest for metadata support in the tun driver v1: https://lore.kernel.org/all/20250130171614.1657224-1-marcus.wichelm...@hetzner-cloud.d

[PATCH bpf-next v4 6/6] selftests/bpf: fix file descriptor assertion in open_tuntap helper

2025-02-27 Thread Marcus Wichelmann
n(/dev/net/tun) unexpected open(/dev/net/tun): actual 0 <= expected 0 Signed-off-by: Marcus Wichelmann Reviewed-by: Willem de Bruijn --- tools/testing/selftests/bpf/network_helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/network_hel

[PATCH bpf-next v4 1/6] net: tun: enable XDP metadata support

2025-02-27 Thread Marcus Wichelmann
t driver is the only one using TUN_MSG_PTR and it already initializes the xdp_buffs with metadata support and sufficient headroom. But the tun driver disables it again, so the xdp_set_data_meta_invalid call has to be removed. Signed-off-by: Marcus Wichelmann Acked-by: Jason Wang --- driver

[PATCH bpf-next v5 0/6] XDP metadata support for tun driver

2025-03-05 Thread Marcus Wichelmann
tps://lore.kernel.org/all/20250130171614.1657224-1-marcus.wichelm...@hetzner-cloud.de/ Marcus Wichelmann (6): net: tun: enable XDP metadata support net: tun: enable transfer of XDP metadata to skb selftests/bpf: move open_tuntap to network helpers selftests/bpf: refactor xdp_context_functi

[PATCH bpf-next v5 4/6] selftests/bpf: refactor xdp_context_functional test and bpf program

2025-03-05 Thread Marcus Wichelmann
nger requires the veth interfaces to have IP addresses assigned, therefore these were removed. Signed-off-by: Marcus Wichelmann Reviewed-by: Willem de Bruijn --- .../bpf/prog_tests/xdp_context_test_run.c | 79 +-- .../selftests/bpf/progs/test_xdp_meta.c | 53 +

[PATCH bpf-next v5 2/6] net: tun: enable transfer of XDP metadata to skb

2025-03-05 Thread Marcus Wichelmann
More information about this feature can be found in the commit message of commit de8f3a83b0a0 ("bpf: add meta pointer for direct access"). Signed-off-by: Marcus Wichelmann Reviewed-by: Willem de Bruijn Acked-by: Jason Wang --- drivers/net/tun.c | 25 ++--- 1 file change

[PATCH bpf-next v5 1/6] net: tun: enable XDP metadata support

2025-03-05 Thread Marcus Wichelmann
t driver is the only one using TUN_MSG_PTR and it already initializes the xdp_buffs with metadata support and sufficient headroom. But the tun driver disables it again, so the xdp_set_data_meta_invalid call has to be removed. Signed-off-by: Marcus Wichelmann Acked-by: Jason Wang --- driver

[PATCH bpf-next v5 5/6] selftests/bpf: add test for XDP metadata support in tun driver

2025-03-05 Thread Marcus Wichelmann
the previous commit ("selftests/bpf: refactor xdp_context_functional test and bpf program") for details about the test design. The test runs in its own network namespace. This provides some extra safety against conflicting interface names. Signed-off-by: Marcus Wichelmann --- .../bpf/

[PATCH bpf-next v5 6/6] selftests/bpf: fix file descriptor assertion in open_tuntap helper

2025-03-05 Thread Marcus Wichelmann
n(/dev/net/tun) unexpected open(/dev/net/tun): actual 0 <= expected 0 Signed-off-by: Marcus Wichelmann Reviewed-by: Willem de Bruijn --- tools/testing/selftests/bpf/network_helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/network_hel

[PATCH bpf-next v5 3/6] selftests/bpf: move open_tuntap to network helpers

2025-03-05 Thread Marcus Wichelmann
To test the XDP metadata functionality of the tun driver, it's necessary to create a new tap device first. A helper function for this already exists in lwt_helpers.h. Move it to the common network helpers header, so it can be reused in other tests. Signed-off-by: Marcus Wichelmann ---