From: Mark Rustad Date: Wed, 26 Aug 2015 21:10:22 +0000 (-0700) Subject: ixgbe: Fix CS4227-related semaphore error on reset failure X-Git-Tag: v4.1.12-92~126^2~212 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=8a09842c851f67adcde935cf69fe9e4b0f550d2e;p=users%2Fjedix%2Flinux-maple.git ixgbe: Fix CS4227-related semaphore error on reset failure Orabug: 23177316 If the reset never completes, it is necessary to retake the semaphore before returning, because the caller will release the semaphore. Signed-off-by: Mark Rustad Tested-by: Darin Miller Signed-off-by: Jeff Kirsher (cherry picked from commit 8bf7a7b879985321c63e3ae46fee4e7f0d654ab1) Signed-off-by: Brian Maly --- diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c index ed7b2899affe0..06b15eddc4ae3 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c @@ -198,6 +198,7 @@ static s32 ixgbe_write_pe(struct ixgbe_hw *hw, u8 reg, u8 value) * ixgbe_reset_cs4227 - Reset CS4227 using port expander * @hw: pointer to hardware structure * + * This function assumes that the caller has acquired the proper semaphore. * Returns error code */ static s32 ixgbe_reset_cs4227(struct ixgbe_hw *hw) @@ -296,6 +297,14 @@ static void ixgbe_check_cs4227(struct ixgbe_hw *hw) hw->mac.ops.release_swfw_sync(hw, swfw_mask); msleep(IXGBE_CS4227_CHECK_DELAY); } + /* If still pending, assume other instance failed. */ + if (retry == IXGBE_CS4227_RETRIES) { + status = hw->mac.ops.acquire_swfw_sync(hw, swfw_mask); + if (status) { + hw_err(hw, "semaphore failed with %d\n", status); + return; + } + } /* Reset the CS4227. */ status = ixgbe_reset_cs4227(hw);