Page MenuHomeFreeBSD

ixgbe: restore missed-packet accounting so input drops are visible
Needs ReviewPublic

Authored by nick_spun.io on Mon, Jun 22, 10:35 PM.
Referenced Files
F160901700: D57756.diff
Sun, Jun 28, 9:36 PM
F160901680: D57756.diff
Sun, Jun 28, 9:36 PM
Unknown Object (File)
Sat, Jun 27, 4:06 AM
Unknown Object (File)
Fri, Jun 26, 12:59 PM
Unknown Object (File)
Fri, Jun 26, 11:54 AM
Unknown Object (File)
Thu, Jun 25, 3:33 PM
Unknown Object (File)
Thu, Jun 25, 10:59 AM

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
drivers
Summary

ixgbe_update_stats_counters() read only IXGBE_MPC(0) into stats->mpc[0]
and left missed_rx and total_missed_rx at zero. Two things broke as a
result: the "gprc counts missed packets" hardware workaround subtracted
zero (stats->gprc -= missed_rx), so IPACKETS was inflated by dropped
packets; and IXGBE_SET_IQDROPS() always published zero, so input drops
from RX overruns were invisible to netstat(1) and ifconfig(8).

The 82599 spreads missed-packet counts across eight per-traffic-class MPC
registers. Restore the eight-entry accumulation loop so missed_rx feeds
the gprc correction and total_missed_rx feeds IQDROPS. This is a
regression from the iflib conversion, which replaced the loop with a
single MPC(0) read.

Also fold in the per-queue QPRDC (Queue Packet Receive Drop Count)
registers, which were read into stats->qprdc[] but never consumed. QPRDC
counts packets dropped because a queue had no RX descriptor available --
a distinct input drop from the packet-buffer overflow counted by MPC (a
no-descriptor packet either drops at the queue or backs up and overflows
the buffer, never both), so summing both into IQDROPS does not double
count. QPRDC is not valid on 82598; Linux likewise accumulates it (as
hw_rx_no_dma_resources) only on 82599 and later parts.

Finally, stop summing mpc into the IERRORS aggregate: missed packets are
input drops reported via IQDROPS, not receive errors, and only mpc[0] was
being added there anyway. Linux likewise keeps missed packets out of
rx_errors.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 74131
Build 71014: arc lint + arc unit

Event Timeline

Owners added a reviewer: Restricted Owners Package.Mon, Jun 22, 10:35 PM
adrian added a reviewer: drivers.
adrian added a subscriber: drivers.

I'm under impression that we use only TC0, but I need to refresh my memory. Do you actually see non-zero values in registers MPC[1-8]?

D'oh - you're right about the TCs, I missed that they're clamped to 1 - been working on a driver where you have to use multiple TCs to spin up multiple TX queues

I think the rest is still right for correctness sake but probably not super valuable

adrian added inline comments.
sys/dev/ixgbe/if_ix.c
1893

is there eight of these units to poll? is this dictated by hardware somehow?

sys/dev/ixgbe/if_ix.c
1893

The packet buffer gets split between up to 8 segments when multiple TCs are being used - when they're unused these counters exist but the extras sit at 0

sys/dev/ixgbe/if_ix.c
1893

(I missed that the driver currently clamps TCs to 1 so this effectively does nothing)