From c3049c8f25bc1f43c7b948a4dbaaae84b0483136 Mon Sep 17 00:00:00 2001 From: Mark Rustad Date: Tue, 14 Jan 2014 18:53:12 -0800 Subject: [PATCH] ixbge: Protect ixgbe_down with __IXGBE_DOWN bit The ixgbe_down function can now prevent multiple executions by doing test_and_set_bit on __IXGBE_DOWN. This did not work before introduction of the __IXGBE_REMOVING bit, because of overloading of __IXGBE_DOWN. Also add smp_mb__before_clear_bit call before clearing the __IXGBE_DOWN bit. Signed-off-by: Mark Rustad Tested-by: Phil Schmitt Signed-off-by: Aaron Brown Signed-off-by: David S. Miller --- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index bf7d177b9579..44a261943279 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -4573,6 +4573,7 @@ static void ixgbe_up_complete(struct ixgbe_adapter *adapter) if (hw->mac.ops.enable_tx_laser) hw->mac.ops.enable_tx_laser(hw); + smp_mb__before_clear_bit(); clear_bit(__IXGBE_DOWN, &adapter->state); ixgbe_napi_enable_all(adapter); @@ -4784,7 +4785,8 @@ void ixgbe_down(struct ixgbe_adapter *adapter) int i; /* signal that we are down to the interrupt handler */ - set_bit(__IXGBE_DOWN, &adapter->state); + if (test_and_set_bit(__IXGBE_DOWN, &adapter->state)) + return; /* do nothing if already down */ /* disable receives */ rxctrl = IXGBE_READ_REG(hw, IXGBE_RXCTRL); -- 2.34.1