netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Emil Tantilov <emil.s.tantilov@intel.com>,
	netdev@vger.kernel.org, gospo@redhat.com, bphilips@novell.com,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next-2.6 17/24] ixgbe: fix 82599 KR downshift coexistence with LESM FW module
Date: Wed, 13 Apr 2011 18:02:13 -0700	[thread overview]
Message-ID: <1302742940-22141-18-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1302742940-22141-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Emil Tantilov <emil.s.tantilov@intel.com>

Disable KR to KX4/KX downshift on 82599 backplane devices when
LESM (Link Establishment State Machine) is enabled in FW. Those
features cannot co-exist as they both manipulate the same registers.

Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Acked-by: Don Skidmore <donald.c.skidmore@intel.com>
Tested-by: Phillip Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ixgbe/ixgbe_82599.c |   46 ++++++++++++++++++++++++++++++++++++++-
 drivers/net/ixgbe/ixgbe_type.h  |    3 ++
 2 files changed, 48 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_82599.c b/drivers/net/ixgbe/ixgbe_82599.c
index 09934a8..d195278 100644
--- a/drivers/net/ixgbe/ixgbe_82599.c
+++ b/drivers/net/ixgbe/ixgbe_82599.c
@@ -61,6 +61,7 @@ static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw,
                                          bool autoneg,
                                          bool autoneg_wait_to_complete);
 static s32 ixgbe_verify_fw_version_82599(struct ixgbe_hw *hw);
+static bool ixgbe_verify_lesm_fw_enabled_82599(struct ixgbe_hw *hw);
 
 static void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw)
 {
@@ -86,7 +87,8 @@ static void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw)
 		if ((mac->ops.get_media_type(hw) ==
 		     ixgbe_media_type_backplane) &&
 		    (hw->phy.smart_speed == ixgbe_smart_speed_auto ||
-		     hw->phy.smart_speed == ixgbe_smart_speed_on))
+		     hw->phy.smart_speed == ixgbe_smart_speed_on) &&
+		     !ixgbe_verify_lesm_fw_enabled_82599(hw))
 			mac->ops.setup_link = &ixgbe_setup_mac_link_smartspeed;
 		else
 			mac->ops.setup_link = &ixgbe_setup_mac_link_82599;
@@ -2028,6 +2030,48 @@ fw_version_out:
 	return status;
 }
 
+/**
+ *  ixgbe_verify_lesm_fw_enabled_82599 - Checks LESM FW module state.
+ *  @hw: pointer to hardware structure
+ *
+ *  Returns true if the LESM FW module is present and enabled. Otherwise
+ *  returns false. Smart Speed must be disabled if LESM FW module is enabled.
+ **/
+static bool ixgbe_verify_lesm_fw_enabled_82599(struct ixgbe_hw *hw)
+{
+	bool lesm_enabled = false;
+	u16 fw_offset, fw_lesm_param_offset, fw_lesm_state;
+	s32 status;
+
+	/* get the offset to the Firmware Module block */
+	status = hw->eeprom.ops.read(hw, IXGBE_FW_PTR, &fw_offset);
+
+	if ((status != 0) ||
+	    (fw_offset == 0) || (fw_offset == 0xFFFF))
+		goto out;
+
+	/* get the offset to the LESM Parameters block */
+	status = hw->eeprom.ops.read(hw, (fw_offset +
+				     IXGBE_FW_LESM_PARAMETERS_PTR),
+				     &fw_lesm_param_offset);
+
+	if ((status != 0) ||
+	    (fw_lesm_param_offset == 0) || (fw_lesm_param_offset == 0xFFFF))
+		goto out;
+
+	/* get the lesm state word */
+	status = hw->eeprom.ops.read(hw, (fw_lesm_param_offset +
+				     IXGBE_FW_LESM_STATE_1),
+				     &fw_lesm_state);
+
+	if ((status == 0) &&
+	    (fw_lesm_state & IXGBE_FW_LESM_STATE_ENABLED))
+		lesm_enabled = true;
+
+out:
+	return lesm_enabled;
+}
+
 static struct ixgbe_mac_operations mac_ops_82599 = {
 	.init_hw                = &ixgbe_init_hw_generic,
 	.reset_hw               = &ixgbe_reset_hw_82599,
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h
index cd1c2b6..e00356a 100644
--- a/drivers/net/ixgbe/ixgbe_type.h
+++ b/drivers/net/ixgbe/ixgbe_type.h
@@ -1625,6 +1625,9 @@
 #define IXGBE_SAN_MAC_ADDR_PORT1_OFFSET  0x3
 #define IXGBE_DEVICE_CAPS_ALLOW_ANY_SFP  0x1
 #define IXGBE_DEVICE_CAPS_FCOE_OFFLOADS  0x2
+#define IXGBE_FW_LESM_PARAMETERS_PTR     0x2
+#define IXGBE_FW_LESM_STATE_1            0x1
+#define IXGBE_FW_LESM_STATE_ENABLED      0x8000 /* LESM Enable bit */
 #define IXGBE_FW_PASSTHROUGH_PATCH_CONFIG_PTR   0x4
 #define IXGBE_FW_PATCH_VERSION_4   0x7
 
-- 
1.7.4.2


  parent reply	other threads:[~2011-04-14  1:02 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-14  1:01 [net-next-2.6 00/26][pull request] Intel Wired LAN Driver Update Jeff Kirsher
2011-04-14  1:01 ` [net-next-2.6 01/24] igb: Add anti-spoofing feature documentation Jeff Kirsher
2011-04-14  1:01 ` [net-next-2.6 02/24] igb: fix typo in igb_validate_nvm_checksum_82580 Jeff Kirsher
2011-04-14  1:01 ` [net-next-2.6 03/24] igb: introduce igb_thermal_sensor_event for sensor checking Jeff Kirsher
2011-04-14  1:02 ` [net-next-2.6 04/24] e1000: convert to set_phys_id Jeff Kirsher
2011-04-14  1:12   ` Allan, Bruce W
2011-04-14  1:18     ` Jeff Kirsher
2011-04-14  1:02 ` [net-next-2.6 05/24] e1000e: convert short duration msleep() to usleep_range() Jeff Kirsher
2011-04-14  1:02 ` [net-next-2.6 06/24] e1000e: PCIe link speed in GT/s, not GB/s Jeff Kirsher
2011-04-14  1:02 ` [net-next-2.6 07/24] e1000e: convert to new VLAN model Jeff Kirsher
2011-04-14  1:02 ` [net-next-2.6 08/24] e1000e: fix stats locking in e1000_watchdog_task Jeff Kirsher
2011-04-14  1:02 ` [net-next-2.6 09/24] e1000e: If ASPM L0s needs to be disabled, do it prior to enabling device Jeff Kirsher
2011-04-14  1:02 ` [net-next-2.6 10/24] ixgbe: DCB, further cleanups to app configuration Jeff Kirsher
2011-04-14  1:02 ` [net-next-2.6 11/24] ixgbe: fix return value checks Jeff Kirsher
2011-04-14  1:02 ` [net-next-2.6 12/24] ixgbe: correct function number for some 82598 parts Jeff Kirsher
2011-04-14  1:02 ` [net-next-2.6 13/24] ixgbe: fix namespacecheck issue Jeff Kirsher
2011-04-14  1:02 ` [net-next-2.6 14/24] ixgbe: update version string for Dell CEM use Jeff Kirsher
2011-04-14  1:02 ` [net-next-2.6 15/24] ixgbe: refactor common start_hw code for 82599 and x540 Jeff Kirsher
2011-04-14  1:02 ` [net-next-2.6 16/24] ixgbe: move disabling of relaxed ordering in start_hw() Jeff Kirsher
2011-04-14  1:02 ` Jeff Kirsher [this message]
2011-04-14  1:02 ` [net-next-2.6 18/24] ixgbe: cleanup short msleep's (<20ms) to use usleep_range Jeff Kirsher
2011-04-14  1:02 ` [net-next-2.6 19/24] ixgbe: fix semaphores in eeprom routines for x540 Jeff Kirsher
2011-04-14  1:02 ` [net-next-2.6 20/24] ixgbe: add support for new HW Jeff Kirsher
2011-04-14  1:02 ` [net-next-2.6 21/24] ixgbe: explicitly disable 100H for x540 Jeff Kirsher
2011-04-14  1:02 ` [net-next-2.6 22/24] ixgbe: make device_caps() generic Jeff Kirsher
2011-04-14  1:02 ` [net-next-2.6 23/24] ixgbe: DCB, misallocated packet buffer size with X540 device Jeff Kirsher
2011-04-14  1:02 ` [net-next-2.6 24/24] ixgbe: DCB, X540 devices do not respond to pause frames Jeff Kirsher

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=1302742940-22141-18-git-send-email-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=bphilips@novell.com \
    --cc=davem@davemloft.net \
    --cc=emil.s.tantilov@intel.com \
    --cc=gospo@redhat.com \
    --cc=netdev@vger.kernel.org \
    /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).