From patchwork Wed Sep 4 11:47:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 272581 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 28AA52C0097 for ; Wed, 4 Sep 2013 21:48:14 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762506Ab3IDLr5 (ORCPT ); Wed, 4 Sep 2013 07:47:57 -0400 Received: from vaxjo.synopsys.com ([198.182.60.75]:59850 "EHLO vaxjo.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756669Ab3IDLr4 (ORCPT ); Wed, 4 Sep 2013 07:47:56 -0400 Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by vaxjo.synopsys.com (Postfix) with ESMTP id 36FEFE3E0; Wed, 4 Sep 2013 04:47:52 -0700 (PDT) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 1FC1BDB9; Wed, 4 Sep 2013 04:47:52 -0700 (PDT) Received: from us01wehtc1.internal.synopsys.com (us01wehtc1-vip.internal.synopsys.com [10.12.239.236]) by mailhost.synopsys.com (Postfix) with ESMTP id 04D17DB7; Wed, 4 Sep 2013 04:47:51 -0700 (PDT) Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.105) by us01wehtc1.internal.synopsys.com (10.12.239.235) with Microsoft SMTP Server (TLS) id 14.2.298.4; Wed, 4 Sep 2013 04:47:51 -0700 Received: from vineetg-E6520.internal.synopsys.com (10.12.197.111) by IN01WEHTCB.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.2.298.4; Wed, 4 Sep 2013 17:17:47 +0530 From: Vineet Gupta To: CC: Vineet Gupta , Alexey Brodkin , "David S. Miller" , , Subject: [PATCH] ethernet/arc/arc_emac: Fix huge delays in large file copies Date: Wed, 4 Sep 2013 17:17:15 +0530 Message-ID: <1378295235-18928-1-git-send-email-vgupta@synopsys.com> X-Mailer: git-send-email 1.8.1.2 MIME-Version: 1.0 X-Originating-IP: [10.12.197.111] Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org copying large files to a NFS mounted host was taking absurdly large time. Turns out that TX BD reclaim had a sublte bug. Loop starts off from @txbd_dirty cursor and stops when it hits a BD still in use by controller. However when it stops it needs to keep the cursor at that very BD to resume scanning in next iteration. However it was erroneously incrementing the cursor, causing the next scan(s) to fail too, unless the BD chain was completely drained out. [ARCLinux]$ ls -l -sh /disk/log.txt 17976 -rw-r--r-- 1 root root 17.5M Sep /disk/log.txt ========== Before ===================== [ARCLinux]$ time cp /disk/log.txt /mnt/. real 31m 7.95s user 0m 0.00s sys 0m 0.10s ========== After ===================== [ARCLinux]$ time cp /disk/log.txt /mnt/. real 0m 24.33s user 0m 0.00s sys 0m 0.19s Signed-off-by: Vineet Gupta Cc: Alexey Brodkin (commit_signer:3/4=75%) Cc: "David S. Miller" (commit_signer:3/4=75%) Cc: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: arc-linux-dev@synopsys.com --- drivers/net/ethernet/arc/emac_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c index 55d79cb..9e16014 100644 --- a/drivers/net/ethernet/arc/emac_main.c +++ b/drivers/net/ethernet/arc/emac_main.c @@ -149,8 +149,6 @@ static void arc_emac_tx_clean(struct net_device *ndev) struct sk_buff *skb = tx_buff->skb; unsigned int info = le32_to_cpu(txbd->info); - *txbd_dirty = (*txbd_dirty + 1) % TX_BD_NUM; - if ((info & FOR_EMAC) || !txbd->data) break; @@ -180,6 +178,8 @@ static void arc_emac_tx_clean(struct net_device *ndev) txbd->data = 0; txbd->info = 0; + *txbd_dirty = (*txbd_dirty + 1) % TX_BD_NUM; + if (netif_queue_stopped(ndev)) netif_wake_queue(ndev); }