Date: Mon, 31 Aug 2009 20:15:53 +0100 From: Andrew Brampton <brampton+freebsd-hackers@gmail.com> To: John Baldwin <jhb@freebsd.org> Cc: jfv@freebsd.org, freebsd-hackers@freebsd.org Subject: Re: netstat -i Ierrs column, Is it total, or per second? Message-ID: <d41814900908311215o24cbded5y4c8dcb14ece5f670@mail.gmail.com> In-Reply-To: <200908310804.27417.jhb@freebsd.org> References: <d41814900908310318n113867dsf9e47f149b0e61b4@mail.gmail.com> <200908310804.27417.jhb@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
2009/8/31 John Baldwin <jhb@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
[-- Attachment #2 --]
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;
}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d41814900908311215o24cbded5y4c8dcb14ece5f670>
