From patchwork Tue Jun 2 21:28:39 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirsher, Jeffrey T" X-Patchwork-Id: 28019 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id A01ECB7043 for ; Wed, 3 Jun 2009 07:29:04 +1000 (EST) Received: by ozlabs.org (Postfix) id 91649DDDA2; Wed, 3 Jun 2009 07:29:04 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 397D8DDDA1 for ; Wed, 3 Jun 2009 07:29:04 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752166AbZFBV24 (ORCPT ); Tue, 2 Jun 2009 17:28:56 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752075AbZFBV24 (ORCPT ); Tue, 2 Jun 2009 17:28:56 -0400 Received: from qmta08.westchester.pa.mail.comcast.net ([76.96.62.80]:35142 "EHLO QMTA08.westchester.pa.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752043AbZFBV2z (ORCPT ); Tue, 2 Jun 2009 17:28:55 -0400 Received: from OMTA10.westchester.pa.mail.comcast.net ([76.96.62.28]) by QMTA08.westchester.pa.mail.comcast.net with comcast id yxvn1b0050cZkys589UyjH; Tue, 02 Jun 2009 21:28:58 +0000 Received: from localhost.localdomain ([63.64.152.142]) by OMTA10.westchester.pa.mail.comcast.net with comcast id z9Uh1b00434bfcX3W9Uj9l; Tue, 02 Jun 2009 21:28:56 +0000 From: Jeff Kirsher Subject: [net-next PATCH 3/7] e1000e: correct flow control thresholds To: davem@davemloft.net Cc: netdev@vger.kernel.org, gospo@redhat.com, Bruce Allan , Jeff Kirsher Date: Tue, 02 Jun 2009 14:28:39 -0700 Message-ID: <20090602212839.24614.70593.stgit@localhost.localdomain> In-Reply-To: <20090602212800.24614.45798.stgit@localhost.localdomain> References: <20090602212800.24614.45798.stgit@localhost.localdomain> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Bruce Allan The flow control thresholds, i.e. high and low watermarks of the Rx FIFO for when the hardware should transmit PAUSE frames (XON and XOFF, respectively), need to be tuned for more efficient use of the FIFO. The logic to set the thresholds for parts that support early-receive (ERT) was also wrong in that it should check whether jumbo frames are in use. Signed-off-by: Bruce Allan Signed-off-by: Jeff Kirsher --- drivers/net/e1000e/defines.h | 2 ++ drivers/net/e1000e/netdev.c | 14 ++++++++------ 2 files changed, 10 insertions(+), 6 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 diff --git a/drivers/net/e1000e/defines.h b/drivers/net/e1000e/defines.h index 243aa49..9acfecd 100644 --- a/drivers/net/e1000e/defines.h +++ b/drivers/net/e1000e/defines.h @@ -469,6 +469,8 @@ #define AUTO_READ_DONE_TIMEOUT 10 /* Flow Control */ +#define E1000_FCRTH_RTH 0x0000FFF8 /* Mask Bits[15:3] for RTH */ +#define E1000_FCRTL_RTL 0x0000FFF8 /* Mask Bits[15:3] for RTL */ #define E1000_FCRTL_XONE 0x80000000 /* Enable XON frame transmission */ /* Transmit Configuration Word */ diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 7e412d1..b7a46c5 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c @@ -2751,23 +2751,25 @@ void e1000e_reset(struct e1000_adapter *adapter) /* * flow control settings * - * The high water mark must be low enough to fit one full frame + * The high water mark must be low enough to fit two full frame * (or the size used for early receive) above it in the Rx FIFO. * Set it to the lower of: * - 90% of the Rx FIFO size, and * - the full Rx FIFO size minus the early receive size (for parts * with ERT support assuming ERT set to E1000_ERT_2048), or - * - the full Rx FIFO size minus one full frame + * - the full Rx FIFO size minus two full frames */ - if (adapter->flags & FLAG_HAS_ERT) + if ((adapter->flags & FLAG_HAS_ERT) && + (adapter->netdev->mtu > ETH_DATA_LEN)) hwm = min(((pba << 10) * 9 / 10), ((pba << 10) - (E1000_ERT_2048 << 3))); else hwm = min(((pba << 10) * 9 / 10), - ((pba << 10) - adapter->max_frame_size)); + ((pba << 10) - (2 * adapter->max_frame_size))); - fc->high_water = hwm & 0xFFF8; /* 8-byte granularity */ - fc->low_water = fc->high_water - 8; + fc->high_water = hwm & E1000_FCRTH_RTH; /* 8-byte granularity */ + fc->low_water = (fc->high_water - (2 * adapter->max_frame_size)); + fc->low_water &= E1000_FCRTL_RTL; /* 8-byte granularity */ if (adapter->flags & FLAG_DISABLE_FC_PAUSE_TIME) fc->pause_time = 0xFFFF;