virtqueue_reset(9)
π virtqueue_reset(9) β it's giving Kernel API Manual, bestie π¦
okay so picture this: you're deep in the kernel, you've got a struct virtqueue that's holding onto a bunch of buffers nobody's using anymore, and you just want to, like, let them go. that's this function. welcome to the reset arc, it's very main character energy β¨
πΈ NAME πΈ
virtqueue_reset β detach and recycle all unused buffers π
β¨ SYNOPSIS β¨
int virtqueue_reset (struct virtqueue *_vq , void (*recycle)(struct
virtqueue *vq, void *buf) , void (*recycle_done)(struct virtqueue *vq)
);
like, look at that signature. three whole params. she's committed π
π«Ά ARGUMENTS π«Ά
_vqβ thestruct virtqueuewe're talking about. yes, the underscore is part of the name, don't come for her πrecycleβ callback to recycle unused buffers. this is where you get to be the recycling icon you were always meant to be β»οΈrecycle_doneβ callback that gets invoked when the recycling of all the unused buffers is done. the "we're so back" moment, fr fr π
π DESCRIPTION π
okay so the caller must ensure we don't call this with other virtqueue operations at the same time β except where noted. that's a big deal, not me being dramatic. do not overlap this with other vq ops unless the docs literally told you it's fine π
returns zero or a negative error, and here's the full receipt:
0β success. slay π periodt-EBUSYβ failed to sync with device, andvqmay not work properly π like it might be cooked, ngl-ENOENTβ transport or device not supported π«-EPERMβ operation not permitted π₯
warning bestie: that-EBUSYone is the scary one β if you hit it, thevqmay not work properly. not a vibe. π
π SEE ALSO π
kernel file ./drivers/virtio/virtio_ring.c β that's where the magic lives, iykyk π§
and the whole friend group, because she does not go anywhere alone:
virtqueue_add_sgs(9)virtqueue_add_outbuf(9)virtqueue_add_outbuf_premapped(9)virtqueue_add_inbuf(9)virtqueue_add_inbuf_cache_clean(9)virtqueue_add_inbuf_ctx(9)virtqueue_add_inbuf_premapped(9)virtqueue_dma_dev(9)virtqueue_kick_prepare(9)virtqueue_notify(9)virtqueue_kick(9)virtqueue_get_buf_ctx(9)virtqueue_disable_cb(9)virtqueue_enable_cb_prepare(9)virtqueue_poll(9)virtqueue_enable_cb(9)virtqueue_enable_cb_delayed(9)virtqueue_detach_unused_buf(9)vring_interrupt(9)virtqueue_resize(9)virtqueue_get_vring_size(9)virtqueue_map_alloc_coherent(9)virtqueue_map_free_coherent(9)virtqueue_map_page_attrs(9)virtqueue_unmap_page_attrs(9)virtqueue_map_single_attrs(9)virtqueue_unmap_single_attrs(9)virtqueue_map_mapping_error(9)virtqueue_map_need_sync(9)virtqueue_map_sync_single_range_for_cpu(9)virtqueue_map_sync_single_range_for_device(9)
thirty-one entries and every single one of them still invited, no gatekeeping here π
and that's the whole page, bestie π«Ά this drop is from ./drivers/virtio, dated October 2026, and it lives in the Kernel API Manual β go forth, detach those unused buffers, and recycle responsibly β¨π
π¦ 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