From patchwork Tue Nov 3 19:36:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 7546461 Return-Path: X-Original-To: patchwork-linux-sh@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 B8FA5BEEA4 for ; Tue, 3 Nov 2015 19:36:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C631D204AD for ; Tue, 3 Nov 2015 19:36:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D392C204A9 for ; Tue, 3 Nov 2015 19:36:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755938AbbKCTgJ (ORCPT ); Tue, 3 Nov 2015 14:36:09 -0500 Received: from mail-lb0-f169.google.com ([209.85.217.169]:36324 "EHLO mail-lb0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755634AbbKCTgI (ORCPT ); Tue, 3 Nov 2015 14:36:08 -0500 Received: by lbjm5 with SMTP id m5so58733lbj.3 for ; Tue, 03 Nov 2015 11:36:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded_com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:organization:user-agent :mime-version:content-transfer-encoding:content-type; bh=WiAXP7po43T14z7CJrI+bEJa50V9NnCPKeWWCoEm7ZM=; b=EEC698QLQ4AB00P/60T0IZH0OCSdscm2ZBU9MT+l9P/BV8Xdvj9QUfpuO5RRYuDMmI Fc7klyhp35XIrPOCpKWZ2J5AptTXKFvziDwNSBJTLZW7rUXwZxOW9wJl1xKdM80uBIQp aR8Ap8FQzJBN/ipT7zF3+E6FWtMd36RgsHA7CUGYTmeeGO0rp4bwgKMRL/SyH647Z6zy CGMmI2+0ywpp9nrMWBTCcrglFEcXe+4ZdBk0AV6WiIQuvU6dpnNAaZP+JWnSxehSDleb fORVjHmpDdMxrYISZ2zji/rYO83yLmsvkOmKqYtPNPYMgstcd2I/+tui1Fs3WmZpUBwF aotA== 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:organization :user-agent:mime-version:content-transfer-encoding:content-type; bh=WiAXP7po43T14z7CJrI+bEJa50V9NnCPKeWWCoEm7ZM=; b=HoXXY+BYFMsWrmeL1NJoMJgeDsY48g9mdlAmph+2S+gziCGBveBjPy6bm8zwPUpRm8 a3JRG77MRbIFQ2M3CdofS75RJ2hBYE8VBOrGSaRRVM4A5z4S1bxWPM3DTt5/t2R2oEV1 W0iFJ+tGQSxBG9kgkVdVXMXrlaLiC2Za96olJ9vUU3JPLsMQPH15WKOJO+7WWlte4leH YvB/sAPcNRCvkGTn8vubRejWOxhxiPBFwo2b202IeNT3Xbbybm8MwKmO+UCf82FezzUW iZIyB82a77VAkvXPb9CN7k/fYoNgZnlvkzX2SUYLN62pjnrXErwXrOlkmNxjTIWj4F4X xfDA== X-Gm-Message-State: ALoCoQldgtZCTLw4NmUx7VpJEvWPTL4HhFlg1N9uXa+E7cCIInmRFbCBxNs5Vh+wYgG4+JXuc5dE X-Received: by 10.112.140.197 with SMTP id ri5mr13764464lbb.65.1446579366388; Tue, 03 Nov 2015 11:36:06 -0800 (PST) Received: from wasted.cogentembedded.com ([31.173.80.192]) by smtp.gmail.com with ESMTPSA id 34sm5097195lfx.47.2015.11.03.11.36.05 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Nov 2015 11:36:05 -0800 (PST) From: Sergei Shtylyov To: netdev@vger.kernel.org Cc: linux-sh@vger.kernel.org Subject: [PATCH v2] sh_eth: use DMA barriers Date: Tue, 03 Nov 2015 22:36:04 +0300 Message-ID: <1753153.kv41W3qdJQ@wasted.cogentembedded.com> Organization: Cogent Embedded Inc. User-Agent: KMail/4.14.9 (Linux/4.2.3-200.fc22.x86_64; KDE/4.14.11; x86_64; ; ) MIME-Version: 1.0 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,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 Commit 7d7355f58ba4 ("sh_eth: Ensure proper ordering of descriptor active bit write/read") did the right thing but used too "heavy" barriers while there were already "lighter" DMA barriers exactly for this case... Signed-off-by: Sergei Shtylyov --- The patch is against DaveM's 'net-next.git' repo. Changes in version 2: - fixed the subject. drivers/net/ethernet/renesas/sh_eth.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: net-next/drivers/net/ethernet/renesas/sh_eth.c =================================================================== --- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c +++ net-next/drivers/net/ethernet/renesas/sh_eth.c @@ -1416,7 +1416,7 @@ static int sh_eth_txfree(struct net_devi if (txdesc->status & cpu_to_edmac(mdp, TD_TACT)) break; /* TACT bit must be checked before all the following reads */ - rmb(); + dma_rmb(); netif_info(mdp, tx_done, ndev, "tx entry %d status 0x%08x\n", entry, edmac_to_cpu(mdp, txdesc->status)); @@ -1458,7 +1458,7 @@ static int sh_eth_rx(struct net_device * rxdesc = &mdp->rx_ring[entry]; while (!(rxdesc->status & cpu_to_edmac(mdp, RD_RACT))) { /* RACT bit must be checked before all the following reads */ - rmb(); + dma_rmb(); desc_status = edmac_to_cpu(mdp, rxdesc->status); pkt_len = rxdesc->frame_length; @@ -1544,7 +1544,7 @@ static int sh_eth_rx(struct net_device * skb_checksum_none_assert(skb); rxdesc->addr = dma_addr; } - wmb(); /* RACT bit must be set after all the above writes */ + dma_wmb(); /* RACT bit must be set after all the above writes */ if (entry >= mdp->num_rx_ring - 1) rxdesc->status |= cpu_to_edmac(mdp, RD_RACT | RD_RFP | RD_RDLE); @@ -2403,7 +2403,7 @@ static int sh_eth_start_xmit(struct sk_b } txdesc->buffer_length = skb->len; - wmb(); /* TACT bit must be set after all the above writes */ + dma_wmb(); /* TACT bit must be set after all the above writes */ if (entry >= mdp->num_tx_ring - 1) txdesc->status |= cpu_to_edmac(mdp, TD_TACT | TD_TDLE); else