Skip to contentSkip to conversation

net/ixgbe: fix x550 code to handle unidentified PHY

PATCH Superseded Luca Boccassi 3 participants 24 messages Aug 15, 2018 – Nov 22, 2018 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 net/ixgbe: fix x550 code to handle unidentified PHY

ixgbe_identify_phy_x550em() was missing the code to handle unidentified PHY that has been there in 82599 so it was not able to complete initialization of ixgbe sequence if no sfp plugged in.
Port it over to return an appropriate type and complete init sequence properly.

Fixes d2e72774e58c ("ixgbe/base: support X550")
---
 drivers/net/ixgbe/base/ixgbe_x550.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
drivers/net/ixgbe/base/ixgbe_x550.c +16 -3
index f66f540761..ef51b6a9a6 100644
@@ -343,13 +343,21 @@ STATIC void ixgbe_setup_mux_ctl(struct ixgbe_hw *hw)
  */
 STATIC s32 ixgbe_identify_phy_x550em(struct ixgbe_hw *hw)
 {
+	s32 status;
+
 	hw->mac.ops.set_lan_id(hw);
 
 	ixgbe_read_mng_if_sel_x550em(hw);
 
 	switch (hw->device_id) {
 	case IXGBE_DEV_ID_X550EM_A_SFP:
-		return ixgbe_identify_module_generic(hw);
+		status = ixgbe_identify_module_generic(hw);
+		/* Set PHY type none if no PHY detected */
+		if (hw->phy.type == ixgbe_phy_unknown) {
+			hw->phy.type = ixgbe_phy_none;
+			return IXGBE_SUCCESS;
+		}
+		return status;
 	case IXGBE_DEV_ID_X550EM_X_SFP:
 		/* set up for CS4227 usage */
 		ixgbe_setup_mux_ctl(hw);
@@ -357,8 +365,13 @@ STATIC s32 ixgbe_identify_phy_x550em(struct ixgbe_hw *hw)
 		/* Fallthrough */
 
 	case IXGBE_DEV_ID_X550EM_A_SFP_N:
-		return ixgbe_identify_module_generic(hw);
-		break;
+		status = ixgbe_identify_module_generic(hw);
+		/* Set PHY type none if no PHY detected */
+		if (hw->phy.type == ixgbe_phy_unknown) {
+			hw->phy.type = ixgbe_phy_none;
+			return IXGBE_SUCCESS;
+		}
+		return status;
 	case IXGBE_DEV_ID_X550EM_X_KX4:
 		hw->phy.type = ixgbe_phy_x550em_kx4;
 		break;
Signature · 1 line
2.18.0
#1 lore raw

PATCH 1/2 net/ixgbe: fix x550 code to handle unidentified PHY

ixgbe_identify_phy_x550em() was missing the code to handle unidentified PHY that has been there in 82599 so it was not able to complete initialization of ixgbe sequence if no sfp plugged in.
Port it over to return an appropriate type and complete init sequence properly.

Fixes d2e72774e58c ("ixgbe/base: support X550")

---
v2: refresh to remove merge conflict with master

 drivers/net/ixgbe/base/ixgbe_x550.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
drivers/net/ixgbe/base/ixgbe_x550.c +16 -3
index f7b98af52..83b394861 100644
@@ -315,13 +315,21 @@ STATIC void ixgbe_setup_mux_ctl(struct ixgbe_hw *hw)
  */
 STATIC s32 ixgbe_identify_phy_x550em(struct ixgbe_hw *hw)
 {
+	s32 status;
+
 	hw->mac.ops.set_lan_id(hw);
 
 	ixgbe_read_mng_if_sel_x550em(hw);
 
 	switch (hw->device_id) {
 	case IXGBE_DEV_ID_X550EM_A_SFP:
-		return ixgbe_identify_sfp_module_X550em(hw);
+		status = ixgbe_identify_sfp_module_X550em(hw);
+		/* Set PHY type none if no PHY detected */
+		if (hw->phy.type == ixgbe_phy_unknown) {
+			hw->phy.type = ixgbe_phy_none;
+			return IXGBE_SUCCESS;
+		}
+		return status;
 	case IXGBE_DEV_ID_X550EM_X_SFP:
 		/* set up for CS4227 usage */
 		ixgbe_setup_mux_ctl(hw);
@@ -329,8 +337,13 @@ STATIC s32 ixgbe_identify_phy_x550em(struct ixgbe_hw *hw)
 		/* Fallthrough */
 
 	case IXGBE_DEV_ID_X550EM_A_SFP_N:
-		return ixgbe_identify_sfp_module_X550em(hw);
-		break;
+		status = ixgbe_identify_sfp_module_X550em(hw);
+		/* Set PHY type none if no PHY detected */
+		if (hw->phy.type == ixgbe_phy_unknown) {
+			hw->phy.type = ixgbe_phy_none;
+			return IXGBE_SUCCESS;
+		}
+		return status;
 	case IXGBE_DEV_ID_X550EM_X_KX4:
 		hw->phy.type = ixgbe_phy_x550em_kx4;
 		break;
Signature · 1 line
2.19.1
#2 lore raw

PATCH 2/2 net/ixgbe: add LHA ID to x550 code

ixgbe is able to recognize 1G SX and LX id, but it is missing the LHA. Add it, so that it can handle LHA sfp plugin.

Fixes d2e72774e58c ("ixgbe/base: support X550")
---
 drivers/net/ixgbe/base/ixgbe_82599.c |  2 ++
 drivers/net/ixgbe/base/ixgbe_phy.c   | 13 +++++++++++++
 drivers/net/ixgbe/base/ixgbe_phy.h   |  1 +
 drivers/net/ixgbe/base/ixgbe_type.h  |  2 ++
 drivers/net/ixgbe/base/ixgbe_x550.c  |  4 ++++
 5 files changed, 22 insertions(+)
drivers/net/ixgbe/base/ixgbe_82599.c +2 -0
index 7de753fd3..96bdde62c 100644
@@ -392,6 +392,8 @@ s32 ixgbe_get_link_capabilities_82599(struct ixgbe_hw *hw,
 	/* Check if 1G SFP module. */
 	if (hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 ||
 	    hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 ||
+	    hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core0 ||
+	    hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core1 ||
 	    hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
 	    hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 ||
 	    hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
drivers/net/ixgbe/base/ixgbe_phy.c +13 -0
index 6cdd8fbab..dd118f917 100644
@@ -1402,6 +1402,13 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
 				else
 					hw->phy.sfp_type =
 						ixgbe_sfp_type_1g_lx_core1;
+			} else if (comp_codes_1g & IXGBE_SFF_1GBASELHA_CAPABLE) {
+				if (hw->bus.lan_id == 0)
+					hw->phy.sfp_type =
+						ixgbe_sfp_type_1g_lha_core0;
+				else
+					hw->phy.sfp_type =
+						ixgbe_sfp_type_1g_lha_core1;
 			} else {
 				hw->phy.sfp_type = ixgbe_sfp_type_unknown;
 			}
@@ -1489,6 +1496,8 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
 		if (comp_codes_10g == 0 &&
 		    !(hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 ||
+		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core0 ||
+		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core1 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
@@ -1508,6 +1517,8 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
 		if (!(enforce_sfp & IXGBE_DEVICE_CAPS_ALLOW_ANY_SFP) &&
 		    !(hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 ||
+		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core0 ||
+		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core1 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
@@ -1835,11 +1846,13 @@ s32 ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw,
 	 */
 	if (sfp_type == ixgbe_sfp_type_da_act_lmt_core0 ||
 	    sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
+	    sfp_type == ixgbe_sfp_type_1g_lha_core0 ||
 	    sfp_type == ixgbe_sfp_type_1g_cu_core0 ||
 	    sfp_type == ixgbe_sfp_type_1g_sx_core0)
 		sfp_type = ixgbe_sfp_type_srlr_core0;
 	else if (sfp_type == ixgbe_sfp_type_da_act_lmt_core1 ||
 		 sfp_type == ixgbe_sfp_type_1g_lx_core1 ||
+		 sfp_type == ixgbe_sfp_type_1g_lha_core1 ||
 		 sfp_type == ixgbe_sfp_type_1g_cu_core1 ||
 		 sfp_type == ixgbe_sfp_type_1g_sx_core1)
 		sfp_type = ixgbe_sfp_type_srlr_core1;
drivers/net/ixgbe/base/ixgbe_phy.h +1 -0
index 132fa542b..f1605f2cc 100644
@@ -41,6 +41,7 @@
 #define IXGBE_SFF_1GBASESX_CAPABLE	0x1
 #define IXGBE_SFF_1GBASELX_CAPABLE	0x2
 #define IXGBE_SFF_1GBASET_CAPABLE	0x8
+#define IXGBE_SFF_1GBASELHA_CAPABLE	0x10
 #define IXGBE_SFF_10GBASESR_CAPABLE	0x10
 #define IXGBE_SFF_10GBASELR_CAPABLE	0x20
 #define IXGBE_SFF_SOFT_RS_SELECT_MASK	0x8
drivers/net/ixgbe/base/ixgbe_type.h +2 -0
index cee6ba2e0..077b8f01c 100644
@@ -3724,6 +3724,8 @@ enum ixgbe_sfp_type {
 	ixgbe_sfp_type_1g_sx_core1 = 12,
 	ixgbe_sfp_type_1g_lx_core0 = 13,
 	ixgbe_sfp_type_1g_lx_core1 = 14,
+	ixgbe_sfp_type_1g_lha_core0 = 15,
+	ixgbe_sfp_type_1g_lha_core1 = 16,
 	ixgbe_sfp_type_not_present = 0xFFFE,
 	ixgbe_sfp_type_unknown = 0xFFFF
 };
drivers/net/ixgbe/base/ixgbe_x550.c +4 -0
index 83b394861..d2b1000e9 100644
@@ -1547,6 +1547,8 @@ STATIC s32 ixgbe_supported_sfp_modules_X550em(struct ixgbe_hw *hw, bool *linear)
 	case ixgbe_sfp_type_1g_sx_core1:
 	case ixgbe_sfp_type_1g_lx_core0:
 	case ixgbe_sfp_type_1g_lx_core1:
+	case ixgbe_sfp_type_1g_lha_core0:
+	case ixgbe_sfp_type_1g_lha_core1:
 		*linear = false;
 		break;
 	case ixgbe_sfp_type_unknown:
@@ -1887,6 +1889,8 @@ s32 ixgbe_get_link_capabilities_X550em(struct ixgbe_hw *hw,
 		/* Check if 1G SFP module. */
 		if (hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
 		    hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1
+		    || hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core0 ||
+		    hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core1
 		    || hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
 		    hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1) {
 			*speed = IXGBE_LINK_SPEED_1GB_FULL;
Signature · 1 line
2.19.1
#3 lore raw
In reply to Luca Boccassi

drivers/net/ixgbe/base/ixgbe_x550.c

Quoted 20 lines · Luca Boccassi

ixgbe_identify_phy_x550em() was missing the code to handle unidentified
PHY that has been there in 82599 so it was not able to complete initialization of ixgbe sequence if no sfp plugged in. Port it over to return an appropriate type and complete init sequence properly.

Fixes d2e72774e58c ("ixgbe/base: support X550")

---
v2: refresh to remove merge conflict with master

 drivers/net/ixgbe/base/ixgbe_x550.c | 19 ++++++++++++++++---

 1 file changed, 16 insertions(+), 3 deletions(-)
drivers/net/ixgbe/base/ixgbe_x550.c +0 -0
index f7b98af52..83b394861 100644

Sorry, finger slipped and missed the -v2 from the command so it's not in the subject - it's the same, just rebased to fix a conflict in the first patch.

Signature · 2 lines
Kind regards,
Luca Boccassi
#4 lore raw
In reply to Luca Boccassi
Quoted 41 lines

-----Original Message-----
From: Luca Boccassi [mailto:[email protected]]
Sent: Thursday, November 1, 2018 9:04 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>; Zhang, Qi Z <[email protected]>; Luca Boccassi <[email protected]>; [email protected]
Subject: [PATCH 1/2] net/ixgbe: fix x550 code to handle unidentified PHY

ixgbe_identify_phy_x550em() was missing the code to handle unidentified PHY that has been there in 82599 so it was not able to complete initialization of ixgbe sequence if no sfp plugged in.
Port it over to return an appropriate type and complete init sequence properly.

Fixes d2e72774e58c ("ixgbe/base: support X550")

---
v2: refresh to remove merge conflict with master

 drivers/net/ixgbe/base/ixgbe_x550.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
drivers/net/ixgbe/base/ixgbe_x550.c +2 -0
index f7b98af52..83b394861 100644
@@ -315,13 +315,21 @@ STATIC void ixgbe_setup_mux_ctl(struct ixgbe_hw
 *hw)
  */
 STATIC s32 ixgbe_identify_phy_x550em(struct ixgbe_hw *hw)  {
+	s32 status;
+
 	hw->mac.ops.set_lan_id(hw);
 
 	ixgbe_read_mng_if_sel_x550em(hw);

drivers/net/ixgbe/base/ixgbe_x550.c STATIC void ixgbe_setup_mux_ctl(struct ixgbe_hw · line 331

Quoted 10 lines
drivers/net/ixgbe/base/ixgbe_x550.c +6 -1
 
 	switch (hw->device_id) {
 	case IXGBE_DEV_ID_X550EM_A_SFP:
-		return ixgbe_identify_sfp_module_X550em(hw);
+		status = ixgbe_identify_sfp_module_X550em(hw);
+		/* Set PHY type none if no PHY detected */
+		if (hw->phy.type == ixgbe_phy_unknown) {
+			hw->phy.type = ixgbe_phy_none;
+			return IXGBE_SUCCESS;
+		}

Why this can't be handled at caller, why we replace phy_unknown by phy_none only for x550?

Quoted 23 lines
drivers/net/ixgbe/base/ixgbe_x550.c +8 -2
+		return status;
 	case IXGBE_DEV_ID_X550EM_X_SFP:
 		/* set up for CS4227 usage */
 		ixgbe_setup_mux_ctl(hw);
@@ -329,8 +337,13 @@ STATIC s32 ixgbe_identify_phy_x550em(struct
 ixgbe_hw *hw)
 		/* Fallthrough */
 
 	case IXGBE_DEV_ID_X550EM_A_SFP_N:
-		return ixgbe_identify_sfp_module_X550em(hw);
-		break;
+		status = ixgbe_identify_sfp_module_X550em(hw);
+		/* Set PHY type none if no PHY detected */
+		if (hw->phy.type == ixgbe_phy_unknown) {
+			hw->phy.type = ixgbe_phy_none;
+			return IXGBE_SUCCESS;
+		}
+		return status;
 	case IXGBE_DEV_ID_X550EM_X_KX4:
 		hw->phy.type = ixgbe_phy_x550em_kx4;

break;
--
2.19.1

#5 lore raw
Quoted 46 lines · Qi Z
Quoted 46 lines

-----Original Message-----
From: Luca Boccassi [mailto:[email protected]]
Sent: Thursday, November 1, 2018 9:04 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>; Zhang, Qi Z <[email protected]>; Luca
Boccassi <[email protected]>; [email protected]
Subject: [PATCH 1/2] net/ixgbe: fix x550 code to handle unidentified PHY

ixgbe_identify_phy_x550em() was missing the code to handle unidentified
PHY that has been there in 82599 so it was not able to complete initialization
of ixgbe sequence if no sfp plugged in.
Port it over to return an appropriate type and complete init sequence
properly.

Fixes d2e72774e58c ("ixgbe/base: support X550")

---
v2: refresh to remove merge conflict with master

 drivers/net/ixgbe/base/ixgbe_x550.c | 19 ++++++++++++++++---

 1 file changed, 16 insertions(+), 3 deletions(-)
drivers/net/ixgbe/base/ixgbe_x550.c +0 -0
index f7b98af52..83b394861 100644
@@ -315,13 +315,21 @@ STATIC void ixgbe_setup_mux_ctl(struct

ixgbe_hw
*hw)
  */
 STATIC s32 ixgbe_identify_phy_x550em(struct ixgbe_hw *hw)  {

drivers/net/ixgbe/base/ixgbe_x550.c +2 -0
+	s32 status;
+

  hw->mac.ops.set_lan_id(hw);

  ixgbe_read_mng_if_sel_x550em(hw);

Quoted 12 lines

drivers/net/ixgbe/base/ixgbe_x550.c STATIC void ixgbe_setup_mux_ctl(struct ixgbe_hw *hw) · line 331

Quoted 9 lines

  switch (hw->device_id) {
  case IXGBE_DEV_ID_X550EM_A_SFP:

drivers/net/ixgbe/base/ixgbe_x550.c +6 -1
-		return ixgbe_identify_sfp_module_X550em(hw);
+		status = ixgbe_identify_sfp_module_X550em(hw);
+		/* Set PHY type none if no PHY detected */
+		if (hw->phy.type == ixgbe_phy_unknown) {
+			hw->phy.type = ixgbe_phy_none;
+			return IXGBE_SUCCESS;
+		}

Why this can't be handled at caller, why we replace phy_unknown by phy_none only for x550?

Hi, thanks for the review.

I've moved the code into the caller in v3.

It's done for x550 simply because that's the hardware that we have and that this was tested with, I didn't want to take extra risks. It's also the hardware that our customer reported the issue with.

Signature · 2 lines
Kind regards,
Luca Boccassi
#6 lore raw
Quoted 66 lines

-----Original Message-----
From: Luca Boccassi [mailto:[email protected]]
Sent: Friday, November 2, 2018 10:21 AM
To: Zhang, Qi Z <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>; [email protected]
Subject: Re: [PATCH 1/2] net/ixgbe: fix x550 code to handle unidentified PHY

Quoted 42 lines · Qi Z
Quoted 42 lines

-----Original Message-----
From: Luca Boccassi [mailto:[email protected]]
Sent: Thursday, November 1, 2018 9:04 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>; Zhang, Qi Z <[email protected]>; Luca Boccassi <[email protected]>; [email protected]
Subject: [PATCH 1/2] net/ixgbe: fix x550 code to handle unidentified PHY

ixgbe_identify_phy_x550em() was missing the code to handle unidentified PHY that has been there in 82599 so it was not able to complete initialization of ixgbe sequence if no sfp plugged in. Port it over to return an appropriate type and complete init sequence properly.

Fixes d2e72774e58c ("ixgbe/base: support X550")

---
v2: refresh to remove merge conflict with master

 drivers/net/ixgbe/base/ixgbe_x550.c | 19 ++++++++++++++++---

 1 file changed, 16 insertions(+), 3 deletions(-)
drivers/net/ixgbe/base/ixgbe_x550.c +0 -0
index f7b98af52..83b394861 100644
@@ -315,13 +315,21 @@ STATIC void ixgbe_setup_mux_ctl(struct

ixgbe_hw
*hw)
  */
 STATIC s32 ixgbe_identify_phy_x550em(struct ixgbe_hw *hw)  {

drivers/net/ixgbe/base/ixgbe_x550.c +2 -0
+	s32 status;
+

  hw->mac.ops.set_lan_id(hw);

  ixgbe_read_mng_if_sel_x550em(hw);

Quoted 12 lines

drivers/net/ixgbe/base/ixgbe_x550.c STATIC void ixgbe_setup_mux_ctl(struct ixgbe_hw *hw) · line 331

Quoted 9 lines

  switch (hw->device_id) {
  case IXGBE_DEV_ID_X550EM_A_SFP:

drivers/net/ixgbe/base/ixgbe_x550.c +6 -1
-		return ixgbe_identify_sfp_module_X550em(hw);
+		status = ixgbe_identify_sfp_module_X550em(hw);
+		/* Set PHY type none if no PHY detected */
+		if (hw->phy.type == ixgbe_phy_unknown) {
+			hw->phy.type = ixgbe_phy_none;
+			return IXGBE_SUCCESS;
+		}

Why this can't be handled at caller, why we replace phy_unknown by phy_none only for x550?

Quoted 3 lines

Hi, thanks for the review.

I've moved the code into the caller in v3.

Sorry, this is not what I suggested.
I'm not sure for X550EM_A_SFP, it is the case that the device does not have PHY so we should correct it (by replace it with no_phy) or it is the case that we can't identify PHY so we just replace it by no_phy to bypass the check for workaround?
If the second case, is it possible not to do replacement and handle it at upper layer (caller or caller's caller ... ) and keep the information more accurate?

Quoted 10 lines

It's done for x550 simply because that's the hardware that we have and that this was tested with, I didn't want to take extra risks. It's also the hardware that our customer reported the issue with.

--
Kind regards,
Luca Boccassi

#7 lore raw
Quoted 73 lines · Qi Z
Quoted 69 lines

-----Original Message-----
From: Luca Boccassi [mailto:[email protected]]
Sent: Friday, November 2, 2018 10:21 AM
To: Zhang, Qi Z <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>; [email protected]
Subject: Re: [PATCH 1/2] net/ixgbe: fix x550 code to handle unidentified PHY

Quoted 45 lines · Qi Z
Quoted 45 lines

-----Original Message-----
From: Luca Boccassi [mailto:[email protected]]
Sent: Thursday, November 1, 2018 9:04 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>; Zhang, Qi Z <[email protected] om>;
Luca Boccassi <[email protected]>; [email protected]
Subject: [PATCH 1/2] net/ixgbe: fix x550 code to handle unidentified
PHY

ixgbe_identify_phy_x550em() was missing the code to handle unidentified PHY that has been there in 82599 so it was not able to
complete initialization of ixgbe sequence if no sfp plugged in. Port it over to return an appropriate type and complete init sequence properly.

Fixes d2e72774e58c ("ixgbe/base: support X550")

---
v2: refresh to remove merge conflict with master

 drivers/net/ixgbe/base/ixgbe_x550.c | 19 ++++++++++++++++---

 1 file changed, 16 insertions(+), 3 deletions(-)
drivers/net/ixgbe/base/ixgbe_x550.c +0 -0
index f7b98af52..83b394861 100644
@@ -315,13 +315,21 @@ STATIC void ixgbe_setup_mux_ctl(struct

ixgbe_hw
*hw)
  */
 STATIC s32 ixgbe_identify_phy_x550em(struct ixgbe_hw *hw)  {

drivers/net/ixgbe/base/ixgbe_x550.c +2 -0
+	s32 status;
+

  hw->mac.ops.set_lan_id(hw);

  ixgbe_read_mng_if_sel_x550em(hw);

Quoted 13 lines

drivers/net/ixgbe/base/ixgbe_x550.c STATIC void ixgbe_setup_mux_ctl(struct ixgbe_hw *hw) · line 331

Quoted 9 lines

  switch (hw->device_id) {
  case IXGBE_DEV_ID_X550EM_A_SFP:

drivers/net/ixgbe/base/ixgbe_x550.c +6 -1
-		return ixgbe_identify_sfp_module_X550em(hw);
+		status = ixgbe_identify_sfp_module_X550em(hw);
+		/* Set PHY type none if no PHY detected */
+		if (hw->phy.type == ixgbe_phy_unknown) {
+			hw->phy.type = ixgbe_phy_none;
+			return IXGBE_SUCCESS;
+		}

Why this can't be handled at caller, why we replace phy_unknown by
phy_none only for x550?

Quoted 3 lines

Hi, thanks for the review.

I've moved the code into the caller in v3.

Quoted 8 lines

Sorry, this is not what I suggested.
I'm not sure for X550EM_A_SFP, it is the case that the device does not have PHY so we should correct it (by replace it with no_phy) or it is the case that we can't identify PHY so we just replace it by no_phy to bypass the check for workaround?
If the second case, is it possible not to do replacement and handle it at upper layer (caller or caller's caller ... ) and keep the information more accurate?

It is the second case - I've amended the comment in v3, the issue is that the driver will fail to initialise if there is no SFP present at boot (not very hotplug-friendly!).
The issue with calling it one layer above is that this function is saved in a table, and there are at least 3-4 places where it is called from. So it would have to be repeated many times, and also I'm not 100% sure of all the places where to do this, as the function table is updated several times across the base driver.

So, when you say caller or caller's caller, do you have identified precisely where? I'm happy to change it if you can point me exactly to the right places.

Thanks!

Quoted 12 lines
Quoted 12 lines

It's done for x550 simply because that's the hardware that we have and that
this was tested with, I didn't want to take extra risks. It's also the hardware
that our customer reported the issue with.

--
Kind regards,
Luca Boccassi

Signature · 2 lines
Kind regards,
Luca Boccassi
#8 lore raw
In reply to Luca Boccassi
Quoted 7 lines · Luca Boccassi

ixgbe_identify_phy_x550em() was missing the code to handle unidentified
PHY that has been there in 82599 so it was not able to complete initialization of ixgbe sequence if no sfp plugged in. Port it over to return an appropriate type and complete init sequence properly.

Quoted 7 lines
Fixes d2e72774e58c ("ixgbe/base: support X550")

---
 drivers/net/ixgbe/base/ixgbe_x550.c | 19 ++++++++++++++++---

 1 file changed, 16 insertions(+), 3 deletions(-)

Ping. Any chance this series could get a review? Thanks!

Signature · 2 lines
Kind regards,
Luca Boccassi
#9 lore raw

PATCH 2/2 net/ixgbe: add LHA ID to x550 code

In reply to Luca Boccassi

ixgbe is able to recognize 1G SX and LX id, but it is missing the LHA. Add it, so that it can handle LHA sfp plugin.

Fixes d2e72774e58c ("ixgbe/base: support X550")
---
 drivers/net/ixgbe/base/ixgbe_82599.c |  2 ++
 drivers/net/ixgbe/base/ixgbe_phy.c   | 13 +++++++++++++
 drivers/net/ixgbe/base/ixgbe_phy.h   |  1 +
 drivers/net/ixgbe/base/ixgbe_type.h  |  2 ++
 drivers/net/ixgbe/base/ixgbe_x550.c  |  4 ++++
 5 files changed, 22 insertions(+)
drivers/net/ixgbe/base/ixgbe_82599.c +2 -0
index 26217212aa..0075404763 100644
@@ -424,6 +424,8 @@ s32 ixgbe_get_link_capabilities_82599(struct ixgbe_hw *hw,
 	/* Check if 1G SFP module. */
 	if (hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 ||
 	    hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 ||
+	    hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core0 ||
+	    hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core1 ||
 	    hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
 	    hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 ||
 	    hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
drivers/net/ixgbe/base/ixgbe_phy.c +13 -0
index 2df068ee30..e1e7a184c9 100644
@@ -1431,6 +1431,13 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
 				else
 					hw->phy.sfp_type =
 						ixgbe_sfp_type_1g_lx_core1;
+			} else if (comp_codes_1g & IXGBE_SFF_1GBASELHA_CAPABLE) {
+				if (hw->bus.lan_id == 0)
+					hw->phy.sfp_type =
+						ixgbe_sfp_type_1g_lha_core0;
+				else
+					hw->phy.sfp_type =
+						ixgbe_sfp_type_1g_lha_core1;
 			} else {
 				hw->phy.sfp_type = ixgbe_sfp_type_unknown;
 			}
@@ -1518,6 +1525,8 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
 		if (comp_codes_10g == 0 &&
 		    !(hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 ||
+		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core0 ||
+		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core1 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
@@ -1537,6 +1546,8 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
 		if (!(enforce_sfp & IXGBE_DEVICE_CAPS_ALLOW_ANY_SFP) &&
 		    !(hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 ||
+		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core0 ||
+		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core1 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
@@ -1864,11 +1875,13 @@ s32 ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw,
 	 */
 	if (sfp_type == ixgbe_sfp_type_da_act_lmt_core0 ||
 	    sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
+	    sfp_type == ixgbe_sfp_type_1g_lha_core0 ||
 	    sfp_type == ixgbe_sfp_type_1g_cu_core0 ||
 	    sfp_type == ixgbe_sfp_type_1g_sx_core0)
 		sfp_type = ixgbe_sfp_type_srlr_core0;
 	else if (sfp_type == ixgbe_sfp_type_da_act_lmt_core1 ||
 		 sfp_type == ixgbe_sfp_type_1g_lx_core1 ||
+		 sfp_type == ixgbe_sfp_type_1g_lha_core1 ||
 		 sfp_type == ixgbe_sfp_type_1g_cu_core1 ||
 		 sfp_type == ixgbe_sfp_type_1g_sx_core1)
 		sfp_type = ixgbe_sfp_type_srlr_core1;
drivers/net/ixgbe/base/ixgbe_phy.h +1 -0
index cf8cadd96a..5a5f995003 100644
@@ -70,6 +70,7 @@ POSSIBILITY OF SUCH DAMAGE.
 #define IXGBE_SFF_1GBASESX_CAPABLE	0x1
 #define IXGBE_SFF_1GBASELX_CAPABLE	0x2
 #define IXGBE_SFF_1GBASET_CAPABLE	0x8
+#define IXGBE_SFF_1GBASELHA_CAPABLE	0x10
 #define IXGBE_SFF_10GBASESR_CAPABLE	0x10
 #define IXGBE_SFF_10GBASELR_CAPABLE	0x20
 #define IXGBE_SFF_SOFT_RS_SELECT_MASK	0x8
drivers/net/ixgbe/base/ixgbe_type.h +2 -0
index 6e03089eb9..2a384b71c5 100644
@@ -3748,6 +3748,8 @@ enum ixgbe_sfp_type {
 	ixgbe_sfp_type_1g_sx_core1 = 12,
 	ixgbe_sfp_type_1g_lx_core0 = 13,
 	ixgbe_sfp_type_1g_lx_core1 = 14,
+	ixgbe_sfp_type_1g_lha_core0 = 15,
+	ixgbe_sfp_type_1g_lha_core1 = 16,
 	ixgbe_sfp_type_not_present = 0xFFFE,
 	ixgbe_sfp_type_unknown = 0xFFFF
 };
drivers/net/ixgbe/base/ixgbe_x550.c +4 -0
index ef51b6a9a6..f24c3c266c 100644
@@ -1575,6 +1575,8 @@ STATIC s32 ixgbe_supported_sfp_modules_X550em(struct ixgbe_hw *hw, bool *linear)
 	case ixgbe_sfp_type_1g_sx_core1:
 	case ixgbe_sfp_type_1g_lx_core0:
 	case ixgbe_sfp_type_1g_lx_core1:
+	case ixgbe_sfp_type_1g_lha_core0:
+	case ixgbe_sfp_type_1g_lha_core1:
 		*linear = false;
 		break;
 	case ixgbe_sfp_type_unknown:
@@ -1915,6 +1917,8 @@ s32 ixgbe_get_link_capabilities_X550em(struct ixgbe_hw *hw,
 		/* Check if 1G SFP module. */
 		if (hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
 		    hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1
+		    || hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core0 ||
+		    hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core1
 		    || hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
 		    hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1) {
 			*speed = IXGBE_LINK_SPEED_1GB_FULL;
Signature · 1 line
2.18.0
#10 lore raw

PATCH v3 1/2 net/ixgbe: fix x550 code to handle unidentified PHY

In reply to Luca Boccassi

ixgbe_identify_sfp_module_X550em() was missing the code to handle unidentified PHY that has been there in 82599 so it was not able to complete initialization of ixgbe sequence if no sfp plugged in. Port it over to return an appropriate type and complete init sequence properly.

Fixes d2e72774e58c ("ixgbe/base: support X550")

---
v2: refresh to remove merge conflict with master
v3: coalesce fix into ixgbe_identify_sfp_module_X550em to avoid
code duplication, improve comment

 drivers/net/ixgbe/base/ixgbe_x550.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/net/ixgbe/base/ixgbe_x550.c +6 -0
index f7b98af52..a88d5c86a 100644
@@ -1561,6 +1561,12 @@ s32 ixgbe_identify_sfp_module_X550em(struct ixgbe_hw *hw)
 
 	status = ixgbe_identify_module_generic(hw);
 
+	/* Set PHY type none if no PHY detected to allow init without SFP */
+	if (hw->phy.type == ixgbe_phy_unknown) {
+		hw->phy.type = ixgbe_phy_none;
+		return IXGBE_SUCCESS;
+	}
+
 	if (status != IXGBE_SUCCESS)
 		return status;
 
Signature · 1 line
2.19.1
#11 lore raw

PATCH v3 2/2 net/ixgbe: add LHA ID to x550 code

ixgbe is able to recognize 1G SX and LX id, but it is missing the LHA. Add it, so that it can handle LHA sfp plugin.

Fixes d2e72774e58c ("ixgbe/base: support X550")
---
 drivers/net/ixgbe/base/ixgbe_82599.c |  2 ++
 drivers/net/ixgbe/base/ixgbe_phy.c   | 13 +++++++++++++
 drivers/net/ixgbe/base/ixgbe_phy.h   |  1 +
 drivers/net/ixgbe/base/ixgbe_type.h  |  2 ++
 drivers/net/ixgbe/base/ixgbe_x550.c  |  4 ++++
 5 files changed, 22 insertions(+)
drivers/net/ixgbe/base/ixgbe_82599.c +2 -0
index 7de753fd3..96bdde62c 100644
@@ -392,6 +392,8 @@ s32 ixgbe_get_link_capabilities_82599(struct ixgbe_hw *hw,
 	/* Check if 1G SFP module. */
 	if (hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 ||
 	    hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 ||
+	    hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core0 ||
+	    hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core1 ||
 	    hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
 	    hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 ||
 	    hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
drivers/net/ixgbe/base/ixgbe_phy.c +13 -0
index 6cdd8fbab..dd118f917 100644
@@ -1402,6 +1402,13 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
 				else
 					hw->phy.sfp_type =
 						ixgbe_sfp_type_1g_lx_core1;
+			} else if (comp_codes_1g & IXGBE_SFF_1GBASELHA_CAPABLE) {
+				if (hw->bus.lan_id == 0)
+					hw->phy.sfp_type =
+						ixgbe_sfp_type_1g_lha_core0;
+				else
+					hw->phy.sfp_type =
+						ixgbe_sfp_type_1g_lha_core1;
 			} else {
 				hw->phy.sfp_type = ixgbe_sfp_type_unknown;
 			}
@@ -1489,6 +1496,8 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
 		if (comp_codes_10g == 0 &&
 		    !(hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 ||
+		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core0 ||
+		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core1 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
@@ -1508,6 +1517,8 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
 		if (!(enforce_sfp & IXGBE_DEVICE_CAPS_ALLOW_ANY_SFP) &&
 		    !(hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 ||
+		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core0 ||
+		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core1 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
@@ -1835,11 +1846,13 @@ s32 ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw,
 	 */
 	if (sfp_type == ixgbe_sfp_type_da_act_lmt_core0 ||
 	    sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
+	    sfp_type == ixgbe_sfp_type_1g_lha_core0 ||
 	    sfp_type == ixgbe_sfp_type_1g_cu_core0 ||
 	    sfp_type == ixgbe_sfp_type_1g_sx_core0)
 		sfp_type = ixgbe_sfp_type_srlr_core0;
 	else if (sfp_type == ixgbe_sfp_type_da_act_lmt_core1 ||
 		 sfp_type == ixgbe_sfp_type_1g_lx_core1 ||
+		 sfp_type == ixgbe_sfp_type_1g_lha_core1 ||
 		 sfp_type == ixgbe_sfp_type_1g_cu_core1 ||
 		 sfp_type == ixgbe_sfp_type_1g_sx_core1)
 		sfp_type = ixgbe_sfp_type_srlr_core1;
drivers/net/ixgbe/base/ixgbe_phy.h +1 -0
index 132fa542b..f1605f2cc 100644
@@ -41,6 +41,7 @@
 #define IXGBE_SFF_1GBASESX_CAPABLE	0x1
 #define IXGBE_SFF_1GBASELX_CAPABLE	0x2
 #define IXGBE_SFF_1GBASET_CAPABLE	0x8
+#define IXGBE_SFF_1GBASELHA_CAPABLE	0x10
 #define IXGBE_SFF_10GBASESR_CAPABLE	0x10
 #define IXGBE_SFF_10GBASELR_CAPABLE	0x20
 #define IXGBE_SFF_SOFT_RS_SELECT_MASK	0x8
drivers/net/ixgbe/base/ixgbe_type.h +2 -0
index cee6ba2e0..077b8f01c 100644
@@ -3724,6 +3724,8 @@ enum ixgbe_sfp_type {
 	ixgbe_sfp_type_1g_sx_core1 = 12,
 	ixgbe_sfp_type_1g_lx_core0 = 13,
 	ixgbe_sfp_type_1g_lx_core1 = 14,
+	ixgbe_sfp_type_1g_lha_core0 = 15,
+	ixgbe_sfp_type_1g_lha_core1 = 16,
 	ixgbe_sfp_type_not_present = 0xFFFE,
 	ixgbe_sfp_type_unknown = 0xFFFF
 };
drivers/net/ixgbe/base/ixgbe_x550.c +4 -0
index a88d5c86a..1114d3faf 100644
@@ -1534,6 +1534,8 @@ STATIC s32 ixgbe_supported_sfp_modules_X550em(struct ixgbe_hw *hw, bool *linear)
 	case ixgbe_sfp_type_1g_sx_core1:
 	case ixgbe_sfp_type_1g_lx_core0:
 	case ixgbe_sfp_type_1g_lx_core1:
+	case ixgbe_sfp_type_1g_lha_core0:
+	case ixgbe_sfp_type_1g_lha_core1:
 		*linear = false;
 		break;
 	case ixgbe_sfp_type_unknown:
@@ -1880,6 +1882,8 @@ s32 ixgbe_get_link_capabilities_X550em(struct ixgbe_hw *hw,
 		/* Check if 1G SFP module. */
 		if (hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
 		    hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1
+		    || hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core0 ||
+		    hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core1
 		    || hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
 		    hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1) {
 			*speed = IXGBE_LINK_SPEED_1GB_FULL;
Signature · 1 line
2.19.1
#12 lore raw
In reply to Luca Boccassi
Quoted 35 lines

-----Original Message-----
From: Luca Boccassi [mailto:[email protected]]
Sent: Friday, November 2, 2018 8:19 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]; Luca Boccassi <[email protected]>; [email protected]
Subject: [PATCH v3 1/2] net/ixgbe: fix x550 code to handle unidentified PHY

ixgbe_identify_sfp_module_X550em() was missing the code to handle unidentified PHY that has been there in 82599 so it was not able to complete initialization of ixgbe sequence if no sfp plugged in.
Port it over to return an appropriate type and complete init sequence properly.

Fixes d2e72774e58c ("ixgbe/base: support X550")

---
v2: refresh to remove merge conflict with master
v3: coalesce fix into ixgbe_identify_sfp_module_X550em to avoid
code duplication, improve comment

 drivers/net/ixgbe/base/ixgbe_x550.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/net/ixgbe/base/ixgbe_x550.c +0 -0
index f7b98af52..a88d5c86a 100644

drivers/net/ixgbe/base/ixgbe_x550.c s32 ixgbe_identify_sfp_module_X550em(struct · line 1567

Quoted 7 lines
drivers/net/ixgbe/base/ixgbe_x550.c +3 -0
@@ -1561,6 +1561,12 @@ s32 ixgbe_identify_sfp_module_X550em(struct
 ixgbe_hw *hw)
 
 	status = ixgbe_identify_module_generic(hw);
 
+	/* Set PHY type none if no PHY detected to allow init without SFP */
+	if (hw->phy.type == ixgbe_phy_unknown) {
+		hw->phy.type = ixgbe_phy_none;

Set PHY type to none for a device that does have PHY looks weird. does ixgeb_phy_generic works here?

Where is failure you met with ixgbe_phy_unknown?

Quoted 8 lines
drivers/net/ixgbe/base/ixgbe_x550.c +3 -1
+		return IXGBE_SUCCESS;
+	}
+
 	if (status != IXGBE_SUCCESS)
 		return status;
 
--

2.19.1

#13 lore raw
Quoted 48 lines · Qi Z
Quoted 42 lines

-----Original Message-----
From: Luca Boccassi [mailto:[email protected]]
Sent: Friday, November 2, 2018 8:19 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]; Luca Boccassi <[email protected]>; [email protected]
Subject: [PATCH v3 1/2] net/ixgbe: fix x550 code to handle unidentified PHY

ixgbe_identify_sfp_module_X550em() was missing the code to handle unidentified PHY that has been there in 82599 so it was not able to complete
initialization of ixgbe sequence if no sfp plugged in. Port it over to return an appropriate type and complete init sequence
properly.

Fixes d2e72774e58c ("ixgbe/base: support X550")

---
v2: refresh to remove merge conflict with master
v3: coalesce fix into ixgbe_identify_sfp_module_X550em to avoid code duplication, improve comment

 drivers/net/ixgbe/base/ixgbe_x550.c | 6 ++++++

 1 file changed, 6 insertions(+)
drivers/net/ixgbe/base/ixgbe_x550.c +1 -0
index f7b98af52..a88d5c86a 100644
@@ -1561,6 +1561,12 @@ s32 ixgbe_identify_sfp_module_X550em(struct
 ixgbe_hw *hw)
 
  	status = ixgbe_identify_module_generic(hw);
 
+	/* Set PHY type none if no PHY detected to allow init

without SFP */

drivers/net/ixgbe/base/ixgbe_x550.c s32 ixgbe_identify_sfp_module_X550em(struct ixgbe_hw *hw) · line 1566

Quoted 2 lines
drivers/net/ixgbe/base/ixgbe_x550.c +2 -0
+	if (hw->phy.type == ixgbe_phy_unknown) {
+		hw->phy.type = ixgbe_phy_none;

Set PHY type to none for a device that does have PHY looks weird. does ixgeb_phy_generic works here?

Quoted 1 line

Where is failure you met with ixgbe_phy_unknown?

Yes it is a bit weird, but it works :-)

The issue is that the PMD fails to initialise when there is no SFP plugged, and then it will always stay in that failed state when an SFP is later plugged in, and it won't work until the machine is rebooted with the SFP plugged in.

The logs (with an older DPDK version):

PMD: eth_ixgbe_dev_init(): Hardware Initialization Failure: -20
EAL: Requested device 0000:04:00.0 cannot be used

The kernel driver didn't like it either:

[    7.579782] ixgbe 0000:04:00.0: Multiqueue Enabled: Rx Queue count = 8, Tx Queue count = 8 [    7.649766] ixgbe 0000:04:00.0: MAC: 5, PHY: 0, PBA No: 020A00-000
[    7.649774] ixgbe 0000:04:00.0: 00:25:90:5e:05:20
[    8.763790] ixgbe 0000:04:00.0 0000:04:00.0 (uninitialized): CS4227 reset did not complete [    8.772051] ixgbe 0000:04:00.0 0000:04:00.0 (uninitialized): CS4227 reset failed: -3 [    9.059374] ixgbe 0000:04:00.0: Intel(R) 10 Gigabit Network Connection

But with the kernel driver, if an SFP is plugged in later then the interface works correctly.

With this series, an SFP can be plugged in after booting and initialising the DPDK application.

Signature · 2 lines
Kind regards,
Luca Boccassi
#14 lore raw
In reply to Zhang, Qi Z
Quoted 37 lines · Qi Z
Quoted 37 lines

-----Original Message-----
From: Luca Boccassi [mailto:[email protected]]
Sent: Friday, November 2, 2018 8:19 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]; Luca Boccassi <[email protected]>; [email protected]
Subject: [PATCH v3 1/2] net/ixgbe: fix x550 code to handle unidentified PHY

ixgbe_identify_sfp_module_X550em() was missing the code to handle unidentified PHY that has been there in 82599 so it was not able to complete initialization of ixgbe sequence if no sfp plugged in.
Port it over to return an appropriate type and complete init sequence properly.

Fixes d2e72774e58c ("ixgbe/base: support X550")

---
v2: refresh to remove merge conflict with master
v3: coalesce fix into ixgbe_identify_sfp_module_X550em to avoid
code duplication, improve comment

  drivers/net/ixgbe/base/ixgbe_x550.c | 6 ++++++
  1 file changed, 6 insertions(+)
drivers/net/ixgbe/base/ixgbe_x550.c +0 -0
index f7b98af52..a88d5c86a 100644
@@ -1561,6 +1561,12 @@ s32 ixgbe_identify_sfp_module_X550em(struct
 ixgbe_hw *hw)
 
Quoted 8 lines

drivers/net/ixgbe/base/ixgbe_x550.c s32 ixgbe_identify_sfp_module_X550em(struct ixgbe_hw *hw) · line 1566

Quoted 5 lines
drivers/net/ixgbe/base/ixgbe_x550.c +3 -0
  	status = ixgbe_identify_module_generic(hw);
 
+	/* Set PHY type none if no PHY detected to allow init without SFP */
+	if (hw->phy.type == ixgbe_phy_unknown) {
+		hw->phy.type = ixgbe_phy_none;

Set PHY type to none for a device that does have PHY looks weird. does ixgeb_phy_generic works here?

Yes, it does seem strange but that's what ixgbe_identify_sfp_module_generic seems to do:

	err_read_i2c_eeprom:
		hw->phy.sfp_type = ixgbe_sfp_type_not_present;
		if (hw->phy.type != ixgbe_phy_nl) {
			hw->phy.id = 0;
			hw->phy.type = ixgbe_phy_unknown;
		}

The QSFP version a little more forceful:

	err_read_i2c_eeprom:
		hw->phy.sfp_type = ixgbe_sfp_type_not_present;
		hw->phy.id = 0;
		hw->phy.type = ixgbe_phy_unknown;

If we go forward without setting the phy_type to none, we will eventually run into issues calling other phy routines.

So should a lack of SFP, reset the PHY type? It's hazy because the difference between PHY and SFP isn't that clear to me here.

Quoted 11 lines

Where is failure you met with ixgbe_phy_unknown?

Quoted 8 lines
drivers/net/ixgbe/base/ixgbe_x550.c +3 -1
+		return IXGBE_SUCCESS;
+	}
+
  	if (status != IXGBE_SUCCESS)
  		return status;
 
--

2.19.1

#15 lore raw
Quoted 80 lines

-----Original Message-----
From: Chas Williams [mailto:[email protected]]
Sent: Monday, November 5, 2018 11:19 AM
To: Zhang, Qi Z <[email protected]>; Luca Boccassi <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>; [email protected]
Subject: Re: [PATCH v3 1/2] net/ixgbe: fix x550 code to handle unidentified PHY

Quoted 30 lines · Qi Z
Quoted 30 lines

-----Original Message-----
From: Luca Boccassi [mailto:[email protected]]
Sent: Friday, November 2, 2018 8:19 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]; Luca Boccassi <[email protected]>; [email protected]
Subject: [PATCH v3 1/2] net/ixgbe: fix x550 code to handle unidentified PHY

ixgbe_identify_sfp_module_X550em() was missing the code to handle unidentified PHY that has been there in 82599 so it was not able to complete initialization of ixgbe sequence if no sfp plugged in. Port it over to return an appropriate type and complete init sequence properly.

Fixes d2e72774e58c ("ixgbe/base: support X550")

---
v2: refresh to remove merge conflict with master
v3: coalesce fix into ixgbe_identify_sfp_module_X550em to avoid
code duplication, improve comment

  drivers/net/ixgbe/base/ixgbe_x550.c | 6 ++++++
  1 file changed, 6 insertions(+)
Quoted 6 lines

drivers/net/ixgbe/base/ixgbe_x550.c s32

Quoted 6 lines
drivers/net/ixgbe/base/ixgbe_x550.c +0 -0
index f7b98af52..a88d5c86a 100644
@@ -1561,6 +1561,12 @@ s32

ixgbe_identify_sfp_module_X550em(struct

Quoted 10 lines

drivers/net/ixgbe/base/ixgbe_x550.c s32 ixgbe_identify_sfp_module_X550em(struct ixgbe_hw *hw) · line 1566

Quoted 7 lines
drivers/net/ixgbe/base/ixgbe_x550.c +3 -0
 ixgbe_hw *hw)
 
  	status = ixgbe_identify_module_generic(hw);
 
+	/* Set PHY type none if no PHY detected to allow init without SFP */
+	if (hw->phy.type == ixgbe_phy_unknown) {
+		hw->phy.type = ixgbe_phy_none;

Set PHY type to none for a device that does have PHY looks weird. does ixgeb_phy_generic works here?

Yes, it does seem strange but that's what ixgbe_identify_sfp_module_generic seems to do:

	err_read_i2c_eeprom:
		hw->phy.sfp_type = ixgbe_sfp_type_not_present;
		if (hw->phy.type != ixgbe_phy_nl) {
			hw->phy.id = 0;
			hw->phy.type = ixgbe_phy_unknown;
		}

The QSFP version a little more forceful:

	err_read_i2c_eeprom:
		hw->phy.sfp_type = ixgbe_sfp_type_not_present;
		hw->phy.id = 0;
		hw->phy.type = ixgbe_phy_unknown;
Quoted 5 lines

If we go forward without setting the phy_type to none, we will eventually run into issues calling other phy routines.

So should a lack of SFP, reset the PHY type? It's hazy because the difference between PHY and SFP isn't that clear to me here.

I'm not sure that's the same case:).
Just feel that it's better to handle ixgbe_phy_unknown directly for some device id as a special case than just replace it to ixgbe_phy_none to cheat the check path, since that rely on we never change the way to handle ixgbe_phy_none.

So still have the question?
What is the failure if you go with ixgbe_phy_unknown? Is that possible to work around this like
if (phy_type == ixgbe_phy_unknown && dev_id == xxxx)

	...
Quoted 12 lines
Quoted 12 lines

Where is failure you met with ixgbe_phy_unknown?

Quoted 8 lines
drivers/net/ixgbe/base/ixgbe_x550.c +3 -1
+		return IXGBE_SUCCESS;
+	}
+
  	if (status != IXGBE_SUCCESS)
  		return status;
 
--

2.19.1

#16 lore raw
Quoted 102 lines · Qi Z
Quoted 88 lines

-----Original Message-----
From: Chas Williams [mailto:[email protected]]
Sent: Monday, November 5, 2018 11:19 AM
To: Zhang, Qi Z <[email protected]>; Luca Boccassi <bluca@debian .org>;
[email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>; [email protected]
Subject: Re: [PATCH v3 1/2] net/ixgbe: fix x550 code to handle unidentified
PHY

Quoted 35 lines · Qi Z
Quoted 35 lines

-----Original Message-----
From: Luca Boccassi [mailto:[email protected]]
Sent: Friday, November 2, 2018 8:19 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>; Zhang, Qi Z <[email protected] om>;
[email protected]; Luca Boccassi <[email protected]>; stable@dpdk .org
Subject: [PATCH v3 1/2] net/ixgbe: fix x550 code to handle unidentified PHY

ixgbe_identify_sfp_module_X550em() was missing the code to handle
unidentified PHY that has been there in 82599 so it was not able to
complete initialization of ixgbe sequence if no sfp plugged in. Port it over to return an appropriate type and complete init sequence
properly.

Fixes d2e72774e58c ("ixgbe/base: support X550")

---
v2: refresh to remove merge conflict with master
v3: coalesce fix into ixgbe_identify_sfp_module_X550em to avoid code duplication, improve comment

  drivers/net/ixgbe/base/ixgbe_x550.c | 6 ++++++

  1 file changed, 6 insertions(+)
Quoted 6 lines

drivers/net/ixgbe/base/ixgbe_x550.c s32

Quoted 6 lines
drivers/net/ixgbe/base/ixgbe_x550.c +0 -0
index f7b98af52..a88d5c86a 100644
@@ -1561,6 +1561,12 @@ s32

ixgbe_identify_sfp_module_X550em(struct

Quoted 11 lines

drivers/net/ixgbe/base/ixgbe_x550.c s32 ixgbe_identify_sfp_module_X550em(struct ixgbe_hw *hw) · line 1566

Quoted 8 lines
drivers/net/ixgbe/base/ixgbe_x550.c +1 -0
 ixgbe_hw *hw)
 
   	status = ixgbe_identify_module_generic(hw);
 
+	/* Set PHY type none if no PHY detected to allow init

without SFP */

drivers/net/ixgbe/base/ixgbe_x550.c +2 -0
+	if (hw->phy.type == ixgbe_phy_unknown) {
+		hw->phy.type = ixgbe_phy_none;

Set PHY type to none for a device that does have PHY looks weird. does ixgeb_phy_generic works here?

Yes, it does seem strange but that's what
ixgbe_identify_sfp_module_generic
seems to do:

	err_read_i2c_eeprom:
		hw->phy.sfp_type = ixgbe_sfp_type_not_present;
		if (hw->phy.type != ixgbe_phy_nl) {
			hw->phy.id = 0;
			hw->phy.type = ixgbe_phy_unknown;
		}

The QSFP version a little more forceful:

	err_read_i2c_eeprom:
		hw->phy.sfp_type = ixgbe_sfp_type_not_present;
		hw->phy.id = 0;
		hw->phy.type = ixgbe_phy_unknown;
Quoted 7 lines

If we go forward without setting the phy_type to none, we will eventually run
into issues calling other phy routines.

So should a lack of SFP, reset the PHY type? It's hazy because the difference
between PHY and SFP isn't that clear to me here.

I'm not sure that's the same case:).
Just feel that it's better to handle ixgbe_phy_unknown directly for some device id as a special case than just replace it to ixgbe_phy_none to cheat the check path, since that rely on we never change the way to handle ixgbe_phy_none.

Quoted 5 lines

So still have the question?
What is the failure if you go with ixgbe_phy_unknown? Is that possible to work around this like
if (phy_type == ixgbe_phy_unknown && dev_id == xxxx)

	...

Hi,

Thanks for having a look at this again. If you could please see the other answer, from myself, I've quoted the exact error we see and the issue it causes.

Signature · 2 lines
Kind regards,
Luca Boccassi
#17 lore raw
Quoted 119 lines

-----Original Message-----
From: Luca Boccassi [mailto:[email protected]]
Sent: Wednesday, November 7, 2018 5:55 AM
To: Zhang, Qi Z <[email protected]>; Chas Williams <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>; [email protected]
Subject: Re: [PATCH v3 1/2] net/ixgbe: fix x550 code to handle unidentified PHY

Quoted 100 lines · Qi Z
Quoted 86 lines

-----Original Message-----
From: Chas Williams [mailto:[email protected]]
Sent: Monday, November 5, 2018 11:19 AM
To: Zhang, Qi Z <[email protected]>; Luca Boccassi <bluca@debian .org>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>; [email protected]
Subject: Re: [PATCH v3 1/2] net/ixgbe: fix x550 code to handle unidentified PHY

Quoted 35 lines · Qi Z
Quoted 35 lines

-----Original Message-----
From: Luca Boccassi [mailto:[email protected]]
Sent: Friday, November 2, 2018 8:19 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>; Zhang, Qi Z <[email protected] om>;
[email protected]; Luca Boccassi <[email protected]>; stable@dpdk .org
Subject: [PATCH v3 1/2] net/ixgbe: fix x550 code to handle unidentified PHY

ixgbe_identify_sfp_module_X550em() was missing the code to handle
unidentified PHY that has been there in 82599 so it was not able to
complete initialization of ixgbe sequence if no sfp plugged in. Port it over to return an appropriate type and complete init sequence
properly.

Fixes d2e72774e58c ("ixgbe/base: support X550")

---
v2: refresh to remove merge conflict with master
v3: coalesce fix into ixgbe_identify_sfp_module_X550em to avoid code duplication, improve comment

  drivers/net/ixgbe/base/ixgbe_x550.c | 6 ++++++

  1 file changed, 6 insertions(+)
Quoted 6 lines

drivers/net/ixgbe/base/ixgbe_x550.c s32

Quoted 6 lines
drivers/net/ixgbe/base/ixgbe_x550.c +0 -0
index f7b98af52..a88d5c86a 100644
@@ -1561,6 +1561,12 @@ s32

ixgbe_identify_sfp_module_X550em(struct

Quoted 11 lines

drivers/net/ixgbe/base/ixgbe_x550.c s32 ixgbe_identify_sfp_module_X550em(struct ixgbe_hw *hw) · line 1566

Quoted 8 lines
drivers/net/ixgbe/base/ixgbe_x550.c +1 -0
 ixgbe_hw *hw)
 
   	status = ixgbe_identify_module_generic(hw);
 
+	/* Set PHY type none if no PHY detected to allow init

without SFP */

drivers/net/ixgbe/base/ixgbe_x550.c +2 -0
+	if (hw->phy.type == ixgbe_phy_unknown) {
+		hw->phy.type = ixgbe_phy_none;

Set PHY type to none for a device that does have PHY looks weird. does ixgeb_phy_generic works here?

Yes, it does seem strange but that's what
ixgbe_identify_sfp_module_generic
seems to do:

	err_read_i2c_eeprom:
		hw->phy.sfp_type = ixgbe_sfp_type_not_present;
		if (hw->phy.type != ixgbe_phy_nl) {
			hw->phy.id = 0;
			hw->phy.type = ixgbe_phy_unknown;
		}

The QSFP version a little more forceful:

	err_read_i2c_eeprom:
		hw->phy.sfp_type = ixgbe_sfp_type_not_present;
		hw->phy.id = 0;
		hw->phy.type = ixgbe_phy_unknown;
Quoted 7 lines

If we go forward without setting the phy_type to none, we will eventually run
into issues calling other phy routines.

So should a lack of SFP, reset the PHY type? It's hazy because the difference
between PHY and SFP isn't that clear to me here.

I'm not sure that's the same case:).
Just feel that it's better to handle ixgbe_phy_unknown directly for some device id as a special case than just replace it to ixgbe_phy_none to cheat the check path, since that rely on we never change the way to handle ixgbe_phy_none.

Quoted 5 lines

So still have the question?
What is the failure if you go with ixgbe_phy_unknown? Is that possible to work around this like
if (phy_type == ixgbe_phy_unknown && dev_id == xxxx)

	...
Quoted 5 lines

Hi,

Thanks for having a look at this again. If you could please see the other answer, from myself, I've quoted the exact error we see and the issue it causes.

Yes, I see it failed at eth_ixgbe_dev_init, it will be better if you can provide more detail for the call stack, so we can figure out if we can work around this by handle ixgbe_phy_unknown directly with some special case.

Quoted 4 lines

--
Kind regards,
Luca Boccassi

#18 lore raw
Quoted 137 lines · Qi Z
Quoted 130 lines

-----Original Message-----
From: Luca Boccassi [mailto:[email protected]]
Sent: Wednesday, November 7, 2018 5:55 AM
To: Zhang, Qi Z <[email protected]>; Chas Williams <3chas3@gmail .com>;
[email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>; [email protected]
Subject: Re: [PATCH v3 1/2] net/ixgbe: fix x550 code to handle unidentified
PHY

Quoted 111 lines · Qi Z
Quoted 94 lines

-----Original Message-----
From: Chas Williams [mailto:[email protected]]
Sent: Monday, November 5, 2018 11:19 AM
To: Zhang, Qi Z <[email protected]>; Luca Boccassi <bluca@de bian
.org>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>; [email protected]
Subject: Re: [PATCH v3 1/2] net/ixgbe: fix x550 code to handle unidentified PHY

Quoted 40 lines · Qi Z
Quoted 40 lines

-----Original Message-----
From: Luca Boccassi [mailto:[email protected]]
Sent: Friday, November 2, 2018 8:19 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>; Zhang, Qi Z <qi.z.zhang@int el.c
om>;
[email protected]; Luca Boccassi <[email protected]>; stable@ dpdk
.org
Subject: [PATCH v3 1/2] net/ixgbe: fix x550 code to handle unidentified PHY

ixgbe_identify_sfp_module_X550em() was missing the code to handle
unidentified PHY that has been there in 82599 so it was not able to
complete initialization of ixgbe sequence if no sfp plugged in.
Port it over to return an appropriate type and complete init
sequence
properly.

Fixes d2e72774e58c ("ixgbe/base: support X550")

---
v2: refresh to remove merge conflict with master
v3: coalesce fix into ixgbe_identify_sfp_module_X550em to avoid
     code duplication, improve comment

  drivers/net/ixgbe/base/ixgbe_x550.c | 6 ++++++

  1 file changed, 6 insertions(+)
Quoted 6 lines

drivers/net/ixgbe/base/ixgbe_x550.c s32

Quoted 6 lines
drivers/net/ixgbe/base/ixgbe_x550.c +0 -0
index f7b98af52..a88d5c86a 100644
@@ -1561,6 +1561,12 @@ s32

ixgbe_identify_sfp_module_X550em(struct

Quoted 4 lines
Quoted 4 lines
drivers/net/ixgbe/base/ixgbe_x550.c +0 -0
 ixgbe_hw *hw)
 
   	status = ixgbe_identify_module_generic(hw);
 
Quoted 9 lines

drivers/net/ixgbe/base/ixgbe_x550.c s32 ixgbe_identify_sfp_module_X550em(struct ixgbe_hw *hw) · line 1566

Quoted 5 lines
drivers/net/ixgbe/base/ixgbe_x550.c +1 -0
+	/* Set PHY type none if no PHY detected to allow

init
without SFP */

drivers/net/ixgbe/base/ixgbe_x550.c +2 -0
+	if (hw->phy.type == ixgbe_phy_unknown) {
+		hw->phy.type = ixgbe_phy_none;

Set PHY type to none for a device that does have PHY looks weird.
does ixgeb_phy_generic works here?

Yes, it does seem strange but that's what
ixgbe_identify_sfp_module_generic
seems to do:

	err_read_i2c_eeprom:
		hw->phy.sfp_type = ixgbe_sfp_type_not_present;
		if (hw->phy.type != ixgbe_phy_nl) {
			hw->phy.id = 0;
			hw->phy.type = ixgbe_phy_unknown;
		}

The QSFP version a little more forceful:

	err_read_i2c_eeprom:
		hw->phy.sfp_type = ixgbe_sfp_type_not_present;
		hw->phy.id = 0;
		hw->phy.type = ixgbe_phy_unknown;
Quoted 8 lines

If we go forward without setting the phy_type to none, we will eventually run
into issues calling other phy routines.

So should a lack of SFP, reset the PHY type? It's hazy because the
difference
between PHY and SFP isn't that clear to me here.

I'm not sure that's the same case:).
Just feel that it's better to handle ixgbe_phy_unknown directly for
some device id as a special case than just replace it to ixgbe_phy_none to cheat the check path, since that rely on we never
change the way to handle ixgbe_phy_none.

Quoted 5 lines

So still have the question?
What is the failure if you go with ixgbe_phy_unknown? Is that possible to work around this like
if (phy_type == ixgbe_phy_unknown && dev_id == xxxx)

	...
Quoted 6 lines

Hi,

Thanks for having a look at this again. If you could please see the other answer, from myself, I've quoted the exact error we see and the
issue it causes.

Quoted 4 lines

Yes, I see it failed at eth_ixgbe_dev_init, it will be better if you can provide more detail for the call stack, so we can figure out if we can work around this by handle ixgbe_phy_unknown directly with some special case.

Hi,

The original problem was found and fixed internally a while ago, so it's taking some time to get hold of the same hardware again. I hope to get back with more details next week, sorry for the delay.

Signature · 2 lines
Kind regards,
Luca Boccassi
#19 lore raw
Quoted 157 lines · Luca Boccassi
Quoted 150 lines · Qi Z
Quoted 142 lines

-----Original Message-----
From: Luca Boccassi [mailto:[email protected]]
Sent: Wednesday, November 7, 2018 5:55 AM
To: Zhang, Qi Z <[email protected]>; Chas Williams <3chas3@gma il
.com>;
[email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>; [email protected]
Subject: Re: [PATCH v3 1/2] net/ixgbe: fix x550 code to handle unidentified
PHY

Quoted 122 lines · Qi Z
Quoted 108 lines

-----Original Message-----
From: Chas Williams [mailto:[email protected]]
Sent: Monday, November 5, 2018 11:19 AM
To: Zhang, Qi Z <[email protected]>; Luca Boccassi <bluca@ de
bian
.org>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>; [email protected]
Subject: Re: [PATCH v3 1/2] net/ixgbe: fix x550 code to handle
unidentified PHY

Quoted 47 lines · Qi Z
Quoted 47 lines

-----Original Message-----
From: Luca Boccassi [mailto:[email protected]]
Sent: Friday, November 2, 2018 8:19 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin
<[email protected]>; Zhang, Qi Z <qi.z.zhang@i nt
el.c
om>;
[email protected]; Luca Boccassi <[email protected]>; stable@
dpdk
.org
Subject: [PATCH v3 1/2] net/ixgbe: fix x550 code to handle
unidentified PHY

ixgbe_identify_sfp_module_X550em() was missing the code to
handle
unidentified PHY that has been there in 82599 so it was not
able to
complete initialization of ixgbe sequence if no sfp plugged
in.
Port it over to return an appropriate type and complete init
sequence
properly.

Fixes d2e72774e58c ("ixgbe/base: support X550")

---
v2: refresh to remove merge conflict with master
v3: coalesce fix into ixgbe_identify_sfp_module_X550em to avoid
     code duplication, improve comment

  drivers/net/ixgbe/base/ixgbe_x550.c | 6 ++++++

  1 file changed, 6 insertions(+)
Quoted 6 lines

drivers/net/ixgbe/base/ixgbe_x550.c s32

Quoted 6 lines
drivers/net/ixgbe/base/ixgbe_x550.c +0 -0
index f7b98af52..a88d5c86a 100644
@@ -1561,6 +1561,12 @@ s32

ixgbe_identify_sfp_module_X550em(struct

Quoted 4 lines
Quoted 4 lines
drivers/net/ixgbe/base/ixgbe_x550.c +0 -0
 ixgbe_hw *hw)
 
   	status = ixgbe_identify_module_generic(hw);
 
Quoted 9 lines

drivers/net/ixgbe/base/ixgbe_x550.c

Quoted 5 lines
drivers/net/ixgbe/base/ixgbe_x550.c +1 -0
+	/* Set PHY type none if no PHY detected to allow

init
without SFP */

drivers/net/ixgbe/base/ixgbe_x550.c +2 -0
+	if (hw->phy.type == ixgbe_phy_unknown) {
+		hw->phy.type = ixgbe_phy_none;

Set PHY type to none for a device that does have PHY looks weird.
does ixgeb_phy_generic works here?

Yes, it does seem strange but that's what
ixgbe_identify_sfp_module_generic
seems to do:

	err_read_i2c_eeprom:
		hw->phy.sfp_type = ixgbe_sfp_type_not_present;
		if (hw->phy.type != ixgbe_phy_nl) {
			hw->phy.id = 0;
			hw->phy.type = ixgbe_phy_unknown;
		}

The QSFP version a little more forceful:

	err_read_i2c_eeprom:
		hw->phy.sfp_type = ixgbe_sfp_type_not_present;
		hw->phy.id = 0;
		hw->phy.type = ixgbe_phy_unknown;

If we go forward without setting the phy_type to none, we will
eventually run
into issues calling other phy routines.

Quoted 5 lines

So should a lack of SFP, reset the PHY type? It's hazy because
the
difference
between PHY and SFP isn't that clear to me here.

I'm not sure that's the same case:).
Just feel that it's better to handle ixgbe_phy_unknown directly for
some device id as a special case than just replace it to ixgbe_phy_none to cheat the check path, since that rely on we never
change the way to handle ixgbe_phy_none.

Quoted 5 lines

So still have the question?
What is the failure if you go with ixgbe_phy_unknown? Is that possible to work around this like
if (phy_type == ixgbe_phy_unknown && dev_id == xxxx)

	...
Quoted 7 lines

Hi,

Thanks for having a look at this again. If you could please see the
other answer, from myself, I've quoted the exact error we see and the
issue it causes.

Quoted 5 lines

Yes, I see it failed at eth_ixgbe_dev_init, it will be better if you
can provide more detail for the call stack, so we can figure out if we can work around this by handle ixgbe_phy_unknown directly with some special case.

Quoted 6 lines

Hi,

The original problem was found and fixed internally a while ago, so it's taking some time to get hold of the same hardware again. I hope to
get back with more details next week, sorry for the delay.

Hi,

I had the chance to rebase the application on 18.11 and test again, and it seems like the first patch is no longer necessary. Which is good! Unfortunately I don't have time to bisect and find exactly when it was fixed.

I have sent a v4 dropping the first patch.

Signature · 2 lines
Kind regards,
Luca Boccassi
#20 lore raw

PATCH v4 1/1 net/ixgbe: add LHA ID to x550 code

In reply to Luca Boccassi

ixgbe is able to recognize 1G SX and LX id, but it is missing the LHA. Add it, so that it can handle LHA sfp plugin.

Fixes d2e72774e58c ("ixgbe/base: support X550")

---
v4: dropped first patch, no longer necessary in 18.11

 drivers/net/ixgbe/base/ixgbe_82599.c |  2 ++
 drivers/net/ixgbe/base/ixgbe_phy.c   | 13 +++++++++++++
 drivers/net/ixgbe/base/ixgbe_phy.h   |  1 +
 drivers/net/ixgbe/base/ixgbe_type.h  |  2 ++
 drivers/net/ixgbe/base/ixgbe_x550.c  |  4 ++++
 5 files changed, 22 insertions(+)
drivers/net/ixgbe/base/ixgbe_82599.c +2 -0
index 7de753fd3..96bdde62c 100644
@@ -392,6 +392,8 @@ s32 ixgbe_get_link_capabilities_82599(struct ixgbe_hw *hw,
 	/* Check if 1G SFP module. */
 	if (hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 ||
 	    hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 ||
+	    hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core0 ||
+	    hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core1 ||
 	    hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
 	    hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 ||
 	    hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
drivers/net/ixgbe/base/ixgbe_phy.c +13 -0
index 6cdd8fbab..dd118f917 100644
@@ -1402,6 +1402,13 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
 				else
 					hw->phy.sfp_type =
 						ixgbe_sfp_type_1g_lx_core1;
+			} else if (comp_codes_1g & IXGBE_SFF_1GBASELHA_CAPABLE) {
+				if (hw->bus.lan_id == 0)
+					hw->phy.sfp_type =
+						ixgbe_sfp_type_1g_lha_core0;
+				else
+					hw->phy.sfp_type =
+						ixgbe_sfp_type_1g_lha_core1;
 			} else {
 				hw->phy.sfp_type = ixgbe_sfp_type_unknown;
 			}
@@ -1489,6 +1496,8 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
 		if (comp_codes_10g == 0 &&
 		    !(hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 ||
+		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core0 ||
+		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core1 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
@@ -1508,6 +1517,8 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
 		if (!(enforce_sfp & IXGBE_DEVICE_CAPS_ALLOW_ANY_SFP) &&
 		    !(hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 ||
+		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core0 ||
+		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core1 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
@@ -1835,11 +1846,13 @@ s32 ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw,
 	 */
 	if (sfp_type == ixgbe_sfp_type_da_act_lmt_core0 ||
 	    sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
+	    sfp_type == ixgbe_sfp_type_1g_lha_core0 ||
 	    sfp_type == ixgbe_sfp_type_1g_cu_core0 ||
 	    sfp_type == ixgbe_sfp_type_1g_sx_core0)
 		sfp_type = ixgbe_sfp_type_srlr_core0;
 	else if (sfp_type == ixgbe_sfp_type_da_act_lmt_core1 ||
 		 sfp_type == ixgbe_sfp_type_1g_lx_core1 ||
+		 sfp_type == ixgbe_sfp_type_1g_lha_core1 ||
 		 sfp_type == ixgbe_sfp_type_1g_cu_core1 ||
 		 sfp_type == ixgbe_sfp_type_1g_sx_core1)
 		sfp_type = ixgbe_sfp_type_srlr_core1;
drivers/net/ixgbe/base/ixgbe_phy.h +1 -0
index 132fa542b..f1605f2cc 100644
@@ -41,6 +41,7 @@
 #define IXGBE_SFF_1GBASESX_CAPABLE	0x1
 #define IXGBE_SFF_1GBASELX_CAPABLE	0x2
 #define IXGBE_SFF_1GBASET_CAPABLE	0x8
+#define IXGBE_SFF_1GBASELHA_CAPABLE	0x10
 #define IXGBE_SFF_10GBASESR_CAPABLE	0x10
 #define IXGBE_SFF_10GBASELR_CAPABLE	0x20
 #define IXGBE_SFF_SOFT_RS_SELECT_MASK	0x8
drivers/net/ixgbe/base/ixgbe_type.h +2 -0
index cee6ba2e0..077b8f01c 100644
@@ -3724,6 +3724,8 @@ enum ixgbe_sfp_type {
 	ixgbe_sfp_type_1g_sx_core1 = 12,
 	ixgbe_sfp_type_1g_lx_core0 = 13,
 	ixgbe_sfp_type_1g_lx_core1 = 14,
+	ixgbe_sfp_type_1g_lha_core0 = 15,
+	ixgbe_sfp_type_1g_lha_core1 = 16,
 	ixgbe_sfp_type_not_present = 0xFFFE,
 	ixgbe_sfp_type_unknown = 0xFFFF
 };
drivers/net/ixgbe/base/ixgbe_x550.c +4 -0
index f7b98af52..a920a146e 100644
@@ -1534,6 +1534,8 @@ STATIC s32 ixgbe_supported_sfp_modules_X550em(struct ixgbe_hw *hw, bool *linear)
 	case ixgbe_sfp_type_1g_sx_core1:
 	case ixgbe_sfp_type_1g_lx_core0:
 	case ixgbe_sfp_type_1g_lx_core1:
+	case ixgbe_sfp_type_1g_lha_core0:
+	case ixgbe_sfp_type_1g_lha_core1:
 		*linear = false;
 		break;
 	case ixgbe_sfp_type_unknown:
@@ -1874,6 +1876,8 @@ s32 ixgbe_get_link_capabilities_X550em(struct ixgbe_hw *hw,
 		/* Check if 1G SFP module. */
 		if (hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
 		    hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1
+		    || hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core0 ||
+		    hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core1
 		    || hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
 		    hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1) {
 			*speed = IXGBE_LINK_SPEED_1GB_FULL;
Signature · 1 line
2.19.1
Reviewed-by on v4 1/1
#21 lore raw

Re: [PATCH v4] net/ixgbe: add LHA ID to x550 code

Quoted 11 lines

-----Original Message-----
From: Luca Boccassi [mailto:[email protected]]
Sent: Tuesday, November 20, 2018 3:27 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]; Luca Boccassi <[email protected]>; [email protected]
Subject: [PATCH v4] net/ixgbe: add LHA ID to x550 code

Quoted 7 lines

ixgbe is able to recognize 1G SX and LX id, but it is missing the LHA. Add it, so that it can handle LHA sfp plugin.

Fixes d2e72774e58c ("ixgbe/base: support X550")

The patch is OK for me, but here is some coding style need to fix.

Quoted 132 lines

---
v4: dropped first patch, no longer necessary in 18.11

 drivers/net/ixgbe/base/ixgbe_82599.c |  2 ++
 drivers/net/ixgbe/base/ixgbe_phy.c   | 13 +++++++++++++
 drivers/net/ixgbe/base/ixgbe_phy.h   |  1 +
 drivers/net/ixgbe/base/ixgbe_type.h  |  2 ++
drivers/net/ixgbe/base/ixgbe_x550.c  |  4 ++++
 5 files changed, 22 insertions(+)
drivers/net/ixgbe/base/ixgbe_82599.c +2 -0
index 7de753fd3..96bdde62c 100644
@@ -392,6 +392,8 @@ s32 ixgbe_get_link_capabilities_82599(struct
 ixgbe_hw *hw,
 	/* Check if 1G SFP module. */
 	if (hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 ||
 	    hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 ||
+	    hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core0 ||
+	    hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core1 ||
 	    hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
 	    hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 ||

hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 || diff --git
a/drivers/net/ixgbe/base/ixgbe_phy.c b/drivers/net/ixgbe/base/ixgbe_phy.c index 6cdd8fbab..dd118f917 100644

drivers/net/ixgbe/base/ixgbe_phy.c +7 -0
@@ -1402,6 +1402,13 @@ s32 ixgbe_identify_sfp_module_generic(struct
 ixgbe_hw *hw)
 				else
 					hw->phy.sfp_type =
 						ixgbe_sfp_type_1g_lx_core1;
+			} else if (comp_codes_1g & IXGBE_SFF_1GBASELHA_CAPABLE) {
+				if (hw->bus.lan_id == 0)
+					hw->phy.sfp_type =
+						ixgbe_sfp_type_1g_lha_core0;
+				else
+					hw->phy.sfp_type =
+						ixgbe_sfp_type_1g_lha_core1;
 			} else {
 				hw->phy.sfp_type = ixgbe_sfp_type_unknown;
drivers/net/ixgbe/base/ixgbe_phy.c +2 -0
 			}
@@ -1489,6 +1496,8 @@ s32 ixgbe_identify_sfp_module_generic(struct
 ixgbe_hw *hw)
 		if (comp_codes_10g == 0 &&
 		    !(hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 ||
+		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core0 ||
+		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core1 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 ||

hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 || @@
-1508,6 +1517,8 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)

drivers/net/ixgbe/base/ixgbe_phy.c +2 -1
 		if (!(enforce_sfp & IXGBE_DEVICE_CAPS_ALLOW_ANY_SFP) &&
 		    !(hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 ||
+		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core0 ||
+		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core1 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 ||
 		      hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 || @@
-1835,11 +1846,13 @@ s32 ixgbe_get_sfp_init_sequence_offsets(struct

ixgbe_hw *hw,

drivers/net/ixgbe/base/ixgbe_phy.c +2 -0
 	 */
 	if (sfp_type == ixgbe_sfp_type_da_act_lmt_core0 ||
 	    sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
+	    sfp_type == ixgbe_sfp_type_1g_lha_core0 ||
 	    sfp_type == ixgbe_sfp_type_1g_cu_core0 ||
 	    sfp_type == ixgbe_sfp_type_1g_sx_core0)
 		sfp_type = ixgbe_sfp_type_srlr_core0;
 	else if (sfp_type == ixgbe_sfp_type_da_act_lmt_core1 ||
 		 sfp_type == ixgbe_sfp_type_1g_lx_core1 ||
+		 sfp_type == ixgbe_sfp_type_1g_lha_core1 ||
 		 sfp_type == ixgbe_sfp_type_1g_cu_core1 ||
 		 sfp_type == ixgbe_sfp_type_1g_sx_core1)
 		sfp_type = ixgbe_sfp_type_srlr_core1; diff --git

a/drivers/net/ixgbe/base/ixgbe_phy.h b/drivers/net/ixgbe/base/ixgbe_phy.h index 132fa542b..f1605f2cc 100644

drivers/net/ixgbe/base/ixgbe_phy.h +1 -0
@@ -41,6 +41,7 @@
 #define IXGBE_SFF_1GBASESX_CAPABLE	0x1
 #define IXGBE_SFF_1GBASELX_CAPABLE	0x2
 #define IXGBE_SFF_1GBASET_CAPABLE	0x8
+#define IXGBE_SFF_1GBASELHA_CAPABLE	0x10
 #define IXGBE_SFF_10GBASESR_CAPABLE	0x10
 #define IXGBE_SFF_10GBASELR_CAPABLE	0x20
 #define IXGBE_SFF_SOFT_RS_SELECT_MASK	0x8
drivers/net/ixgbe/base/ixgbe_type.h +2 -0
index cee6ba2e0..077b8f01c 100644
@@ -3724,6 +3724,8 @@ enum ixgbe_sfp_type {
 	ixgbe_sfp_type_1g_sx_core1 = 12,
 	ixgbe_sfp_type_1g_lx_core0 = 13,
 	ixgbe_sfp_type_1g_lx_core1 = 14,
+	ixgbe_sfp_type_1g_lha_core0 = 15,
+	ixgbe_sfp_type_1g_lha_core1 = 16,
 	ixgbe_sfp_type_not_present = 0xFFFE,
 	ixgbe_sfp_type_unknown = 0xFFFF
 };
drivers/net/ixgbe/base/ixgbe_x550.c +2 -0
index f7b98af52..a920a146e 100644
@@ -1534,6 +1534,8 @@ STATIC s32
 ixgbe_supported_sfp_modules_X550em(struct ixgbe_hw *hw, bool *linear)
 	case ixgbe_sfp_type_1g_sx_core1:
 	case ixgbe_sfp_type_1g_lx_core0:
 	case ixgbe_sfp_type_1g_lx_core1:
+	case ixgbe_sfp_type_1g_lha_core0:
+	case ixgbe_sfp_type_1g_lha_core1:
 		*linear = false;
 		break;
drivers/net/ixgbe/base/ixgbe_x550.c +2 -0
 	case ixgbe_sfp_type_unknown:
@@ -1874,6 +1876,8 @@ s32 ixgbe_get_link_capabilities_X550em(struct
 ixgbe_hw *hw,
 		/* Check if 1G SFP module. */
 		if (hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
 		    hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1
+		    || hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core0 ||
+		    hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core1
 		    || hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
 		    hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1) {

*speed = IXGBE_LINK_SPEED_1GB_FULL;
--
2.19.1

#22 lore raw

Re: [dpdk-stable] [PATCH v4] net/ixgbe: add LHA ID to x550 code

Quoted 13 lines · Qi Z
Quoted 13 lines

-----Original Message-----
From: Luca Boccassi [mailto:[email protected]]
Sent: Tuesday, November 20, 2018 3:27 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]; Luca Boccassi <[email protected]>; [email protected]
Subject: [PATCH v4] net/ixgbe: add LHA ID to x550 code

ixgbe is able to recognize 1G SX and LX id, but it is missing the LHA.
Add it, so that it can handle LHA sfp plugin.

Quoted 8 lines
Quoted 4 lines
Fixes d2e72774e58c ("ixgbe/base: support X550")

The patch is OK for me, but here is some coding style need to fix.

Thanks for the review!

I intentionally left the checkpatch complaint unfixed as it applies just the same to the other existing lines above and below the addition of this patch, so it makes more sense for it to be fixed (if desired) separately and for all affected lines.

Quoted 164 lines
Quoted 162 lines

---
v4: dropped first patch, no longer necessary in 18.11

 drivers/net/ixgbe/base/ixgbe_82599.c |  2 ++ drivers/net/ixgbe/base/ixgbe_phy.c   | 13 +++++++++++++ drivers/net/ixgbe/base/ixgbe_phy.h   |  1 + drivers/net/ixgbe/base/ixgbe_type.h  |  2 ++ drivers/net/ixgbe/base/ixgbe_x550.c  |  4 ++++

 5 files changed, 22 insertions(+)
drivers/net/ixgbe/base/ixgbe_82599.c +0 -0
index 7de753fd3..96bdde62c 100644
@@ -392,6 +392,8 @@ s32 ixgbe_get_link_capabilities_82599(struct
 ixgbe_hw *hw,
  	/* Check if 1G SFP module. */

  if (hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 || hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 ||

drivers/net/ixgbe/base/ixgbe_82599.c +2 -0
+	    hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core0 ||
+	    hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core1 ||
 	    hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
 	    hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 ||
 	    hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 || diff

--git
a/drivers/net/ixgbe/base/ixgbe_phy.c
b/drivers/net/ixgbe/base/ixgbe_phy.c
index 6cdd8fbab..dd118f917 100644

drivers/net/ixgbe/base/ixgbe_phy.c +0 -0
@@ -1402,6 +1402,13 @@ s32 ixgbe_identify_sfp_module_generic(struct
 ixgbe_hw *hw)

  else
  hw->phy.sfp_type = ixgbe_sfp_type_1g_ lx_core1;

drivers/net/ixgbe/base/ixgbe_phy.c +1 -0
+			} else if (comp_codes_1g &

IXGBE_SFF_1GBASELHA_CAPABLE) {

drivers/net/ixgbe/base/ixgbe_phy.c +3 -0
+				if (hw->bus.lan_id == 0)
+					hw->phy.sfp_type =
+						ixgbe_sfp_type_1g_

lha_core0;

drivers/net/ixgbe/base/ixgbe_phy.c +3 -0
+				else
+					hw->phy.sfp_type =
+						ixgbe_sfp_type_1g_

lha_core1;
  } else { hw->phy.sfp_type = ixgbe_sfp_type_unknown;
  }

drivers/net/ixgbe/base/ixgbe_phy.c +0 -0
@@ -1489,6 +1496,8 @@ s32 ixgbe_identify_sfp_module_generic(struct
 ixgbe_hw *hw)

  if (comp_codes_10g == 0 &&
      !(hw->phy.sfp_type ==
ixgbe_sfp_type_1g_cu_core1 ||
        hw->phy.sfp_type ==
ixgbe_sfp_type_1g_cu_core0 ||

drivers/net/ixgbe/base/ixgbe_phy.c +1 -0
+		      hw->phy.sfp_type ==

ixgbe_sfp_type_1g_lha_core0 ||

drivers/net/ixgbe/base/ixgbe_phy.c +1 -0
+		      hw->phy.sfp_type ==

ixgbe_sfp_type_1g_lha_core1 ||
        hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
        hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 ||
        hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 || @@
-1508,6 +1517,8 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw
*hw)
  if (!(enforce_sfp & IXGBE_DEVICE_CAPS_ALLOW_ANY_SFP) && !(hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 ||
        hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 ||

drivers/net/ixgbe/base/ixgbe_phy.c +1 -0
+		      hw->phy.sfp_type ==

ixgbe_sfp_type_1g_lha_core0 ||

drivers/net/ixgbe/base/ixgbe_phy.c +1 -0
+		      hw->phy.sfp_type ==

ixgbe_sfp_type_1g_lha_core1 ||
        hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
        hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 ||
        hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 || @@
-1835,11 +1846,13 @@ s32 ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw,
   */
  if (sfp_type == ixgbe_sfp_type_da_act_lmt_core0 || sfp_type == ixgbe_sfp_type_1g_lx_core0 ||

drivers/net/ixgbe/base/ixgbe_phy.c +1 -0
+	    sfp_type == ixgbe_sfp_type_1g_lha_core0 ||

      sfp_type == ixgbe_sfp_type_1g_cu_core0 || sfp_type == ixgbe_sfp_type_1g_sx_core0) sfp_type = ixgbe_sfp_type_srlr_core0; else if (sfp_type == ixgbe_sfp_type_da_act_lmt_core1 || sfp_type == ixgbe_sfp_type_1g_lx_core1 ||

drivers/net/ixgbe/base/ixgbe_phy.c +1 -0
+		 sfp_type == ixgbe_sfp_type_1g_lha_core1 ||

   sfp_type == ixgbe_sfp_type_1g_cu_core1 || sfp_type == ixgbe_sfp_type_1g_sx_core1) sfp_type = ixgbe_sfp_type_srlr_core1; diff --git a/drivers/net/ixgbe/base/ixgbe_phy.h b/drivers/net/ixgbe/base/ixgbe_phy.h
index 132fa542b..f1605f2cc 100644

drivers/net/ixgbe/base/ixgbe_phy.h +1 -0
@@ -41,6 +41,7 @@
  #define IXGBE_SFF_1GBASESX_CAPABLE	0x1
  #define IXGBE_SFF_1GBASELX_CAPABLE	0x2
  #define IXGBE_SFF_1GBASET_CAPABLE	0x8
+#define IXGBE_SFF_1GBASELHA_CAPABLE	0x10
  #define IXGBE_SFF_10GBASESR_CAPABLE	0x10
  #define IXGBE_SFF_10GBASELR_CAPABLE	0x20
  #define IXGBE_SFF_SOFT_RS_SELECT_MASK	0x8
drivers/net/ixgbe/base/ixgbe_type.h +2 -0
index cee6ba2e0..077b8f01c 100644
@@ -3724,6 +3724,8 @@ enum ixgbe_sfp_type {
  	ixgbe_sfp_type_1g_sx_core1 = 12,
  	ixgbe_sfp_type_1g_lx_core0 = 13,
  	ixgbe_sfp_type_1g_lx_core1 = 14,
+	ixgbe_sfp_type_1g_lha_core0 = 15,
+	ixgbe_sfp_type_1g_lha_core1 = 16,
  	ixgbe_sfp_type_not_present = 0xFFFE,

  ixgbe_sfp_type_unknown = 0xFFFF
 };

drivers/net/ixgbe/base/ixgbe_x550.c +0 -0
index f7b98af52..a920a146e 100644
@@ -1534,6 +1534,8 @@ STATIC s32

ixgbe_supported_sfp_modules_X550em(struct ixgbe_hw *hw, bool *linear)
  case ixgbe_sfp_type_1g_sx_core1:
  case ixgbe_sfp_type_1g_lx_core0:
  case ixgbe_sfp_type_1g_lx_core1:

drivers/net/ixgbe/base/ixgbe_x550.c +2 -0
+	case ixgbe_sfp_type_1g_lha_core0:
+	case ixgbe_sfp_type_1g_lha_core1:

  *linear = false;
  break;
  case ixgbe_sfp_type_unknown:

drivers/net/ixgbe/base/ixgbe_x550.c +0 -0
@@ -1874,6 +1876,8 @@ s32 ixgbe_get_link_capabilities_X550em(struct
 ixgbe_hw *hw,
  		/* Check if 1G SFP module. */

  if (hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
      hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1

drivers/net/ixgbe/base/ixgbe_x550.c +1 -0
+		    || hw->phy.sfp_type ==

ixgbe_sfp_type_1g_lha_core0 ||

drivers/net/ixgbe/base/ixgbe_x550.c +1 -0
+		    hw->phy.sfp_type ==

ixgbe_sfp_type_1g_lha_core1

 		    || hw->phy.sfp_type ==
ixgbe_sfp_type_1g_lx_core0 ||

      hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1) {
  *speed = IXGBE_LINK_SPEED_1GB_FULL; --
2.19.1

Signature · 2 lines
Kind regards,
Luca Boccassi
Applied
#23 lore raw

Re: [dpdk-stable] [PATCH v4] net/ixgbe: add LHA ID to x550 code

Quoted 31 lines

-----Original Message-----
From: Luca Boccassi [mailto:[email protected]]
Sent: Tuesday, November 20, 2018 1:08 PM
To: Zhang, Qi Z <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>; [email protected]; [email protected]
Subject: Re: [dpdk-stable] [PATCH v4] net/ixgbe: add LHA ID to x550 code

Quoted 20 lines · Qi Z
Quoted 9 lines

-----Original Message-----
From: Luca Boccassi [mailto:[email protected]]
Sent: Tuesday, November 20, 2018 3:27 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Ananyev, Konstantin <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]; Luca Boccassi <[email protected]>; [email protected]
Subject: [PATCH v4] net/ixgbe: add LHA ID to x550 code

Quoted 8 lines

ixgbe is able to recognize 1G SX and LX id, but it is missing the LHA.
Add it, so that it can handle LHA sfp plugin.

Fixes d2e72774e58c ("ixgbe/base: support X550")

The patch is OK for me, but here is some coding style need to fix.

Quoted 7 lines
Quoted 1 line

Thanks for the review!

I intentionally left the checkpatch complaint unfixed as it applies just the same to the other existing lines above and below the addition of this patch, so it makes more sense for it to be fixed (if desired) separately and for all affected lines.

Applied to dpdk-next-net-intel.

Thanks
Qi

Quoted 167 lines
Quoted 154 lines
Quoted 154 lines

---
v4: dropped first patch, no longer necessary in 18.11

 drivers/net/ixgbe/base/ixgbe_82599.c |  2 ++ drivers/net/ixgbe/base/ixgbe_phy.c   | 13 +++++++++++++ drivers/net/ixgbe/base/ixgbe_phy.h   |  1 + drivers/net/ixgbe/base/ixgbe_type.h  |  2 ++ drivers/net/ixgbe/base/ixgbe_x550.c  |  4 ++++

 5 files changed, 22 insertions(+)
drivers/net/ixgbe/base/ixgbe_82599.c +0 -0
index 7de753fd3..96bdde62c 100644
@@ -392,6 +392,8 @@ s32 ixgbe_get_link_capabilities_82599(struct
 ixgbe_hw *hw,
  	/* Check if 1G SFP module. */

  if (hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 || hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 ||

drivers/net/ixgbe/base/ixgbe_82599.c +2 -0
+	    hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core0 ||
+	    hw->phy.sfp_type == ixgbe_sfp_type_1g_lha_core1 ||
 	    hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
 	    hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 ||
 	    hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 || diff --git

a/drivers/net/ixgbe/base/ixgbe_phy.c
b/drivers/net/ixgbe/base/ixgbe_phy.c
index 6cdd8fbab..dd118f917 100644

drivers/net/ixgbe/base/ixgbe_phy.c +0 -0
@@ -1402,6 +1402,13 @@ s32 ixgbe_identify_sfp_module_generic(struct
 ixgbe_hw *hw)

  else
  hw->phy.sfp_type = ixgbe_sfp_type_1g_ lx_core1;

drivers/net/ixgbe/base/ixgbe_phy.c +1 -0
+			} else if (comp_codes_1g &

IXGBE_SFF_1GBASELHA_CAPABLE) {

drivers/net/ixgbe/base/ixgbe_phy.c +3 -0
+				if (hw->bus.lan_id == 0)
+					hw->phy.sfp_type =
+						ixgbe_sfp_type_1g_

lha_core0;

drivers/net/ixgbe/base/ixgbe_phy.c +3 -0
+				else
+					hw->phy.sfp_type =
+						ixgbe_sfp_type_1g_

lha_core1;
  } else { hw->phy.sfp_type = ixgbe_sfp_type_unknown;
  }

drivers/net/ixgbe/base/ixgbe_phy.c +0 -0
@@ -1489,6 +1496,8 @@ s32 ixgbe_identify_sfp_module_generic(struct
 ixgbe_hw *hw)

  if (comp_codes_10g == 0 &&
      !(hw->phy.sfp_type ==
ixgbe_sfp_type_1g_cu_core1 ||
        hw->phy.sfp_type ==
ixgbe_sfp_type_1g_cu_core0 ||

drivers/net/ixgbe/base/ixgbe_phy.c +1 -0
+		      hw->phy.sfp_type ==

ixgbe_sfp_type_1g_lha_core0 ||

drivers/net/ixgbe/base/ixgbe_phy.c +1 -0
+		      hw->phy.sfp_type ==

ixgbe_sfp_type_1g_lha_core1 ||
        hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
        hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 ||
        hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 || @@
-1508,6 +1517,8 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw
*hw)
  if (!(enforce_sfp & IXGBE_DEVICE_CAPS_ALLOW_ANY_SFP) && !(hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 ||
        hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 ||

drivers/net/ixgbe/base/ixgbe_phy.c +1 -0
+		      hw->phy.sfp_type ==

ixgbe_sfp_type_1g_lha_core0 ||

drivers/net/ixgbe/base/ixgbe_phy.c +1 -0
+		      hw->phy.sfp_type ==

ixgbe_sfp_type_1g_lha_core1 ||
        hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
        hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 ||
        hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 || @@
-1835,11 +1846,13 @@ s32 ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw,
   */
  if (sfp_type == ixgbe_sfp_type_da_act_lmt_core0 || sfp_type == ixgbe_sfp_type_1g_lx_core0 ||

drivers/net/ixgbe/base/ixgbe_phy.c +1 -0
+	    sfp_type == ixgbe_sfp_type_1g_lha_core0 ||

      sfp_type == ixgbe_sfp_type_1g_cu_core0 || sfp_type == ixgbe_sfp_type_1g_sx_core0) sfp_type = ixgbe_sfp_type_srlr_core0; else if (sfp_type == ixgbe_sfp_type_da_act_lmt_core1 || sfp_type == ixgbe_sfp_type_1g_lx_core1 ||

drivers/net/ixgbe/base/ixgbe_phy.c +1 -0
+		 sfp_type == ixgbe_sfp_type_1g_lha_core1 ||

   sfp_type == ixgbe_sfp_type_1g_cu_core1 || sfp_type == ixgbe_sfp_type_1g_sx_core1) sfp_type = ixgbe_sfp_type_srlr_core1; diff --git a/drivers/net/ixgbe/base/ixgbe_phy.h b/drivers/net/ixgbe/base/ixgbe_phy.h
index 132fa542b..f1605f2cc 100644

drivers/net/ixgbe/base/ixgbe_phy.h +1 -0
@@ -41,6 +41,7 @@
  #define IXGBE_SFF_1GBASESX_CAPABLE	0x1
  #define IXGBE_SFF_1GBASELX_CAPABLE	0x2
  #define IXGBE_SFF_1GBASET_CAPABLE	0x8
+#define IXGBE_SFF_1GBASELHA_CAPABLE	0x10
  #define IXGBE_SFF_10GBASESR_CAPABLE	0x10
  #define IXGBE_SFF_10GBASELR_CAPABLE	0x20
  #define IXGBE_SFF_SOFT_RS_SELECT_MASK	0x8
drivers/net/ixgbe/base/ixgbe_type.h +2 -0
index cee6ba2e0..077b8f01c 100644
@@ -3724,6 +3724,8 @@ enum ixgbe_sfp_type {
  	ixgbe_sfp_type_1g_sx_core1 = 12,
  	ixgbe_sfp_type_1g_lx_core0 = 13,
  	ixgbe_sfp_type_1g_lx_core1 = 14,
+	ixgbe_sfp_type_1g_lha_core0 = 15,
+	ixgbe_sfp_type_1g_lha_core1 = 16,
  	ixgbe_sfp_type_not_present = 0xFFFE,

  ixgbe_sfp_type_unknown = 0xFFFF
 };

drivers/net/ixgbe/base/ixgbe_x550.c +0 -0
index f7b98af52..a920a146e 100644
@@ -1534,6 +1534,8 @@ STATIC s32

ixgbe_supported_sfp_modules_X550em(struct ixgbe_hw *hw, bool *linear)
  case ixgbe_sfp_type_1g_sx_core1:
  case ixgbe_sfp_type_1g_lx_core0:
  case ixgbe_sfp_type_1g_lx_core1:

drivers/net/ixgbe/base/ixgbe_x550.c +2 -0
+	case ixgbe_sfp_type_1g_lha_core0:
+	case ixgbe_sfp_type_1g_lha_core1:

  *linear = false;
  break;
  case ixgbe_sfp_type_unknown:

drivers/net/ixgbe/base/ixgbe_x550.c +0 -0
@@ -1874,6 +1876,8 @@ s32 ixgbe_get_link_capabilities_X550em(struct
 ixgbe_hw *hw,
  		/* Check if 1G SFP module. */

  if (hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
      hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1

drivers/net/ixgbe/base/ixgbe_x550.c +1 -0
+		    || hw->phy.sfp_type ==

ixgbe_sfp_type_1g_lha_core0 ||

drivers/net/ixgbe/base/ixgbe_x550.c +1 -0
+		    hw->phy.sfp_type ==
Quoted 10 lines
Quoted 8 lines

ixgbe_sfp_type_1g_lha_core1

 		    || hw->phy.sfp_type ==
ixgbe_sfp_type_1g_lx_core0 ||

      hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1) {
  *speed = IXGBE_LINK_SPEED_1GB_FULL; --
2.19.1

--
Kind regards,
Luca Boccassi