From patchwork Thu Apr 19 12:27:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ruchika Gupta X-Patchwork-Id: 153657 X-Patchwork-Delegate: joe.hershberger@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 82C15B6FA3 for ; Thu, 19 Apr 2012 17:00:04 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7221328087; Thu, 19 Apr 2012 09:00:02 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BDRulIwvgCqS; Thu, 19 Apr 2012 09:00:02 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 30C2628089; Thu, 19 Apr 2012 08:59:57 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7368228089 for ; Thu, 19 Apr 2012 08:59:55 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gywaUYyerA7N for ; Thu, 19 Apr 2012 08:59:54 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from am1outboundpool.messaging.microsoft.com (am1ehsobe005.messaging.microsoft.com [213.199.154.208]) by theia.denx.de (Postfix) with ESMTPS id B79BF28087 for ; Thu, 19 Apr 2012 08:59:51 +0200 (CEST) Received: from mail40-am1-R.bigfish.com (10.3.201.236) by AM1EHSOBE006.bigfish.com (10.3.204.26) with Microsoft SMTP Server id 14.1.225.23; Thu, 19 Apr 2012 06:59:51 +0000 Received: from mail40-am1 (localhost [127.0.0.1]) by mail40-am1-R.bigfish.com (Postfix) with ESMTP id 4816F10016E for ; Thu, 19 Apr 2012 06:59:51 +0000 (UTC) X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275bhz2dh2a8h668h839hd24h) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI Received: from mail40-am1 (localhost.localdomain [127.0.0.1]) by mail40-am1 (MessageSwitch) id 1334818788675670_15200; Thu, 19 Apr 2012 06:59:48 +0000 (UTC) Received: from AM1EHSMHS006.bigfish.com (unknown [10.3.201.231]) by mail40-am1.bigfish.com (Postfix) with ESMTP id 97A16140045 for ; Thu, 19 Apr 2012 06:59:48 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by AM1EHSMHS006.bigfish.com (10.3.207.106) with Microsoft SMTP Server (TLS) id 14.1.225.23; Thu, 19 Apr 2012 06:59:48 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-001.039d.mgd.msft.net (10.84.1.13) with Microsoft SMTP Server (TLS) id 14.1.355.3; Thu, 19 Apr 2012 01:59:44 -0500 Received: from udp158975uds.ap.freescale.net ([10.213.130.145]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id q3INxTCY028607 for ; Wed, 18 Apr 2012 16:59:30 -0700 Received: from udp158975uds.ap.freescale.net (udp158975uds.ap.freescale.net [127.0.0.1]) by udp158975uds.ap.freescale.net (8.14.4/8.14.4) with ESMTP id q3JCRDUh014545; Thu, 19 Apr 2012 17:57:13 +0530 Received: (from r66431@localhost) by udp158975uds.ap.freescale.net (8.14.4/8.14.4/Submit) id q3JCRBlj014543; Thu, 19 Apr 2012 17:57:11 +0530 From: Ruchika Gupta To: Date: Thu, 19 Apr 2012 17:57:11 +0530 Message-ID: <1334838431-14516-1-git-send-email-ruchika.gupta@freescale.com> X-Mailer: git-send-email 1.5.6.5 MIME-Version: 1.0 X-OriginatorOrg: freescale.net Cc: Ruchika Gupta , Vakul Garg Subject: [U-Boot] [PATCHv2] e1000e : Correct Rx Threshold granularity X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de In e1000e driver, Rx descriptor queue is used such that hardware can add only one descriptor at a time. So the WTHRESH granularity in RXDCTL should be set to single descriptor. This would ensure that every time controller fills a Rx descriptor, it is flushed to host memory. Earlier this granularity was in cache line units i.e 2 descriptors. This leads to controller always waiting for 2 descriptors before flushing them out. But since not more than one Rx BD is actually available , the accumulation condition never gets hit. Signed-off-by: Ruchika Gupta Signed-off-by: Vakul Garg Acked-by: Roy Zang --- Tested on P1010 and P4080 with 82572 and 82574 cards. Changes in v2 - Fixed subject line and commit message drivers/net/e1000.c | 10 ++++++++++ drivers/net/e1000.h | 1 + 2 files changed, 11 insertions(+), 0 deletions(-) diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c index 98145bc..1f3c2b0 100644 --- a/drivers/net/e1000.c +++ b/drivers/net/e1000.c @@ -1703,6 +1703,16 @@ e1000_init_hw(struct eth_device *nic) E1000_WRITE_REG(hw, TXDCTL, ctrl); } + /* Set the receive descriptor write back policy */ + + if (hw->mac_type >= e1000_82571) { + ctrl = E1000_READ_REG(hw, RXDCTL); + ctrl = + (ctrl & ~E1000_RXDCTL_WTHRESH) | + E1000_RXDCTL_FULL_RX_DESC_WB; + E1000_WRITE_REG(hw, RXDCTL, ctrl); + } + switch (hw->mac_type) { default: break; diff --git a/drivers/net/e1000.h b/drivers/net/e1000.h index 720d8c6..cdb0e36 100644 --- a/drivers/net/e1000.h +++ b/drivers/net/e1000.h @@ -1518,6 +1518,7 @@ struct e1000_hw { #define E1000_RXDCTL_HTHRESH 0x00003F00 /* RXDCTL Host Threshold */ #define E1000_RXDCTL_WTHRESH 0x003F0000 /* RXDCTL Writeback Threshold */ #define E1000_RXDCTL_GRAN 0x01000000 /* RXDCTL Granularity */ +#define E1000_RXDCTL_FULL_RX_DESC_WB 0x01010000 /* GRAN=1, WTHRESH=1 */ /* Transmit Descriptor Control */ #define E1000_TXDCTL_PTHRESH 0x0000003F /* TXDCTL Prefetch Threshold */