Skip to content

Fix FILL/COMPLETION ring element sizes in the AF_XDP page - #292

Merged
dylandreimerink merged 1 commit into
isovalent:masterfrom
NAME-ASHWANIYADAV:docs/af-xdp-ring-sizes
Sep 5, 2026
Merged

Fix FILL/COMPLETION ring element sizes in the AF_XDP page#292
dylandreimerink merged 1 commit into
isovalent:masterfrom
NAME-ASHWANIYADAV:docs/af-xdp-ring-sizes

Conversation

@NAME-ASHWANIYADAV

Copy link
Copy Markdown
Contributor

Fixes #239

The XSK setup example sized all four ring mmaps with sizeof(struct xdp_desc), but the FILL and COMPLETION rings are arrays of plain _u64 UMEM addresses, not descriptors. The same mistake appeared in the ring-access line right below the mmap call, and in the ring-buffer concept section further down the page.

Verified against libxdp and the kernel

  • libxdp's xsk_umem_create_with_fd maps the fill ring with off.fr.desc + fill_size * sizeof(_u64) (and the completion ring likewise), while the RX ring uses off.rx.desc + rx_size * sizeof(struct xdp_desc) - exactly the split the reporter pointed at (xsk.c#L258, xsk.c#L1167)
  • Kernel-side, the two ring layouts are xdp_rxtx_ring { …; struct xdp_desc desc[] } vs xdp_umem_ring { …; u64 desc[] } (net/xdp/xsk_queue.h)

Changes

  • The mmap length now uses the four-way expansion sizeof({struct xdp_desc,struct xdp_desc,__u64,__u64}), matching the page's existing {rx,tx,fill,completion} shorthand one-to-one
  • The ring-access line is split so RX/TX rings are typed struct xdp_desc * and FILL/COMPLETION rings __u64 * (the old single line also used invalid array syntax)
  • A short note under the example explains the element-size difference
  • The concept section's "array of descriptors (struct xdp_desc)" now names both entry types

The XSK setup example sized all four ring mmaps with
sizeof(struct xdp_desc), but the FILL and COMPLETION rings are arrays
of plain __u64 UMEM addresses, not descriptors - see libxdp's
xsk_umem__create_with_fd (off.fr.desc + fill_size * sizeof(__u64)) and
the kernel's xdp_umem_ring (u64 desc[]). The same mistake appeared in
the ring-access line and in the ring-buffer concept section further
down the page.

Size the FILL/COMPLETION mappings with sizeof(__u64), type their ring
pointers as __u64 *, and add a short note explaining the difference.

Fixes isovalent#239

Signed-off-by: Ashwani Yadav <22ashwaniyadav@gmail.com>
@NAME-ASHWANIYADAV

Copy link
Copy Markdown
Contributor Author

@dylandreimerink will appreciate a review !!

@dylandreimerink
dylandreimerink merged commit 8c0bbef into isovalent:master Sep 5, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect mmap arguments regarding Completion / Fill Rings

2 participants