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
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
---
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/
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
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
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 +
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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!
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
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
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
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
-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
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
---
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
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
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
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
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
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
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
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
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
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
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
---
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
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
41 matches
Mail list logo