From patchwork Sun May 15 01:23:38 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirsher, Jeffrey T" X-Patchwork-Id: 95603 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 42407B6EF2 for ; Sun, 15 May 2011 11:24:34 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759796Ab1EOBY3 (ORCPT ); Sat, 14 May 2011 21:24:29 -0400 Received: from mga11.intel.com ([192.55.52.93]:1031 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759488Ab1EOBXv (ORCPT ); Sat, 14 May 2011 21:23:51 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 14 May 2011 18:23:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.64,368,1301900400"; d="scan'208";a="1789327" Received: from unknown (HELO jtkirshe-MOBL1.amr.corp.intel.com) ([10.255.12.73]) by fmsmga002.fm.intel.com with ESMTP; 14 May 2011 18:23:50 -0700 From: Jeff Kirsher To: davem@davemloft.net Cc: Emil Tantilov , netdev@vger.kernel.org, gospo@redhat.com, bphilips@novell.com, Jeff Kirsher Subject: [net-next-2.6 04/13] ixgbe: force unlock on timeout Date: Sat, 14 May 2011 18:23:38 -0700 Message-Id: <1305422627-9583-5-git-send-email-jeffrey.t.kirsher@intel.com> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1305422627-9583-1-git-send-email-jeffrey.t.kirsher@intel.com> References: <1305422627-9583-1-git-send-email-jeffrey.t.kirsher@intel.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Emil Tantilov The semaphore can be in locked state upon driver load, particularly on 82598 if a machine is rebooted due to panic and the semaphore was acquired just prior to the panic. This patch unlocks the semaphore if it times out. Signed-off-by: Emil Tantilov Signed-off-by: Jeff Kirsher --- drivers/net/ixgbe/ixgbe_common.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c index c4730cd..b894b42 100644 --- a/drivers/net/ixgbe/ixgbe_common.c +++ b/drivers/net/ixgbe/ixgbe_common.c @@ -1189,6 +1189,28 @@ static s32 ixgbe_get_eeprom_semaphore(struct ixgbe_hw *hw) udelay(50); } + if (i == timeout) { + hw_dbg(hw, "Driver can't access the Eeprom - SMBI Semaphore " + "not granted.\n"); + /* + * this release is particularly important because our attempts + * above to get the semaphore may have succeeded, and if there + * was a timeout, we should unconditionally clear the semaphore + * bits to free the driver to make progress + */ + ixgbe_release_eeprom_semaphore(hw); + + udelay(50); + /* + * one last try + * If the SMBI bit is 0 when we read it, then the bit will be + * set and we have the semaphore + */ + swsm = IXGBE_READ_REG(hw, IXGBE_SWSM); + if (!(swsm & IXGBE_SWSM_SMBI)) + status = 0; + } + /* Now get the semaphore between SW/FW through the SWESMBI bit */ if (status == 0) { for (i = 0; i < timeout; i++) {