diff mbox series

[bpf] selftests/bpf: add XDP_UMEM_TX_METADATA_LEN flag to umem_config

Message ID 20241220091806.1856223-1-wei.fang@nxp.com (mailing list archive)
State New
Headers show
Series [bpf] selftests/bpf: add XDP_UMEM_TX_METADATA_LEN flag to umem_config | expand

Commit Message

Wei Fang Dec. 20, 2024, 9:18 a.m. UTC
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")
Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
 tools/testing/selftests/bpf/xdp_hw_metadata.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stanislav Fomichev Dec. 20, 2024, 3:26 p.m. UTC | #1
On 12/20, Wei Fang wrote:
> 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")
> Signed-off-by: Wei Fang <wei.fang@nxp.com>

Thanks for the patch, but it should have been fixed recently in:
https://lore.kernel.org/bpf/20241205044258.3155799-1-yoong.siang.song@intel.com/#t
Frank Li Dec. 20, 2024, 4:10 p.m. UTC | #2
On Fri, Dec 20, 2024 at 05:18:06PM +0800, Wei Fang wrote:
> 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 ....

> 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")
> Signed-off-by: Wei Fang <wei.fang@nxp.com>
> ---
>  tools/testing/selftests/bpf/xdp_hw_metadata.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/xdp_hw_metadata.c b/tools/testing/selftests/bpf/xdp_hw_metadata.c
> index 6f9956eed797..ad6c08dfd6c8 100644
> --- a/tools/testing/selftests/bpf/xdp_hw_metadata.c
> +++ b/tools/testing/selftests/bpf/xdp_hw_metadata.c
> @@ -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

>  		.tx_metadata_len = sizeof(struct xsk_tx_metadata),
>  	};
>  	__u32 idx = 0;
> --
> 2.34.1
>
Wei Fang Dec. 21, 2024, 1:54 a.m. UTC | #3
> On 12/20, Wei Fang wrote:
> > 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")
> > Signed-off-by: Wei Fang <wei.fang@nxp.com>
> 
> 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.
Wei Fang Dec. 21, 2024, 1:56 a.m. UTC | #4
> On Fri, Dec 20, 2024 at 05:18:06PM +0800, Wei Fang wrote:
> > 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 ....
> 
> > 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")
> > Signed-off-by: Wei Fang <wei.fang@nxp.com>
> > ---
> >  tools/testing/selftests/bpf/xdp_hw_metadata.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/testing/selftests/bpf/xdp_hw_metadata.c
> > b/tools/testing/selftests/bpf/xdp_hw_metadata.c
> > index 6f9956eed797..ad6c08dfd6c8 100644
> > --- a/tools/testing/selftests/bpf/xdp_hw_metadata.c
> > +++ b/tools/testing/selftests/bpf/xdp_hw_metadata.c
> > @@ -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?
> 

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/20241205044258.3155799-1-yoong.siang.song@intel.com/#t

> 
> >  		.tx_metadata_len = sizeof(struct xsk_tx_metadata),
> >  	};
> >  	__u32 idx = 0;
> > --
> > 2.34.1
> >
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/xdp_hw_metadata.c b/tools/testing/selftests/bpf/xdp_hw_metadata.c
index 6f9956eed797..ad6c08dfd6c8 100644
--- a/tools/testing/selftests/bpf/xdp_hw_metadata.c
+++ b/tools/testing/selftests/bpf/xdp_hw_metadata.c
@@ -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;