From patchwork Tue Jan 5 09:16:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuyu Wei X-Patchwork-Id: 7953311 Return-Path: X-Original-To: patchwork-linux-rockchip@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F12959F3F6 for ; Tue, 5 Jan 2016 09:17:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 61C6B20396 for ; Tue, 5 Jan 2016 09:17:28 +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 A245E203B5 for ; Tue, 5 Jan 2016 09:17:26 +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 1aGNk5-00028q-DV; Tue, 05 Jan 2016 09:17:25 +0000 Received: from blu004-omc1s7.hotmail.com ([65.55.116.18]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aGNk2-00021W-Qq for linux-rockchip@lists.infradead.org; Tue, 05 Jan 2016 09:17:24 +0000 Received: from BLU436-SMTP117 ([65.55.116.7]) by BLU004-OMC1S7.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Tue, 5 Jan 2016 01:17:01 -0800 X-TMN: [TIl9CmMfiasWpuqgRkSgx3SSBtuSVWEb] X-Originating-Email: [sy.w@outlook.com] Message-ID: Date: Tue, 5 Jan 2016 17:16:54 +0800 From: Shuyu Wei To: netdev@vger.kernel.org Subject: [PATCH] ethernet:arc: Move arc_emac_tx_clean() into arc_emac_tx() and disable tx interrupt MIME-Version: 1.0 Content-Disposition: inline; filename="mail.txt" User-Agent: Mutt/1.5.24 (2015-08-30) X-OriginalArrivalTime: 05 Jan 2016 09:17:00.0833 (UTC) FILETIME=[D585A910:01D14799] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160105_011723_029098_3D4ABB79 X-CRM114-Status: UNSURE ( 6.72 ) 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: 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 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;