From nobody@FreeBSD.org  Thu May 12 06:52:57 2005
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 EC43E16A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 12 May 2005 06:52:57 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id BD18543D8F
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 12 May 2005 06:52:57 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j4C6qt4r039120
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 12 May 2005 06:52:55 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id j4C6qtjV039119;
	Thu, 12 May 2005 06:52:55 GMT
	(envelope-from nobody)
Message-Id: <200505120652.j4C6qtjV039119@www.freebsd.org>
Date: Thu, 12 May 2005 06:52:55 GMT
From: Marian Durkovic <md@bts.sk>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] Degraded performance of em driver
X-Send-Pr-Version: www-2.3

>Number:         80932
>Category:       kern
>Synopsis:       [em] [patch] Degraded performance of em driver
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    jfv
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 12 07:00:31 GMT 2005
>Closed-Date:    Tue Mar 01 10:14:49 EST 2011
>Last-Modified:  Tue Mar 01 10:14:49 EST 2011
>Originator:     Marian Durkovic
>Release:        4.11
>Organization:
Slovak Technical University
>Environment:
>Description:
Please see:
http://lists.freebsd.org/pipermail/freebsd-net/2005-May/007161.html
>How-To-Repeat:

>Fix:
patch applicable to all CVS branches, line numbers might be slighly different. Use patch -l to ignore tabs/spaces in case of errors
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->tackerman 
Responsible-Changed-By: glebius 
Responsible-Changed-When: Mon May 23 14:25:16 GMT 2005 
Responsible-Changed-Why:  
Over to em(4) maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=80932 
State-Changed-From-To: open->feedback 
State-Changed-By: linimon 
State-Changed-When: Wed Apr 5 00:39:36 UTC 2006 
State-Changed-Why:  
Did this change ever get incorporated? 


Responsible-Changed-From-To: tackerman->linimon 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Wed Apr 5 00:39:36 UTC 2006 
Responsible-Changed-Why:  
Reset PR assigned to inactive committer. 

Hat:	gnats-admin 

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

From: Marian Durkovic <md@bts.sk>
To: Mark Linimon <linimon@FreeBSD.org>, bug-followup@FreeBSD.org
Cc: tackerman@FreeBSD.org
Subject: Re: kern/80932: [em] [patch] Degraded performance of em driver
Date: Wed, 5 Apr 2006 20:44:02 +0200

 Hi,
 
 > Did this change ever get incorporated?
 
   apparently not :-(  The packet buffer allocation codeblock has been
 improved, but it still has the same bug.
 
   The packetbuffer must be always able to accomodate 2 frames, otherwise
 the performance drops dramatically (the card must be able to handle one
 frame and DMA the next frame at the same time).
 
   Here is the problematic codeblock in sys/dev/em/if_em.c:
 
 	/*
 	 * Packet Buffer Allocation (PBA)
 	 * Writing PBA sets the receive portion of the buffer
 	 * the remainder is used for the transmit buffer.
 	 */
 	switch (adapter->hw.mac_type) {
 	case em_82547:
 	case em_82547_rev_2: /* 82547: Total Packet Buffer is 40K */
 		if (adapter->hw.max_frame_size > EM_RXBUFFER_8192)
 
 -------> EM_RXBUFFER_8192 needs to be replaced with 5120 <------------
 
 			pba = E1000_PBA_22K; /* 22K for Rx, 18K for Tx */
 		else
 			pba = E1000_PBA_30K; /* 30K for Rx, 10K for Tx */
 		adapter->tx_fifo_head = 0;
 		adapter->tx_head_addr = pba << EM_TX_HEAD_ADDR_SHIFT;
 		adapter->tx_fifo_size = (E1000_PBA_40K - pba) <<
 EM_PBA_BYTES_SHIFT;
 		break;
 	case em_82571: /* 82571: Total Packet Buffer is 48K */
 	case em_82572: /* 82572: Total Packet Buffer is 48K */
 			pba = E1000_PBA_32K; /* 32K for Rx, 16K for Tx */
 
 ----------> 16 KB is not enough for two frames 9000 bytes long <----------
 ----------> instead of the above line there should be:
 
                 if(adapter->hw.max_frame_size > EM_RXBUFFER_8192)
                         pba = E1000_PBA_30K; /* 30K for Rx, 18K for Tx */
                 else
                         pba = E1000_PBA_32K; /* 32K for Rx, 16K for Tx */
 
 -----------> end of changes
 
 		break;
 	case em_82573: /* 82573: Total Packet Buffer is 32K */
 		/* Jumbo frames not supported */
 			pba = E1000_PBA_12K; /* 12K for Rx, 20K for Tx */
 		break;
 	default:
 		/* Devices before 82547 had a Packet Buffer of 64K.   */
 		if(adapter->hw.max_frame_size > EM_RXBUFFER_8192)
 			pba = E1000_PBA_40K; /* 40K for Rx, 24K for Tx */
 		else
 			pba = E1000_PBA_48K; /* 48K for Rx, 16K for Tx */
 	}
 
 
 	With kind regards,
 
 		M.
 
 --------------------------------------------------------------------------
 ----                                                                  ----
 ----   Marian Durkovic                       network  manager         ----
 ----                                                                  ----
 ----   Slovak Technical University           Tel: +421 2 524 51 301   ----
 ----   Computer Centre, Nam. Slobody 17      Fax: +421 2 524 94 351   ----
 ----   812 43 Bratislava, Slovak Republic    E-mail/sip: md@bts.sk    ----
 ----                                                                  ----
 --------------------------------------------------------------------------
State-Changed-From-To: feedback->open 
State-Changed-By: linimon 
State-Changed-When: Wed Apr 5 19:20:58 UTC 2006 
State-Changed-Why:  
Submitter notes these changes were never incorporated, and should still 
be considered. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=80932 
State-Changed-From-To: open->suspended 
State-Changed-By: linimon 
State-Changed-When: Wed Apr 5 20:01:46 UTC 2006 
State-Changed-Why:  
I don't have a src commit bit.  Mark as 'suspended' awaiting an interested 
committer. 


Responsible-Changed-From-To: linimon->freebsd-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Wed Apr 5 20:01:46 UTC 2006 
Responsible-Changed-Why:  

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

From: linimon@lonesome.com (Mark Linimon)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/80932: [em] [patch] Degraded performance of em driver
Date: Thu, 6 Apr 2006 10:19:11 -0500

 ----- Forwarded message from Marian Durkovic <md@bts.sk> -----
 
  please find the patch for RELENG_6 and MAIN branches in the attachment.
 
 RELENG_5 branch needs to be patched with my original patch:
 http://lists.freebsd.org/pipermail/freebsd-net/2005-May/007161.html
 
    Thanks & kind regards,
 
 	M.
 
 --------------------------------------------------------------------------
 ----                                                                  ----
 ----   Marian Durkovic                       network  manager         ----
 ----                                                                  ----
 ----   Slovak Technical University           Tel: +421 2 524 51 301   ----
 ----   Computer Centre, Nam. Slobody 17      Fax: +421 2 524 94 351   ----
 ----   812 43 Bratislava, Slovak Republic    E-mail/sip: md@bts.sk    ----
 ----                                                                  ----
 --------------------------------------------------------------------------
 
 --- src/sys/dev/em/if_em.c	Thu Apr  6 07:56:15 2006
 +++ src/sys/dev/em/if_em.c.new	Thu Apr  6 08:01:38 2006
 @@ -912,11 +912,13 @@
  	 * Packet Buffer Allocation (PBA)
  	 * Writing PBA sets the receive portion of the buffer
  	 * the remainder is used for the transmit buffer.
 +	 * BEWARE: For wirespeed performance, Tx buffer must be able
 +	 * to accommodate 2 frames
  	 */
  	switch (adapter->hw.mac_type) {
  	case em_82547:
  	case em_82547_rev_2: /* 82547: Total Packet Buffer is 40K */
 -		if (adapter->hw.max_frame_size > EM_RXBUFFER_8192)
 +		if (adapter->hw.max_frame_size > 5120)
  			pba = E1000_PBA_22K; /* 22K for Rx, 18K for Tx */
  		else
  			pba = E1000_PBA_30K; /* 30K for Rx, 10K for Tx */
 @@ -926,6 +928,9 @@
  		break;
  	case em_82571: /* 82571: Total Packet Buffer is 48K */
  	case em_82572: /* 82572: Total Packet Buffer is 48K */
 +		if(adapter->hw.max_frame_size > EM_RXBUFFER_8192)
 +			pba = E1000_PBA_30K; /* 30K for Rx, 18K for Tx */
 +		else
  			pba = E1000_PBA_32K; /* 32K for Rx, 16K for Tx */
  		break;
  	case em_82573: /* 82573: Total Packet Buffer is 32K */
 
 
 ----- End forwarded message -----
State-Changed-From-To: suspended->open 
State-Changed-By: remko 
State-Changed-When: Sun Dec 9 13:58:15 UTC 2007 
State-Changed-Why:  
Hi Jack can you have a look at this please? 


Responsible-Changed-From-To: freebsd-bugs->jfv 
Responsible-Changed-By: remko 
Responsible-Changed-When: Sun Dec 9 13:58:15 UTC 2007 
Responsible-Changed-Why:  
Hi Jack can you have a look at this please? 

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

From: Niclas Zeising <niclas.zeising@gmail.com>
To: bug-followup@FreeBSD.org, md@bts.sk
Cc: jfl@freebsd.org
Subject: Re: kern/80932: [em] [patch] Degraded performance of em driver
Date: Sat, 31 Jan 2009 00:17:53 +0100

 Hi Jack!
 Is this PR still applicable?
  From what I can tell looking at the code in 6, 7 and current It's still 
 pretty much directly applicable to 6, but I'm not as sure about 7 and 
 current (they have the same driver). The code is still around, but I 
 don't know if it's an issue any more. Unfortunately I have no 
 possibility whatsoever to test, I'm just looking through old PRs that's 
 still open.
 For reference, the code resides in the function em_init_locked()
 Regards!
 
State-Changed-From-To: open->closed 
State-Changed-By: eadler 
State-Changed-When: Tue Mar 1 10:14:48 EST 2011 
State-Changed-Why:  
This PR is fixed in head, 8.x and 7.x, but will not be merged to 6.x now 
that that branch is unsupported, sorry 

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