Module Name: src Committed By: msaitoh Date: Wed Jan 24 05:18:59 UTC 2024
Modified Files: src/sys/dev/pci/ixgbe: ixgbe.c Log Message: ixgbe: Add QPRDC into iqdrops. A receive packet might drop at two different locations. One is the packet buffer that packets are received into the chip first. If the packet buffer is overflowed, the MPC register is incremented. It's currently added to iqdrops. It's no problem. Another is descriptor ring(s). A packet from the packet buffer is DMA'ed into main memory base on the descriptor ring. If the ring is full, the packet is dropped and the QPRDC register is incremented. It should be added to iqdrops but it was not done. Fix it. Reported by ozaki-r@. To generate a diff of this commit: cvs rdiff -u -r1.348 -r1.349 src/sys/dev/pci/ixgbe/ixgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/ixgbe/ixgbe.c diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.348 src/sys/dev/pci/ixgbe/ixgbe.c:1.349 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.348 Wed Nov 15 03:50:22 2023 +++ src/sys/dev/pci/ixgbe/ixgbe.c Wed Jan 24 05:18:59 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe.c,v 1.348 2023/11/15 03:50:22 msaitoh Exp $ */ +/* $NetBSD: ixgbe.c,v 1.349 2024/01/24 05:18:59 msaitoh Exp $ */ /****************************************************************************** @@ -64,7 +64,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.348 2023/11/15 03:50:22 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.349 2024/01/24 05:18:59 msaitoh Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1637,7 +1637,7 @@ ixgbe_update_stats_counters(struct ixgbe struct ixgbe_hw *hw = &sc->hw; struct ixgbe_hw_stats *stats = &sc->stats.pf; u32 missed_rx = 0, bprc, lxontxc, lxofftxc; - u64 total, total_missed_rx = 0; + u64 total, total_missed_rx = 0, total_qprdc = 0; uint64_t crcerrs, illerrc, rlec, ruc, rfc, roc, rjc; unsigned int queue_counters; int i; @@ -1656,13 +1656,18 @@ ixgbe_update_stats_counters(struct ixgbe IXGBE_EVC_REGADD(hw, stats, IXGBE_QPRC(i), qprc[i]); IXGBE_EVC_REGADD(hw, stats, IXGBE_QPTC(i), qptc[i]); if (hw->mac.type >= ixgbe_mac_82599EB) { + uint32_t qprdc; + IXGBE_EVC_ADD(&stats->qbrc[i], IXGBE_READ_REG(hw, IXGBE_QBRC_L(i)) + ((u64)IXGBE_READ_REG(hw, IXGBE_QBRC_H(i)) << 32)); IXGBE_EVC_ADD(&stats->qbtc[i], IXGBE_READ_REG(hw, IXGBE_QBTC_L(i)) + ((u64)IXGBE_READ_REG(hw, IXGBE_QBTC_H(i)) << 32)); - IXGBE_EVC_REGADD(hw, stats, IXGBE_QPRDC(i), qprdc[i]); + /* QPRDC will be added to iqdrops. */ + qprdc = IXGBE_READ_REG(hw, IXGBE_QPRDC(i)); + IXGBE_EVC_ADD(&stats->qprdc[i], qprdc); + total_qprdc += qprdc; } else { /* 82598 */ IXGBE_EVC_REGADD(hw, stats, IXGBE_QBRC(i), qbrc[i]); @@ -1793,7 +1798,7 @@ ixgbe_update_stats_counters(struct ixgbe * normal RX counters are prepared in ether_input(). */ net_stat_ref_t nsr = IF_STAT_GETREF(ifp); - if_statadd_ref(nsr, if_iqdrops, total_missed_rx); + if_statadd_ref(nsr, if_iqdrops, total_missed_rx + total_qprdc); /* * Aggregate following types of errors as RX errors: