STRUCT VIRTQUEUE(9)
β¨ struct virtqueue(9) β¨
okay bestie, welcome to the struct virtqueue(9) page, straight out of the Kernel API Manual π
this is literally the little data structure that says "hey, here's a queue, go register some buffers in it" β for sending or receiving, no cap π
πΈ NAME πΈ
struct virtqueue β a queue to register buffers for sending or receiving. that's it, that's the whole vibe β¨
π¦ SYNOPSIS π¦
here's the whole struct, character for character, don't touch a thing:
struct virtqueue {
struct list_head list;
void (*callback)(struct virtqueue *vq);
const char *name;
struct virtio_device *vdev;
unsigned int index;
unsigned int num_free;
unsigned int num_max;
bool reset;
void *priv;
};
π Members π
okay so let's meet the cast, each one gets a moment:
listβ the chain of virtqueues for this device. it's giving linked-list energy, one vq holding hands with the next π«Άcallbackβ the function to call when buffers are consumed. and yes, it can beNULLβ sometimes we just don't want the drama πnameβ the name of this virtqueue. mainly for debugging, so it's lowkey the vq's government name πvdevβ the virtio device this queue was created for. every queue has a parent, iconic πindexβ the zero-based ordinal number for this queue. zero-based, so the first one is0, that's just how we do it πnum_freeβ number of elements we expect to be able to fit. like how many more snacks fit in the bag πnum_maxβ the maximum number of elements supported by the device. the absolute ceiling, the hard limit, periodt π₯resetβ vq is in reset state or not. it's abool, so it's a yes-or-no baddie βprivβ a pointer for the virtqueue implementation to use. free real estate for whoever's implementing this thing π
π Description π
the num_free note (important, pay attention bestie)
- with indirect buffers, each buffer needs one element in the queue. one buffer, one element. simple, clean, slay β¨
- otherwise, a buffer will need one element per sg element. so more sg elements = more elements needed, fr fr π
not me making you count queue elements π but like, that's genuinely what it says in the source, so.
π₯ SEE ALSO π₯
go read these next, iykyk:
- Kernel file
./include/linux/virtio.h struct virtio_device(9)struct virtio_driver(9)
and that's the whole page, bestie π§ this one came from ./include/linux β Copyright October 2026, struct virtqueue(9) β ok bye love u, go queue some buffers π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms