Expand description
This module implements the low-level interface to the VmBus ring buffer. The ring buffer resides in guest memory and is mapped into the host, allowing efficient transfer of variable-sized packets.
Ring buffer packets have headers called descriptors, which can specify a transaction ID and metadata referring to memory outside the ring buffer. Each packet is a multiple of 8 bytes.
In practice, ring buffers always come in pairs so that packets can be both sent and received. However, this module’s interfaces operate on them singly.
Modules§
Structs§
- Flat
Ring Mem - An implementation of
RingMem
over a flat allocation. Useful for tests. - Incoming
Offset - The current incoming ring state.
- Incoming
Packet - An incoming packet.
- Incoming
Ring - The interface to the receiving endpoint of a ring buffer.
- Outgoing
Offset - An outgoing ring offset, used to determine the position to write packets to.
- Outgoing
Packet - Information about an outgoing packet.
- Outgoing
Ring - The sending side of a ring buffer.
- Packet
Size - Namespace type with methods to compute packet sizes, for use with
set_pending_send_size
. - Paged
Ring Mem - An implementation of
RingMem
on top of discontiguous pages. - Pipe
Header - Pipe channel packets are prefixed with this header to allow for non-8-multiple lengths.
- Ring
Range - A range within a ring buffer.
- Ring
Range Reader - A type implementing
MemoryRead
accessing aRingRange
. - Ring
Range Writer - A type implementing
MemoryWrite
accessing aRingRange
. - Single
Mapped Ring Mem - Transfer
Page Range - A transfer range specifying a length and offset within a transfer page set. Only used by NetVSP.
Enums§
- Error
- Incoming
Packet Type - The alternate types of incoming packets. For packets with external data,
includes a
RingRange
whose data is the variable portion of the packet descriptor. - Outgoing
Packet Type - The outgoing packet type variants.
- Read
Error - Write
Error
Constants§
- CONTROL_
WORD_ COUNT - The size of the control region in 32-bit words.
- MAXIMUM_
PIPE_ PACKET_ SIZE - The maximum size of a pipe packet’s payload.
- PAGE_
SIZE - VmBus ring buffers are sized in multiples 4KB pages, with a 4KB control page.
- PIPE_
PACKET_ TYPE_ DATA - Regular data packet.
- PIPE_
PACKET_ TYPE_ PARTIAL - Data packet that has been partially consumed, in which case the
len
field’s high word is the number of bytes already read. The opposite endpoint will never write this type. - PIPE_
PACKET_ TYPE_ SETUP_ GPA_ DIRECT - Setup a GPA direct buffer for RDMA.
- PIPE_
PACKET_ TYPE_ TEARDOWN_ GPA_ DIRECT - Tear down a GPA direct buffer.
Traits§
- Paged
Memory - A trait for ring buffer memory divided into discontiguous pages.
- Ring
- A trait shared by the incoming and outgoing ring buffers. Used primarily
with
RingRange::reader
andRingRange::writer
. - RingMem
- A trait for memory backing a ring buffer.
Functions§
- inspect_
ring - Inspects ring buffer state without creating an IncomingRing or OutgoingRing structure.
- reader_
needs_ signal - Returns whether a ring buffer is in a state where the receiving end might need a signal.
- writer_
needs_ signal - Returns whether a ring buffer is in a state where the sending end might need a signal.