Skip to contentSkip to conversation

selftests/bpf: add XDP_UMEM_TX_METADATA_LEN flag to umem_config

PATCH In review Wei Fang 3 participants 5 messages Dec 20, 2024 – Dec 21, 2024

Subsystems (7)
lore
Share & tools
lore

Wei Fang

author
#0 lore raw

PATCH 1/1 selftests/bpf: add XDP_UMEM_TX_METADATA_LEN flag to umem_config

The Tx metadata test has been broken since the commit d5e726d9143c ("xsk:
Require XDP_UMEM_TX_METADATA_LEN to actuate tx_metadata_len"). Because this change requires XDP_UMEM_TX_METADATA_LEN flag to be set, otherwise xsk_buff_pool::tx_metadata_len will be initialized to 0, which means that the driver cannot get Tx metadata and cannot execute AF_XDP Tx metadata hooks.

Fixes d5e726d9143c ("xsk: Require XDP_UMEM_TX_METADATA_LEN to actuate tx_metadata_len")
---
 tools/testing/selftests/bpf/xdp_hw_metadata.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/xdp_hw_metadata.c +1 -1
index 6f9956eed797..ad6c08dfd6c8 100644
@@ -79,7 +79,7 @@ static int open_xsk(int ifindex, struct xsk *xsk, __u32 queue_id)
 		.fill_size = XSK_RING_PROD__DEFAULT_NUM_DESCS,
 		.comp_size = XSK_RING_CONS__DEFAULT_NUM_DESCS,
 		.frame_size = XSK_UMEM__DEFAULT_FRAME_SIZE,
-		.flags = XSK_UMEM__DEFAULT_FLAGS,
+		.flags = XDP_UMEM_TX_METADATA_LEN,
 		.tx_metadata_len = sizeof(struct xsk_tx_metadata),
 	};
 	__u32 idx = 0;
Signature · 1 line
2.34.1
#1 lore raw
Quoted 9 lines · Wei Fang

The Tx metadata test has been broken since the commit d5e726d9143c ("xsk:
Require XDP_UMEM_TX_METADATA_LEN to actuate tx_metadata_len"). Because this change requires XDP_UMEM_TX_METADATA_LEN flag to be set, otherwise xsk_buff_pool::tx_metadata_len will be initialized to 0, which means that the driver cannot get Tx metadata and cannot execute AF_XDP Tx metadata hooks.

Fixes d5e726d9143c ("xsk: Require XDP_UMEM_TX_METADATA_LEN to actuate tx_metadata_len")

Thanks for the patch, but it should have been fixed recently in:
https://lore.kernel.org/bpf/[email protected]/#t

author
#2 lore raw
Quoted 10 lines · Wei Fang
Quoted 1 line

The Tx metadata test has been broken since the commit d5e726d9143c

("xsk:

Quoted 1 line

Require XDP_UMEM_TX_METADATA_LEN to actuate tx_metadata_len").

Because

Quoted 5 lines

this change requires XDP_UMEM_TX_METADATA_LEN flag to be set, otherwise xsk_buff_pool::tx_metadata_len will be initialized to 0, which means that the driver cannot get Tx metadata and cannot execute AF_XDP Tx metadata hooks.

Quoted 6 lines
Quoted 1 line
Fixes d5e726d9143c ("xsk: Require XDP_UMEM_TX_METADATA_LEN to

actuate

Quoted 2 lines

tx_metadata_len")

Thanks for the patch, but it should have been fixed recently in:

Oh, I was not aware of that the same patch had been applied to bpf-next tree, thanks for reminder.

maintainer
#3 lore raw
In reply to Wei Fang
Quoted 2 lines · Wei Fang

The Tx metadata test has been broken since the commit d5e726d9143c ("xsk:
Require XDP_UMEM_TX_METADATA_LEN to actuate tx_metadata_len").

Nit:

Fixes tag already include this information.

The Tx metadata test has been broken becasue XDP_UMEM_TX_METADATA_LEN flag is not set ....

Quoted 17 lines

Because
this change requires XDP_UMEM_TX_METADATA_LEN flag to be set, otherwise xsk_buff_pool::tx_metadata_len will be initialized to 0, which means that the driver cannot get Tx metadata and cannot execute AF_XDP Tx metadata hooks.

Fixes d5e726d9143c ("xsk: Require XDP_UMEM_TX_METADATA_LEN to actuate tx_metadata_len")
---
 tools/testing/selftests/bpf/xdp_hw_metadata.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/xdp_hw_metadata.c +0 -0
index 6f9956eed797..ad6c08dfd6c8 100644

tools/testing/selftests/bpf/xdp_hw_metadata.c static int open_xsk(int ifindex, struct xsk *xsk, __u32 queue_id) · line 82

Quoted 5 lines
tools/testing/selftests/bpf/xdp_hw_metadata.c +1 -1
@@ -79,7 +79,7 @@ static int open_xsk(int ifindex, struct xsk *xsk, __u32 queue_id)
 		.fill_size = XSK_RING_PROD__DEFAULT_NUM_DESCS,
 		.comp_size = XSK_RING_CONS__DEFAULT_NUM_DESCS,
 		.frame_size = XSK_UMEM__DEFAULT_FRAME_SIZE,
-		.flags = XSK_UMEM__DEFAULT_FLAGS,
+		.flags = XDP_UMEM_TX_METADATA_LEN,

look like "XSK_UMEM__DEFAULT_FLAGS | XDP_UMEM_TX_METADATA_LEN"

You clean other flags, does it what you what?

Frank

Quoted 6 lines
tools/testing/selftests/bpf/xdp_hw_metadata.c +0 -1
 		.tx_metadata_len = sizeof(struct xsk_tx_metadata),
 	};
 	__u32 idx = 0;
--

2.34.1

author
#4 lore raw
Quoted 41 lines · Wei Fang
Quoted 1 line

The Tx metadata test has been broken since the commit d5e726d9143c

("xsk:

Quoted 1 line

Require XDP_UMEM_TX_METADATA_LEN to actuate tx_metadata_len").

Nit:

Fixes tag already include this information.

The Tx metadata test has been broken becasue
XDP_UMEM_TX_METADATA_LEN flag is not set ....

Quoted 7 lines

Because
this change requires XDP_UMEM_TX_METADATA_LEN flag to be set, otherwise xsk_buff_pool::tx_metadata_len will be initialized to 0, which means that the driver cannot get Tx metadata and cannot execute AF_XDP Tx metadata hooks.

Fixes d5e726d9143c ("xsk: Require XDP_UMEM_TX_METADATA_LEN to

actuate

tools/testing/selftests/bpf/xdp_hw_metadata.c static int open_xsk(int ifindex, struct xsk *xsk, __u32

Quoted 12 lines

tx_metadata_len")

---
 tools/testing/selftests/bpf/xdp_hw_metadata.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/xdp_hw_metadata.c +0 -0
index 6f9956eed797..ad6c08dfd6c8 100644
@@ -79,7 +79,7 @@ static int open_xsk(int ifindex, struct xsk *xsk, __u32

queue_id)

tools/testing/selftests/bpf/xdp_hw_metadata.c static int open_xsk(int ifindex, struct xsk *xsk, __u32 queue_id) · line 82

Quoted 5 lines
tools/testing/selftests/bpf/xdp_hw_metadata.c +1 -1
 		.fill_size = XSK_RING_PROD__DEFAULT_NUM_DESCS,
 		.comp_size = XSK_RING_CONS__DEFAULT_NUM_DESCS,
 		.frame_size = XSK_UMEM__DEFAULT_FRAME_SIZE,
-		.flags = XSK_UMEM__DEFAULT_FLAGS,
+		.flags = XDP_UMEM_TX_METADATA_LEN,

look like "XSK_UMEM__DEFAULT_FLAGS | XDP_UMEM_TX_METADATA_LEN"

Quoted 2 lines

You clean other flags, does it what you what?

XSK_UMEM__DEFAULT_FLAGS is 0, so no need anymore. The same patch had been applied to bpf-next tree [1], so please ignore this one.

[1] https://lore.kernel.org/bpf/[email protected]/#t

Quoted 7 lines
Quoted 7 lines
tools/testing/selftests/bpf/xdp_hw_metadata.c +0 -1
 		.tx_metadata_len = sizeof(struct xsk_tx_metadata),
 	};
 	__u32 idx = 0;
--

2.34.1