netstat -i Ierrs column, Is it total, or per second?

John Baldwin jhb at freebsd.org
Mon Aug 31 12:23:57 UTC 2009


On Monday 31 August 2009 6:18:56 am Andrew Brampton wrote:
> Hi FreeBSD-Hackers,
> 
> netstat -i will print out statistics for each interface, including
> input/output packets, input/output bytes, and input/output errors. Now
> packets and bytes columns seem to be absolute counts, whereas the
> errors column seems to be a count over the last second. For example,
> when I am filling a link (and then stop), I get output like so:
> 
> Name    Mtu Network       Address              Ipkts Ierrs    Opkts Oerrs  
Coll
> ix0    9000 <Link#4>      00:1b:21:20:f9:07 12687951213 432913
> 1     0     0
> <wait a second>
> ix0    9000 <Link#4>      00:1b:21:20:f9:07 12691545431 435439
> 1     0     0
> <wait a second>
> ix0    9000 <Link#4>      00:1b:21:20:f9:07 12692054413 434735
> 1     0     0
> <wait a second and traffic has stopped>
> ix0    9000 <Link#4>      00:1b:21:20:f9:07 12696499228 300785
> 1     0     0
> <wait a second>
> ix0    9000 <Link#4>      00:1b:21:20:f9:07 12696499228     0        1
>     0     0
> 
> As you can see the "Ipkts" value continues to rise, but the "Ierrs"
> goes up and down, eventually falling to zero. So my question is,
> should this "Ierrs" count be per second?, if so how can I change this
> behaviour. I looked at the source code for the driver (ixgbe) and the
> OS, looking for every reference to ifp->if_ierrors, but I didn't find
> anything that reset this value over time. I also tried a similar
> experiment with the e1000 driver but I couldn't get that interface to
> list any errors.
> 
> I'm running these tests on FreeBSD 8.0-Beta3, but I observed the same
> behaviour on FreeBSD 7.2.

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


More information about the freebsd-hackers mailing list