| Zephyr Project API 4.2.99
    A Scalable Open Source RTOS | 
virtqueue More...
#include <virtqueue.h>
| Data Fields | |
| struct k_spinlock | lock | 
| lock used to synchronize operations on virtqueue | |
| uint16_t | num | 
| size of virtqueue | |
| struct virtq_desc * | desc | 
| array with descriptors | |
| struct virtq_avail * | avail | 
| available ring | |
| struct virtq_used * | used | 
| used ring | |
| uint16_t | last_used_idx | 
| last seen idx in used ring, used to determine first descriptor to process after receiving virtqueue interrupt | |
| struct k_stack | free_desc_stack | 
| Stack containing indexes of free descriptors. | |
| uint16_t | free_desc_n | 
| amount of free descriptors in the free_desc_stack | |
| struct virtq_receive_callback_entry * | recv_cbs | 
| array with callbacks invoked after receiving buffers back from the device | |
virtqueue
contains structures required for virtqueue operation
| struct virtq_avail* virtq::avail | 
available ring
| struct virtq_desc* virtq::desc | 
array with descriptors
| uint16_t virtq::free_desc_n | 
amount of free descriptors in the free_desc_stack
| struct k_stack virtq::free_desc_stack | 
Stack containing indexes of free descriptors.
Because virtio devices are not required to use received descriptors in order (see 2.7.9) unless VIRTIO_F_IN_ORDER was offered, we can't use array with descriptors as another ring buffer, always taking next descriptor. This is an auxilary structure to easily determine next free descriptor
| uint16_t virtq::last_used_idx | 
last seen idx in used ring, used to determine first descriptor to process after receiving virtqueue interrupt
| struct k_spinlock virtq::lock | 
lock used to synchronize operations on virtqueue
| uint16_t virtq::num | 
size of virtqueue
| struct virtq_receive_callback_entry* virtq::recv_cbs | 
array with callbacks invoked after receiving buffers back from the device
| struct virtq_used* virtq::used | 
used ring