Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Aug 2009 08:04:27 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-hackers@freebsd.org
Cc:        jfv@FreeBSD.org, Andrew Brampton <brampton+freebsd-hackers@gmail.com>
Subject:   Re: netstat -i Ierrs column, Is it total, or per second?
Message-ID:  <200908310804.27417.jhb@freebsd.org>
In-Reply-To: <d41814900908310318n113867dsf9e47f149b0e61b4@mail.gmail.com>
References:  <d41814900908310318n113867dsf9e47f149b0e61b4@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200908310804.27417.jhb>