About qmapsΒΆ
You can associate 6WINDGate DPDK queues with virtio rings via qmap
structures.
A virtio ring is a software structure used to exchange packets between a host and a guest.
A 6WINDGate DPDK queue is a software abstraction layer that is part of the 6WINDGate DPDK PMD API: packets are received from and transmitted to 6WINDGate DPDK queues. A queue is accessed by one core at a time. For physical hardware, a software queue is usually associated with an hardware queue. In Virtio Host PMD, the software queue is associated with one or several virtio rings for more flexibility. For example, it allows to spread the traffic sent to one queue over several virtio rings, providing a RSS-like feature to the guest.
You can set up more complex associations with qmap
configurations:
- 1-1 association
One queue is associated with one ring.
- 1-N association
One queue is associated with several rings, selected via a round-robin or a hash mechanism.
- N-1 association
N queues are associated with the same ring.
- N-M association
N queues are associated with several rings, selected via a round-robin or a hash mechanism.
A qmap
structure is associated with one 6WINDGate DPDK queue; therefore it is
only accessed by one core.
A rxqmap
is a list of rings polled by one 6WINDGate DPDK queue in a round-robin
fashion.
A txqmap
is a list of rings filled when transmitting on one 6WINDGate DPDK
queue. The rings are selected using round-robin or based on the flow hash of
the packet. In the latter case, the flow hash depends on:
the Ethernet protocol
the most inner vlan id
the most inner IPv4 or IPv6 addresses
the Layer 4 protocol
the Layer 4 ports if protocol is TCP or UDP
The following network headers are recognized:
Ethernet
VLAN
IPv4, IPv6
IPv4 and IPv6 tunnels
GRE tunnels
TCP, UDP
It is important to understand how queues are allocated in your application (for
instance testpmd
, or the fast path). In the fast path, there is one TX queue per core,
and you can configure the number of RX queues via the CORE_PORT_MAPPING
parameter.
The virtio specifications states that:
RX rings identifiers are odd
TX rings identifiers are even
Example
The example below illustrates the concept of qmap
. It is based on the
following configuration:
One port and 3 cores
One RX queue (
q0
), polled by core 13 RX virtio rings, polled in round-robin mode when reading from RX queue 0
3 TX queues (one for each core)
One TX ring, filled when transmitting to any TX queue
When configuring Virtio Host PMD, you can specify:
which rings are polled for each
rxqmap
,to which rings packets will be transmitted for each
txqmap
.
To avoid packet losses, check the qmap
configuration to ensure that:
the virtio rings filled by the host are all emptied by the guest,
the virtio rings filled by the guest are all emptied by the host.
To enhance performance, if possible, set up the fast path CORE_PORT_MAPPING
value
and the driver qmap
configuration so that:
Work is equally distributed among all cores.
Inter-sockets memory transfer is kept to a minimum: cores polling a given virtio ring should be on the same socket as cores transmitting to the virtio ring.
Concurrent accesses on virtio rings are kept to a minimum: virtio rings are single-producer and single-consumer, therefore a lock is automatically added when several cores can access the same virtio ring.
The number of virtio rings is kept to a minimum: when virtio rings are full, in-flight packets can consume much memory. If memory consumption exceeds the size of the CPU cache, performance drops.
See also
Virtual I/O Device (VIRTIO) Specifications
The 6WINDGate DPDK documentation
FPN-SDK Add-on for DPDK for details about the fast path queue allocation policy