From patchwork Thu Jan 28 21:25:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 8154031 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 49BF7BEEE5 for ; Thu, 28 Jan 2016 21:32:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6EAA52020F for ; Thu, 28 Jan 2016 21:32:53 +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 9F97E2013A for ; Thu, 28 Jan 2016 21:32:52 +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 1aOu9Y-0008Qr-DQ; Thu, 28 Jan 2016 21:30:56 +0000 Received: from mail-pf0-x22b.google.com ([2607:f8b0:400e:c00::22b]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aOu7N-0005rX-4t for linux-arm-kernel@lists.infradead.org; Thu, 28 Jan 2016 21:28:43 +0000 Received: by mail-pf0-x22b.google.com with SMTP id x125so29971381pfb.0 for ; Thu, 28 Jan 2016 13:28:20 -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=UpiIbA8MNXiG+GnIuG2d4UNsYC6WHIyGUnXCOMoTAys=; b=mSdXsUaJXAaEELqthbMKPdd11JilAdtlRenF0/T/aCOAIsDb8uLd17KRAulWptX5oN F9078k+cfOD9PyrSLFMJFG3/ihAxi5IppeHcz4+cK5KsKtvfdq2hIG2bScF30LRh2hgP 1MAlIkCLFmfwCkbZXNJsefL/uO94PCBQSQCsASow+aRU99nLzUVRV8sdpf3NnAWPdjWq uu4her6u6aItlXXfYiHYN6zr9deIJP76vXdYJw8mJ2uSJUgqa0tiyU/WJdnmIQ65i8P2 Bky3fq3NAKQop5ZPZTUY9W2gnk7gacCTvUOVspG3KAbhUCRwl+CBokS9TVYKNijCHHJn 7cMQ== 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=UpiIbA8MNXiG+GnIuG2d4UNsYC6WHIyGUnXCOMoTAys=; b=Xt5OADc56suMdHMyugC/gb1vvst7Q1kJDDGsQVbz6Gat+aO6zO2BdRIFe6Z3uM5WfG x91/TgxgrzmAdy+Vybb4etW6hXNFGV//eovOOnEzPTbbUWgrBmN9lEo2tMbBzlOxCbYd XkHHXYLGD5ZiJWuvJK99TJKqCrCrkG5zC34RLPO/CXXkVWuqoJSXE62czmj0F7TEyBsi dwgQGIxNsDauuDlNThruskXGU4/oMAOtm6aWfCg5v0OzMoZ/ytyvA+18KsgTZMG9CCCZ +cSj+cO+KBhxh4BuKfqDG1nTgyzVyIPabvoSuMsUfCLPmTmRuSE6tAbKuRozXLhsC3Dp Rm4w== X-Gm-Message-State: AG10YOSiFyw9qbcB47bl/nrY7MHmtl1lavjEUrVGP4RYJg+t+duIwgF3S6yzx9/rGEMS6Q== X-Received: by 10.98.42.88 with SMTP id q85mr8028264pfq.1.1454016500510; Thu, 28 Jan 2016 13:28:20 -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.28.18 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 28 Jan 2016 13:28:19 -0800 (PST) From: Troy Kisky To: netdev@vger.kernel.org, davem@davemloft.net, B38611@freescale.com Subject: [PATCH net-next 07/40] net: fec: don't transfer ownership until descriptor write is complete Date: Thu, 28 Jan 2016 14:25:31 -0700 Message-Id: <1454016364-30985-8-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_132841_534249_A242F9A2 X-CRM114-Status: GOOD ( 12.31 ) 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=ham 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 Signed-off-by: Troy Kisky --- drivers/net/ethernet/freescale/fec_main.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index e8f35fb..b87f80d 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -388,6 +388,10 @@ fec_enet_txq_submit_frag_skb(struct fec_enet_priv_tx_q *txq, bdp->cbd_bufaddr = addr; bdp->cbd_datlen = frag_len; + /* Make sure the updates to rest of the descriptor are + * performed before transferring ownership. + */ + wmb(); bdp->cbd_sc = status; } @@ -497,6 +501,10 @@ static int fec_enet_txq_submit_skb(struct fec_enet_priv_tx_q *txq, bdp->cbd_datlen = buflen; bdp->cbd_bufaddr = addr; + /* 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. @@ -1467,7 +1475,6 @@ rx_processing_done: /* Mark the buffer empty */ status |= BD_ENET_RX_EMPTY; - bdp->cbd_sc = status; if (fep->bufdesc_ex) { struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp; @@ -1476,6 +1483,11 @@ rx_processing_done: ebdp->cbd_prot = 0; ebdp->cbd_bdu = 0; } + /* Make sure the updates to rest of the descriptor are + * performed before transferring ownership. + */ + wmb(); + bdp->cbd_sc = status; /* Update BD pointer to next entry */ bdp = fec_enet_get_nextdesc(bdp, &rxq->bd);