Low-level Virtqueue.
More...
|
enum | |
| Fixed alignment values for different parts of a virtqueue.
|
|
|
static unsigned long | total_size (unsigned num) |
| Calculate the total size for a virtqueue of the given dimensions. More...
|
|
static unsigned long | desc_size (unsigned num) |
| Calculate the size of the descriptor table for num entries. More...
|
|
static unsigned long | desc_align () |
| Get the alignment in zero LSBs needed for the descriptor table. More...
|
|
static unsigned long | avail_size (unsigned num) |
| Calculate the size of the available ring for num entries. More...
|
|
static unsigned long | avail_align () |
| Get the alignment in zero LSBs needed for the available ring. More...
|
|
static unsigned long | used_size (unsigned num) |
| Calculate the size of the used ring for num entries. More...
|
|
static unsigned long | used_align () |
| Get the alignment in zero LSBs needed for the used ring. More...
|
|
Low-level Virtqueue.
This class represents a single virtqueue, with a local running available index.
Definition at line 87 of file virtqueue.
◆ avail_align()
static unsigned long L4virtio::Virtqueue::avail_align |
( |
| ) |
|
|
inlinestatic |
Get the alignment in zero LSBs needed for the available ring.
- Returns
- The alignment in zero LSBs needed for an available ring.
Definition at line 291 of file virtqueue.
◆ avail_size()
static unsigned long L4virtio::Virtqueue::avail_size |
( |
unsigned |
num | ) |
|
|
inlinestatic |
◆ desc_align()
static unsigned long L4virtio::Virtqueue::desc_align |
( |
| ) |
|
|
inlinestatic |
Get the alignment in zero LSBs needed for the descriptor table.
- Returns
- The alignment in zero LSBs needed for a descriptor table.
Definition at line 273 of file virtqueue.
◆ desc_size()
static unsigned long L4virtio::Virtqueue::desc_size |
( |
unsigned |
num | ) |
|
|
inlinestatic |
◆ disable()
void L4virtio::Virtqueue::disable |
( |
| ) |
|
|
inline |
◆ dump()
void L4virtio::Virtqueue::dump |
( |
Desc const * |
d | ) |
const |
|
inline |
◆ get_avail_idx()
l4_uint16_t L4virtio::Virtqueue::get_avail_idx |
( |
| ) |
const |
|
inline |
Get available index from available ring (for debugging).
- Precondition
- Queue must be in a working state.
- Returns
- current index in the available ring (shared between device model and device driver).
Definition at line 452 of file virtqueue.
References L4virtio::Virtqueue::Avail::idx.
◆ get_tail_avail_idx()
l4_uint16_t L4virtio::Virtqueue::get_tail_avail_idx |
( |
| ) |
const |
|
inline |
Get tail-available index stored in local state (for debugging).
- Returns
- current tail index for the the available ring.
Definition at line 459 of file virtqueue.
◆ no_notify_guest()
bool L4virtio::Virtqueue::no_notify_guest |
( |
| ) |
const |
|
inline |
◆ no_notify_host() [1/2]
bool L4virtio::Virtqueue::no_notify_host |
( |
| ) |
const |
|
inline |
◆ no_notify_host() [2/2]
void L4virtio::Virtqueue::no_notify_host |
( |
bool |
value | ) |
|
|
inline |
◆ num()
unsigned L4virtio::Virtqueue::num |
( |
| ) |
const |
|
inline |
◆ ready()
bool L4virtio::Virtqueue::ready |
( |
| ) |
const |
|
inline |
◆ setup()
void L4virtio::Virtqueue::setup |
( |
unsigned |
num, |
|
|
void * |
desc, |
|
|
void * |
avail, |
|
|
void * |
used |
|
) |
| |
|
inline |
Enable this queue.
- Parameters
-
num | The number of entries in the descriptor table, the available ring, and the used ring (must be a power of 2). |
desc | The address of the descriptor table. (Must be Desc_align aligned and at least desc_size(num) bytes in size.) |
avail | The address of the available ring. (Must be Avail_align aligned and at least avail_size(num) bytes in size.) |
used | The address of the used ring. (Must be Used_align aligned and at least used_size(num) bytes in size.) |
Due to the data type of the descriptors, the queue can have a maximum size of 2^16.
Definition at line 353 of file virtqueue.
References L4_EINVAL.
Referenced by L4virtio::Svr::Device_t< Ds_data >::setup_queue().
◆ setup_simple()
void L4virtio::Virtqueue::setup_simple |
( |
unsigned |
num, |
|
|
void * |
ring |
|
) |
| |
|
inline |
Enable this queue.
- Parameters
-
num | The number of entries in the descriptor table, the available ring, and the used ring (must be a power of 2). |
ring | The base address for the queue data structure. The memory block at ring must be at least total_size(num) bytes in size and have an alignment of Desc_align (desc_align()) bits. |
Due to the data type of the descriptors, the queue can have a maximum size of 2^16.
Definition at line 382 of file virtqueue.
References l4_round_size().
◆ total_size() [1/2]
static unsigned long L4virtio::Virtqueue::total_size |
( |
unsigned |
num | ) |
|
|
inlinestatic |
Calculate the total size for a virtqueue of the given dimensions.
- Parameters
-
num | The number of entries in the descriptor table, the available ring, and the used ring (must be a power of 2). |
- Returns
- The total size in bytes of the queue data structures.
Definition at line 249 of file virtqueue.
◆ total_size() [2/2]
unsigned long L4virtio::Virtqueue::total_size |
( |
| ) |
const |
|
inline |
Calculate the total size of this virtqueue.
- Precondition
- The queue has been set up.
Definition at line 318 of file virtqueue.
◆ used_align()
static unsigned long L4virtio::Virtqueue::used_align |
( |
| ) |
|
|
inlinestatic |
Get the alignment in zero LSBs needed for the used ring.
- Returns
- The alignment in zero LSBs needed for an used ring.
Definition at line 310 of file virtqueue.
◆ used_size()
static unsigned long L4virtio::Virtqueue::used_size |
( |
unsigned |
num | ) |
|
|
inlinestatic |
The documentation for this class was generated from the following file: