linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/2] Clarify and Enhance XDP Rx Metadata Handling
@ 2025-07-01  4:29 Song Yoong Siang
  2025-07-01  4:29 ` [PATCH bpf-next 1/2] doc: clarify XDP Rx metadata layout and bpf_xdp_adjust_meta usage Song Yoong Siang
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Song Yoong Siang @ 2025-07-01  4:29 UTC (permalink / raw)
  To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Jonathan Corbet, Alexei Starovoitov,
	Daniel Borkmann, Jesper Dangaard Brouer, John Fastabend,
	Stanislav Fomichev, Andrii Nakryiko, Martin KaFai Lau,
	Eduard Zingerman, Song Liu, Yonghong Song, KP Singh, Hao Luo,
	Jiri Olsa, Mykola Lysenko, Shuah Khan
  Cc: netdev, linux-doc, linux-kernel, bpf, linux-kselftest

This patch set improves the documentation and selftests for XDP Rx metadata
handling. The first patch clarifies the documentation around XDP metadata
layout and the use of bpf_xdp_adjust_meta. The second patch enhances the
BPF selftests to make XDP metadata handling more robust and portable across
different NICs.

Prior to this patch set, the user application retrieved the xdp_meta by
calculating backward from the data pointer, while the XDP program fill in
the xdp_meta by calculating backward from data_meta. This approach will
cause mismatch if there is device-reserved metadata.

                        |<---sizeof(xdp_meta)--|
                        |                      |
                 struct xdp_meta               rx_desc->address
                        ^                      ^
                        |                      |
+----------+----------------------+------------+------+
| headroom |    custom metadata   |  reserved  | data |
+----------+----------------------+------------+------+
           ^                      ^            ^
           |                      |            |
    struct xdp_meta     xdp_buff->data_meta    xdp_buff->data
           |                      |
           |<---sizeof(xdp_meta)--|

Song Yoong Siang (2):
  doc: clarify XDP Rx metadata layout and bpf_xdp_adjust_meta usage
  selftests/bpf: Enhance XDP Rx Metadata Handling

 Documentation/networking/xdp-rx-metadata.rst  | 38 +++++++++++++++++++
 .../selftests/bpf/prog_tests/xdp_metadata.c   |  2 +-
 .../selftests/bpf/progs/xdp_hw_metadata.c     | 10 ++++-
 .../selftests/bpf/progs/xdp_metadata.c        |  8 +++-
 tools/testing/selftests/bpf/xdp_hw_metadata.c |  2 +-
 tools/testing/selftests/bpf/xdp_metadata.h    |  7 ++++
 6 files changed, 63 insertions(+), 4 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2025-07-08  2:32 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-01  4:29 [PATCH bpf-next 0/2] Clarify and Enhance XDP Rx Metadata Handling Song Yoong Siang
2025-07-01  4:29 ` [PATCH bpf-next 1/2] doc: clarify XDP Rx metadata layout and bpf_xdp_adjust_meta usage Song Yoong Siang
2025-07-01  4:29 ` [PATCH bpf-next 2/2] selftests/bpf: Enhance XDP Rx Metadata Handling Song Yoong Siang
2025-07-01 16:31   ` Stanislav Fomichev
2025-07-02  2:23     ` Song, Yoong Siang
2025-07-02  3:55       ` Song, Yoong Siang
2025-07-02 15:18         ` Stanislav Fomichev
2025-07-02 15:56           ` Song, Yoong Siang
2025-07-02 16:04             ` Stanislav Fomichev
2025-07-02 16:17               ` Song, Yoong Siang
2025-07-07 20:55 ` [PATCH bpf-next 0/2] Clarify and " Jakub Kicinski
2025-07-08  1:34   ` Song, Yoong Siang
2025-07-08  1:44     ` Jakub Kicinski
2025-07-08  2:06       ` Song, Yoong Siang
2025-07-08  2:17         ` Jakub Kicinski
2025-07-08  2:32           ` Song, Yoong Siang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).