Skip to contentSkip to conversation

IGC: Remove I225_I_PHY_ID checking

PATCH Superseded [email protected] 5 participants 16 messages Aug 29, 2022 – Dec 21, 2022 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IGC: Remove I225_I_PHY_ID checking

From: NSWE SWS DPDK Dev <[email protected]>

i225 devices have only one PHY vendor. There is unnecessary to check _I_PHY_ID during the link establishment and auto-negotiation process, the checking also caused devices like i225-IT failed. This patch is to remove the mentioned unnecessary checking.

---
 drivers/net/igc/base/igc_api.c  |  1 +
 drivers/net/igc/base/igc_hw.h   |  1 +
 drivers/net/igc/base/igc_i225.c | 15 ++-------------
 drivers/net/igc/base/igc_phy.c  |  6 ++----
 drivers/net/igc/igc_ethdev.c    |  1 +
 5 files changed, 7 insertions(+), 17 deletions(-)
drivers/net/igc/base/igc_api.c +1 -0
index 9b791dc082..c9fc9ed4b0 100644
@@ -886,6 +886,7 @@ s32 igc_set_mac_type(struct igc_hw *hw)
 	case IGC_DEV_ID_I225_V:
 	case IGC_DEV_ID_I225_K:
 	case IGC_DEV_ID_I225_I:
+	case IGC_DEV_ID_I225_IT:
 	case IGC_DEV_ID_I220_V:
 	case IGC_DEV_ID_I225_BLANK_NVM:
 	case IGC_DEV_ID_I226_K:
drivers/net/igc/base/igc_hw.h +1 -0
index 707a1883b4..e919a11c02 100644
@@ -164,6 +164,7 @@ struct igc_hw;
 #define IGC_DEV_ID_I225_V			0x15F3
 #define IGC_DEV_ID_I225_K			0x3100
 #define IGC_DEV_ID_I225_I			0x15F8
+#define IGC_DEV_ID_I225_IT			0x0D9F
 #define IGC_DEV_ID_I220_V			0x15F7
 #define IGC_DEV_ID_I225_BLANK_NVM		0x15FD
 #define IGC_DEV_ID_I226_K           0x3102
drivers/net/igc/base/igc_i225.c +2 -13
index 5f3d535490..bdc6f74976 100644
@@ -173,19 +173,8 @@ static s32 igc_init_phy_params_i225(struct igc_hw *hw)
 	phy->ops.write_reg = igc_write_phy_reg_gpy;
 
 	ret_val = igc_get_phy_id(hw);
-	/* Verify phy id and set remaining function pointers */
-	switch (phy->id) {
-	case I225_I_PHY_ID:
-	case I226_LM_PHY_ID:
-		phy->type		= igc_phy_i225;
-		phy->ops.set_d0_lplu_state = igc_set_d0_lplu_state_i225;
-		phy->ops.set_d3_lplu_state = igc_set_d3_lplu_state_i225;
-		/* TODO - complete with GPY PHY information */
-		break;
-	default:
-		ret_val = -IGC_ERR_PHY;
-		goto out;
-	}
+
+	phy->type		= igc_phy_i225;
 
 out:
 	return ret_val;
drivers/net/igc/base/igc_phy.c +2 -4
index 43bbe69bca..2906bae21a 100644
@@ -1474,8 +1474,7 @@ s32 igc_phy_setup_autoneg(struct igc_hw *hw)
 			return ret_val;
 	}
 
-	if ((phy->autoneg_mask & ADVERTISE_2500_FULL) &&
-	    hw->phy.id == I225_I_PHY_ID) {
+	if (phy->autoneg_mask & ADVERTISE_2500_FULL) {
 	/* Read the MULTI GBT AN Control Register - reg 7.32 */
 		ret_val = phy->ops.read_reg(hw, (STANDARD_AN_REG_MASK <<
 					    MMD_DEVADDR_SHIFT) |
@@ -1615,8 +1614,7 @@ s32 igc_phy_setup_autoneg(struct igc_hw *hw)
 		ret_val = phy->ops.write_reg(hw, PHY_1000T_CTRL,
 					     mii_1000t_ctrl_reg);
 
-	if ((phy->autoneg_mask & ADVERTISE_2500_FULL) &&
-	    hw->phy.id == I225_I_PHY_ID)
+	if (phy->autoneg_mask & ADVERTISE_2500_FULL)
 		ret_val = phy->ops.write_reg(hw,
 					     (STANDARD_AN_REG_MASK <<
 					     MMD_DEVADDR_SHIFT) |
drivers/net/igc/igc_ethdev.c +1 -0
index 7f221a5d34..2989b8d488 100644
@@ -97,6 +97,7 @@ static const struct rte_pci_id pci_id_igc_map[] = {
 	{ RTE_PCI_DEVICE(IGC_INTEL_VENDOR_ID, IGC_DEV_ID_I225_V)  },
 	{ RTE_PCI_DEVICE(IGC_INTEL_VENDOR_ID, IGC_DEV_ID_I225_I)  },
 	{ RTE_PCI_DEVICE(IGC_INTEL_VENDOR_ID, IGC_DEV_ID_I225_K)  },
+	{ RTE_PCI_DEVICE(IGC_INTEL_VENDOR_ID, IGC_DEV_ID_I225_IT)  },
 	{ RTE_PCI_DEVICE(IGC_INTEL_VENDOR_ID, IGC_DEV_ID_I226_K)  },
 	{ RTE_PCI_DEVICE(IGC_INTEL_VENDOR_ID, IGC_DEV_ID_I226_LMVP)  },
 	{ RTE_PCI_DEVICE(IGC_INTEL_VENDOR_ID, IGC_DEV_ID_I226_LM)  },
Signature · 1 line
2.36.1
#1 lore raw
Quoted 10 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Monday, August 29, 2022 4:15 PM
To: [email protected]
Subject: [PATCH] IGC: Remove I225_I_PHY_ID checking

From: NSWE SWS DPDK Dev <[email protected]>

Quoted 7 lines

i225 devices have only one PHY vendor. There is unnecessary to check _I_PHY_ID during the link establishment and auto-negotiation process, the checking also caused devices like i225-IT failed. This patch is to remove the mentioned unnecessary checking.

Is this the expected author name?

Quoted 25 lines
---
 drivers/net/igc/base/igc_api.c  |  1 +
 drivers/net/igc/base/igc_hw.h   |  1 +
 drivers/net/igc/base/igc_i225.c | 15 ++-------------
drivers/net/igc/base/igc_phy.c  |  6 ++----
 drivers/net/igc/igc_ethdev.c    |  1 +
 5 files changed, 7 insertions(+), 17 deletions(-)
drivers/net/igc/base/igc_api.c +1 -0
index 9b791dc082..c9fc9ed4b0 100644
@@ -886,6 +886,7 @@ s32 igc_set_mac_type(struct igc_hw *hw)
 	case IGC_DEV_ID_I225_V:
 	case IGC_DEV_ID_I225_K:
 	case IGC_DEV_ID_I225_I:
+	case IGC_DEV_ID_I225_IT:
 	case IGC_DEV_ID_I220_V:
 	case IGC_DEV_ID_I225_BLANK_NVM:
 	case IGC_DEV_ID_I226_K:
drivers/net/igc/base/igc_hw.h +0 -0
index 707a1883b4..e919a11c02 100644

drivers/net/igc/base/igc_hw.h struct igc_hw; · line 167

Quoted 4 lines
drivers/net/igc/base/igc_hw.h +1 -0
@@ -164,6 +164,7 @@ struct igc_hw;
 #define IGC_DEV_ID_I225_V			0x15F3
 #define IGC_DEV_ID_I225_K			0x3100
 #define IGC_DEV_ID_I225_I			0x15F8
+#define IGC_DEV_ID_I225_IT			0x0D9F

The patch's commit log claims to remove something,
but in code it also add some new device ID, could you clarify why we need this or it should be in a separate patch?

#2 lore raw
Quoted 19 lines

-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Tuesday, 30 August, 2022 7:17 PM
To: IOTG DPDK Ref App <[email protected]>; [email protected]
Subject: RE: [PATCH] IGC: Remove I225_I_PHY_ID checking

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Monday, August 29, 2022 4:15 PM
To: [email protected]
Subject: [PATCH] IGC: Remove I225_I_PHY_ID checking

From: NSWE SWS DPDK Dev <[email protected]>

i225 devices have only one PHY vendor. There is unnecessary to check _I_PHY_ID during the link establishment and auto-negotiation process, the checking also caused devices like i225-IT failed. This patch is to remove the mentioned unnecessary checking.

Quoted 4 lines

Is this the expected author name?

Yes, this is expected author name, the PDL email contain all developers working on the patch for better support and response.

Quoted 30 lines
---
 drivers/net/igc/base/igc_api.c  |  1 +
 drivers/net/igc/base/igc_hw.h   |  1 +
 drivers/net/igc/base/igc_i225.c | 15 ++------------- 
drivers/net/igc/base/igc_phy.c  |  6 ++----
 drivers/net/igc/igc_ethdev.c    |  1 +
 5 files changed, 7 insertions(+), 17 deletions(-)
(quoted diff) +0 -0

b/drivers/net/igc/base/igc_api.c index 9b791dc082..c9fc9ed4b0 100644

drivers/net/igc/base/igc_api.c +1 -0
@@ -886,6 +886,7 @@ s32 igc_set_mac_type(struct igc_hw *hw)
 	case IGC_DEV_ID_I225_V:
 	case IGC_DEV_ID_I225_K:
 	case IGC_DEV_ID_I225_I:
+	case IGC_DEV_ID_I225_IT:
 	case IGC_DEV_ID_I220_V:
 	case IGC_DEV_ID_I225_BLANK_NVM:
 	case IGC_DEV_ID_I226_K:
(quoted diff) +0 -0

b/drivers/net/igc/base/igc_hw.h index 707a1883b4..e919a11c02 100644

drivers/net/igc/base/igc_hw.h +1 -0
@@ -164,6 +164,7 @@ struct igc_hw;
 #define IGC_DEV_ID_I225_V			0x15F3
 #define IGC_DEV_ID_I225_K			0x3100
 #define IGC_DEV_ID_I225_I			0x15F8
+#define IGC_DEV_ID_I225_IT			0x0D9F
 
Quoted 1 line

The patch's commit log claims to remove something, but in code it also add some new device ID, could you clarify why we need this or it should be in a separate patch?

The checking issue was firstly discovered because of i225-IT not working on our lab and escalated to DPDK team for support, as informed by DPDK team after the patch sent, that the i225-IT device ID has been patched in DPDK next release, we'll send out v2 patch soon with only removing redundance checking without i225-IT device ID.

#3 lore raw
Quoted 20 lines · Yock Gen
Quoted 20 lines

-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Tuesday, 30 August, 2022 7:17 PM
To: IOTG DPDK Ref App <[email protected]>; [email protected]
Subject: RE: [PATCH] IGC: Remove I225_I_PHY_ID checking

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Monday, August 29, 2022 4:15 PM
To: [email protected]
Subject: [PATCH] IGC: Remove I225_I_PHY_ID checking

From: NSWE SWS DPDK Dev <[email protected]>

i225 devices have only one PHY vendor. There is unnecessary to check _I_PHY_ID during the link establishment and auto-negotiation process, the checking also caused devices like i225-IT failed. This patch is to remove the mentioned unnecessary checking.

Quoted 5 lines
Quoted 4 lines

Is this the expected author name?

Yes, this is expected author name, the PDL email contain all developers working on the patch for better support and response.

This is not acceptable.

https://doc.dpdk.org/guides/contributing/patches.html#commit-messages-body

It is clearly stated that:
"""
The signoff must be a real name and not an alias or nickname. More than one signoff is allowed.
"""

And all developers involved in the making of a patch must follow the Developer’s Certificate of Origin.
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#developer-s-certificate-of-origin-1-1

In its current form, this patch cannot be merged in the DPDK project.

Besides, please register to the @dev mailing list.

Signature · 1 line
David Marchand
#4 lore raw
Quoted 1 line · David Marchand

Besides, please register to the @dev mailing list.

Bis.

Please register to the @dev mailing list.

Signature · 1 line
David Marchand
#5 lore raw

PATCH v2 1/1 IGC: Remove I225_I_PHY_ID checking

In reply to [email protected]

From: NSWE SWS DPDK Dev <[email protected]>

i225 devices have only one PHY vendor. There is unnecessary to check _I_PHY_ID during the link establishment and auto-negotiation process, the checking also caused devices like i225-IT failed. This patch is to remove the mentioned unnecessary checking.

---
 drivers/net/igc/base/igc_i225.c | 15 ++-------------
 drivers/net/igc/base/igc_phy.c  |  6 ++----
 2 files changed, 4 insertions(+), 17 deletions(-)
drivers/net/igc/base/igc_i225.c +2 -13
index 5f3d535490..af26602afb 100644
@@ -173,19 +173,8 @@ static s32 igc_init_phy_params_i225(struct igc_hw *hw)
 	phy->ops.write_reg = igc_write_phy_reg_gpy;
 
 	ret_val = igc_get_phy_id(hw);
-	/* Verify phy id and set remaining function pointers */
-	switch (phy->id) {
-	case I225_I_PHY_ID:
-	case I226_LM_PHY_ID:
-		phy->type		= igc_phy_i225;
-		phy->ops.set_d0_lplu_state = igc_set_d0_lplu_state_i225;
-		phy->ops.set_d3_lplu_state = igc_set_d3_lplu_state_i225;
-		/* TODO - complete with GPY PHY information */
-		break;
-	default:
-		ret_val = -IGC_ERR_PHY;
-		goto out;
-	}
+        phy->type = igc_phy_i225;
+
 
 out:
 	return ret_val;
drivers/net/igc/base/igc_phy.c +2 -4
index 43bbe69bca..2906bae21a 100644
@@ -1474,8 +1474,7 @@ s32 igc_phy_setup_autoneg(struct igc_hw *hw)
 			return ret_val;
 	}
 
-	if ((phy->autoneg_mask & ADVERTISE_2500_FULL) &&
-	    hw->phy.id == I225_I_PHY_ID) {
+	if (phy->autoneg_mask & ADVERTISE_2500_FULL) {
 	/* Read the MULTI GBT AN Control Register - reg 7.32 */
 		ret_val = phy->ops.read_reg(hw, (STANDARD_AN_REG_MASK <<
 					    MMD_DEVADDR_SHIFT) |
@@ -1615,8 +1614,7 @@ s32 igc_phy_setup_autoneg(struct igc_hw *hw)
 		ret_val = phy->ops.write_reg(hw, PHY_1000T_CTRL,
 					     mii_1000t_ctrl_reg);
 
-	if ((phy->autoneg_mask & ADVERTISE_2500_FULL) &&
-	    hw->phy.id == I225_I_PHY_ID)
+	if (phy->autoneg_mask & ADVERTISE_2500_FULL)
 		ret_val = phy->ops.write_reg(hw,
 					     (STANDARD_AN_REG_MASK <<
 					     MMD_DEVADDR_SHIFT) |
Signature · 1 line
2.36.1
#6 lore raw

PATCH v3 1/1 IGC: Remove I225_I_PHY_ID checking

From: Mah Yock Gen <[email protected]>

i225 devices have only one PHY vendor. There is unnecessary to check _I_PHY_ID during the link establishment and auto-negotiation process, the checking also caused devices like i225-IT failed. This patch is to remove the mentioned unnecessary checking.

<changelog>

---
V3:
* Fixed coding style issue

V2:
* Removing i225-IT device id added in V1 patch, as it has been superseded

 drivers/net/igc/base/igc_i225.c | 15 ++-------------
 drivers/net/igc/base/igc_phy.c  |  6 ++----
 2 files changed, 4 insertions(+), 17 deletions(-)
drivers/net/igc/base/igc_i225.c +2 -13
index 5f3d535490..180d3cf687 100644
@@ -173,19 +173,8 @@ static s32 igc_init_phy_params_i225(struct igc_hw *hw)
 	phy->ops.write_reg = igc_write_phy_reg_gpy;
 
 	ret_val = igc_get_phy_id(hw);
-	/* Verify phy id and set remaining function pointers */
-	switch (phy->id) {
-	case I225_I_PHY_ID:
-	case I226_LM_PHY_ID:
-		phy->type		= igc_phy_i225;
-		phy->ops.set_d0_lplu_state = igc_set_d0_lplu_state_i225;
-		phy->ops.set_d3_lplu_state = igc_set_d3_lplu_state_i225;
-		/* TODO - complete with GPY PHY information */
-		break;
-	default:
-		ret_val = -IGC_ERR_PHY;
-		goto out;
-	}
+	phy->type = igc_phy_i225;
+
 
 out:
 	return ret_val;
drivers/net/igc/base/igc_phy.c +2 -4
index 43bbe69bca..2906bae21a 100644
@@ -1474,8 +1474,7 @@ s32 igc_phy_setup_autoneg(struct igc_hw *hw)
 			return ret_val;
 	}
 
-	if ((phy->autoneg_mask & ADVERTISE_2500_FULL) &&
-	    hw->phy.id == I225_I_PHY_ID) {
+	if (phy->autoneg_mask & ADVERTISE_2500_FULL) {
 	/* Read the MULTI GBT AN Control Register - reg 7.32 */
 		ret_val = phy->ops.read_reg(hw, (STANDARD_AN_REG_MASK <<
 					    MMD_DEVADDR_SHIFT) |
@@ -1615,8 +1614,7 @@ s32 igc_phy_setup_autoneg(struct igc_hw *hw)
 		ret_val = phy->ops.write_reg(hw, PHY_1000T_CTRL,
 					     mii_1000t_ctrl_reg);
 
-	if ((phy->autoneg_mask & ADVERTISE_2500_FULL) &&
-	    hw->phy.id == I225_I_PHY_ID)
+	if (phy->autoneg_mask & ADVERTISE_2500_FULL)
 		ret_val = phy->ops.write_reg(hw,
 					     (STANDARD_AN_REG_MASK <<
 					     MMD_DEVADDR_SHIFT) |
Signature · 1 line
2.36.1
Acked-by on v3 1/1 Applied
#7 lore raw
Quoted 18 lines

-----Original Message-----
From: Mah, Yock Gen <[email protected]>
Sent: Friday, September 2, 2022 8:18 AM
To: Zhang, Qi Z <[email protected]>
Cc: [email protected]
Subject: [PATCH v3] IGC: Remove I225_I_PHY_ID checking

From: Mah Yock Gen <[email protected]>

i225 devices have only one PHY vendor. There is unnecessary to check _I_PHY_ID during the link establishment and auto-negotiation process, the checking also caused devices like i225-IT failed. This patch is to remove the mentioned unnecessary checking.

Quoted 7 lines

<changelog>

Applied to dpdk-next-net-intel with below minor changes.

1. rename title to "remove unnecessary PHY ID checking" to fix check-git-log warning
2. remove "<change log>" tag
3. remove duplicated "Signed-off-by"

Thanks
Qi

#8 lore raw
In reply to [email protected]
Quoted 19 lines · On 31/08/2022 23:51, [email protected] wrote:

From: NSWE SWS DPDK Dev <[email protected]>

i225 devices have only one PHY vendor. There is unnecessary to check _I_PHY_ID during the link establishment and auto-negotiation process, the checking also caused devices like i225-IT failed. This patch is to remove the mentioned unnecessary checking.

---
  drivers/net/igc/base/igc_i225.c | 15 ++-------------
  drivers/net/igc/base/igc_phy.c  |  6 ++----
  2 files changed, 4 insertions(+), 17 deletions(-)
drivers/net/igc/base/igc_i225.c +0 -0
index 5f3d535490..af26602afb 100644

drivers/net/igc/base/igc_i225.c static s32 igc_init_phy_params_i225(struct igc_hw *hw) · line 182

Quoted 10 lines
drivers/net/igc/base/igc_i225.c +0 -7
@@ -173,19 +173,8 @@ static s32 igc_init_phy_params_i225(struct igc_hw *hw)
  	phy->ops.write_reg = igc_write_phy_reg_gpy;
 
  	ret_val = igc_get_phy_id(hw);
-	/* Verify phy id and set remaining function pointers */
-	switch (phy->id) {
-	case I225_I_PHY_ID:
-	case I226_LM_PHY_ID:
-		phy->type		= igc_phy_i225;
-		phy->ops.set_d0_lplu_state = igc_set_d0_lplu_state_i225;
-		phy->ops.set_d3_lplu_state = igc_set_d3_lplu_state_i225;

The commit log says it is removing a check on the ID, but it does not say why these function pointers are being removed.

Why are they removed, were they not needed?

Quoted 35 lines
drivers/net/igc/base/igc_i225.c +2 -6
-		/* TODO - complete with GPY PHY information */
-		break;
-	default:
-		ret_val = -IGC_ERR_PHY;
-		goto out;
-	}
+        phy->type = igc_phy_i225;
+
 
  out:
  	return ret_val;
drivers/net/igc/base/igc_phy.c +2 -4
index 43bbe69bca..2906bae21a 100644
@@ -1474,8 +1474,7 @@ s32 igc_phy_setup_autoneg(struct igc_hw *hw)
  			return ret_val;
  	}
 
-	if ((phy->autoneg_mask & ADVERTISE_2500_FULL) &&
-	    hw->phy.id == I225_I_PHY_ID) {
+	if (phy->autoneg_mask & ADVERTISE_2500_FULL) {
  	/* Read the MULTI GBT AN Control Register - reg 7.32 */
  		ret_val = phy->ops.read_reg(hw, (STANDARD_AN_REG_MASK <<
  					    MMD_DEVADDR_SHIFT) |
@@ -1615,8 +1614,7 @@ s32 igc_phy_setup_autoneg(struct igc_hw *hw)
  		ret_val = phy->ops.write_reg(hw, PHY_1000T_CTRL,
  					     mii_1000t_ctrl_reg);
 
-	if ((phy->autoneg_mask & ADVERTISE_2500_FULL) &&
-	    hw->phy.id == I225_I_PHY_ID)
+	if (phy->autoneg_mask & ADVERTISE_2500_FULL)
  		ret_val = phy->ops.write_reg(hw,
  					     (STANDARD_AN_REG_MASK <<
  					     MMD_DEVADDR_SHIFT) |
#9 lore raw

-----Original Message-----
From: Kevin Traynor <[email protected]>
Sent: Tuesday, 11 October, 2022 7:05 PM
To: IOTG DPDK Ref App <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v2] IGC: Remove I225_I_PHY_ID checking

Quoted 23 lines · On 31/08/2022 23:51, [email protected] wrote:

From: NSWE SWS DPDK Dev <[email protected]>

i225 devices have only one PHY vendor. There is unnecessary to check _I_PHY_ID during the link establishment and auto-negotiation process, the checking also caused devices like i225-IT failed. This patch is to remove the mentioned unnecessary checking.

---
  drivers/net/igc/base/igc_i225.c | 15 ++-------------
  drivers/net/igc/base/igc_phy.c  |  6 ++----
  2 files changed, 4 insertions(+), 17 deletions(-)
(quoted diff) +0 -0

b/drivers/net/igc/base/igc_i225.c index 5f3d535490..af26602afb 100644

drivers/net/igc/base/igc_i225.c +0 -1
@@ -173,19 +173,8 @@ static s32 igc_init_phy_params_i225(struct igc_hw *hw)
  	phy->ops.write_reg = igc_write_phy_reg_gpy;
 
  	ret_val = igc_get_phy_id(hw);
-	/* Verify phy id and set remaining function pointers */

drivers/net/igc/base/igc_i225.c static s32 igc_init_phy_params_i225(struct igc_hw *hw) · line 186

Quoted 10 lines
drivers/net/igc/base/igc_i225.c +0 -8
-	switch (phy->id) {
-	case I225_I_PHY_ID:
-	case I226_LM_PHY_ID:
-		phy->type		= igc_phy_i225;
-		phy->ops.set_d0_lplu_state = igc_set_d0_lplu_state_i225;
-		phy->ops.set_d3_lplu_state = igc_set_d3_lplu_state_i225;
 
- The commit log says it is removing a check on the ID, but it does not say why these function pointers are being removed.
 
- Why are they removed, were they not needed?

i225 devices have only one PHY vendor. There is no point checking _I_PHY_ID during the link establishment and auto-negotiation process.

Quoted 35 lines
drivers/net/igc/base/igc_i225.c +2 -6
-		/* TODO - complete with GPY PHY information */
-		break;
-	default:
-		ret_val = -IGC_ERR_PHY;
-		goto out;
-	}
+        phy->type = igc_phy_i225;
+
 
  out:
  	return ret_val;
(quoted diff) +0 -0

b/drivers/net/igc/base/igc_phy.c index 43bbe69bca..2906bae21a 100644

drivers/net/igc/base/igc_phy.c +2 -4
@@ -1474,8 +1474,7 @@ s32 igc_phy_setup_autoneg(struct igc_hw *hw)
  			return ret_val;
  	}
 
-	if ((phy->autoneg_mask & ADVERTISE_2500_FULL) &&
-	    hw->phy.id == I225_I_PHY_ID) {
+	if (phy->autoneg_mask & ADVERTISE_2500_FULL) {
  	/* Read the MULTI GBT AN Control Register - reg 7.32 */
  		ret_val = phy->ops.read_reg(hw, (STANDARD_AN_REG_MASK <<
  					    MMD_DEVADDR_SHIFT) |
@@ -1615,8 +1614,7 @@ s32 igc_phy_setup_autoneg(struct igc_hw *hw)
  		ret_val = phy->ops.write_reg(hw, PHY_1000T_CTRL,
  					     mii_1000t_ctrl_reg);
 
-	if ((phy->autoneg_mask & ADVERTISE_2500_FULL) &&
-	    hw->phy.id == I225_I_PHY_ID)
+	if (phy->autoneg_mask & ADVERTISE_2500_FULL)
  		ret_val = phy->ops.write_reg(hw,
  					     (STANDARD_AN_REG_MASK <<
  					     MMD_DEVADDR_SHIFT) |
#10 lore raw
Quoted 40 lines · Yock Gen

-----Original Message-----
From: Kevin Traynor <[email protected]>
Sent: Tuesday, 11 October, 2022 7:05 PM
To: IOTG DPDK Ref App <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v2] IGC: Remove I225_I_PHY_ID checking

Quoted 29 lines · On 31/08/2022 23:51, [email protected] wrote:

From: NSWE SWS DPDK Dev <[email protected]>

i225 devices have only one PHY vendor. There is unnecessary to check _I_PHY_ID during the link establishment and auto-negotiation process, the checking also caused devices like i225-IT failed. This patch is to remove the mentioned unnecessary checking.

---
   drivers/net/igc/base/igc_i225.c | 15 ++-------------
   drivers/net/igc/base/igc_phy.c  |  6 ++----
   2 files changed, 4 insertions(+), 17 deletions(-)
(quoted diff) +0 -0

b/drivers/net/igc/base/igc_i225.c index 5f3d535490..af26602afb 100644

drivers/net/igc/base/igc_i225.c +0 -7
@@ -173,19 +173,8 @@ static s32 igc_init_phy_params_i225(struct igc_hw *hw)
   	phy->ops.write_reg = igc_write_phy_reg_gpy;
 
   	ret_val = igc_get_phy_id(hw);
-	/* Verify phy id and set remaining function pointers */
-	switch (phy->id) {
-	case I225_I_PHY_ID:
-	case I226_LM_PHY_ID:
-		phy->type		= igc_phy_i225;
-		phy->ops.set_d0_lplu_state = igc_set_d0_lplu_state_i225;
-		phy->ops.set_d3_lplu_state = igc_set_d3_lplu_state_i225;
Quoted 7 lines

drivers/net/igc/base/igc_i225.c static s32 igc_init_phy_params_i225(struct igc_hw *hw) · line 185

Quoted 3 lines
drivers/net/igc/base/igc_i225.c +0 -2
- The commit log says it is removing a check on the ID, but it does not say why these function pointers are being removed.
 
- Why are they removed, were they not needed?

i225 devices have only one PHY vendor. There is no point checking _I_PHY_ID during the link establishment and auto-negotiation process.

Right, that's clear about the vendor ID check. But it's not clear to me why the the resulting code like this:

phy->type = igc_phy_i225;

and not like this:

phy->type = igc_phy_i225; phy->ops.set_d0_lplu_state = igc_set_d0_lplu_state_i225; phy->ops.set_d3_lplu_state = igc_set_d3_lplu_state_i225;

So it is using dummy null functions instead:
https://git.dpdk.org/dpdk/tree/drivers/net/igc/base/igc_phy.c#n61

Do the device registers not need to be set anymore?

Quoted 36 lines
Quoted 35 lines
drivers/net/igc/base/igc_i225.c +2 -6
-		/* TODO - complete with GPY PHY information */
-		break;
-	default:
-		ret_val = -IGC_ERR_PHY;
-		goto out;
-	}
+        phy->type = igc_phy_i225;
+
 
   out:
   	return ret_val;
(quoted diff) +0 -0

b/drivers/net/igc/base/igc_phy.c index 43bbe69bca..2906bae21a 100644

drivers/net/igc/base/igc_phy.c +2 -4
@@ -1474,8 +1474,7 @@ s32 igc_phy_setup_autoneg(struct igc_hw *hw)
   			return ret_val;
   	}
 
-	if ((phy->autoneg_mask & ADVERTISE_2500_FULL) &&
-	    hw->phy.id == I225_I_PHY_ID) {
+	if (phy->autoneg_mask & ADVERTISE_2500_FULL) {
   	/* Read the MULTI GBT AN Control Register - reg 7.32 */
   		ret_val = phy->ops.read_reg(hw, (STANDARD_AN_REG_MASK <<
   					    MMD_DEVADDR_SHIFT) |
@@ -1615,8 +1614,7 @@ s32 igc_phy_setup_autoneg(struct igc_hw *hw)
   		ret_val = phy->ops.write_reg(hw, PHY_1000T_CTRL,
   					     mii_1000t_ctrl_reg);
 
-	if ((phy->autoneg_mask & ADVERTISE_2500_FULL) &&
-	    hw->phy.id == I225_I_PHY_ID)
+	if (phy->autoneg_mask & ADVERTISE_2500_FULL)
   		ret_val = phy->ops.write_reg(hw,
   					     (STANDARD_AN_REG_MASK <<
   					     MMD_DEVADDR_SHIFT) |
#11 lore raw
Quoted 56 lines · Kevin Traynor
Quoted 40 lines · Yock Gen

-----Original Message-----
From: Kevin Traynor <[email protected]>
Sent: Tuesday, 11 October, 2022 7:05 PM
To: IOTG DPDK Ref App <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v2] IGC: Remove I225_I_PHY_ID checking

Quoted 29 lines · On 31/08/2022 23:51, [email protected] wrote:

From: NSWE SWS DPDK Dev <[email protected]>

i225 devices have only one PHY vendor. There is unnecessary to check _I_PHY_ID during the link establishment and auto-negotiation process, the checking also caused devices like i225-IT failed. This patch is to remove the mentioned unnecessary checking.

---
    drivers/net/igc/base/igc_i225.c | 15 ++-------------
    drivers/net/igc/base/igc_phy.c  |  6 ++----
    2 files changed, 4 insertions(+), 17 deletions(-)
(quoted diff) +0 -0

b/drivers/net/igc/base/igc_i225.c index 5f3d535490..af26602afb 100644

drivers/net/igc/base/igc_i225.c +0 -7
@@ -173,19 +173,8 @@ static s32 igc_init_phy_params_i225(struct igc_hw *hw)
    	phy->ops.write_reg = igc_write_phy_reg_gpy;
 
    	ret_val = igc_get_phy_id(hw);
-	/* Verify phy id and set remaining function pointers */
-	switch (phy->id) {
-	case I225_I_PHY_ID:
-	case I226_LM_PHY_ID:
-		phy->type		= igc_phy_i225;
-		phy->ops.set_d0_lplu_state = igc_set_d0_lplu_state_i225;
-		phy->ops.set_d3_lplu_state = igc_set_d3_lplu_state_i225;
Quoted 7 lines

drivers/net/igc/base/igc_i225.c static s32 igc_init_phy_params_i225(struct igc_hw *hw) · line 185

Quoted 3 lines
drivers/net/igc/base/igc_i225.c +0 -2
- The commit log says it is removing a check on the ID, but it does not say why these function pointers are being removed.
 
- Why are they removed, were they not needed?

i225 devices have only one PHY vendor. There is no point checking _I_PHY_ID during the link establishment and auto-negotiation process.

Right, that's clear about the vendor ID check. But it's not clear to me why the the resulting code like this:

phy->type = igc_phy_i225;

and not like this:

Quoted 9 lines

phy->type = igc_phy_i225; phy->ops.set_d0_lplu_state = igc_set_d0_lplu_state_i225; phy->ops.set_d3_lplu_state = igc_set_d3_lplu_state_i225;

So it is using dummy null functions instead:
https://git.dpdk.org/dpdk/tree/drivers/net/igc/base/igc_phy.c#n61

Do the device registers not need to be set anymore?

For main branch, it would be nice to have an answer to above.

It only adds a small readability benefit by removing some code branches, but does change functionality which adds risk, so I don't think it's a good candidate for stable branches.

Quoted 37 lines
Quoted 36 lines
Quoted 35 lines
drivers/net/igc/base/igc_i225.c +2 -6
-		/* TODO - complete with GPY PHY information */
-		break;
-	default:
-		ret_val = -IGC_ERR_PHY;
-		goto out;
-	}
+        phy->type = igc_phy_i225;
+
 
    out:
    	return ret_val;
(quoted diff) +0 -0

b/drivers/net/igc/base/igc_phy.c index 43bbe69bca..2906bae21a 100644

drivers/net/igc/base/igc_phy.c +2 -4
@@ -1474,8 +1474,7 @@ s32 igc_phy_setup_autoneg(struct igc_hw *hw)
    			return ret_val;
    	}
 
-	if ((phy->autoneg_mask & ADVERTISE_2500_FULL) &&
-	    hw->phy.id == I225_I_PHY_ID) {
+	if (phy->autoneg_mask & ADVERTISE_2500_FULL) {
    	/* Read the MULTI GBT AN Control Register - reg 7.32 */
    		ret_val = phy->ops.read_reg(hw, (STANDARD_AN_REG_MASK <<
    					    MMD_DEVADDR_SHIFT) |
@@ -1615,8 +1614,7 @@ s32 igc_phy_setup_autoneg(struct igc_hw *hw)
    		ret_val = phy->ops.write_reg(hw, PHY_1000T_CTRL,
    					     mii_1000t_ctrl_reg);
 
-	if ((phy->autoneg_mask & ADVERTISE_2500_FULL) &&
-	    hw->phy.id == I225_I_PHY_ID)
+	if (phy->autoneg_mask & ADVERTISE_2500_FULL)
    		ret_val = phy->ops.write_reg(hw,
    					     (STANDARD_AN_REG_MASK <<
    					     MMD_DEVADDR_SHIFT) |
#12 lore raw

-----Original Message-----
From: Kevin Traynor <[email protected]>
Sent: Tuesday, 18 October, 2022 8:54 PM
To: Mah, Yock Gen <[email protected]>; IOTG DPDK Ref App <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v2] IGC: Remove I225_I_PHY_ID checking

Quoted 65 lines · Kevin Traynor
Quoted 42 lines · Yock Gen

-----Original Message-----
From: Kevin Traynor <[email protected]>
Sent: Tuesday, 11 October, 2022 7:05 PM
To: IOTG DPDK Ref App <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v2] IGC: Remove I225_I_PHY_ID checking

Quoted 30 lines · On 31/08/2022 23:51, [email protected] wrote:

From: NSWE SWS DPDK Dev <[email protected]>

i225 devices have only one PHY vendor. There is unnecessary to check _I_PHY_ID during the link establishment and auto-negotiation process, the checking also caused devices like i225-IT failed. This patch is to remove the mentioned unnecessary checking.

---
    drivers/net/igc/base/igc_i225.c | 15 ++-------------
    drivers/net/igc/base/igc_phy.c  |  6 ++----
    2 files changed, 4 insertions(+), 17 deletions(-)
(quoted diff) +0 -0

b/drivers/net/igc/base/igc_i225.c index 5f3d535490..af26602afb 100644

drivers/net/igc/base/igc_i225.c +0 -7
@@ -173,19 +173,8 @@ static s32 igc_init_phy_params_i225(struct igc_hw *hw)
    	phy->ops.write_reg = igc_write_phy_reg_gpy;
 
    	ret_val = igc_get_phy_id(hw);
-	/* Verify phy id and set remaining function pointers */
-	switch (phy->id) {
-	case I225_I_PHY_ID:
-	case I226_LM_PHY_ID:
-		phy->type		= igc_phy_i225;
-		phy->ops.set_d0_lplu_state = igc_set_d0_lplu_state_i225;
-		phy->ops.set_d3_lplu_state = igc_set_d3_lplu_state_i225;
Quoted 7 lines

drivers/net/igc/base/igc_i225.c static s32 igc_init_phy_params_i225(struct igc_hw *hw) · line 185

Quoted 3 lines
drivers/net/igc/base/igc_i225.c +0 -2
- The commit log says it is removing a check on the ID, but it does not say why these function pointers are being removed.
 
- Why are they removed, were they not needed?

i225 devices have only one PHY vendor. There is no point checking _I_PHY_ID during the link establishment and auto-negotiation process.

Right, that's clear about the vendor ID check. But it's not clear to me why the the resulting code like this:

phy->type = igc_phy_i225;

and not like this:

phy->type = igc_phy_i225; phy->ops.set_d0_lplu_state = igc_set_d0_lplu_state_i225; phy->ops.set_d3_lplu_state = igc_set_d3_lplu_state_i225;

So it is using dummy null functions instead:
https://git.dpdk.org/dpdk/tree/drivers/net/igc/base/igc_phy.c#n61

Quoted 6 lines

Do the device registers not need to be set anymore?

For main branch, it would be nice to have an answer to above.

It only adds a small readability benefit by removing some code branches, but does change functionality which adds risk, so I don't think it's a good candidate for stable branches.

This is not only added readability, but to fix real world issue, we were experiencing i225-IT not runnable issue without patching another case checking as below:

+++ b/drivers/net/igc/base/igc_phy.c
@@ -1881,6 +1881,7 @@ s32 igc_phy_force_speed_duplex_m88(struct igc_hw *hw)

                                case I210_I_PHY_ID:
                                /* fall-through */
                                case I225_I_PHY_ID:

+ case I225_IT_PHY_ID:

However, cleaner solution is to remove those unnecessary checking completely as it does in kernel also https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7c496de538eebd8212dc2a3c9a468386b264d0d4

Quoted 37 lines
Quoted 36 lines
Quoted 35 lines
drivers/net/igc/base/igc_i225.c +2 -6
-		/* TODO - complete with GPY PHY information */
-		break;
-	default:
-		ret_val = -IGC_ERR_PHY;
-		goto out;
-	}
+        phy->type = igc_phy_i225;
+
 
    out:
    	return ret_val;
(quoted diff) +0 -0

b/drivers/net/igc/base/igc_phy.c index 43bbe69bca..2906bae21a 100644

drivers/net/igc/base/igc_phy.c +2 -4
@@ -1474,8 +1474,7 @@ s32 igc_phy_setup_autoneg(struct igc_hw *hw)
    			return ret_val;
    	}
 
-	if ((phy->autoneg_mask & ADVERTISE_2500_FULL) &&
-	    hw->phy.id == I225_I_PHY_ID) {
+	if (phy->autoneg_mask & ADVERTISE_2500_FULL) {
    	/* Read the MULTI GBT AN Control Register - reg 7.32 */
    		ret_val = phy->ops.read_reg(hw, (STANDARD_AN_REG_MASK <<
    					    MMD_DEVADDR_SHIFT) |
@@ -1615,8 +1614,7 @@ s32 igc_phy_setup_autoneg(struct igc_hw *hw)
    		ret_val = phy->ops.write_reg(hw, PHY_1000T_CTRL,
    					     mii_1000t_ctrl_reg);
 
-	if ((phy->autoneg_mask & ADVERTISE_2500_FULL) &&
-	    hw->phy.id == I225_I_PHY_ID)
+	if (phy->autoneg_mask & ADVERTISE_2500_FULL)
    		ret_val = phy->ops.write_reg(hw,
    					     (STANDARD_AN_REG_MASK <<
    					     MMD_DEVADDR_SHIFT) |
#13 lore raw
Quoted 91 lines · Yock Gen

-----Original Message-----
From: Kevin Traynor <[email protected]>
Sent: Tuesday, 18 October, 2022 8:54 PM
To: Mah, Yock Gen <[email protected]>; IOTG DPDK Ref App <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v2] IGC: Remove I225_I_PHY_ID checking

Quoted 65 lines · Kevin Traynor
Quoted 42 lines · Yock Gen

-----Original Message-----
From: Kevin Traynor <[email protected]>
Sent: Tuesday, 11 October, 2022 7:05 PM
To: IOTG DPDK Ref App <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v2] IGC: Remove I225_I_PHY_ID checking

Quoted 30 lines · On 31/08/2022 23:51, [email protected] wrote:

From: NSWE SWS DPDK Dev <[email protected]>

i225 devices have only one PHY vendor. There is unnecessary to check _I_PHY_ID during the link establishment and auto-negotiation process, the checking also caused devices like i225-IT failed. This patch is to remove the mentioned unnecessary checking.

---
     drivers/net/igc/base/igc_i225.c | 15 ++-------------
     drivers/net/igc/base/igc_phy.c  |  6 ++----
     2 files changed, 4 insertions(+), 17 deletions(-)
(quoted diff) +0 -0

b/drivers/net/igc/base/igc_i225.c index 5f3d535490..af26602afb 100644

drivers/net/igc/base/igc_i225.c +0 -7
@@ -173,19 +173,8 @@ static s32 igc_init_phy_params_i225(struct igc_hw *hw)
     	phy->ops.write_reg = igc_write_phy_reg_gpy;
 
     	ret_val = igc_get_phy_id(hw);
-	/* Verify phy id and set remaining function pointers */
-	switch (phy->id) {
-	case I225_I_PHY_ID:
-	case I226_LM_PHY_ID:
-		phy->type		= igc_phy_i225;
-		phy->ops.set_d0_lplu_state = igc_set_d0_lplu_state_i225;
-		phy->ops.set_d3_lplu_state = igc_set_d3_lplu_state_i225;
Quoted 7 lines

drivers/net/igc/base/igc_i225.c static s32 igc_init_phy_params_i225(struct igc_hw *hw) · line 185

Quoted 3 lines
drivers/net/igc/base/igc_i225.c +0 -2
- The commit log says it is removing a check on the ID, but it does not say why these function pointers are being removed.
 
- Why are they removed, were they not needed?

i225 devices have only one PHY vendor. There is no point checking _I_PHY_ID during the link establishment and auto-negotiation process.

Right, that's clear about the vendor ID check. But it's not clear to me why the the resulting code like this:

phy->type = igc_phy_i225;

and not like this:

phy->type = igc_phy_i225; phy->ops.set_d0_lplu_state = igc_set_d0_lplu_state_i225; phy->ops.set_d3_lplu_state = igc_set_d3_lplu_state_i225;

So it is using dummy null functions instead:
https://git.dpdk.org/dpdk/tree/drivers/net/igc/base/igc_phy.c#n61

Quoted 6 lines

Do the device registers not need to be set anymore?

For main branch, it would be nice to have an answer to above.

It only adds a small readability benefit by removing some code branches, but does change functionality which adds risk, so I don't think it's a good candidate for stable branches.

This is not only added readability, but to fix real world issue, we were experiencing i225-IT not runnable issue without patching another case checking as below:

+++ b/drivers/net/igc/base/igc_phy.c

(quoted diff) +1 -0
@@ -1881,6 +1881,7 @@ s32 igc_phy_force_speed_duplex_m88(struct igc_hw *hw)
                                 case I210_I_PHY_ID:
                                 /* fall-through */
                                 case I225_I_PHY_ID:
+                              case I225_IT_PHY_ID:
 
Quoted 2 lines

However, cleaner solution is to remove those unnecessary checking completely as it does in kernel also https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7c496de538eebd8212dc2a3c9a468386b264d0d4

ok, you are correct that it is more than readability. I can apply but first it would be good if you can answer the original question and explain why the functionality is changed for I225_I_PHY_ID by removing the function pointers that set the registers.

Quoted 38 lines
Quoted 37 lines
Quoted 36 lines
Quoted 35 lines
drivers/net/igc/base/igc_i225.c +2 -6
-		/* TODO - complete with GPY PHY information */
-		break;
-	default:
-		ret_val = -IGC_ERR_PHY;
-		goto out;
-	}
+        phy->type = igc_phy_i225;
+
 
     out:
     	return ret_val;
(quoted diff) +0 -0

b/drivers/net/igc/base/igc_phy.c index 43bbe69bca..2906bae21a 100644

drivers/net/igc/base/igc_phy.c +2 -4
@@ -1474,8 +1474,7 @@ s32 igc_phy_setup_autoneg(struct igc_hw *hw)
     			return ret_val;
     	}
 
-	if ((phy->autoneg_mask & ADVERTISE_2500_FULL) &&
-	    hw->phy.id == I225_I_PHY_ID) {
+	if (phy->autoneg_mask & ADVERTISE_2500_FULL) {
     	/* Read the MULTI GBT AN Control Register - reg 7.32 */
     		ret_val = phy->ops.read_reg(hw, (STANDARD_AN_REG_MASK <<
     					    MMD_DEVADDR_SHIFT) |
@@ -1615,8 +1614,7 @@ s32 igc_phy_setup_autoneg(struct igc_hw *hw)
     		ret_val = phy->ops.write_reg(hw, PHY_1000T_CTRL,
     					     mii_1000t_ctrl_reg);
 
-	if ((phy->autoneg_mask & ADVERTISE_2500_FULL) &&
-	    hw->phy.id == I225_I_PHY_ID)
+	if (phy->autoneg_mask & ADVERTISE_2500_FULL)
     		ret_val = phy->ops.write_reg(hw,
     					     (STANDARD_AN_REG_MASK <<
     					     MMD_DEVADDR_SHIFT) |
#14 lore raw
Quoted 92 lines · Kevin Traynor
Quoted 91 lines · Yock Gen

-----Original Message-----
From: Kevin Traynor <[email protected]>
Sent: Tuesday, 18 October, 2022 8:54 PM
To: Mah, Yock Gen <[email protected]>; IOTG DPDK Ref App <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v2] IGC: Remove I225_I_PHY_ID checking

Quoted 65 lines · Kevin Traynor
Quoted 42 lines · Yock Gen

-----Original Message-----
From: Kevin Traynor <[email protected]>
Sent: Tuesday, 11 October, 2022 7:05 PM
To: IOTG DPDK Ref App <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v2] IGC: Remove I225_I_PHY_ID checking

Quoted 30 lines · On 31/08/2022 23:51, [email protected] wrote:

From: NSWE SWS DPDK Dev <[email protected]>

i225 devices have only one PHY vendor. There is unnecessary to check _I_PHY_ID during the link establishment and auto-negotiation process, the checking also caused devices like i225-IT failed. This patch is to remove the mentioned unnecessary checking.

---
      drivers/net/igc/base/igc_i225.c | 15 ++-------------
      drivers/net/igc/base/igc_phy.c  |  6 ++----
      2 files changed, 4 insertions(+), 17 deletions(-)
(quoted diff) +0 -0

b/drivers/net/igc/base/igc_i225.c index 5f3d535490..af26602afb 100644

drivers/net/igc/base/igc_i225.c +0 -7
@@ -173,19 +173,8 @@ static s32 igc_init_phy_params_i225(struct igc_hw *hw)
      	phy->ops.write_reg = igc_write_phy_reg_gpy;
 
      	ret_val = igc_get_phy_id(hw);
-	/* Verify phy id and set remaining function pointers */
-	switch (phy->id) {
-	case I225_I_PHY_ID:
-	case I226_LM_PHY_ID:
-		phy->type		= igc_phy_i225;
-		phy->ops.set_d0_lplu_state = igc_set_d0_lplu_state_i225;
-		phy->ops.set_d3_lplu_state = igc_set_d3_lplu_state_i225;
Quoted 7 lines

drivers/net/igc/base/igc_i225.c static s32 igc_init_phy_params_i225(struct igc_hw *hw) · line 185

Quoted 3 lines
drivers/net/igc/base/igc_i225.c +0 -2
- The commit log says it is removing a check on the ID, but it does not say why these function pointers are being removed.
 
- Why are they removed, were they not needed?

i225 devices have only one PHY vendor. There is no point checking _I_PHY_ID during the link establishment and auto-negotiation process.

Right, that's clear about the vendor ID check. But it's not clear to me why the the resulting code like this:

phy->type = igc_phy_i225;

and not like this:

phy->type = igc_phy_i225; phy->ops.set_d0_lplu_state = igc_set_d0_lplu_state_i225; phy->ops.set_d3_lplu_state = igc_set_d3_lplu_state_i225;

So it is using dummy null functions instead:
https://git.dpdk.org/dpdk/tree/drivers/net/igc/base/igc_phy.c#n61

Quoted 6 lines

Do the device registers not need to be set anymore?

For main branch, it would be nice to have an answer to above.

It only adds a small readability benefit by removing some code branches, but does change functionality which adds risk, so I don't think it's a good candidate for stable branches.

This is not only added readability, but to fix real world issue, we were experiencing i225-IT not runnable issue without patching another case checking as below:

+++ b/drivers/net/igc/base/igc_phy.c

(quoted diff) +1 -0
@@ -1881,6 +1881,7 @@ s32 igc_phy_force_speed_duplex_m88(struct igc_hw *hw)
                                  case I210_I_PHY_ID:
                                  /* fall-through */
                                  case I225_I_PHY_ID:
+                              case I225_IT_PHY_ID:
 
Quoted 8 lines
Quoted 2 lines

However, cleaner solution is to remove those unnecessary checking completely as it does in kernel also https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7c496de538eebd8212dc2a3c9a468386b264d0d4

ok, you are correct that it is more than readability. I can apply but first it would be good if you can answer the original question and explain why the functionality is changed for I225_I_PHY_ID by removing the function pointers that set the registers.

Hi, I didn't apply this to DPDK 21.11.3 because there was no explanation of why the registers were changing after asking multiple times.

If it is required for a later 21.11 LTS release, please send a backport to stable mailing list with an updated commit message explaining the changes.

thanks,
Kevin.

Quoted 39 lines
Quoted 38 lines
Quoted 37 lines
Quoted 36 lines
Quoted 35 lines
drivers/net/igc/base/igc_i225.c +2 -6
-		/* TODO - complete with GPY PHY information */
-		break;
-	default:
-		ret_val = -IGC_ERR_PHY;
-		goto out;
-	}
+        phy->type = igc_phy_i225;
+
 
      out:
      	return ret_val;
(quoted diff) +0 -0

b/drivers/net/igc/base/igc_phy.c index 43bbe69bca..2906bae21a 100644

drivers/net/igc/base/igc_phy.c +2 -4
@@ -1474,8 +1474,7 @@ s32 igc_phy_setup_autoneg(struct igc_hw *hw)
      			return ret_val;
      	}
 
-	if ((phy->autoneg_mask & ADVERTISE_2500_FULL) &&
-	    hw->phy.id == I225_I_PHY_ID) {
+	if (phy->autoneg_mask & ADVERTISE_2500_FULL) {
      	/* Read the MULTI GBT AN Control Register - reg 7.32 */
      		ret_val = phy->ops.read_reg(hw, (STANDARD_AN_REG_MASK <<
      					    MMD_DEVADDR_SHIFT) |
@@ -1615,8 +1614,7 @@ s32 igc_phy_setup_autoneg(struct igc_hw *hw)
      		ret_val = phy->ops.write_reg(hw, PHY_1000T_CTRL,
      					     mii_1000t_ctrl_reg);
 
-	if ((phy->autoneg_mask & ADVERTISE_2500_FULL) &&
-	    hw->phy.id == I225_I_PHY_ID)
+	if (phy->autoneg_mask & ADVERTISE_2500_FULL)
      		ret_val = phy->ops.write_reg(hw,
      					     (STANDARD_AN_REG_MASK <<
      					     MMD_DEVADDR_SHIFT) |
#15 lore raw

-----Original Message-----
From: Kevin Traynor <[email protected]>
Sent: Tuesday, 20 December, 2022 11:48 PM
To: Mah, Yock Gen <[email protected]>; IOTG DPDK Ref App <[email protected]>; Zhang, Qi Z <[email protected]>; Taripin, Samuel <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v2] IGC: Remove I225_I_PHY_ID checking

Quoted 105 lines · Kevin Traynor
Quoted 92 lines · Yock Gen

-----Original Message-----
From: Kevin Traynor <[email protected]>
Sent: Tuesday, 18 October, 2022 8:54 PM
To: Mah, Yock Gen <[email protected]>; IOTG DPDK Ref App <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v2] IGC: Remove I225_I_PHY_ID checking

Quoted 65 lines · Kevin Traynor
Quoted 42 lines · Yock Gen

-----Original Message-----
From: Kevin Traynor <[email protected]>
Sent: Tuesday, 11 October, 2022 7:05 PM
To: IOTG DPDK Ref App <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v2] IGC: Remove I225_I_PHY_ID checking

Quoted 30 lines · On 31/08/2022 23:51, [email protected] wrote:

From: NSWE SWS DPDK Dev <[email protected]>

i225 devices have only one PHY vendor. There is unnecessary to check _I_PHY_ID during the link establishment and auto-negotiation process, the checking also caused devices like i225-IT failed. This patch is to remove the mentioned unnecessary checking.

---
      drivers/net/igc/base/igc_i225.c | 15 ++-------------
      drivers/net/igc/base/igc_phy.c  |  6 ++----
      2 files changed, 4 insertions(+), 17 deletions(-)
(quoted diff) +0 -0

b/drivers/net/igc/base/igc_i225.c index 5f3d535490..af26602afb 100644

drivers/net/igc/base/igc_i225.c +0 -7
@@ -173,19 +173,8 @@ static s32 igc_init_phy_params_i225(struct igc_hw *hw)
      	phy->ops.write_reg = igc_write_phy_reg_gpy;
 
      	ret_val = igc_get_phy_id(hw);
-	/* Verify phy id and set remaining function pointers */
-	switch (phy->id) {
-	case I225_I_PHY_ID:
-	case I226_LM_PHY_ID:
-		phy->type		= igc_phy_i225;
-		phy->ops.set_d0_lplu_state = igc_set_d0_lplu_state_i225;
-		phy->ops.set_d3_lplu_state = igc_set_d3_lplu_state_i225;
Quoted 7 lines

drivers/net/igc/base/igc_i225.c static s32 igc_init_phy_params_i225(struct igc_hw *hw) · line 185

Quoted 3 lines
drivers/net/igc/base/igc_i225.c +0 -2
- The commit log says it is removing a check on the ID, but it does not say why these function pointers are being removed.
 
- Why are they removed, were they not needed?

i225 devices have only one PHY vendor. There is no point checking _I_PHY_ID during the link establishment and auto-negotiation process.

Right, that's clear about the vendor ID check. But it's not clear to me why the the resulting code like this:

phy->type = igc_phy_i225;

and not like this:

phy->type = igc_phy_i225; phy->ops.set_d0_lplu_state = igc_set_d0_lplu_state_i225; phy->ops.set_d3_lplu_state = igc_set_d3_lplu_state_i225;

So it is using dummy null functions instead:
https://git.dpdk.org/dpdk/tree/drivers/net/igc/base/igc_phy.c#n61

Quoted 6 lines

Do the device registers not need to be set anymore?

For main branch, it would be nice to have an answer to above.

It only adds a small readability benefit by removing some code branches, but does change functionality which adds risk, so I don't think it's a good candidate for stable branches.

This is not only added readability, but to fix real world issue, we were experiencing i225-IT not runnable issue without patching another case checking as below:

+++ b/drivers/net/igc/base/igc_phy.c

(quoted diff) +1 -0
@@ -1881,6 +1881,7 @@ s32 igc_phy_force_speed_duplex_m88(struct igc_hw *hw)
                                  case I210_I_PHY_ID:
                                  /* fall-through */
                                  case I225_I_PHY_ID:
+                              case I225_IT_PHY_ID:
 
Quoted 5 lines

However, cleaner solution is to remove those unnecessary checking completely as it does in kernel also
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/co
mmit/?id=7c496de538eebd8212dc2a3c9a468386b264d0d4

ok, you are correct that it is more than readability. I can apply but first it would be good if you can answer the original question and explain why the functionality is changed for I225_I_PHY_ID by removing the function pointers that set the registers.

Quoted 1 line

Hi, I didn't apply this to DPDK 21.11.3 because there was no explanation of why the registers were changing after asking multiple times.

I>f it is required for a later 21.11 LTS release, please send a backport to stable mailing list with an updated commit message explaining the changes.

Quoted 2 lines

thanks,
Kevin.

Apology of the late reply, we were missed out your last message.

Yes, we will re-submit the patch for 21.11 LTS with clearer explanation.

Thanks,
Mah

Quoted 40 lines
Quoted 39 lines
Quoted 38 lines
Quoted 37 lines
Quoted 36 lines
drivers/net/igc/base/igc_i225.c +2 -6
-		/* TODO - complete with GPY PHY information */
-		break;
-	default:
-		ret_val = -IGC_ERR_PHY;
-		goto out;
-	}
+        phy->type = igc_phy_i225;
+
 
      out:
      	return ret_val;
(quoted diff) +0 -0

b/drivers/net/igc/base/igc_phy.c index 43bbe69bca..2906bae21a 100644

drivers/net/igc/base/igc_phy.c +1 -2
@@ -1474,8 +1474,7 @@ s32 igc_phy_setup_autoneg(struct igc_hw *hw)
      			return ret_val;
      	}
 
-	if ((phy->autoneg_mask & ADVERTISE_2500_FULL) &&
-	    hw->phy.id == I225_I_PHY_ID) {
+	if (phy->autoneg_mask & ADVERTISE_2500_FULL) {
      	/* Read the MULTI GBT AN Control Register - reg 7.32 */
      		ret_val = phy->ops.read_reg(hw, (STANDARD_AN_REG_MASK <<
      					    MMD_DEVADDR_SHIFT) | @@ -1615,8 +1614,7 @@ s32 

igc_phy_setup_autoneg(struct igc_hw *hw)

      		ret_val = phy->ops.write_reg(hw, PHY_1000T_CTRL,
      					     mii_1000t_ctrl_reg);
drivers/net/igc/base/igc_phy.c +1 -2
-	if ((phy->autoneg_mask & ADVERTISE_2500_FULL) &&
-	    hw->phy.id == I225_I_PHY_ID)
+	if (phy->autoneg_mask & ADVERTISE_2500_FULL)
      		ret_val = phy->ops.write_reg(hw,
      					     (STANDARD_AN_REG_MASK <<
      					     MMD_DEVADDR_SHIFT) |