From patchwork Fri Feb 19 06:59:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuyu Wei X-Patchwork-Id: 8356821 Return-Path: X-Original-To: patchwork-linux-rockchip@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C10F3C0553 for ; Fri, 19 Feb 2016 07:00:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DCFA62040F for ; Fri, 19 Feb 2016 07:00:17 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EA8F1203F3 for ; Fri, 19 Feb 2016 07:00:15 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aWf30-0005Ty-PA; Fri, 19 Feb 2016 07:00:14 +0000 Received: from blu004-omc1s11.hotmail.com ([65.55.116.22]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aWf2y-0004Fr-6d for linux-rockchip@lists.infradead.org; Fri, 19 Feb 2016 07:00:13 +0000 Received: from BLU436-SMTP169 ([65.55.116.9]) by BLU004-OMC1S11.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Thu, 18 Feb 2016 22:59:50 -0800 X-TMN: [AGYkI8G/Aa3ORmqugPqfovGZna3Iql2IFuy10vZTBQM=] X-Originating-Email: [sy.w@outlook.com] Message-ID: Date: Fri, 19 Feb 2016 14:59:42 +0800 From: Shuyu Wei To: caesar.upstream@gmail.com, heiko@sntech.de, davem@davemloft.net, zhengxing@rock-chips.com Subject: [PATCH RESEND] ethernet:arc: Move arc_emac_tx_clean() into arc_emac_tx() and disable tx interrut MIME-Version: 1.0 Content-Disposition: inline; filename="mail.txt" User-Agent: Mutt/1.5.24 (2015-08-30) X-OriginalArrivalTime: 19 Feb 2016 06:59:49.0548 (UTC) FILETIME=[1FE1FEC0:01D16AE3] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160218_230012_410438_8D51F1D1 X-CRM114-Status: UNSURE ( 7.15 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.6 (--) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-rockchip@lists.infradead.org Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Doing tx_clean() inside poll() may scramble the tx ring buffer if tx() is running. This will cause tx to stop working, which can be reproduced by simultaneously downloading two large files at high speed. Moving tx_clean() into tx() will prevent this. And tx interrupt is no longer needed now. Signed-off-by: Shuyu Wei Tested-by: Michael Niewoehner Tested-by: Xing Zheng diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c index abe1eab..34531b3 100644 --- a/drivers/net/ethernet/arc/emac_main.c +++ b/drivers/net/ethernet/arc/emac_main.c @@ -311,12 +311,10 @@ static int arc_emac_poll(struct napi_struct *napi, int budget) struct arc_emac_priv *priv = netdev_priv(ndev); unsigned int work_done; - arc_emac_tx_clean(ndev); - work_done = arc_emac_rx(ndev, budget); if (work_done < budget) { napi_complete(napi); - arc_reg_or(priv, R_ENABLE, RXINT_MASK | TXINT_MASK); + arc_reg_or(priv, R_ENABLE, RXINT_MASK); } return work_done; @@ -345,9 +343,9 @@ static irqreturn_t arc_emac_intr(int irq, void *dev_instance) /* Reset all flags except "MDIO complete" */ arc_reg_set(priv, R_STATUS, status); - if (status & (RXINT_MASK | TXINT_MASK)) { + if (status & RXINT_MASK) { if (likely(napi_schedule_prep(&priv->napi))) { - arc_reg_clr(priv, R_ENABLE, RXINT_MASK | TXINT_MASK); + arc_reg_clr(priv, R_ENABLE, RXINT_MASK); __napi_schedule(&priv->napi); } } @@ -458,7 +456,7 @@ static int arc_emac_open(struct net_device *ndev) arc_reg_set(priv, R_TX_RING, (unsigned int)priv->txbd_dma); /* Enable interrupts */ - arc_reg_set(priv, R_ENABLE, RXINT_MASK | TXINT_MASK | ERR_MASK); + arc_reg_set(priv, R_ENABLE, RXINT_MASK | ERR_MASK); /* Set CONTROL */ arc_reg_set(priv, R_CTRL, @@ -529,7 +527,7 @@ static int arc_emac_stop(struct net_device *ndev) netif_stop_queue(ndev); /* Disable interrupts */ - arc_reg_clr(priv, R_ENABLE, RXINT_MASK | TXINT_MASK | ERR_MASK); + arc_reg_clr(priv, R_ENABLE, RXINT_MASK | ERR_MASK); /* Disable EMAC */ arc_reg_clr(priv, R_CTRL, EN_MASK); @@ -587,6 +585,8 @@ static int arc_emac_tx(struct sk_buff *skb, struct net_device *ndev) __le32 *info = &priv->txbd[*txbd_curr].info; dma_addr_t addr; + arc_emac_tx_clean(ndev); + if (skb_padto(skb, ETH_ZLEN)) return NETDEV_TX_OK;