netstat -i Ierrs column, Is it total, or per second?
Andrew Brampton
brampton+freebsd-hackers at gmail.com
Mon Aug 31 19:15:56 UTC 2009
2009/8/31 John Baldwin <jhb at freebsd.org>:
> It should be total and it sounds like a bug in the device driver. It looks
> like ixgbe_update_stats_counters() overwrites the accumulated value of
> if_ierrors:
>
> /* Rx Errors */
> ifp->if_ierrors = total_missed_rx + adapter->stats.crcerrs +
> adapter->stats.rlec;
>
> It also increments if_ierrors in ixgbe_rxeof(). The driver should only do one
> or the other, but probably not both.
>
> --
> John Baldwin
>
Thanks for your reply. I had wondered that, but looking at
e1000/if_em.c it does a similar thing. However, a quick look at
non-intel drivers and it seems others don't. So perhaps this is a
problem across the intel drivers?
So anyway I spent my afternoon reading the ixgbe spec sheet and
creating the attached patch, which hopefully fixes this problem. I
will forward this patch to freebsd <at> intel.com unless someone can
point me toward the maintainers email address, or should I just create
a PR?
thanks
Andrew
-------------- next part --------------
diff -u ixgbe.old/ixgbe.c ixgbe/ixgbe.c
--- ixgbe.old/ixgbe.c 2009-08-31 18:15:05.000000000 +0100
+++ ixgbe/ixgbe.c 2009-08-31 19:52:14.000000000 +0100
@@ -3978,7 +3978,6 @@
if (eop) {
rxr->fmp->m_pkthdr.rcvif = ifp;
- ifp->if_ipackets++;
rxr->rx_packets++;
/* capture data for AIM */
rxr->bytes += rxr->fmp->m_pkthdr.len;
@@ -4000,8 +3999,9 @@
rxr->lmp = NULL;
}
} else {
- ifp->if_ierrors++;
discard:
+ adapter->dropped_pkts++;
+
/* Reuse loaded DMA map and just update mbuf chain */
if (hlen) {
mh = rxr->rx_buffers[i].m_head;
@@ -4459,12 +4459,15 @@
u32 missed_rx = 0, bprc, lxon, lxoff, total;
adapter->stats.crcerrs += IXGBE_READ_REG(hw, IXGBE_CRCERRS);
+ adapter->stats.illerrc += IXGBE_READ_REG(hw, IXGBE_ILLERRC);
+ adapter->stats.errbc += IXGBE_READ_REG(hw, IXGBE_ERRBC);
for (int i = 0; i < 8; i++) {
int mp;
mp = IXGBE_READ_REG(hw, IXGBE_MPC(i));
missed_rx += mp;
adapter->stats.mpc[i] += mp;
+ adapter->stats.mpctotal += mp;
adapter->stats.rnbc[i] += IXGBE_READ_REG(hw, IXGBE_RNBC(i));
}
@@ -4532,8 +4535,11 @@
ifp->if_collisions = 0;
/* Rx Errors */
- ifp->if_ierrors = missed_rx + adapter->stats.crcerrs +
- adapter->stats.rlec;
+ ifp->if_ierrors = adapter->stats.mpctotal +
+ adapter->stats.crcerrs +
+ adapter->stats.illerrc +
+ adapter->stats.errbc +
+ adapter->stats.rlec;
}
More information about the freebsd-hackers
mailing list