From patchwork Wed Sep 4 13:03:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 272605 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 B34BC2C008A for ; Wed, 4 Sep 2013 23:03:50 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934624Ab3IDNDe (ORCPT ); Wed, 4 Sep 2013 09:03:34 -0400 Received: from us02smtp2.synopsys.com ([198.182.60.77]:64215 "EHLO alvesta.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934452Ab3IDNDd (ORCPT ); Wed, 4 Sep 2013 09:03:33 -0400 Received: from mailhost.synopsys.com (mailhost2.synopsys.com [10.9.202.240]) by alvesta.synopsys.com (Postfix) with ESMTP id 1F45417789; Wed, 4 Sep 2013 06:03:33 -0700 (PDT) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 0CAF8D5E; Wed, 4 Sep 2013 06:03:33 -0700 (PDT) Received: from US01WEHTC2.internal.synopsys.com (us01wehtc2.internal.synopsys.com [10.12.239.237]) by mailhost.synopsys.com (Postfix) with ESMTP id E5043D5D; Wed, 4 Sep 2013 06:03:32 -0700 (PDT) Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.105) by US01WEHTC2.internal.synopsys.com (10.12.239.237) with Microsoft SMTP Server (TLS) id 14.2.298.4; Wed, 4 Sep 2013 06:03:32 -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 18:33:28 +0530 From: Vineet Gupta To: CC: Vineet Gupta , Alexey Brodkin , "David S. Miller" , "Francois Romieu" , , Subject: [PATCH] ethernet/arc/arc_emac: optimize the Tx/Tx-reclaim paths a bit Date: Wed, 4 Sep 2013 18:33:11 +0530 Message-ID: <1378299791-24598-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 This came out of staring at code due to recent performance fix. * TX BD reclaim can call netif_wake_queue() once, outside the loop if one/more BDs were freed, NO need to do this each iteration. * TX need not look at next BD to stop the netif queue. It rather be done in the next tx call, when it actually fails as the queue seldom gets full but the check nevertheless needs to be done for each packet Tx. Profiled this under heavy traffic (big tar file cp, LMBench betworking tests) and saw not a single hit to that code. Signed-off-by: Vineet Gupta Cc: Alexey Brodkin Cc: "David S. Miller" Cc: Francois Romieu Cc: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: arc-linux-dev@synopsys.com --- drivers/net/ethernet/arc/emac_main.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c index 9e16014..a3dd048 100644 --- a/drivers/net/ethernet/arc/emac_main.c +++ b/drivers/net/ethernet/arc/emac_main.c @@ -179,10 +179,10 @@ static void arc_emac_tx_clean(struct net_device *ndev) txbd->info = 0; *txbd_dirty = (*txbd_dirty + 1) % TX_BD_NUM; - - if (netif_queue_stopped(ndev)) - netif_wake_queue(ndev); } + + if (i && netif_queue_stopped(ndev)) + netif_wake_queue(ndev); } /** @@ -570,13 +570,6 @@ static int arc_emac_tx(struct sk_buff *skb, struct net_device *ndev) /* Increment index to point to the next BD */ *txbd_curr = (*txbd_curr + 1) % TX_BD_NUM; - /* Get "info" of the next BD */ - info = &priv->txbd[*txbd_curr].info; - - /* Check if if Tx BD ring is full - next BD is still owned by EMAC */ - if (unlikely((le32_to_cpu(*info) & OWN_MASK) == FOR_EMAC)) - netif_stop_queue(ndev); - arc_reg_set(priv, R_STATUS, TXPL_MASK); skb_tx_timestamp(skb);