Re: [PATCH bpf-next v2] selftests/bpf: add options and frags to xdp_hw_metadata

From: Stanislav Fomichev
Date: Tue Oct 17 2023 - 12:41:46 EST


On Tue, Oct 17, 2023 at 9:35 AM Larysa Zaremba <larysa.zaremba@xxxxxxxxx> wrote:
>
> This is a follow-up to the commit 9b2b86332a9b ("bpf: Allow to use kfunc
> XDP hints and frags together").
>
> The are some possible implementations problems that may arise when
> providing metadata specifically for multi-buffer packets, therefore there
> must be a possibility to test such option separately.
>
> Add an option to use multi-buffer AF_XDP xdp_hw_metadata and mark used XDP
> program as capable to use frags.
>
> As for now, xdp_hw_metadata accepts no options, so add simple option
> parsing logic and a help message.
>
> For quick reference, also add an ingress packet generation command to the
> help message. The command comes from [0].
>
> Example of output for multi-buffer packet:
>
> xsk_ring_cons__peek: 1
> 0xead018: rx_desc[15]->addr=10000000000f000 addr=f100 comp_addr=f000
> rx_hash: 0x5789FCBB with RSS type:0x29
> rx_timestamp: 1696856851535324697 (sec:1696856851.5353)
> XDP RX-time: 1696856843158256391 (sec:1696856843.1583)
> delta sec:-8.3771 (-8377068.306 usec)
> AF_XDP time: 1696856843158413078 (sec:1696856843.1584)
> delta sec:0.0002 (156.687 usec)
> 0xead018: complete idx=23 addr=f000
> xsk_ring_cons__peek: 1
> 0xead018: rx_desc[16]->addr=100000000008000 addr=8100 comp_addr=8000
> 0xead018: complete idx=24 addr=8000
> xsk_ring_cons__peek: 1
> 0xead018: rx_desc[17]->addr=100000000009000 addr=9100 comp_addr=9000 EoP
> 0xead018: complete idx=25 addr=9000
>
> Metadata is printed for the first packet only.
>
> [0] https://lore.kernel.org/all/20230119221536.3349901-18-sdf@xxxxxxxxxx/
>
> Signed-off-by: Larysa Zaremba <larysa.zaremba@xxxxxxxxx>
> ---
> V1 -> V2: drop gen_socket_config(), remove extra spaces in help message

Acked-by: Stanislav Fomichev <sdf@xxxxxxxxxx>

Thanks!