From patchwork Mon Aug 25 14:22:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Jensen X-Patchwork-Id: 4775241 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 58E7CC0338 for ; Mon, 25 Aug 2014 14:25:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6D2572012E for ; Mon, 25 Aug 2014 14:25:02 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A46C220109 for ; Mon, 25 Aug 2014 14:24:56 +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 1XLvAV-00026q-ML; Mon, 25 Aug 2014 14:22:47 +0000 Received: from mail-la0-x233.google.com ([2a00:1450:4010:c03::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XLvAS-00021O-Cg for linux-arm-kernel@lists.infradead.org; Mon, 25 Aug 2014 14:22:44 +0000 Received: by mail-la0-f51.google.com with SMTP id pn19so13092366lab.10 for ; Mon, 25 Aug 2014 07:22:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BjsFnXRiNntaZfRZ1H4JDLNOCzggI183Zxwa5VIT6K4=; b=cy1GMSnCOxCpFlpNR+Z3bHcdGzlu8zrSMlr9Q1jVnPa4F2BakKa/KOcdztmRXtKTRS gWcqjIegq3KtROrtGFD1GDTBgOnLnsDnokYY1BY7ZeJIscZ50BrrDOggQmZawRCqJ9GS m1h60I0KT7sk7BRPp3zWOswH3RFmf9WYyNgOtr9FO+8RZAOmcEoD4zrKE8LaQiv5pic7 vgQyK0socrJjZJXsqkyAFCXztHq7QA05waA8ziHw4tFbrfGJ4OfJN+tX7DmB/H0t5AIY bPWkMZPT6t/ovxo6SNO/hXe7fcQC6q9yvmF43zqYNNbMsAIAimOKX/V6+ufDDPjvW7zN HHog== X-Received: by 10.112.173.136 with SMTP id bk8mr3214836lbc.88.1408976538703; Mon, 25 Aug 2014 07:22:18 -0700 (PDT) Received: from Ildjarn.ath.cx (static-213-115-41-10.sme.bredbandsbolaget.se. [213.115.41.10]) by mx.google.com with ESMTPSA id et9sm16898lbb.15.2014.08.25.07.22.17 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 25 Aug 2014 07:22:18 -0700 (PDT) From: Jonas Jensen To: netdev@vger.kernel.org Subject: [PATCH v6 1/4] net: moxa: clear DESC1 on ndo_start_xmit() Date: Mon, 25 Aug 2014 16:22:11 +0200 Message-Id: <1408976531-15589-1-git-send-email-jonas.jensen@gmail.com> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1408544322-32023-1-git-send-email-jonas.jensen@gmail.com> References: <1408544322-32023-1-git-send-email-jonas.jensen@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140825_072244_629186_49BAC18B X-CRM114-Status: GOOD ( 11.85 ) X-Spam-Score: -0.8 (/) Cc: f.fainelli@gmail.com, eric.dumazet@gmail.com, linux-kernel@vger.kernel.org, Jonas Jensen , mirqus@gmail.com, davem@davemloft.net, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no 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 TX buffer length is not cleared on ndo_start_xmit(). Failing to do so can bug/hang the controller and cause TX interrupts to stop altogether. Remove the readl() and compute a new value for DESC1. Addresses https://bugzilla.kernel.org/show_bug.cgi?id=69031 Signed-off-by: Jonas Jensen --- Notes: Changes since v5: 1. remove readl(desc + TX_REG_OFFSET_DESC1) in moxart_mac_start_xmit() 2. compute entirely new values for DESC1 3. set TX_DESC1_END if (tx_head == TX_DESC_NUM_MASK) Applies to next-20140825 drivers/net/ethernet/moxa/moxart_ether.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c index 5020fd4..eed70d9 100644 --- a/drivers/net/ethernet/moxa/moxart_ether.c +++ b/drivers/net/ethernet/moxa/moxart_ether.c @@ -346,10 +346,9 @@ static int moxart_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev) len = ETH_ZLEN; } - txdes1 = readl(desc + TX_REG_OFFSET_DESC1); - txdes1 |= TX_DESC1_LTS | TX_DESC1_FTS; - txdes1 &= ~(TX_DESC1_FIFO_COMPLETE | TX_DESC1_INTR_COMPLETE); - txdes1 |= (len & TX_DESC1_BUF_SIZE_MASK); + txdes1 = TX_DESC1_LTS | TX_DESC1_FTS | (len & TX_DESC1_BUF_SIZE_MASK); + if (tx_head == TX_DESC_NUM_MASK) + txdes1 |= TX_DESC1_END; writel(txdes1, desc + TX_REG_OFFSET_DESC1); writel(TX_DESC0_DMA_OWN, desc + TX_REG_OFFSET_DESC0);