接收端缩放简介Introduction to Receive Side Scaling

接收的方缩放 (RSS) 是一种网络驱动程序技术实现高效的网络分布在多处理器系统中接收处理跨多个 Cpu。Receive side scaling (RSS) is a network driver technology that enables the efficient distribution of network receive processing across multiple CPUs in multiprocessor systems.

请注意  因为相同的核心处理器共享相同的执行引擎上的超线程 Cpu,效果不是为具有多个核处理器相同。Note  Because hyper-threaded CPUs on the same core processor share the same execution engine, the effect is not the same as having multiple core processors. 出于此原因,RSS 不使用超线程处理器。For this reason, RSS does not use hyper-threaded processors.

若要有效地处理接收的数据,微型端口驱动程序收到中断服务函数计划延迟的过程调用 (DPC)。To process received data efficiently, a miniport driver's receive interrupt service function schedules a deferred procedure call (DPC). 不使用 RSS,典型 DPC 指示 DPC 调用中接收的所有数据。Without RSS, a typical DPC indicates all received data within the DPC call. 因此,所有与中断相关联的接收处理运行在 CPU 上接收中断的发生位置。Therefore, all of the receive processing that is associated with the interrupt runs on the CPU where the receive interrupt occurs. 有关非 RSS 概述接收处理,请参阅处理非 RSS 接收For an overview of non-RSS receive processing, see Non-RSS Receive Processing.

使用 RSS,NIC 和微型端口驱动程序提供的功能来计划在其他处理器上接收 dpc 进行标记。With RSS, the NIC and miniport driver provide the ability to schedule receive DPCs on other processors. 此外,RSS 设计可确保与给定连接关联的处理会保留在已分配的 CPU 上。Also, the RSS design ensures that the processing that is associated with a given connection stays on an assigned CPU. NIC 实现一个哈希函数,并生成的哈希值提供的方法来选择一个 CPU。The NIC implements a hash function and the resulting hash value provides the means to select a CPU.

下图说明了用于确定 CPU 的 RSS 机制。The following figure illustrates the RSS mechanism for determining a CPU.

说明用于确定 cpu 的 rss 机制的关系图

NIC 使用的哈希函数来计算哈希值通过定义区域 (哈希类型) 中接收的网络数据。A NIC uses a hashing function to compute a hash value over a defined area (hash type) within the received network data. 定义的区域可以是不连续。The defined area can be noncontiguous.

数的哈希值的最低有效位 (LSBs) 用于编制索引的间接寻址表。A number of least significant bits (LSBs) of the hash value are used to index an indirection table. 间接寻址表中的值用于将接收到的数据分配给一个 CPU。The values in the indirection table are used to assign the received data to a CPU. 有关详细的间接寻址表有关的信息,请参阅RSS 配置For more detailed information about the indirection table, see RSS Configuration.

消息信号中断 (MSI) 支持,NIC 可以还中断关联的 CPU。With message signaled interrupt (MSI) support, a NIC can also interrupt the associated CPU. 有关 Msi 的 NDIS 支持的详细信息,请参阅NDIS MSI-XFor more information about NDIS support for MSIs, see NDIS MSI-X.

通过减少,RSS 可以提高网络系统性能:RSS can improve network system performance by reducing:

  • 通过分发的处理延迟接收处理 NIC 中跨多个 Cpu。Processing delays by distributing receive processing from a NIC across multiple CPUs.

    这有助于确保没有 CPU 负载很重时另一个 CPU 处于空闲状态。This helps to ensure that no CPU is heavily loaded while another CPU is idle.

  • 旋转锁开销通过增加共享数据的软件算法在 CPU 执行相同的概率。Spin lock overhead by increasing the probability that software algorithms that share data execute on the same CPU.

    数值调节钮锁定开销时发生,例如上卸下 cpu 0, 函数执行都拥有 CPU1 上运行的函数必须访问的数据的自旋锁。Spin lock overhead occurs, for example, when a function executing on CPU0 possesses a spin lock on data that a function running on CPU1 must access. CPU1 旋转 (等待),直到卸下 cpu 0 释放锁。CPU1 spins (waits) until CPU0 releases the lock.

  • 通过增加共享数据的软件算法在 CPU 执行相同的概率,重新加载缓存和其他资源。Reloading of caches and other resources by increasing the probability that software algorithms that share data execute on the same CPU.

    此类重新加载,例如,当执行并访问上卸下 cpu 0,共享的数据的函数执行时发生上 CPU1 中后续中断。Such reloading occurs, for example, when a function that is executing and accessing shared data on CPU0, executes on CPU1 in a subsequent interrupt.

若要实现这些性能改进的安全环境中,RSS 提供了以下机制:To achieve these performance improvements in a secure environment, RSS provides the following mechanisms:

  • 分布式的处理Distributed processing

    RSS 将的处理进程分布到多个 Cpu Dpc 在给定 NIC 中接收的指示。RSS distributes the processing of receive indications from a given NIC in DPCs to multiple CPUs.

  • 按序处理In-order processing

    RSS 可保留已接收的数据包的传递的顺序。RSS preserves the order of delivery of received data packets. 对于每个网络连接,RSS 进程收到指示关联的 CPU 上。For each network connection, RSS processes receive indications on an associated CPU. 有关 RSS 的详细信息接收处理,请参阅接收数据,该值指示 RSSFor more information about RSS receive processing, see Indicating RSS Receive Data.

  • 动态负载平衡Dynamic load balancing

    RSS 提供了一种方法来重新平衡 Cpu 之间的网络处理负载,因为主机系统负载各不相同。RSS provides a means to rebalance the network processing load between CPUs as host system load varies. 若要重新平衡负荷,过量驱动程序可以更改间接表。To rebalance the load, overlying drivers can change the indirection table. 有关指定间接表的详细信息,哈希处理类型和哈希函数,请参阅RSS 配置For more information about specifying indirection tables, hash types, and hashing functions, see RSS Configuration.

  • 发送方缩放Send-side scaling

    RSS 可让进程发送和接收端数据在同一 CPU 上的给定连接的驱动程序堆栈。RSS enables driver stacks to process send and receive-side data for a given connection on the same CPU. 通常情况下,基础驱动程序 (例如,TCP) 发送数据块的一部分,并发送数据的平衡性之前等待确认。Typically, an overlying driver (for example, TCP) sends part of a data block and waits for an acknowledgment before sending the balance of the data. 然后,此确认触发器后续发送请求。The acknowledgment then triggers subsequent send requests. RSS 间接表标识接收数据处理的特定 CPU。The RSS indirection table identifies a particular CPU for the receive data processing. 默认情况下,发送处理在上运行相同的 CPU 如果它由接收确认触发。By default, the send processing runs on the same CPU if it is triggered by the receive acknowledgment. 驱动程序还可以指定 CPU (例如,如果使用计时器)。A driver can also specify the CPU (for example, if a timer is used).

  • 安全哈希Secure hash

    RSS 包括一个签名,它提供了更高的安全性。RSS includes a signature that provides added security. 此签名保护系统免受恶意远程主机要强行使系统进入不平衡状态可能会尝试。This signature protects the system from malicious remote hosts that might attempt to force the system into an unbalanced state.

  • MSI X 支持MSI-X support

    RSS,与支持 MSI X 运行中断服务例程 (ISR) 更高版本执行 DPC 在同一 CPU 上。RSS, with support for MSI-X, runs the interrupt service routine (ISR) on the same CPU that later executes the DPC. 这将减少系统开销并重新加载缓存的自旋锁。This reduces spin lock overhead and reloading of caches.

下图说明了 RSS 的硬件支持的级别。The following figure illustrates the levels of hardware support for RSS.

说明的 rss 硬件支持的级别的关系图

有三个可能的 RSS 硬件支持级别:There are three possible levels of hardware support for RSS:

使用单个队列的哈希计算Hash calculation with a single queue
NIC 计算的哈希值并微型端口驱动程序将接收到的数据包分配给与 Cpu 相关联的队列。The NIC calculates the hash value and the miniport driver assigns received packets to queues that are associated with CPUs. 有关详细信息,请参阅与单个硬件接收队列的 RSSFor more information, see RSS with a Single Hardware Receive Queue.

具有多个哈希计算接收队列Hash calculation with multiple receive queues
NIC 将分配给与 Cpu 相关联的队列的接收的数据缓冲区。The NIC assigns the received data buffers to queues that are associated with CPUs. 有关详细信息,请参阅与硬件队列的 RSSFor more information, see RSS with Hardware Queuing.

发出信号的消息可以中断 (Msi)Message Signaled Interrupts (MSIs)
NIC 会中断应处理接收到的数据包的 CPU。The NIC interrupts the CPU that should handle the received packets. 有关详细信息,请参阅与消息信号中断 RSSFor more information, see RSS with Message Signaled Interrupts.

始终在 32 位哈希值将传递 NIC。The NIC always passes on the 32-bit hash value.