From patchwork Thu Mar 4 14:37:16 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Dillow X-Patchwork-Id: 46910 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 C0771B7CB9 for ; Fri, 5 Mar 2010 02:00:17 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753458Ab0CDPAL (ORCPT ); Thu, 4 Mar 2010 10:00:11 -0500 Received: from emroute2.ornl.gov ([160.91.86.17]:53391 "EHLO emroute2.ornl.gov" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753319Ab0CDPAK convert rfc822-to-8bit (ORCPT ); Thu, 4 Mar 2010 10:00:10 -0500 X-Greylist: delayed 1368 seconds by postgrey-1.27 at vger.kernel.org; Thu, 04 Mar 2010 10:00:10 EST Received: from emroute2.ornl.gov ([127.0.0.1]) by emroute2.ornl.gov (PMDF V6.4 #31561) with ESMTP id <0KYR001Q3HY894@emroute2.ornl.gov> for netdev@vger.kernel.org; Thu, 04 Mar 2010 09:37:20 -0500 (EST) Received: from CONVERSION-DAEMON.emroute2.ornl.gov by emroute2.ornl.gov (PMDF V6.4 #31561) id <0KYR00601HY8MN@emroute2.ornl.gov>; Thu, 04 Mar 2010 09:37:20 -0500 (EST) Received: from lap75545.ornl.gov (lap75545.ornl.gov [160.91.210.54]) by emroute2.ornl.gov (PMDF V6.4 #31561) with ESMTPS id <0KYR002Q6HY7F4@emroute2.ornl.gov>; Thu, 04 Mar 2010 09:37:20 -0500 (EST) Received: from lap75545.ornl.gov (localhost [127.0.0.1]) by lap75545.ornl.gov (8.14.3/8.14.3) with ESMTP id o24EbIs3004213; Thu, 04 Mar 2010 09:37:19 -0500 Received: (from dad@localhost) by lap75545.ornl.gov (8.14.3/8.14.3/Submit) id o24EbHmv004209; Thu, 04 Mar 2010 09:37:17 -0500 Date: Thu, 04 Mar 2010 09:37:16 -0500 From: David Dillow Subject: [PATCH] typhoon: fix incorrect use of smp_wmb() To: netdev@vger.kernel.org Cc: David Miller Message-id: <1267713436.2328.12.camel@lap75545.ornl.gov> MIME-version: 1.0 X-Mailer: Evolution 2.28.2 (2.28.2-1.fc12) Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 8BIT X-Authentication-warning: lap75545.ornl.gov: dad set sender to dave@thedillows.org using -f Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The typhoon driver was incorrectly using smp_wmb() to order memory accesses against IO to the NIC in a few instances. Use wmb() instead, which is required to actually order between memory types. Signed-off-by: David Dillow --- This is against Linus's tree, which doesn't appear to have net-next in it yet. It should apply with offsets, though. I can redo against net-next if needed, but likely won't have quick access to that tree until the weekend. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c index 39f1fc6..a192852 100644 --- a/drivers/net/typhoon.c +++ b/drivers/net/typhoon.c @@ -487,7 +487,7 @@ typhoon_hello(struct typhoon *tp) typhoon_inc_cmd_index(&ring->lastWrite, 1); INIT_COMMAND_NO_RESPONSE(cmd, TYPHOON_CMD_HELLO_RESP); - smp_wmb(); + wmb(); iowrite32(ring->lastWrite, tp->ioaddr + TYPHOON_REG_CMD_READY); spin_unlock(&tp->command_lock); } @@ -1321,13 +1321,15 @@ typhoon_init_interface(struct typhoon *tp) tp->txlo_dma_addr = le32_to_cpu(iface->txLoAddr); tp->card_state = Sleeping; - smp_wmb(); tp->offload = TYPHOON_OFFLOAD_IP_CHKSUM | TYPHOON_OFFLOAD_TCP_CHKSUM; tp->offload |= TYPHOON_OFFLOAD_UDP_CHKSUM | TSO_OFFLOAD_ON; spin_lock_init(&tp->command_lock); spin_lock_init(&tp->state_lock); + + /* Force the writes to the shared memory area out before continuing. */ + wmb(); } static void