[PATCH] Convert ixl(4) and ixlv(4) to ifcounters, and fix some counter bugs

Gleb Smirnoff glebius at FreeBSD.org
Thu Sep 25 12:08:15 UTC 2014


On Tue, Sep 23, 2014 at 07:18:51PM -0400, Ryan Stone wrote:
R> The patch below converts the ixl(4) and ixlv(4) drivers to use the new
R> ifcounter interface.  I've hidden the interface behind some macros to
R> ensure that the driver continues to compile for FreeBSD 10 and
R> earlier.  The result of the macros is that the ifcounter
R> implementation is somewhat clunkier than I would have liked, but I
R> preferred to try and share as much code between the legacy counter
R> implementation and the ifcounter implementation.
R> 
R> I have tested the ixl driver with head.  I have only compile-tested it
R> for stable/10.
R> 
R> This patch also fixes some counter bugs:
R> 
R> - Ensure that tx discards are reported
R> - There are actually two types of rx discard counters in the hardware.
R> Currently the driver is only reporting discards from one of the two
R> counters, so I fixed that
R> - The ipackets and opackets counters were being unnecessarily
R> incremented in the rx and tx paths.  This was racy, unnecessary (the
R> counters also get explicitly set based on the values in HW counters)
R> and very bad for performance -- the cacheline contained the counters
R> was constantly bouncing between CPUs.  I saw this even with only one
R> queue active, probably due to false sharing with some other field in
R> the ifnet struct.
R> 
R> https://people.freebsd.org/~rstone/patches/ixl/0005-Convert-ixl-and-ixlv-drivers-to-use-new-ifcounter-in.patch

Thanks, Ryan!

I'd suggest to use check against __FreeBSD_version >= 1100036.

Can you please commit this? Navdeep promised to do cxgbe(4), Alexander
is working on ixgbe. After that we can go forward with making counters
in struct ifnet non-racy and cheap counter(9).

-- 
Totus tuus, Glebius.


More information about the freebsd-net mailing list