pub struct QueueState {
    pub max_size: u16,
    pub next_avail: Wrapping<u16>,
    pub next_used: Wrapping<u16>,
    pub event_idx_enabled: bool,
    pub num_added: Wrapping<u16>,
    pub size: u16,
    pub ready: bool,
    pub desc_table: GuestAddress,
    pub avail_ring: GuestAddress,
    pub used_ring: GuestAddress,
}
Expand description

Struct to maintain information and manipulate state of a virtio queue.

WARNING: The way the QueueState is defined now, it can be used as the queue object, therefore it is allowed to set up and use an invalid queue (initialized with random data since the QueueState’s fields are public). When fixing https://github.com/rust-vmm/vm-virtio/issues/143, we plan to rename QueueState to Queue, and define a new QueueState that would be the actual state of the queue (no Wrappings in it, for example). This way, we will also be able to do the checks that we normally do in the queue’s field setters when starting from scratch, when trying to create a Queue from a QueueState.

Fields

max_size: u16

The maximum size in elements offered by the device.

next_avail: Wrapping<u16>

Tail position of the available ring.

next_used: Wrapping<u16>

Head position of the used ring.

event_idx_enabled: bool

VIRTIO_F_RING_EVENT_IDX negotiated.

num_added: Wrapping<u16>

The number of descriptor chains placed in the used ring via add_used since the last time needs_notification was called on the associated queue.

size: u16

The queue size in elements the driver selected.

ready: bool

Indicates if the queue is finished with configuration.

desc_table: GuestAddress

Guest physical address of the descriptor table.

avail_ring: GuestAddress

Guest physical address of the available ring.

used_ring: GuestAddress

Guest physical address of the used ring.

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Type for guard returned by Self::lock().

Get a consuming iterator over all available descriptor chain heads offered by the driver. Read more

Undo the last advancement of the next available index field by decrementing its value by one. Read more

Construct an empty virtio queue state object with the given max_size.

Check whether the queue configuration is valid.

Reset the queue to the initial state.

Get an exclusive reference to the underlying QueueState object. Read more

Get the maximum size of the virtio queue.

Get the actual size configured by the guest.

Configure the queue size for the virtio queue.

Check whether the queue is ready to be processed.

Configure the queue to ready for processing state.

Set the descriptor table address for the queue. Read more

Set the available ring address for the queue. Read more

Set the used ring address for the queue. Read more

Enable/disable the VIRTIO_F_RING_EVENT_IDX feature for interrupt coalescing.

Read the idx field from the available ring.

Read the idx field from the used ring.

Put a used descriptor head into the used ring.

Enable notification events from the guest driver. Read more

Disable notification events from the guest driver.

Check whether a notification to the guest is needed. Read more

Return the index of the next entry in the available ring.

Set the index of the next entry in the available ring.

Return the index for the next descriptor in the used ring.

Set the index for the next descriptor in the used ring.

Pop and return the next available descriptor chain, or None when there are no more descriptor chains available. Read more

Get an exclusive reference to the underlying QueueState object with an associated GuestMemory object. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.