Re: [xdp-hints] Re: [PATCH RFC bpf-next 32/52] bpf, cpumap: switch to GRO from netif_receive_skb_list()

Jesper Dangaard Brouer
2024-08-09T10:02:36Z

On 08/08/2024 22.52, Daniel Xu wrote:
>
> On Thu, Aug 8, 2024, at 7:57 AM, Alexander Lobakin wrote:
>>
[...]
>> The only concern for having GRO in cpumap without metadata from the NIC
>> descriptor was that when the checksum status is missing, GRO calculates
>> the checksum on CPU, which is not really fast.
>> But I remember sometimes GRO was faster despite that.
>
> Good to know, thanks. IIUC some kind of XDP hint support landed already?
>

The XDP-hints ended-up being called 'XDP RX metadata' in kernel docs[1],
which makes it difficult to talk about without talking past each-other.
The TX side only got implemented for AF_XDP.

[1] https://www.kernel.org/doc/html/latest/networking/xdp-rx-metadata.html
[2] https://www.kernel.org/doc/html/latest/networking/xsk-tx-metadata.html

What landed 'XDP RX metadata'[1] is that we (via kfunc calls) get
access to reading hardware RX offloads/hints directly from the
RX-descriptor. This implies a limitation that we only have access to
this data in the running XDP-program as the RX-descriptor is short lived.

Thus, we need to store the RX-descriptor information somewhere, to make
it available to 'cpumap' on the remote CPU. After failing to standardize
formatting XDP metadata area. My "new" opinion is that we should simply
extend struct xdp_frame with the fields needed for SKB creation. Then
we can create some kfunc helpers that allow XDP-prog stores this info.

> My use case could also use HW RSS hash to avoid a rehash in XDP prog.
> And HW RX timestamp to not break SO_TIMESTAMPING. These two
> are on one of my TODO lists. But I can’t get to them for at least
> a few weeks. So free to take it if you’d like.

The kfuncs you need should be available:

HW RSS hash = bpf_xdp_metadata_rx_hash()
HW RX timestamp = bpf_xdp_metadata_rx_timestamp()

We just need to implement storing the information, such that it is
available to CPUMAP, and make it generic such that it also works for
veth when getting a XDP redirected xdp_frame.

Hoping someone can works on this soon,
--Jesper