From patchwork Thu Jan 28 21:25:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 8154331 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A5615BEEE5 for ; Thu, 28 Jan 2016 21:49:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B9EEA20218 for ; Thu, 28 Jan 2016 21:49:03 +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 DBC4E20211 for ; Thu, 28 Jan 2016 21:49:02 +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 1aOuPj-0000tk-QJ; Thu, 28 Jan 2016 21:47:39 +0000 Received: from mail-pf0-x22d.google.com ([2607:f8b0:400e:c00::22d]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aOu84-000689-O2 for linux-arm-kernel@lists.infradead.org; Thu, 28 Jan 2016 21:29:26 +0000 Received: by mail-pf0-x22d.google.com with SMTP id x125so29980066pfb.0 for ; Thu, 28 Jan 2016 13:29:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=boundarydevices-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4rCsPfeL4o/C44gxSAJ7Myc+bq5TK6vRBIqHGWySTWs=; b=lk3qVIEJVPnub9nFFLkXvL257xd0BXHvJdFSazDlf+h1cqUtuKy6HeHaGDaE5xOkJV zzTTtkqokyzayL9DyhGgo6St5ZzIL3LWOeKCiNBOKwKFwwY/ZW/Dot9kKCeMtdjSzMBg XB+OEnkGa3Iofq2Ax1FoYt1X3DWoJjtcbINupeOEdL+6xPlqV2+2JEs5sLtKABkZFe+S B4wLlCe8R+K4KvZZhZt/u0e6QY0Jb0vuwRP783pEjt/3QSV0RpctkYPCr8PcuF2bVxcX 1D/FSyxmwC2EWAFM7JN8ibHzUno0vanzPVSOsZIM08/bLN46RI92zef2jwzyNCzybKyA dYcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4rCsPfeL4o/C44gxSAJ7Myc+bq5TK6vRBIqHGWySTWs=; b=AQn/62DwNesBLAQ+aZetoipYja41hQu1Lym99cD9nslDUdRqMYL2QIjOmYZuKUrRWH sVwYH/+1jxzZfgmFL9CD0szjUX9NcaB8Zr+urnu4nNslOSg8IlSouJMRicf5EErzYaYI HkZ3aaJ5lyaMBfhqJR2OnXexECUIV9mKFfSErdQlnNb/u3BoDRFI9jtoe5fjxS+B+hS7 DeTy4sgWYDt1w2NIYLE2eqyeo84vANskG5gD+/BGd+7aAbhbdH3pNBhxNeFhC60h89zS EGHJ+QPRxRjBX/lb1t2cVdSvG7xM4JfXVYGdi1WJWozCum97Zp0+ll6tiXlVBlAc9E0u 8KOQ== X-Gm-Message-State: AG10YORH8mUHF1vEfpOK1YjOrX2byJX1wvgbcutVlln7k0tW7Or7JNFSNsjkjrJdrsyzmA== X-Received: by 10.98.14.29 with SMTP id w29mr7890532pfi.160.1454016544040; Thu, 28 Jan 2016 13:29:04 -0800 (PST) Received: from localhost.localdomain (wsip-70-184-93-199.ph.ph.cox.net. [70.184.93.199]) by smtp.googlemail.com with ESMTPSA id c90sm18583190pfd.31.2016.01.28.13.29.02 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 28 Jan 2016 13:29:03 -0800 (PST) From: Troy Kisky To: netdev@vger.kernel.org, davem@davemloft.net, B38611@freescale.com Subject: [PATCH net-next 33/40] net: fec: shrink the window for 'tx int lost' Date: Thu, 28 Jan 2016 14:25:57 -0700 Message-Id: <1454016364-30985-34-git-send-email-troy.kisky@boundarydevices.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1454016364-30985-1-git-send-email-troy.kisky@boundarydevices.com> References: <1454016364-30985-1-git-send-email-troy.kisky@boundarydevices.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160128_132924_955595_1E06FF82 X-CRM114-Status: GOOD ( 12.46 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fabio.estevam@freescale.com, andrew@lunn.ch, linux@arm.linux.org.uk, Troy Kisky , laci@boundarydevices.com, l.stach@pengutronix.de, shawnguo@kernel.org, linux-arm-kernel@lists.infradead.org, tremyfr@gmail.com 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=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,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 Perform skb_tx_timestamp before transferring ownership This shrinks the window for 'tx int lost' If the packet is transmitted and napi clears the tx interrupt before the txq->bd.cur assignment, then the tx interrupt is effectively lost. Signed-off-by: Troy Kisky --- drivers/net/ethernet/freescale/fec_main.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 9da2c6d..512b1ad 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -510,27 +510,24 @@ static int fec_enet_txq_submit_skb(struct fec_enet_priv_tx_q *txq, index = fec_enet_get_bd_index(last_bdp, &txq->bd); /* Save skb pointer */ txq->tx_skbuff[index] = skb; + last_bdp = fec_enet_get_nextdesc(last_bdp, &txq->bd); + skb_tx_timestamp(skb); /* Make sure the updates to rest of the descriptor are performed before * transferring ownership. */ wmb(); - /* Send it on its way. Tell FEC it's ready, interrupt when done, - * it's the last BD of the frame, and to put the CRC on the end. + /* Send it on its way. Transfer ownership + * Make sure the update to bdp and tx_skbuff are performed before + * the update to txq->bd.cur. + * Keep window for interrupt between the next 3 lines as small as + * possible, to avoid "tx int lost" in case no more tx interrupts + * happen within 2 seconds. */ bdp->cbd_sc = status; - - /* If this was the last BD in the ring, start at the beginning again. */ - bdp = fec_enet_get_nextdesc(last_bdp, &txq->bd); - - skb_tx_timestamp(skb); - - /* Make sure the update to bdp and tx_skbuff are performed before - * txq->bd.cur. - */ wmb(); - txq->bd.cur = bdp; + txq->bd.cur = last_bdp; /* Trigger transmission start */ writel(0, txq->bd.reg_desc_active); @@ -719,12 +716,12 @@ static int fec_enet_txq_submit_tso(struct fec_enet_priv_tx_q *txq, * transferring ownership. */ wmb(); - /* Send it on its way. Tell FEC it's ready, interrupt when done, + /* Send it on its way. Transfer ownership + * Keep window for interrupt between the next 3 lines as small as + * possible, to avoid "tx int lost" in case no more tx interrupts + * happen within 2 seconds. */ first_bdp->cbd_sc = status; - /* Make sure ownership is transferred before the - * update to txq->bd.cur. - */ wmb(); txq->bd.cur = bdp;