From nobody@FreeBSD.org  Sun Oct  3 20:17:00 2004
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 38B5516A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  3 Oct 2004 20:17:00 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 2C3D343D53
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  3 Oct 2004 20:17:00 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.11/8.12.11) with ESMTP id i93KGxXn045684
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 3 Oct 2004 20:16:59 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.11/8.12.11/Submit) id i93KGxxJ045683;
	Sun, 3 Oct 2004 20:16:59 GMT
	(envelope-from nobody)
Message-Id: <200410032016.i93KGxxJ045683@www.freebsd.org>
Date: Sun, 3 Oct 2004 20:16:59 GMT
From: Alexander Usov <usov@kvi.nl>
To: freebsd-gnats-submit@FreeBSD.org
Subject: altq queueing in combination with bfe(4) network card results in the speed reduced by a factor of 2
X-Send-Pr-Version: www-2.3

>Number:         72286
>Category:       kern
>Synopsis:       altq queueing in combination with bfe(4) network card results in the speed reduced by a factor of 2
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    mlaier
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct 03 20:20:27 GMT 2004
>Closed-Date:    Tue Aug 23 14:18:39 GMT 2005
>Last-Modified:  Tue Aug 23 14:18:39 GMT 2005
>Originator:     Alexander Usov
>Release:        5.3-BETA7
>Organization:
KVI
>Environment:
FreeBSD kvip55.lan 5.3-BETA7 FreeBSD 5.3-BETA7 #1: Sat Oct  2 20:36:16 CEST 2004     root@kvip88.kvi.nl:/usr/obj/usr/src/sys/KVIP88  i386
>Description:
Turning on altq filtering using for example following 2 lines in pf.conf:
altq on bfe0 priq bandwidth 350Kb queue {q}
queue q priority 1 priq(default)

and doing some upload from the pc results in the outgoing traffic limited by approx 160-170Kbit/s:
$ pfctl -vvsq
queue q priq( default )
  [ pkts:       6515  bytes:    7183041  dropped pkts:      0 bytes:      0 ]
  [ qlength:   4/ 50 ]
  [ measured:    18.2 packets/s, 162.56Kb/s ]

The same pf.conf was checked on 2 other systems: OpenBSD-current on the same hardware and 5.3-BETA7 on different machine with very close configuration. In both cases the problem is not reproduced.
>How-To-Repeat:
Find Broadcom 4401 network card and turn on queueing on it.
>Fix:
None.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->mlaier 
Responsible-Changed-By: glebius 
Responsible-Changed-When: Wed Oct 6 06:18:58 GMT 2004 
Responsible-Changed-Why:  
Over to pf/altq maintainer. 

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

From: Max Laier <max@love2party.net>
To: freebsd-gnats-submit@freebsd.org, usov@kvi.nl
Cc:  
Subject: Re: kern/72286: altq queueing in combination with bfe(4) network card results in the speed reduced by a factor of 2
Date: Wed, 6 Oct 2004 12:02:35 +0200

 --Boundary-00=_9K8YBr/4VPrUZq9
 Content-Type: text/plain;
   charset="us-ascii"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline
 
 Can you try the following diff, please?
 
 http://people.freebsd.org/~mlaier/if_bfe.c.diff
 
 -- 
  Max
 
 --Boundary-00=_9K8YBr/4VPrUZq9
 Content-Type: text/x-diff;
   charset="us-ascii";
   name="if_bfe.c.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename="if_bfe.c.diff"
 
 Index: if_bfe.c
 ===================================================================
 RCS file: /usr/store/mlaier/fcvs/src/sys/dev/bfe/if_bfe.c,v
 retrieving revision 1.16
 diff -u -r1.16 if_bfe.c
 --- if_bfe.c	1 Sep 2004 06:10:11 -0000	1.16
 +++ if_bfe.c	6 Oct 2004 09:59:52 -0000
 @@ -1357,7 +1357,7 @@
  {
  	struct bfe_softc *sc;
  	struct mbuf *m_head = NULL;
 -	int idx;
 +	int idx, queued;
  
  	sc = ifp->if_softc;
  	idx = sc->bfe_tx_prod;
 @@ -1398,17 +1398,22 @@
  		 * to him.
  		 */
  		BPF_MTAP(ifp, m_head);
 +
 +		queued++;
  	}
  
 -	sc->bfe_tx_prod = idx;
 -	/* Transmit - twice due to apparent hardware bug */
 -	CSR_WRITE_4(sc, BFE_DMATX_PTR, idx * sizeof(struct bfe_desc));
 -	CSR_WRITE_4(sc, BFE_DMATX_PTR, idx * sizeof(struct bfe_desc));
 +	if (queued) {
 +		sc->bfe_tx_prod = idx;
 +		/* Transmit - twice due to apparent hardware bug */
 +		CSR_WRITE_4(sc, BFE_DMATX_PTR, idx * sizeof(struct bfe_desc));
 +		CSR_WRITE_4(sc, BFE_DMATX_PTR, idx * sizeof(struct bfe_desc));
 +
 +		/*
 +		 * Set a timeout in case the chip goes out to lunch.
 +		 */
 +		ifp->if_timer = 5;
 +	}
  
 -	/*
 -	 * Set a timeout in case the chip goes out to lunch.
 -	 */
 -	ifp->if_timer = 5;
  	BFE_UNLOCK(sc);
  }
  
 
 --Boundary-00=_9K8YBr/4VPrUZq9--

From: "Alexander S. Usov" <A.S.Usov@KVI.nl>
To: Max Laier <max@love2party.net>
Cc: freebsd-gnats-submit@freebsd.org, usov@KVI.nl
Subject: Re: kern/72286: altq queueing in combination with bfe(4) network card
 results in the speed reduced by a factor of 2
Date: Wed, 06 Oct 2004 14:10:38 +0200

 On Wednesday 06 October 2004 12:02, Max Laier wrote:
 > Can you try the following diff, please?
 >
 > http://people.freebsd.org/~mlaier/if_bfe.c.diff
 
 I had to add queued=0 to make it compile, but it still
 doesn't correctly.
 
 -- 
 Best regards,
   Alexander.
State-Changed-From-To: open->feedback 
State-Changed-By: mlaier 
State-Changed-When: Wed Jan 12 17:57:00 GMT 2005 
State-Changed-Why:  
A patch has been committed a long time ago.  Is this still an issue or was 
it fixed.  The patch is in 5.3R already.  Sorry, for the delay/forgetting. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=72286 
State-Changed-From-To: feedback->closed 
State-Changed-By: mlaier 
State-Changed-When: Tue Aug 23 14:18:22 GMT 2005 
State-Changed-Why:  
Time out 

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