RING DESIGN(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ¦‹ Ring Design πŸ¦‹

okay bestie, welcome to the Kernel API Manual, section 9 β€” this is the Ring Design page and the heading literally goes Ring Design -----------, which is a whole vibe ✨

The mmaped area is divided into three parts, fr fr:

  1. The mailbox (struct tcmu_mailbox, below);
  2. The command ring;
  3. Everything beyond the command ring (data).

The mailbox tells userspace the offset of the command ring from the start of the shared memory region, and how big the command ring is. iconic πŸ’…

The kernel passes SCSI commands to userspace by putting a struct tcmu_cmd_entry in the ring, updating mailbox->cmd_head, and poking userspace via UIO's interrupt mechanism.

tcmu_cmd_entry contains a header. If the header type is PAD, userspace should skip hdr->length bytes (mod cmdr_size) to find the next cmd_entry.

Otherwise, the entry will contain offsets into the mmaped area that contain the cdb and data buffers β€” the latter accessible via the iov array. iov addresses are also offsets into the shared area. 🫢

When userspace is done handling the command, set entry->rsp.scsi_status, fill in rsp.sense_buffer if appropriate, and also set mailbox->cmd_tail equal to the old cmd_tail plus hdr->length, mod cmdr_size. If cmd_tail doesn't equal cmd_head, it should process the next packet the same way, and so on. πŸ”₯

πŸ‘€ SEE ALSO πŸ‘€

  • Kernel file ./include/uapi/linux/target_core_user.h

that's the whole page, bestie 🫢 it comes from ./include/uapi/linux, dated October 2026, and it's Ring Design(9) β€” periodt πŸ’–

πŸ“¦ where this page comes from