From owner-freebsd-net@freebsd.org Thu Aug 15 19:20:36 2019 Return-Path: Delivered-To: freebsd-net@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1360EB3F11 for ; Thu, 15 Aug 2019 19:20:36 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "gate2.funkthat.com", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 468brg0z0Sz4KLd for ; Thu, 15 Aug 2019 19:20:34 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (localhost [127.0.0.1]) by gold.funkthat.com (8.15.2/8.15.2) with ESMTPS id x7FJKQ5G032645 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 15 Aug 2019 12:20:26 -0700 (PDT) (envelope-from jmg@gold.funkthat.com) Received: (from jmg@localhost) by gold.funkthat.com (8.15.2/8.15.2/Submit) id x7FJKP17032644; Thu, 15 Aug 2019 12:20:25 -0700 (PDT) (envelope-from jmg) Date: Thu, 15 Aug 2019 12:20:25 -0700 From: John-Mark Gurney To: "Andrey V. Elsukov" Cc: freebsd-net@freebsd.org Subject: Re: igb netstat input counters 2x? Message-ID: <20190815192025.GF2342@funkthat.com> Mail-Followup-To: "Andrey V. Elsukov" , freebsd-net@freebsd.org References: <20190814002705.GD2342@funkthat.com> <52b37710-8eb3-7e08-ee04-4682deb93c76@yandex.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="w7PDEPdKQumQfZlR" Content-Disposition: inline In-Reply-To: <52b37710-8eb3-7e08-ee04-4682deb93c76@yandex.ru> X-Operating-System: FreeBSD 11.0-RELEASE-p7 amd64 X-PGP-Fingerprint: D87A 235F FB71 1F3F 55B7 ED9B D5FF 5A51 C0AC 3D65 X-Files: The truth is out there X-URL: https://www.funkthat.com/ X-Resume: https://www.funkthat.com/~jmg/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? User-Agent: Mutt/1.6.1 (2016-04-27) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (gold.funkthat.com [127.0.0.1]); Thu, 15 Aug 2019 12:20:26 -0700 (PDT) X-Rspamd-Queue-Id: 468brg0z0Sz4KLd X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of jmg@gold.funkthat.com designates 208.87.223.18 as permitted sender) smtp.mailfrom=jmg@gold.funkthat.com X-Spamd-Result: default: False [-5.04 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a]; IP_SCORE(-0.99)[ip: (-2.57), ipnet: 208.87.216.0/21(-1.29), asn: 32354(-1.03), country: US(-0.05)]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; MIME_TRACE(0.00)[0:+,1:+,2:~]; DMARC_NA(0.00)[funkthat.com]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.95)[-0.950,0]; RCPT_COUNT_TWO(0.00)[2]; SIGNED_PGP(-2.00)[]; FREEMAIL_TO(0.00)[yandex.ru]; FORGED_SENDER(0.30)[jmg@funkthat.com,jmg@gold.funkthat.com]; R_DKIM_NA(0.00)[]; SUBJECT_ENDS_QUESTION(1.00)[]; ASN(0.00)[asn:32354, ipnet:208.87.216.0/21, country:US]; FROM_NEQ_ENVFROM(0.00)[jmg@funkthat.com,jmg@gold.funkthat.com]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Aug 2019 19:20:36 -0000 --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--