Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Aug 2019 12:20:25 -0700
From:      John-Mark Gurney <jmg@funkthat.com>
To:        "Andrey V. Elsukov" <bu7cher@yandex.ru>
Cc:        freebsd-net@freebsd.org
Subject:   Re: igb netstat input counters 2x?
Message-ID:  <20190815192025.GF2342@funkthat.com>
In-Reply-To: <52b37710-8eb3-7e08-ee04-4682deb93c76@yandex.ru>
References:  <20190814002705.GD2342@funkthat.com> <52b37710-8eb3-7e08-ee04-4682deb93c76@yandex.ru>

next in thread | previous in thread | raw e-mail | index | archive | help

--w7PDEPdKQumQfZlR
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Andrey V. Elsukov wrote this message on Thu, Aug 15, 2019 at 17:38 +0300:
> On 14.08.2019 03:27, John-Mark Gurney wrote:
> > I'm doing some perf testing on an APU4 board, and I noticed that
> > it looks like the input netstat counters are 2x than what they should
> > be.
> >=20
> > I was seeing 60MiB/sec via netstat -w 1 -I igb1:
> >      40034     0     0   60760352       2538     0     177909     0
> >      40700     0     0   61776228       2574     0     180300     0
> >=20
> > But the program was only reading 27MB/sec.  I decided to read the mac
> > stats directly via:
> > bytes=3D$(sysctl -n dev.igb.1.mac_stats.good_octets_recvd); while sleep=
 1; do
> > 	nbytes=3D$(sysctl -n dev.igb.1.mac_stats.good_octets_recvd)
> > 	echo $(($nbytes - $bytes)); bytes=3D$nbytes
> > done
> >=20
> > and saw much more reasonable numbers:
> > 31099740
> > 30512488
> > 30675974
> >=20
> > Which is more in line w/ the 27MB/sec that the program reports.
> >=20
> > I haven't looked at the code to see what could be causing the double
> > counting.  Also, the output numbers appear to be accurate.
> >=20
> > This is with 13.0-CURRENT from the July 25th snapshot, which is r350322.
>=20
> Does this doubling happens only with IBYTES counter? What about
> IPACKETS? Also I'd check L2/L3 addresses to be sure that they by
> accident are not broadcast/multicast.

as for L2 addresses, it shouldn't be, but:
root@gate3:~ # arp -an | grep igb1
? (69.x.x.1) at a0:xx:xx:xx:xx:xx on igb1 expires in 777 seconds [ethernet]
? (69.x.x.27) at f8:xx:xx:xx:xx:xx on igb1 permanent [ethernet]

It's solely the upload to my fiber, so there should only be two hosts
on it..  my machine, and the gateway, and things look that way...
Also, traffic was generated by https, and counters go to near zero when
not collecting stats, and then immediately jump to double when running
the fetch...

Looks like the pkts are doubled as well, which lends itself to the fact
that packets are being double counted...
            input           igb1           output
   packets  errs idrops      bytes    packets  errs      bytes colls
     39668     0     0   60193686       2507     0     175751     0
     39042     0     0   59247132       2469     0     173104     0

and I expanded the above to pull the pkts as well and got:

good_octets	good	mcast	bcast	total
29935544        19676   0       0       19672
29868462        19629   0       0       19629

So, looks like they are double counted.

The later was generated using:
bytes=3D$(sysctl -n dev.igb.1.mac_stats.good_octets_recvd);
mpkts=3D$(sysctl -n dev.igb.1.mac_stats.mcast_pkts_recvd);
bpkts=3D$(sysctl -n dev.igb.1.mac_stats.bcast_pkts_recvd);
gpkts=3D$(sysctl -n dev.igb.1.mac_stats.good_pkts_recvd);
tpkts=3D$(sysctl -n dev.igb.1.mac_stats.total_pkts_recvd);
while sleep 1; do
        nbytes=3D$(sysctl -n dev.igb.1.mac_stats.good_octets_recvd)
        nmpkts=3D$(sysctl -n dev.igb.1.mac_stats.mcast_pkts_recvd);
        nbpkts=3D$(sysctl -n dev.igb.1.mac_stats.bcast_pkts_recvd);
        ngpkts=3D$(sysctl -n dev.igb.1.mac_stats.good_pkts_recvd);
        ntpkts=3D$(sysctl -n dev.igb.1.mac_stats.total_pkts_recvd);
        printf "%d\t%d\t%d\t%d\t%d\n" $(($nbytes - $bytes)) $(($ngpkts - $g=
pkts)) $(($nmpkts - $mpkts)) $(($nbpkts - $bpkts)) $(($ntpkts - $tpkts))
        bytes=3D$nbytes
        mpkts=3D$nmpkts
        bpkts=3D$nbpkts
        gpkts=3D$ngpkts
        tpkts=3D$ntpkts
done

--=20
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."

--w7PDEPdKQumQfZlR
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQJ8BAEBCgBmBQJdVbB3XxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ2MEI1RTRGMTNDNzYyMDZDNjEyMDBCNjAy
MDVGMEIzM0REMDA2QURBAAoJECBfCzPdAGralnEQAKWpn/I6l5ASMzWFS6Ficdvg
AxJRSjb0S9gupEHi0wruYpYhnZ5NEa2V13kB7lVh3vfgOtZGHyfYxjELdfRQRERS
epOvLDzsheG/tO+QmLWPrL1BIAthwGVF+lK0JO1VzLn/vMIbawfAscLFkK0g0tsa
4QGAzvFN96On8K7XaObGho1fkkIPBOGI0OwodNWUk/xq7XL6c5GaZWa+AzBsQTAw
ISwKjsX24xxuQTYvpfXI0OvN0lrZMuBUj86ymshUToKEQtKQ2NnaAldBLRocbUbS
jH+SysJI9Bj7Oo274IePtSi/RUSKHv4c57z444p6KOekJH7PR3waAqUqFJWvtAnI
RmIJPl0Ju8f/mkjPtmiBCS++p8v2KJ4W6QEaE0dE5l61MNVg2jEVawvKuK95n1mp
kLO/FtpTOlho5iFfqT8BoxlubSetZiQNi9SYidvDwOjELTHXE8BhOj/PkUzI2kGG
QIr/Ioj4bqbAtmxvie7QI7EPasgMyr3UCJ8Pqc7yFl0hTpA+qXLq7mhINDm2rYVa
LecvEJ0FXzbTMIxz8qNgCAHhQFfscskLzDSlNmjDnKGtQzGW2afvp07k2dvjy1o2
EQ0LhLqEVui1jO602YyUCsIWaQDpj44ibWmqyZ1axwPXW3dX4tLTiI2DpWOSC4Dt
He71h7QuUkr/rpe26dIM
=stcl
-----END PGP SIGNATURE-----

--w7PDEPdKQumQfZlR--



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