[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231129084913.01dc63c2@kernel.org>
Date: Wed, 29 Nov 2023 08:49:13 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Stanislav Fomichev <sdf@...gle.com>
Cc: bpf@...r.kernel.org, ast@...nel.org, daniel@...earbox.net,
andrii@...nel.org, martin.lau@...ux.dev, song@...nel.org, yhs@...com,
john.fastabend@...il.com, kpsingh@...nel.org, haoluo@...gle.com,
jolsa@...nel.org, toke@...nel.org, willemb@...gle.com, dsahern@...nel.org,
magnus.karlsson@...el.com, bjorn@...nel.org, maciej.fijalkowski@...el.com,
hawk@...nel.org, yoong.siang.song@...el.com, netdev@...r.kernel.org,
xdp-hints@...-project.net
Subject: Re: [PATCH bpf-next v6 02/13] xsk: Add TX timestamp and TX checksum
offload support
On Mon, 27 Nov 2023 11:03:08 -0800 Stanislav Fomichev wrote:
> This change actually defines the (initial) metadata layout
> that should be used by AF_XDP userspace (xsk_tx_metadata).
> The first field is flags which requests appropriate offloads,
> followed by the offload-specific fields. The supported per-device
> offloads are exported via netlink (new xsk-flags).
>
> The offloads themselves are still implemented in a bit of a
> framework-y fashion that's left from my initial kfunc attempt.
> I'm introducing new xsk_tx_metadata_ops which drivers are
> supposed to implement. The drivers are also supposed
> to call xsk_tx_metadata_request/xsk_tx_metadata_complete in
> the right places. Since xsk_tx_metadata_{request,_complete}
> are static inline, we don't incur any extra overhead doing
> indirect calls.
>
> The benefit of this scheme is as follows:
> - keeps all metadata layout parsing away from driver code
> - makes it easy to grep and see which drivers implement what
> - don't need any extra flags to maintain to keep track of what
> offloads are implemented; if the callback is implemented - the offload
> is supported (used by netlink reporting code)
>
> Two offloads are defined right now:
> 1. XDP_TXMD_FLAGS_CHECKSUM: skb-style csum_start+csum_offset
> 2. XDP_TXMD_FLAGS_TIMESTAMP: writes TX timestamp back into metadata
> area upon completion (tx_timestamp field)
>
> XDP_TXMD_FLAGS_TIMESTAMP is also implemented for XDP_COPY mode: it writes
> SW timestamp from the skb destructor (note I'm reusing hwtstamps to pass
> metadata pointer).
>
> The struct is forward-compatible and can be extended in the future
> by appending more fields.
Acked-by: Jakub Kicinski <kuba@...nel.org>
Powered by blists - more mailing lists