Multi-queue Nic is a technology that was initially used to solve the problem of network IOQoS (qualityofservice). later, with the increasing bandwidth of network I/O, the single-core CPU cannot fully meet the needs of the NIC, with the support of multi-queue NIC driver, each queue is bound to different cores through interruption to meet NIC requirements. Commonly, there are Intel 82575, 82576, and Boardcom 57711. the following uses the Intel82575 Nic used by the company's servers as an example to analyze that multi-queue Nic is a technology, it was initially used to solve the problem of network I/O QoS (quality of service). later, with the increasing bandwidth of network I/O, a single core CPU cannot fully meet the needs of the NIC, with the support of multi-queue NIC driver, each queue is bound to different cores through interruption to meet NIC requirements.
Common examples include Intel 82575, 82576, and Boardcom 57711. the following uses an Intel 82575 Nic that is used by the company's servers as an example, analyze the hardware implementation of multi-queue NICs and the support of Linux kernel software.
1. Multi-queue NIC hardware implementation
. 1 is an Intel 82575 hardware logic diagram with four Hardware queues. When a message is received, a stream is always received in the same queue through the SIP, Sport, DIP, and Dport tuples of the hash packet header. At the same time, the interrupt bound to the queue is triggered.
. 1 82575 hardware logic diagram
2. what is RSS?
RSS (Receive Side Scaling) is a Nic driving technology that enables efficient delivery of received packets among multiple CPUs in a multi-processor system.
The network adapter parses the received packets to obtain information about the IP address, protocol, and Port quintuple.
The NIC uses the configured HASH function to calculate the HASH value based on the quintuple information. Alternatively, the HASH value can be calculated based on two, three, or four tuples.
The number of lower digits of the HASH value (which may vary depending on the NIC) as the RETA (redirection table) index.
Distribute to the corresponding CPU according to the stored values in the RETA
Describes the complete processing process:
RSS-based programs can distribute data streams between multiple CPUs by hardware, and dynamically load balancing can be achieved by modifying RETA.
3. configure RSS in DPDK
DPDK supports setting static hash values and configuring RETA. However, RSS in DPDK is Port-based and distributes packets based on the receiving queue of the port. For example, if we configure three receiving queues (0, 1, 2) on a port and enable RSS, the following is true:
{, 0 .........}
Applications running on different CPUs receive messages from different receiving queues, which achieves packet distribution.
In DPDK, setrte_eth_conf
Inmq_mode
Field to enable the RSS function,rx_mode.mq_mode = ETH_MQ_RX_RSS
.
When the RSS function is enabled, the correspondingrte_pktmbuf
The hash value calculated by RSS is stored.pktmbuf.hash.rss
. This value can be directly used in subsequent packet processing without re-calculating the hash value, such as fast forwarding and identifying the packet stream.
RETA can be configured during running, so that the application can dynamically change the receiving queue corresponding to the CPU, so as to dynamically adjust packet distribution. It is configured by the driver of the PMD module, for exampleixgbe_dev_rss_reta_update
Andixgbe_dev_rss_reta_query
.
The above is a detailed description of the NIC multi-queue technology and RSS function. For more information, see other related articles in the first PHP community!