From patchwork Fri Oct 3 16:02:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Manoil X-Patchwork-Id: 396300 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 9FA2514012D for ; Sat, 4 Oct 2014 02:25:28 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753450AbaJCQZY (ORCPT ); Fri, 3 Oct 2014 12:25:24 -0400 Received: from mail-bn1bon0142.outbound.protection.outlook.com ([157.56.111.142]:60463 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752668AbaJCQZY (ORCPT ); Fri, 3 Oct 2014 12:25:24 -0400 Received: from DM2PR03MB368.namprd03.prod.outlook.com (10.141.55.22) by DM2PR03MB398.namprd03.prod.outlook.com (10.141.84.140) with Microsoft SMTP Server (TLS) id 15.0.1044.10; Fri, 3 Oct 2014 16:09:30 +0000 Received: from CO2PR03CA0034.namprd03.prod.outlook.com (10.141.194.161) by DM2PR03MB368.namprd03.prod.outlook.com (10.141.55.22) with Microsoft SMTP Server (TLS) id 15.0.1044.10; Fri, 3 Oct 2014 16:09:29 +0000 Received: from BN1BFFO11FD020.protection.gbl (2a01:111:f400:7c10::1:137) by CO2PR03CA0034.outlook.office365.com (2a01:111:e400:1414::33) with Microsoft SMTP Server (TLS) id 15.0.1044.10 via Frontend Transport; Fri, 3 Oct 2014 16:09:28 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD020.mail.protection.outlook.com (10.58.144.83) with Microsoft SMTP Server (TLS) id 15.0.1029.15 via Frontend Transport; Fri, 3 Oct 2014 16:09:28 +0000 Received: from fsr-fed1764-016.ea.freescale.net (fsr-fed1764-016.ea.freescale.net [10.171.81.161]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id s93G9FUW031613; Fri, 3 Oct 2014 09:09:26 -0700 From: Claudiu Manoil To: CC: "David S. Miller" , Xiubo Li , Shruti Kanetkar Subject: [net 8/8] gianfar: Replace eieio with wmb for non-PPC archs Date: Fri, 3 Oct 2014 19:02:49 +0300 Message-ID: <1412352169-14414-9-git-send-email-claudiu.manoil@freescale.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1412352169-14414-1-git-send-email-claudiu.manoil@freescale.com> References: <1412352169-14414-1-git-send-email-claudiu.manoil@freescale.com> X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:CAL; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(448002)(189002)(199003)(50226001)(4396001)(229853001)(102836001)(97736003)(76482002)(50986999)(76176999)(95666004)(6806004)(106466001)(104166001)(19580405001)(64706001)(26826002)(47776003)(44976005)(19580395003)(20776003)(107046002)(110136001)(89996001)(86362001)(10300001)(93916002)(33646002)(99396003)(46102003)(80022003)(92566001)(88136002)(92726001)(85852003)(36756003)(77156001)(62966002)(31966008)(120916001)(87286001)(68736004)(48376002)(2351001)(84676001)(21056001)(85306004)(104016003)(85326001)(87936001)(50466002); DIR:OUT; SFP:1102; SCL:1; SRVR:DM2PR03MB368; H:tx30smr01.am.freescale.net; FPR:; MLV:ovrnspm; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: UriScan:;UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:DM2PR03MB368; X-Forefront-PRVS: 0353563E2B Received-SPF: PermError (protection.outlook.com: domain of freescale.com used an invalid SPF mechanism) Authentication-Results: spf=permerror (sender IP is 192.88.168.50) smtp.mailfrom=claudiu.manoil@freescale.com; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:DM2PR03MB398; X-OriginatorOrg: freescale.com Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Replace PPC specific eieio() with arch independent wmb() for other architectures, i.e. ARM. The eieio() macro is not defined on ARM and generates build error. Signed-off-by: Claudiu Manoil --- drivers/net/ethernet/freescale/gianfar.c | 13 +++---------- drivers/net/ethernet/freescale/gianfar.h | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index 356a998..379b1a5 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c @@ -165,7 +165,7 @@ static void gfar_init_rxbdp(struct gfar_priv_rx_q *rx_queue, struct rxbd8 *bdp, if (bdp == rx_queue->rx_bd_base + rx_queue->rx_ring_size - 1) lstatus |= BD_LFLAG(RXBD_WRAP); - eieio(); + gfar_wmb(); bdp->lstatus = lstatus; } @@ -2371,18 +2371,11 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev) */ spin_lock_irqsave(&tx_queue->txlock, flags); - /* The powerpc-specific eieio() is used, as wmb() has too strong - * semantics (it requires synchronization between cacheable and - * uncacheable mappings, which eieio doesn't provide and which we - * don't need), thus requiring a more expensive sync instruction. At - * some point, the set of architecture-independent barrier functions - * should be expanded to include weaker barriers. - */ - eieio(); + gfar_wmb(); txbdp_start->lstatus = lstatus; - eieio(); /* force lstatus write before tx_skbuff */ + gfar_wmb(); /* force lstatus write before tx_skbuff */ tx_queue->tx_skbuff[tx_queue->skb_curtx] = skb; diff --git a/drivers/net/ethernet/freescale/gianfar.h b/drivers/net/ethernet/freescale/gianfar.h index 0b37722..2805cfb 100644 --- a/drivers/net/ethernet/freescale/gianfar.h +++ b/drivers/net/ethernet/freescale/gianfar.h @@ -1241,6 +1241,22 @@ static inline int gfar_is_rx_dma_stopped(struct gfar_private *priv) return gfar_read(®s->ievent) & IEVENT_GRSC; } +static inline void gfar_wmb(void) +{ +#if defined(CONFIG_PPC) + /* The powerpc-specific eieio() is used, as wmb() has too strong + * semantics (it requires synchronization between cacheable and + * uncacheable mappings, which eieio() doesn't provide and which we + * don't need), thus requiring a more expensive sync instruction. At + * some point, the set of architecture-independent barrier functions + * should be expanded to include weaker barriers. + */ + eieio(); +#else + wmb(); /* order write acesses for BD (or FCB) fields */ +#endif +} + irqreturn_t gfar_receive(int irq, void *dev_id); int startup_gfar(struct net_device *dev); void stop_gfar(struct net_device *dev);