Skip to content

Improve candumpr design documentation#4

Merged
Notgnoshi merged 10 commits intomainfrom
dev/design
Mar 30, 2026
Merged

Improve candumpr design documentation#4
Notgnoshi merged 10 commits intomainfrom
dev/design

Conversation

@Notgnoshi
Copy link
Copy Markdown
Owner

No description provided.

There's multiple arrays running around that are easy to conflate:

* The SQ, a shared ringbuf allocated by the kernel containing indices
  into a separate SQE array containing RecvMsgMulti SQEs submitted by
  the user. We submit SQEs that identify socket FDs that we want to read
  from.

  The SQ and SQE arrays are hidden by the io-uring crate.

* The CQ, a shared ringbuf containing allocated by the kernel CQEs. The
  CQE flags identify which buffer from the framebuf_ring_ptr contains
  the result.

  The CQ array is hidden by the io-uring crate.

* The framebuf_ring_ptr array of BufRingEntry descriptors. Each
  descriptor points to a buffer that the kernel can write the CanFrame,
  cmsg and recvmsg_out header to.

  This array must be page-aligned.

  Each BufRingEntry descriptor *could* point to a unique allocation, but
  we have a single framebuf_data array that each BufRingEntry descriptor
  points into.

* framebuf_data array actually holds the received CAN frame, plus
  recvmsg_out header and cmsg

It didn't make sense for the framebuf_ring_ptr array to be a different
size from the CQE array, because they're one-to-one. The kernel can't
write to the framebuf_data without also writing a CQE.

However, if we just make them equal sizes, I found that it resulted in
lots and lots of frame drops due to DEFER_TASKRUN causing the kernel to
not do any work until the next submit_with_args call.
This will allow integration tests in the workspace to run their own
crate's binaries.
@Notgnoshi Notgnoshi merged commit 9e8003b into main Mar 30, 2026
7 checks passed
@Notgnoshi Notgnoshi deleted the dev/design branch March 30, 2026 02:25
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.

1 participant