Detailed introduction of network card multi-queue technology and RSS function

Y2J
Release: 2017-04-25 09:23:41
Original
6544 people have browsed it

Multi-queue network card is a technology. It was originally used to solve the problem of network IO QoS (quality of service). Later, as the bandwidth of network IO continued to increase, a single-core CPU could not fully meet the needs of the network card. Through Support for multi-queue network card drivers binds each queue to different cores through interrupts to meet the needs of the network card.

Common ones include Intel's 82575, 82576, Boardcom's 57711, etc. The following takes the Intel 82575 network card that is commonly used by the company's servers as an example to analyze the hardware implementation of the multi-queue network card and the support of the Linux kernel software. .

1. Multi-queue network card hardware implementation

Figure 1.1 is the Intel 82575 hardware logic diagram, with four hardware queues. When a packet is received, a flow is always received in the same queue by hashing the SIP, Sport, DIP, and Dport quadruples in the packet header. At the same time, the interrupt bound to the queue is triggered.

Figure 1.1 82575 hardware logic diagram

2. What is RSS

RSS (Receive Side Scaling) is a method that can Network card driver technology that enables efficient distribution of received messages among multiple CPUs under the processor system.

  • The network card parses the received message and obtains the IP address, protocol and port quintuple information

  • The network card passes the configured HASH The function calculates the HASH value based on the five-tuple information, and can also calculate the HASH value based on the two, three, or four-tuple information.

  • Take the lower digits of the HASH value (the specific network card may be different) as the index of RETA (redirection table)

  • According to the storage in RETA The value is distributed to the corresponding CPU

The following figure describes the complete processing flow:

Programs based on RSS technology can distribute data between multiple CPUs through hardware flow, and dynamic 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 based on ports, and packets are distributed according to the port's receiving queue. For example, if we configure 3 receive queues (0,1,2) on a port and enable RSS, then it will look like this:

{0,1,2,0,1,2,0 .........}

Applications running on different CPUs receive messages from different receive queues, thus achieving the effect of message distribution.

Enable the RSS function in DPDK by setting the mq_mode field in rte_eth_conf, rx_mode.mq_mode = ETH_MQ_RX_RSS.

When the RSS function is turned on, the hash value calculated by RSS will be stored in the rte_pktmbuf corresponding to the message, which can be accessed through pktmbuf.hash.rss. This value can be used directly in subsequent packet processing without recalculating the hash value, such as fast forwarding, identifying packet flows, etc.

RETA is configurable at runtime, so that the application can dynamically change the receiving queue corresponding to the CPU, thereby dynamically adjusting message distribution. Specifically configured through the driver of the PMD module, such as ixgbe_dev_rss_reta_update and ixgbe_dev_rss_reta_query.

The above is the detailed content of Detailed introduction of network card multi-queue technology and RSS function. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template