DPDK patches and discussions
 help / color / mirror / Atom feed
From: Wenzhuo Lu <wenzhuo.lu@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 06/37] ixgbe/base: add x550em identify SFP module support
Date: Wed, 24 Jun 2015 11:25:55 +0800	[thread overview]
Message-ID: <1435116386-12010-7-git-send-email-wenzhuo.lu@intel.com> (raw)
In-Reply-To: <1435116386-12010-1-git-send-email-wenzhuo.lu@intel.com>

This patch adds identify SFP module support for x550em. x550em
support returns an error for SFP module types not supported by
x550em design.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_x550.c | 101 +++++++++++++++++++++++++++---------
 drivers/net/ixgbe/base/ixgbe_x550.h |   1 +
 2 files changed, 77 insertions(+), 25 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index 82414dc..e34778f 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -990,13 +990,82 @@ enum ixgbe_media_type ixgbe_get_media_type_X550em(struct ixgbe_hw *hw)
 }
 
 /**
+ *  ixgbe_supported_sfp_modules_X550em - Check if SFP module type is supported
+ *  @hw: pointer to hardware structure
+ *  @linear: true if SFP module is linear
+ */
+STATIC s32 ixgbe_supported_sfp_modules_X550em(struct ixgbe_hw *hw, bool *linear)
+{
+	DEBUGFUNC("ixgbe_supported_sfp_modules_X550em");
+
+	switch (hw->phy.sfp_type) {
+	case ixgbe_sfp_type_not_present:
+		return IXGBE_SUCCESS;
+	case ixgbe_sfp_type_da_cu_core0:
+	case ixgbe_sfp_type_da_cu_core1:
+		*linear = true;
+		break;
+	case ixgbe_sfp_type_srlr_core0:
+	case ixgbe_sfp_type_srlr_core1:
+	case ixgbe_sfp_type_da_act_lmt_core0:
+	case ixgbe_sfp_type_da_act_lmt_core1:
+	case ixgbe_sfp_type_1g_sx_core0:
+	case ixgbe_sfp_type_1g_sx_core1:
+	case ixgbe_sfp_type_1g_lx_core0:
+	case ixgbe_sfp_type_1g_lx_core1:
+		*linear = false;
+		break;
+	case ixgbe_sfp_type_unknown:
+	case ixgbe_sfp_type_1g_cu_core0:
+	case ixgbe_sfp_type_1g_cu_core1:
+	default:
+		return IXGBE_ERR_SFP_NOT_SUPPORTED;
+	}
+
+	return IXGBE_SUCCESS;
+}
+
+/**
+ *  ixgbe_identify_sfp_module_X550em - Identifies SFP modules
+ *  @hw: pointer to hardware structure
+ *
+ *  Searches for and identifies the SFP module and assigns appropriate PHY type.
+ **/
+s32 ixgbe_identify_sfp_module_X550em(struct ixgbe_hw *hw)
+{
+	s32 status;
+	bool linear;
+
+	DEBUGFUNC("ixgbe_identify_sfp_module_X550em");
+
+	status = ixgbe_identify_module_generic(hw);
+
+	if (status != IXGBE_SUCCESS)
+		return status;
+
+	/* Check if SFP module is supported */
+	status = ixgbe_supported_sfp_modules_X550em(hw, &linear);
+
+	return status;
+}
+
+/**
  *  ixgbe_setup_sfp_modules_X550em - Setup MAC link ops
  *  @hw: pointer to hardware structure
  */
 s32 ixgbe_setup_sfp_modules_X550em(struct ixgbe_hw *hw)
 {
+	s32 status;
+	bool linear;
+
 	DEBUGFUNC("ixgbe_setup_sfp_modules_X550em");
 
+	/* Check if SFP module is supported */
+	status = ixgbe_supported_sfp_modules_X550em(hw, &linear);
+
+	if (status != IXGBE_SUCCESS)
+		return status;
+
 	ixgbe_init_mac_link_ops_X550em(hw);
 	hw->phy.ops.reset = NULL;
 
@@ -1254,6 +1323,8 @@ s32 ixgbe_init_phy_ops_X550em(struct ixgbe_hw *hw)
 	if (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_fiber) {
 		phy->phy_semaphore_mask = IXGBE_GSSR_SHARED_I2C_SM;
 		ixgbe_setup_mux_ctl(hw);
+
+		phy->ops.identify_sfp = ixgbe_identify_sfp_module_X550em;
 	}
 
 	/* Identify the PHY or SFP module */
@@ -1651,31 +1722,11 @@ s32 ixgbe_setup_mac_link_sfp_x550em(struct ixgbe_hw *hw,
 	bool setup_linear;
 	UNREFERENCED_1PARAMETER(autoneg_wait_to_complete);
 
-	/* Configure the external PHY. */
-	switch (hw->phy.sfp_type) {
-	case ixgbe_sfp_type_unknown:
-		return IXGBE_ERR_SFP_NOT_SUPPORTED;
-	case ixgbe_sfp_type_not_present:
-		return IXGBE_SUCCESS;
-	case ixgbe_sfp_type_da_cu_core0:
-	case ixgbe_sfp_type_da_cu_core1:
-		setup_linear = true;
-		break;
-	case ixgbe_sfp_type_srlr_core0:
-	case ixgbe_sfp_type_srlr_core1:
-	case ixgbe_sfp_type_da_act_lmt_core0:
-	case ixgbe_sfp_type_da_act_lmt_core1:
-	case ixgbe_sfp_type_1g_sx_core0:
-	case ixgbe_sfp_type_1g_sx_core1:
-#ifdef SUPPORT_1000BASE_LX
-	case ixgbe_sfp_type_1g_lx_core0:
-	case ixgbe_sfp_type_1g_lx_core1:
-#endif /* SUPPORT_1000BASE_LX */
-		setup_linear = false;
-		break;
-	default:
-		return IXGBE_ERR_SFP_NOT_SUPPORTED;
-	}
+	/* Check if SFP module is supported and linear */
+	ret_val = ixgbe_supported_sfp_modules_X550em(hw, &setup_linear);
+
+	if (ret_val != IXGBE_SUCCESS)
+		return ret_val;
 
 	/* Configure CS4227 for connection rate. */
 	reg_slice = IXGBE_CS4227_LINE_SPARE22_MSB + (hw->bus.lan_id << 12);
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.h b/drivers/net/ixgbe/base/ixgbe_x550.h
index 4cfd49c..230b44f 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.h
+++ b/drivers/net/ixgbe/base/ixgbe_x550.h
@@ -102,4 +102,5 @@ s32 ixgbe_setup_mac_link_t_X550em(struct ixgbe_hw *hw,
 s32 ixgbe_check_link_t_X550em(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
 			      bool *link_up, bool link_up_wait_to_complete);
 s32 ixgbe_reset_phy_t_X550em(struct ixgbe_hw *hw);
+s32 ixgbe_identify_sfp_module_X550em(struct ixgbe_hw *hw);
 #endif /* _IXGBE_X550_H_ */
-- 
1.9.3

  parent reply	other threads:[~2015-06-24  3:26 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-24  3:25 [dpdk-dev] [PATCH 00/37] update ixgbe base driver Wenzhuo Lu
2015-06-24  3:25 ` [dpdk-dev] [PATCH 01/37] ixgbe/base: update readme Wenzhuo Lu
2015-06-24  3:25 ` [dpdk-dev] [PATCH 02/37] ixgbe/base: update Low Power Link Up to use MAC ops link Wenzhuo Lu
2015-06-24  3:25 ` [dpdk-dev] [PATCH 03/37] ixgbe/base: fix 1G and 10G link stability for x550em SFP+ Wenzhuo Lu
2015-06-24  3:25 ` [dpdk-dev] [PATCH 04/37] ixgbe/base: update x550em SFP link setup Wenzhuo Lu
2015-06-24  3:25 ` [dpdk-dev] [PATCH 05/37] ixgbe/base: add shift define for EEE_SU.TEEE_DLY Wenzhuo Lu
2015-06-24  3:25 ` Wenzhuo Lu [this message]
2015-06-24  3:25 ` [dpdk-dev] [PATCH 07/37] ixgbe/base: fix potential warning Wenzhuo Lu
2015-06-24  3:25 ` [dpdk-dev] [PATCH 08/37] ixgbe/base: return err when SFP module is not present Wenzhuo Lu
2015-06-24  3:25 ` [dpdk-dev] [PATCH 09/37] ixgbe/base: power down the x550em PHY on overtemp events Wenzhuo Lu
2015-06-24  3:25 ` [dpdk-dev] [PATCH 10/37] ixgbe/base: restore advertised autoneg after setting LPLU Wenzhuo Lu
2015-06-24  3:26 ` [dpdk-dev] [PATCH 11/37] ixgbe/base: fix UniPHY link configuration Wenzhuo Lu
2015-06-24  3:26 ` [dpdk-dev] [PATCH 12/37] ixgbe/base: add macro for x550em bus speed fuse Wenzhuo Lu
2015-06-24  3:26 ` [dpdk-dev] [PATCH 13/37] ixgbe/base: add a new 82599 device ID Wenzhuo Lu
2015-06-24  3:26 ` [dpdk-dev] [PATCH 14/37] ixgbe/base: enable FEC when EEE is disabled Wenzhuo Lu
2015-06-24  3:26 ` [dpdk-dev] [PATCH 15/37] ixgbe/base: release semaphores in proper order Wenzhuo Lu
2015-06-24  3:26 ` [dpdk-dev] [PATCH 16/37] ixgbe/base: add wait helper for IOSF accesses Wenzhuo Lu
2015-06-24  3:26 ` [dpdk-dev] [PATCH 17/37] ixgbe/base: use a semaphore to serialize " Wenzhuo Lu
2015-06-24  3:26 ` [dpdk-dev] [PATCH 18/37] ixgbe/base: check for functional ucode Wenzhuo Lu
2015-06-24  3:26 ` [dpdk-dev] [PATCH 19/37] ixgbe/base: add KR/iXFI internal link mode support Wenzhuo Lu
2015-06-24  3:26 ` [dpdk-dev] [PATCH 20/37] ixgbe/base: check link again after getting speed Wenzhuo Lu
2015-06-24  3:26 ` [dpdk-dev] [PATCH 21/37] ixgbe/base: config MDIO clock for x550em Wenzhuo Lu
2015-06-24  3:26 ` [dpdk-dev] [PATCH 22/37] ixgbe/base: add support for led_on and led_off for X557 PHY LEDs Wenzhuo Lu
2015-06-24  3:26 ` [dpdk-dev] [PATCH 23/37] ixgbe/base: update EEE/FEC support for device X550EM_X_KR Wenzhuo Lu
2015-06-24  3:26 ` [dpdk-dev] [PATCH 24/37] ixgbe/base: introduce array of mac-type-dependent values Wenzhuo Lu
2015-06-24  3:26 ` [dpdk-dev] [PATCH 25/37] ixgbe/base: use mvals array for I2C_*_BY_MAC values Wenzhuo Lu
2015-06-24  3:26 ` [dpdk-dev] [PATCH 26/37] ixgbe/base: use mvals array for *_GPI*_BY_MAC values Wenzhuo Lu
2015-06-24  3:26 ` [dpdk-dev] [PATCH 27/37] ixgbe/base: use mvals array for CIA*_BY_MAC values Wenzhuo Lu
2015-06-24  3:26 ` [dpdk-dev] [PATCH 28/37] ixgbe/base: add new mac-dependent values for x540, x550 Wenzhuo Lu
2015-06-24  3:26 ` [dpdk-dev] [PATCH 29/37] ixgbe/base: disable SW LPLU implementation for x557 V2 Wenzhuo Lu
2015-06-24  3:26 ` [dpdk-dev] [PATCH 30/37] ixgbe/base: remove FEC disablement for x550em Wenzhuo Lu
2015-06-24  3:26 ` [dpdk-dev] [PATCH 31/37] ixgbe/base: modify register definition code style Wenzhuo Lu
2015-06-24  3:26 ` [dpdk-dev] [PATCH 32/37] ixgbe/base: specific process for X550 and X550em when disabling PCIe master Wenzhuo Lu
2015-06-24  3:26 ` [dpdk-dev] [PATCH 33/37] ixgbe/base: fix flow control to be KR only Wenzhuo Lu
2015-06-24  3:26 ` [dpdk-dev] [PATCH 34/37] ixgbe/base: fix 5G and 2.5G speed description Wenzhuo Lu
2015-06-24  3:26 ` [dpdk-dev] [PATCH 35/37] ixgbe/base: force cs4227 LINE side to 10G SR mode Wenzhuo Lu
2015-06-24  3:26 ` [dpdk-dev] [PATCH 36/37] ixgbe/base: a minor optimization for max link up time Wenzhuo Lu
2015-06-24  3:26 ` [dpdk-dev] [PATCH 37/37] ixgbe/base: add support for new x550 PHY IDs Wenzhuo Lu
2015-06-25  1:24 ` [dpdk-dev] [PATCH 00/37] update ixgbe base driver Zhang, Helin
2015-06-26 11:27   ` Thomas Monjalon

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=1435116386-12010-7-git-send-email-wenzhuo.lu@intel.com \
    --to=wenzhuo.lu@intel.com \
    --cc=dev@dpdk.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).