From owner-freebsd-net@freebsd.org Thu Nov 5 12:31:06 2015 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C78EA2371C for ; Thu, 5 Nov 2015 12:31:06 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from forward13h.cmail.yandex.net (forward13h.cmail.yandex.net [IPv6:2a02:6b8:0:f35::9e]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "forwards.mail.yandex.net", Issuer "Certum Level IV CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 28B5B14F4 for ; Thu, 5 Nov 2015 12:31:06 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from web29h.yandex.ru (web29h.yandex.ru [84.201.187.163]) by forward13h.cmail.yandex.net (Yandex) with ESMTP id 5FE7C2144A; Thu, 5 Nov 2015 15:31:01 +0300 (MSK) Received: from 127.0.0.1 (localhost [127.0.0.1]) by web29h.yandex.ru (Yandex) with ESMTP id D90B82FC23D2; Thu, 5 Nov 2015 15:31:00 +0300 (MSK) Received: by web29h.yandex.ru with HTTP; Thu, 05 Nov 2015 15:31:00 +0300 From: Alexander V. Chernikov Envelope-From: melifaro@ipfw.ru To: "elof2@sentor.se" , freebsd-net In-Reply-To: References: null Subject: Re: netstat -B "Recv" MIME-Version: 1.0 Message-Id: <111891446726660@web29h.yandex.ru> X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Thu, 05 Nov 2015 15:31:00 +0300 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=koi8-r X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.20 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, 05 Nov 2015 12:31:06 -0000 04.11.2015, 19:55, "elof2@sentor.se" : > Hi! > > Question: > What do the Recv column in 'netstat -B' show? > > I thought it was tha amount of packets received, but appaently not so. > > I send 2000000 packets from a tcpreplay machine to a receiving machine. > I do it a few times. > > On the receiver I see: > netstat -in > Name Mtu Network Address Ipkts Ierrs Idrop Opkts > Oerrs Coll > ix0 1500 0c:c4:7a:58:e2:3c 0 0 0 0 > 0 0 > ix1 1500 0c:c4:7a:58:e2:3d 6000000 0 0 0 > 0 0 > > and then > netstat -in > Name Mtu Network Address Ipkts Ierrs Idrop Opkts > Oerrs Coll > ix0 1500 0c:c4:7a:58:e2:3c 0 0 0 0 > 0 0 > ix1 1500 0c:c4:7a:58:e2:3d 8000000 0 0 0 > 0 0 > > So 6000000 has increased to 8000000. Good. > > However, 'netstat -B' show: > šššPid Netif Flags Recv Drop Match Sblen Hblen Command > 25553 mon0 p--s--- 1996862 0 2000000 0 0 tcpdump > > How can the "Recv" be *lower* than "Match"? > 1996862 < 2000000. > > For every new run (fast and slow) I get the same results, slightly less > than 2000000 Recv. > > What am I missing? Well, "Recv" is read from d->bd_rcount which is not per-cpu counter and is incrementing unlocked. On the other hand, "Match" increases when filter returned match condition and we (w)locked bpf descriptor, so this one is accurate. > > /Elof > _______________________________________________ > freebsd-net@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"