MCPcopy Create free account
hub / github.com/Simple-XX/SimpleKernel / Avail

Class Avail

src/device/virtio/virt_queue/split.hpp:103–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101 * @see virtio-v1.2#2.7.6 The Virtqueue Available Ring
102 */
103 struct [[gnu::packed]] Avail {
104 /// Available Ring 对齐要求(字节)
105 static constexpr size_t kAlign = 2;
106 /// 标志位: AvailFlags (little-endian)
107 uint16_t flags;
108 /// 驱动程序将下一个描述符条目放入环中的位置(模 queue_size) (little-endian)
109 uint16_t idx;
110 /// 可用描述符头索引数组 ring[queue_size] (little-endian)
111#pragma GCC diagnostic push
112#pragma GCC diagnostic ignored "-Wpedantic"
113 uint16_t ring[];
114#pragma GCC diagnostic pop
115
116 /**
117 * @brief 获取 used_event 字段的指针
118 * @param queue_size 队列大小
119 * @return used_event 字段指针
120 * @note 仅当协商 VIRTIO_F_EVENT_IDX 特性时使用
121 * @see virtio-v1.2#2.7.10 Available Buffer Notification Suppression
122 */
123 [[nodiscard]] auto used_event(uint16_t queue_size) volatile
124 -> volatile uint16_t* {
125 return ring + queue_size;
126 }
127
128 [[nodiscard]] auto used_event(uint16_t queue_size) const volatile -> const
129 volatile uint16_t* {
130 return ring + queue_size;
131 }
132 };
133
134 /**
135 * @brief Virtqueue Used Ring 元素

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected