From nobody@FreeBSD.org  Sun May 31 02:50:20 2009
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3F719106564A
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 31 May 2009 02:50:19 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 2D5DD8FC13
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 31 May 2009 02:50:19 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n4V2oIZ5038232
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 31 May 2009 02:50:18 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id n4V2oIIh038231;
	Sun, 31 May 2009 02:50:18 GMT
	(envelope-from nobody)
Message-Id: <200905310250.n4V2oIIh038231@www.freebsd.org>
Date: Sun, 31 May 2009 02:50:18 GMT
From: hshh <hunreal@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [bce] if_bce inbound traffic bytes counter is incorrect in 7.2-RELEASE
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         135091
>Category:       kern
>Synopsis:       [bce] if_bce inbound traffic bytes counter is incorrect in 7.2-RELEASE
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    delphij
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun May 31 03:00:04 UTC 2009
>Closed-Date:    Tue Jun 09 05:45:44 UTC 2009
>Last-Modified:  Tue Jun 09 05:45:44 UTC 2009
>Originator:     hshh
>Release:        7.2-RELEASE
>Organization:
hshh.org
>Environment:
FreeBSD x.hshh.org 7.2-RELEASE FreeBSD 7.2-RELEASE #2: Fri May  8 15:18:48 CST 2009     root@x.hshh.org:/usr/obj/usr/src/sys/x  amd64
>Description:
The box is Dell 1950PE or 2950PE with Broadcom 5708C.
bce0@pci0:9:0:0:        class=0x020000 card=0x01b31028 chip=0x164c14e4 rev=0x12 hdr=0x00
    vendor     = 'Broadcom Corporation'
    device     = '5708C Broadcom NetXtreme II Gigabit Ethernet Adapter'
    class      = network
    subclass   = ethernet


When I use ``netstat 1'' or ``systat -if 1'', I found the inbound bytes counter is incorrect. Here is sample, and also I attached tcpdump log.

[root@x] ~# netstat 1
            input        (Total)           output
   packets  errs      bytes    packets  errs      bytes colls
         1     0       2026          1     0        218     0
         4     0       8104          1     0        170     0
         1     0       2026          1     0        170     0
         1     0       2026          1     0        170     0

[root@x] ~# tcpdump -vvn
tcpdump: listening on bce0, link-type EN10MB (Ethernet), capture size 96 bytes
10:38:24.855321 IP (tos 0x0, ttl 127, id 1506, offset 0, flags [DF], proto TCP (6), length 40) 172.17.2.9.1232 > 172.18.0.200.22: ., cksum 0x7c81 (correct), 1:1(0) ack 132 win 63848

You see, only length 40 bytes in, but netstat show me 2026 bytes.
>How-To-Repeat:
Install FreeBSD 7.2-RELEASE AMD64 in Broadcom 5708C box, and try to use ``netstat 1'' or ``systat -if 1''.
>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-net 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sun May 31 04:18:00 UTC 2009 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=135091 

From: smallpox <smallpox@gmail.com>
To: bug-followup@FreeBSD.org, hunreal@gmail.com, 
 Harti Brandt <harti@freebsd.org>
Cc:  
Subject: Re: kern/135091: [bce] if_bce inbound traffic bytes counter is incorrect
 in 7.2-RELEASE
Date: Sat, 30 May 2009 21:27:01 -0700

 i actually complained about this a few days ago and harti was helping me..
 
 http://lists.freebsd.org/pipermail/freebsd-net/2009-May/022131.html
 
 hunreal, can you verify any packet loss? i'm having 0.5% to 2%
 
 i just got the identical system up at the office, it's running 
 7.1-stable.. numbers look good but it was on 100mbit, i ran there to put 
 it on gigabit.
 
 thanks.
State-Changed-From-To: open->feedback 
State-Changed-By: delphij 
State-Changed-When: Mon Jun 1 05:32:22 UTC 2009 
State-Changed-Why:  
This seems to be a known issue.  I have replied with a patch 
and waiting for feedback. 


Responsible-Changed-From-To: freebsd-net->delphij 
Responsible-Changed-By: delphij 
Responsible-Changed-When: Mon Jun 1 05:32:22 UTC 2009 
Responsible-Changed-Why:  
Grab.  (Hopefully I can close this soon as I believe that it 
was patched in -STABLE). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=135091 

From: Xin LI <delphij@delphij.net>
To: hshh <hunreal@gmail.com>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: kern/135091: [bce] if_bce inbound traffic bytes counter is	incorrect
 in 7.2-RELEASE
Date: Sun, 31 May 2009 22:32:05 -0700

 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
 Hi,
 
 > You see, only length 40 bytes in, but netstat show me 2026 bytes.
 
 I think this was caused by a bug introduced with 7.2-RELEASE driver.
 
 The following patch should fix it if you want to patch manually:
 
 - --- src/sys/dev/bce/if_bce.c
 +++ src/sys/dev/bce/if_bce.c
 @@ -5895,6 +5894,9 @@ bce_rx_intr(struct bce_softc *sc)
  			/* Set the total packet length. */
  			m0->m_pkthdr.len = m0->m_len = pkt_len;
  		}
 +#else
 +        /* Set the total packet length. */
 +		m0->m_pkthdr.len = m0->m_len = pkt_len;
  #endif
 
  		/* Remove the trailing Ethernet FCS. */
 
 Cheers,
 - --
 Xin LI <delphij@delphij.net>	http://www.delphij.net/
 FreeBSD - The Power to Serve!
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.11 (FreeBSD)
 
 iEYEARECAAYFAkojZ9UACgkQi+vbBBjt66BUigCfd0o8t9iOGQZZXCW32gxLszuK
 N1UAoI6xqqZi3wFiSYe4LY1vWvtieXWq
 =zXbA
 -----END PGP SIGNATURE-----

From: hshh <hunreal@gmail.com>
To: d@delphij.net
Cc: freebsd-gnats-submit@freebsd.org, bug-followup@FreeBSD.org
Subject: Re: kern/135091: [bce] if_bce inbound traffic bytes counter is 
	incorrect in 7.2-RELEASE
Date: Tue, 9 Jun 2009 12:50:58 +0800

 Hi,
 I just tested. It's valid.
 Thank you.
 
 On Mon, Jun 1, 2009 at 1:32 PM, Xin LI<delphij@delphij.net> wrote:
 > -----BEGIN PGP SIGNED MESSAGE-----
 > Hash: SHA1
 >
 > Hi,
 >
 >> You see, only length 40 bytes in, but netstat show me 2026 bytes.
 >
 > I think this was caused by a bug introduced with 7.2-RELEASE driver.
 >
 > The following patch should fix it if you want to patch manually:
 >
 > - --- src/sys/dev/bce/if_bce.c
 > +++ src/sys/dev/bce/if_bce.c
 > @@ -5895,6 +5894,9 @@ bce_rx_intr(struct bce_softc *sc)
 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
 =A0 =C2=A0/* Set the total packet length. */
 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
 =A0 =C2=A0m0->m_pkthdr.len =3D m0->m_len =3D pkt_len;
 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
 > +#else
 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0/* Set the total packet length. */
 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 m0->m_pkthdr.len =3D m=
 0->m_len =3D pkt_len;
 > =C2=A0#endif
 >
 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* Remove the trai=
 ling Ethernet FCS. */
 >
 > Cheers,
 > - --
 > Xin LI <delphij@delphij.net> =C2=A0 =C2=A0http://www.delphij.net/
 > FreeBSD - The Power to Serve!
 > -----BEGIN PGP SIGNATURE-----
 > Version: GnuPG v2.0.11 (FreeBSD)
 >
 > iEYEARECAAYFAkojZ9UACgkQi+vbBBjt66BUigCfd0o8t9iOGQZZXCW32gxLszuK
 > N1UAoI6xqqZi3wFiSYe4LY1vWvtieXWq
 > =3DzXbA
 > -----END PGP SIGNATURE-----
 >

From: hshh <hunreal@gmail.com>
To: d@delphij.net
Cc: freebsd-gnats-submit@freebsd.org, bug-followup@FreeBSD.org
Subject: Re: kern/135091: [bce] if_bce inbound traffic bytes counter is 
	incorrect in 7.2-RELEASE
Date: Tue, 9 Jun 2009 12:50:58 +0800

 Hi,
 I just tested. It's valid.
 Thank you.
 
 On Mon, Jun 1, 2009 at 1:32 PM, Xin LI<delphij@delphij.net> wrote:
 > -----BEGIN PGP SIGNED MESSAGE-----
 > Hash: SHA1
 >
 > Hi,
 >
 >> You see, only length 40 bytes in, but netstat show me 2026 bytes.
 >
 > I think this was caused by a bug introduced with 7.2-RELEASE driver.
 >
 > The following patch should fix it if you want to patch manually:
 >
 > - --- src/sys/dev/bce/if_bce.c
 > +++ src/sys/dev/bce/if_bce.c
 > @@ -5895,6 +5894,9 @@ bce_rx_intr(struct bce_softc *sc)
 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
 =A0 =C2=A0/* Set the total packet length. */
 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
 =A0 =C2=A0m0->m_pkthdr.len =3D m0->m_len =3D pkt_len;
 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
 > +#else
 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0/* Set the total packet length. */
 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 m0->m_pkthdr.len =3D m=
 0->m_len =3D pkt_len;
 > =C2=A0#endif
 >
 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* Remove the trai=
 ling Ethernet FCS. */
 >
 > Cheers,
 > - --
 > Xin LI <delphij@delphij.net> =C2=A0 =C2=A0http://www.delphij.net/
 > FreeBSD - The Power to Serve!
 > -----BEGIN PGP SIGNATURE-----
 > Version: GnuPG v2.0.11 (FreeBSD)
 >
 > iEYEARECAAYFAkojZ9UACgkQi+vbBBjt66BUigCfd0o8t9iOGQZZXCW32gxLszuK
 > N1UAoI6xqqZi3wFiSYe4LY1vWvtieXWq
 > =3DzXbA
 > -----END PGP SIGNATURE-----
 >
State-Changed-From-To: feedback->closed 
State-Changed-By: delphij 
State-Changed-When: Tue Jun 9 05:45:02 UTC 2009 
State-Changed-Why:  
Submitter confirms that the proposed fix worked.  Note that this 
is already MFC'ed to 7-STABLE so mark this as CLOSED.  Thanks for 
your submission! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=135091 
>Unformatted:
