From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, gospo@redhat.com,
Jesse Brandeburg <jesse.brandeburg@intel.com>,
Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>,
Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next PATCH 08/11] ixgbe: Add a few safety nets for register writes and descriptor cleanups
Date: Sat, 14 Mar 2009 01:14:50 -0700 [thread overview]
Message-ID: <20090314081450.4687.87025.stgit@lost.foo-projects.org> (raw)
In-Reply-To: <20090314081229.4687.40245.stgit@lost.foo-projects.org>
From: Jesse Brandeburg <jesse.brandeburg@intel.com>
There are possible times that a driver may fail to completely initialize,
due to a buggy platform or a buggy kernel. In those cases, we'd rather
fail gracefully instead of a panic. Add a few safety checks to some
critical paths to try and prevent a panic in these corner-case situations.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ixgbe/ixgbe_main.c | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 78b0357..8821c5f 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -2458,8 +2458,10 @@ static void ixgbe_clean_rx_ring(struct ixgbe_adapter *adapter,
rx_ring->next_to_clean = 0;
rx_ring->next_to_use = 0;
- writel(0, adapter->hw.hw_addr + rx_ring->head);
- writel(0, adapter->hw.hw_addr + rx_ring->tail);
+ if (rx_ring->head)
+ writel(0, adapter->hw.hw_addr + rx_ring->head);
+ if (rx_ring->tail)
+ writel(0, adapter->hw.hw_addr + rx_ring->tail);
}
/**
@@ -2490,8 +2492,10 @@ static void ixgbe_clean_tx_ring(struct ixgbe_adapter *adapter,
tx_ring->next_to_use = 0;
tx_ring->next_to_clean = 0;
- writel(0, adapter->hw.hw_addr + tx_ring->head);
- writel(0, adapter->hw.hw_addr + tx_ring->tail);
+ if (tx_ring->head)
+ writel(0, adapter->hw.hw_addr + tx_ring->head);
+ if (tx_ring->tail)
+ writel(0, adapter->hw.hw_addr + tx_ring->tail);
}
/**
@@ -3327,7 +3331,8 @@ static void ixgbe_free_all_tx_resources(struct ixgbe_adapter *adapter)
int i;
for (i = 0; i < adapter->num_tx_queues; i++)
- ixgbe_free_tx_resources(adapter, &adapter->tx_ring[i]);
+ if (adapter->tx_ring[i].desc)
+ ixgbe_free_tx_resources(adapter, &adapter->tx_ring[i]);
}
/**
@@ -3363,7 +3368,8 @@ static void ixgbe_free_all_rx_resources(struct ixgbe_adapter *adapter)
int i;
for (i = 0; i < adapter->num_rx_queues; i++)
- ixgbe_free_rx_resources(adapter, &adapter->rx_ring[i]);
+ if (adapter->rx_ring[i].desc)
+ ixgbe_free_rx_resources(adapter, &adapter->rx_ring[i]);
}
/**
next prev parent reply other threads:[~2009-03-14 8:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-14 8:12 [net-next PATCH 01/11] ixgbe: Fix get_supported_physical_layer() due to new 82599 PHY types Jeff Kirsher
2009-03-14 8:12 ` [net-next PATCH 02/11] ixgbe: Fix an accounting problem when the Rx FIFO is full Jeff Kirsher
2009-03-14 8:13 ` [net-next PATCH 03/11] ixgbe: Disable DROP_EN for Rx queues Jeff Kirsher
2009-03-14 8:13 ` [net-next PATCH 04/11] ixgbe: Fix interrupt configuration for 82599 Jeff Kirsher
2009-03-14 8:13 ` [net-next PATCH 05/11] ixgbe: fix bug with napi add before request_irq Jeff Kirsher
2009-03-14 8:14 ` [net-next PATCH 06/11] ixgbe: Fix the Tx clean logic to return proper status Jeff Kirsher
2009-03-14 8:14 ` [net-next PATCH 07/11] ixgbe: Cleanup on the Rx init path Jeff Kirsher
2009-03-14 8:14 ` Jeff Kirsher [this message]
2009-03-14 8:15 ` [net-next PATCH 09/11] ixgbe: Two small fixes for 82599 when bringing the device down and for WoL Jeff Kirsher
2009-03-14 8:15 ` [net-next PATCH 10/11] ixgbe: Cleanup some whitespace issues, fixup and add some comments Jeff Kirsher
2009-03-14 8:15 ` [net-next PATCH 11/11] ixgbe: Add documentation for the driver Jeff Kirsher
2009-03-15 19:25 ` Ben Hutchings
2009-03-14 19:51 ` [net-next PATCH 01/11] ixgbe: Fix get_supported_physical_layer() due to new 82599 PHY types David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090314081450.4687.87025.stgit@lost.foo-projects.org \
--to=jeffrey.t.kirsher@intel.com \
--cc=davem@davemloft.net \
--cc=gospo@redhat.com \
--cc=jesse.brandeburg@intel.com \
--cc=netdev@vger.kernel.org \
--cc=peter.p.waskiewicz.jr@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).