Page MenuHomeFreeBSD

Fix if_vmx receive checksum offload bug and harden against the device skipping receive descriptors

Authored by pkelsey on Mar 3 2020, 5:17 PM.



This patch:

  • Fixes a bug where the checksum offload status of received packets was being taken from the first descriptor instead of the last descriptor. For LRO packets, whose checksums are always offloaded, and whose synthesized packet header does not contain valid checksum information, this resulted in the LRO packets being dropped, and the data only eventually getting through via retransmits that did not result in LRO processing. For single-descriptor packets and for multi-descriptor, non-LRO, jumbo frames, there is no impact.
  • Hardens the driver against device-skipped descriptors. Skipping of descriptors has yet to be observed during operation. It is currently believed that existing reports of this with this implementation were actually state corruption resulting from the iflib bug fixed by D23943, and that the device only skips descriptors with configurations that mix head and body type descriptors on the same receive ring (which this implementation does not). This relies on the patches in D23943 and D23946.
  • Avoids passing packets received with the error indicator set into the stack by forcing all fragment lengths of such packets when handing off to iflib. Such packets should wind up being discarded at some point in the stack, but this removes any questions by killing them in the driver. If LRO is enabled, and iflib refill limits are not disabled and/or the receive queue size is too small, there may be many such packets due to the device (apparently) running out of receive descriptors while constructing an LRO packet. This relies on the patch in D23945.
  • Adds sysctl-visible counters for skipped descriptor detection, zero-length packet reception, and reception of packets with the error indicator set.
Test Plan

This has been tested on a 12.1 system (with r356932 applied) with em and vmx devices, and with the patches from D23943, D23945, and D23946 applied.

This builds for 13-current, but testing on 13-current is waiting for the package system to get fixed.

Diff Detail

rS FreeBSD src repository - subversion
Lint Not Applicable
Tests Not Applicable