From patchwork Fri Sep 25 22:18:07 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirsher, Jeffrey T" X-Patchwork-Id: 34315 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.176.167]) by ozlabs.org (Postfix) with ESMTP id A805CB7BC1 for ; Sat, 26 Sep 2009 08:18:45 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752732AbZIYWSh (ORCPT ); Fri, 25 Sep 2009 18:18:37 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752607AbZIYWSg (ORCPT ); Fri, 25 Sep 2009 18:18:36 -0400 Received: from qmta05.emeryville.ca.mail.comcast.net ([76.96.30.48]:34302 "EHLO QMTA05.emeryville.ca.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752541AbZIYWSg (ORCPT ); Fri, 25 Sep 2009 18:18:36 -0400 Received: from OMTA23.emeryville.ca.mail.comcast.net ([76.96.30.90]) by QMTA05.emeryville.ca.mail.comcast.net with comcast id l9uA1c0061wfjNsA5AJhE8; Fri, 25 Sep 2009 22:18:41 +0000 Received: from localhost.localdomain ([72.254.87.24]) by OMTA23.emeryville.ca.mail.comcast.net with comcast id lAQJ1c0020XWpyY8jAQUnh; Fri, 25 Sep 2009 22:24:48 +0000 From: Jeff Kirsher Subject: [net-2.6 PATCH 06/13] e1000: fix tx waking queue after queue stopped during shutdown To: davem@davemloft.net Cc: netdev@vger.kernel.org, gospo@redhat.com, Jesse Brandeburg , Don Skidmore , Jeff Kirsher Date: Fri, 25 Sep 2009 15:18:07 -0700 Message-ID: <20090925221807.26715.3976.stgit@localhost.localdomain> In-Reply-To: <20090925221613.26715.66796.stgit@localhost.localdomain> References: <20090925221613.26715.66796.stgit@localhost.localdomain> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jesse Brandeburg This fix closes a race where the adapter can be shutting down while hard_start_xmit is being called and interrupts are being handled. Signed-off-by: Jesse Brandeburg Signed-off-by: Don Skidmore Signed-off-by: Jeff Kirsher --- drivers/net/e1000/e1000_main.c | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) -- 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/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 11508af..8c64363 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c @@ -2733,8 +2733,9 @@ static int e1000_tx_map(struct e1000_adapter *adapter, size -= 4; buffer_info->length = size; - buffer_info->dma = skb_shinfo(skb)->dma_head + offset; + /* set time_stamp *before* dma to help avoid a possible race */ buffer_info->time_stamp = jiffies; + buffer_info->dma = skb_shinfo(skb)->dma_head + offset; buffer_info->next_to_watch = i; len -= size; @@ -2774,8 +2775,8 @@ static int e1000_tx_map(struct e1000_adapter *adapter, size -= 4; buffer_info->length = size; - buffer_info->dma = map[f] + offset; buffer_info->time_stamp = jiffies; + buffer_info->dma = map[f] + offset; buffer_info->next_to_watch = i; len -= size; @@ -3459,7 +3460,9 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter, * sees the new next_to_clean. */ smp_mb(); - if (netif_queue_stopped(netdev)) { + + if (netif_queue_stopped(netdev) && + !(test_bit(__E1000_DOWN, &adapter->flags))) { netif_wake_queue(netdev); ++adapter->restart_queue; } @@ -3469,8 +3472,8 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter, /* Detect a transmit hang in hardware, this serializes the * check with the clearing of time_stamp and movement of i */ adapter->detect_tx_hung = false; - if (tx_ring->buffer_info[i].time_stamp && - time_after(jiffies, tx_ring->buffer_info[i].time_stamp + + if (tx_ring->buffer_info[eop].time_stamp && + time_after(jiffies, tx_ring->buffer_info[eop].time_stamp + (adapter->tx_timeout_factor * HZ)) && !(er32(STATUS) & E1000_STATUS_TXOFF)) { @@ -3492,7 +3495,7 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter, readl(hw->hw_addr + tx_ring->tdt), tx_ring->next_to_use, tx_ring->next_to_clean, - tx_ring->buffer_info[i].time_stamp, + tx_ring->buffer_info[eop].time_stamp, eop, jiffies, eop_desc->upper.fields.status);