Patchwork [NET-NEXT,1/2] igb: update handling of RCTL for smaller buffer sizes

login
register
mail settings
Submitter Jeff Kirsher
Date Dec. 10, 2008, 2:41 a.m.
Message ID <20081210024156.27280.78618.stgit@lost.foo-projects.org>
Download mbox | patch
Permalink /patch/13124/
State Accepted
Delegated to: David Miller
Headers show

Comments

Jeff Kirsher - Dec. 10, 2008, 2:41 a.m.
From: Alexander Duyck <alexander.h.duyck@intel.com>

As we begin to move into virtualization the use of a global value for
buffer sizes becomes undesirable.  This change makes it so only 256 and 512
byte buffers require use of the RCTL register.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---

 drivers/net/igb/igb_main.c |   32 ++++++++++++++------------------
 1 files changed, 14 insertions(+), 18 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Dec. 10, 2008, 9:09 a.m.
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Tue, 09 Dec 2008 18:41:57 -0800

> As we begin to move into virtualization the use of a global value for
> buffer sizes becomes undesirable.  This change makes it so only 256 and 512
> byte buffers require use of the RCTL register.
> 
> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index c49b8d8..dad742f 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -1801,25 +1801,21 @@  static void igb_setup_rctl(struct igb_adapter *adapter)
 	 */
 	rctl &= ~(E1000_RCTL_SBP | E1000_RCTL_LPE | E1000_RCTL_SZ_256);
 
-	if (adapter->netdev->mtu <= ETH_DATA_LEN) {
-		/* Setup buffer sizes */
-		switch (adapter->rx_buffer_len) {
-		case IGB_RXBUFFER_256:
-			rctl |= E1000_RCTL_SZ_256;
-			break;
-		case IGB_RXBUFFER_512:
-			rctl |= E1000_RCTL_SZ_512;
-			break;
-		case IGB_RXBUFFER_1024:
-			rctl |= E1000_RCTL_SZ_1024;
-			break;
-		default:
-			rctl |= E1000_RCTL_SZ_2048;
-			break;
-		}
-	} else {
+	if (adapter->netdev->mtu > ETH_DATA_LEN)
 		rctl |= E1000_RCTL_LPE;
-		srrctl = adapter->rx_buffer_len >> E1000_SRRCTL_BSIZEPKT_SHIFT;
+
+	/* Setup buffer sizes */
+	switch (adapter->rx_buffer_len) {
+	case IGB_RXBUFFER_256:
+		rctl |= E1000_RCTL_SZ_256;
+		break;
+	case IGB_RXBUFFER_512:
+		rctl |= E1000_RCTL_SZ_512;
+		break;
+	default:
+		srrctl = ALIGN(adapter->rx_buffer_len, 1024)
+		         >> E1000_SRRCTL_BSIZEPKT_SHIFT;
+		break;
 	}
 
 	/* 82575 and greater support packet-split where the protocol