All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v2 0/2] Fix PHY handle no longer parsing
@ 2023-03-14  7:02 ` Michael Sit Wei Hong
  0 siblings, 0 replies; 32+ messages in thread
From: Michael Sit Wei Hong @ 2023-03-14  7:02 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Ong Boon Leong, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel
  Cc: Looi Hong Aun, Voon Weifeng, Lai Peter Jun Ann

After the fixed link support was introduced, it is observed that PHY
no longer attach to the MAC properly.

This patch series fixes the issue and maintains fixed-link capability.

Michael Sit Wei Hong (2):
  net: stmmac: fix PHY handle parsing
  net: stmmac: move fixed-link support fixup code

 .../net/ethernet/stmicro/stmmac/dwmac-intel.c | 11 ---------
 .../net/ethernet/stmicro/stmmac/stmmac_main.c | 24 +++++++++++++++++--
 2 files changed, 22 insertions(+), 13 deletions(-)

v2: Initialize fwnode before using the variable
-- 
2.34.1


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH net v2 0/2] Fix PHY handle no longer parsing
@ 2023-03-14  7:02 ` Michael Sit Wei Hong
  0 siblings, 0 replies; 32+ messages in thread
From: Michael Sit Wei Hong @ 2023-03-14  7:02 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Ong Boon Leong, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel
  Cc: Looi Hong Aun, Voon Weifeng, Lai Peter Jun Ann

After the fixed link support was introduced, it is observed that PHY
no longer attach to the MAC properly.

This patch series fixes the issue and maintains fixed-link capability.

Michael Sit Wei Hong (2):
  net: stmmac: fix PHY handle parsing
  net: stmmac: move fixed-link support fixup code

 .../net/ethernet/stmicro/stmmac/dwmac-intel.c | 11 ---------
 .../net/ethernet/stmicro/stmmac/stmmac_main.c | 24 +++++++++++++++++--
 2 files changed, 22 insertions(+), 13 deletions(-)

v2: Initialize fwnode before using the variable
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH net v2 1/2] net: stmmac: fix PHY handle parsing
  2023-03-14  7:02 ` Michael Sit Wei Hong
@ 2023-03-14  7:02   ` Michael Sit Wei Hong
  -1 siblings, 0 replies; 32+ messages in thread
From: Michael Sit Wei Hong @ 2023-03-14  7:02 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Ong Boon Leong, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel
  Cc: Looi Hong Aun, Voon Weifeng, Lai Peter Jun Ann

phylink_fwnode_phy_connect returns 0 when set to MLO_AN_INBAND.
This causes the PHY handle parsing to skip and the PHY will not be attached
to the MAC.

Add additional check for PHY handle parsing when set to MLO_AN_INBAND.

Fixes: ab21cf920928 ("net: stmmac: make mdio register skips PHY scanning for fixed-link")
Signed-off-by: Michael Sit Wei Hong <michael.wei.hong.sit@intel.com>
Signed-off-by: Lai Peter Jun Ann <peter.jun.ann.lai@intel.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 8f543c3ab5c5..398adcd68ee8 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1134,6 +1134,7 @@ static void stmmac_check_pcs_mode(struct stmmac_priv *priv)
 static int stmmac_init_phy(struct net_device *dev)
 {
 	struct stmmac_priv *priv = netdev_priv(dev);
+	struct fwnode_handle *fixed_node;
 	struct fwnode_handle *fwnode;
 	int ret;
 
@@ -1141,13 +1142,16 @@ static int stmmac_init_phy(struct net_device *dev)
 	if (!fwnode)
 		fwnode = dev_fwnode(priv->device);
 
-	if (fwnode)
+	if (fwnode) {
+		fixed_node = fwnode_get_named_child_node(fwnode, "fixed-link");
+		fwnode_handle_put(fixed_node);
 		ret = phylink_fwnode_phy_connect(priv->phylink, fwnode, 0);
+	}
 
 	/* Some DT bindings do not set-up the PHY handle. Let's try to
 	 * manually parse it
 	 */
-	if (!fwnode || ret) {
+	if (!fwnode || ret || !fixed_node) {
 		int addr = priv->plat->phy_addr;
 		struct phy_device *phydev;
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH net v2 1/2] net: stmmac: fix PHY handle parsing
@ 2023-03-14  7:02   ` Michael Sit Wei Hong
  0 siblings, 0 replies; 32+ messages in thread
From: Michael Sit Wei Hong @ 2023-03-14  7:02 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Ong Boon Leong, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel
  Cc: Looi Hong Aun, Voon Weifeng, Lai Peter Jun Ann

phylink_fwnode_phy_connect returns 0 when set to MLO_AN_INBAND.
This causes the PHY handle parsing to skip and the PHY will not be attached
to the MAC.

Add additional check for PHY handle parsing when set to MLO_AN_INBAND.

Fixes: ab21cf920928 ("net: stmmac: make mdio register skips PHY scanning for fixed-link")
Signed-off-by: Michael Sit Wei Hong <michael.wei.hong.sit@intel.com>
Signed-off-by: Lai Peter Jun Ann <peter.jun.ann.lai@intel.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 8f543c3ab5c5..398adcd68ee8 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1134,6 +1134,7 @@ static void stmmac_check_pcs_mode(struct stmmac_priv *priv)
 static int stmmac_init_phy(struct net_device *dev)
 {
 	struct stmmac_priv *priv = netdev_priv(dev);
+	struct fwnode_handle *fixed_node;
 	struct fwnode_handle *fwnode;
 	int ret;
 
@@ -1141,13 +1142,16 @@ static int stmmac_init_phy(struct net_device *dev)
 	if (!fwnode)
 		fwnode = dev_fwnode(priv->device);
 
-	if (fwnode)
+	if (fwnode) {
+		fixed_node = fwnode_get_named_child_node(fwnode, "fixed-link");
+		fwnode_handle_put(fixed_node);
 		ret = phylink_fwnode_phy_connect(priv->phylink, fwnode, 0);
+	}
 
 	/* Some DT bindings do not set-up the PHY handle. Let's try to
 	 * manually parse it
 	 */
-	if (!fwnode || ret) {
+	if (!fwnode || ret || !fixed_node) {
 		int addr = priv->plat->phy_addr;
 		struct phy_device *phydev;
 
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH net v2 2/2] net: stmmac: move fixed-link support fixup code
  2023-03-14  7:02 ` Michael Sit Wei Hong
@ 2023-03-14  7:02   ` Michael Sit Wei Hong
  -1 siblings, 0 replies; 32+ messages in thread
From: Michael Sit Wei Hong @ 2023-03-14  7:02 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Ong Boon Leong, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel
  Cc: Looi Hong Aun, Voon Weifeng, Lai Peter Jun Ann

xpcs_an_inband value is updated in the speed_mode_2500 function
which turns on the xpcs_an_inband mode.

Moving the fixed-link fixup code to right before phylink setup to
ensure no more fixup will affect the fixed-link mode configurations.

Fixes: 72edaf39fc65 ("stmmac: intel: add phy-mode and fixed-link ACPI _DSD setting support")
Signed-off-by: Michael Sit Wei Hong <michael.wei.hong.sit@intel.com>
---
 .../net/ethernet/stmicro/stmmac/dwmac-intel.c    | 11 -----------
 .../net/ethernet/stmicro/stmmac/stmmac_main.c    | 16 ++++++++++++++++
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
index 7deb1f817dac..d02db2b529b9 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
@@ -592,17 +592,6 @@ static int intel_mgbe_common_data(struct pci_dev *pdev,
 		plat->mdio_bus_data->xpcs_an_inband = true;
 	}
 
-	/* For fixed-link setup, we clear xpcs_an_inband */
-	if (fwnode) {
-		struct fwnode_handle *fixed_node;
-
-		fixed_node = fwnode_get_named_child_node(fwnode, "fixed-link");
-		if (fixed_node)
-			plat->mdio_bus_data->xpcs_an_inband = false;
-
-		fwnode_handle_put(fixed_node);
-	}
-
 	/* Ensure mdio bus scan skips intel serdes and pcs-xpcs */
 	plat->mdio_bus_data->phy_mask = 1 << INTEL_MGBE_ADHOC_ADDR;
 	plat->mdio_bus_data->phy_mask |= 1 << INTEL_MGBE_XPCS_ADDR;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 398adcd68ee8..6560aed95036 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7064,6 +7064,7 @@ int stmmac_dvr_probe(struct device *device,
 		     struct stmmac_resources *res)
 {
 	struct net_device *ndev = NULL;
+	struct fwnode_handle *fwnode;
 	struct stmmac_priv *priv;
 	u32 rxq;
 	int i, ret = 0;
@@ -7306,6 +7307,21 @@ int stmmac_dvr_probe(struct device *device,
 			goto error_xpcs_setup;
 	}
 
+	/* For fixed-link setup, we clear xpcs_an_inband */
+	fwnode = of_fwnode_handle(priv->plat->phylink_node);
+	if (!fwnode)
+		fwnode = dev_fwnode(priv->device);
+
+	if (fwnode) {
+		struct fwnode_handle *fixed_node;
+
+		fixed_node = fwnode_get_named_child_node(fwnode, "fixed-link");
+		if (fixed_node)
+			priv->plat->mdio_bus_data->xpcs_an_inband = false;
+
+		fwnode_handle_put(fixed_node);
+	}
+
 	ret = stmmac_phy_setup(priv);
 	if (ret) {
 		netdev_err(ndev, "failed to setup phy (%d)\n", ret);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH net v2 2/2] net: stmmac: move fixed-link support fixup code
@ 2023-03-14  7:02   ` Michael Sit Wei Hong
  0 siblings, 0 replies; 32+ messages in thread
From: Michael Sit Wei Hong @ 2023-03-14  7:02 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Ong Boon Leong, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel
  Cc: Looi Hong Aun, Voon Weifeng, Lai Peter Jun Ann

xpcs_an_inband value is updated in the speed_mode_2500 function
which turns on the xpcs_an_inband mode.

Moving the fixed-link fixup code to right before phylink setup to
ensure no more fixup will affect the fixed-link mode configurations.

Fixes: 72edaf39fc65 ("stmmac: intel: add phy-mode and fixed-link ACPI _DSD setting support")
Signed-off-by: Michael Sit Wei Hong <michael.wei.hong.sit@intel.com>
---
 .../net/ethernet/stmicro/stmmac/dwmac-intel.c    | 11 -----------
 .../net/ethernet/stmicro/stmmac/stmmac_main.c    | 16 ++++++++++++++++
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
index 7deb1f817dac..d02db2b529b9 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
@@ -592,17 +592,6 @@ static int intel_mgbe_common_data(struct pci_dev *pdev,
 		plat->mdio_bus_data->xpcs_an_inband = true;
 	}
 
-	/* For fixed-link setup, we clear xpcs_an_inband */
-	if (fwnode) {
-		struct fwnode_handle *fixed_node;
-
-		fixed_node = fwnode_get_named_child_node(fwnode, "fixed-link");
-		if (fixed_node)
-			plat->mdio_bus_data->xpcs_an_inband = false;
-
-		fwnode_handle_put(fixed_node);
-	}
-
 	/* Ensure mdio bus scan skips intel serdes and pcs-xpcs */
 	plat->mdio_bus_data->phy_mask = 1 << INTEL_MGBE_ADHOC_ADDR;
 	plat->mdio_bus_data->phy_mask |= 1 << INTEL_MGBE_XPCS_ADDR;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 398adcd68ee8..6560aed95036 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7064,6 +7064,7 @@ int stmmac_dvr_probe(struct device *device,
 		     struct stmmac_resources *res)
 {
 	struct net_device *ndev = NULL;
+	struct fwnode_handle *fwnode;
 	struct stmmac_priv *priv;
 	u32 rxq;
 	int i, ret = 0;
@@ -7306,6 +7307,21 @@ int stmmac_dvr_probe(struct device *device,
 			goto error_xpcs_setup;
 	}
 
+	/* For fixed-link setup, we clear xpcs_an_inband */
+	fwnode = of_fwnode_handle(priv->plat->phylink_node);
+	if (!fwnode)
+		fwnode = dev_fwnode(priv->device);
+
+	if (fwnode) {
+		struct fwnode_handle *fixed_node;
+
+		fixed_node = fwnode_get_named_child_node(fwnode, "fixed-link");
+		if (fixed_node)
+			priv->plat->mdio_bus_data->xpcs_an_inband = false;
+
+		fwnode_handle_put(fixed_node);
+	}
+
 	ret = stmmac_phy_setup(priv);
 	if (ret) {
 		netdev_err(ndev, "failed to setup phy (%d)\n", ret);
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: [PATCH net v2 1/2] net: stmmac: fix PHY handle parsing
  2023-03-14  7:02   ` Michael Sit Wei Hong
  (?)
@ 2023-03-14  9:56   ` Fabian Bläse
  -1 siblings, 0 replies; 32+ messages in thread
From: Fabian Bläse @ 2023-03-14  9:56 UTC (permalink / raw)
  To: Michael Sit Wei Hong, Giuseppe Cavallaro, Alexandre Torgue,
	Jose Abreu, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Maxime Coquelin, Ong Boon Leong, netdev,
	linux-stm32, linux-arm-kernel, linux-kernel
  Cc: Looi Hong Aun, Voon Weifeng, Lai Peter Jun Ann

On 14.03.23 08:02, Michael Sit Wei Hong wrote:
> phylink_fwnode_phy_connect returns 0 when set to MLO_AN_INBAND.
> This causes the PHY handle parsing to skip and the PHY will not be attached
> to the MAC.
> 
> Add additional check for PHY handle parsing when set to MLO_AN_INBAND.
> 
> Fixes: ab21cf920928 ("net: stmmac: make mdio register skips PHY scanning for fixed-link")
> Signed-off-by: Michael Sit Wei Hong <michael.wei.hong.sit@intel.com>
> Signed-off-by: Lai Peter Jun Ann <peter.jun.ann.lai@intel.com>

Tested-by: Fabian Bläse <fabian@blaese.de>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH net v2 2/2] net: stmmac: move fixed-link support fixup code
  2023-03-14  7:02   ` Michael Sit Wei Hong
  (?)
@ 2023-03-14  9:56   ` Fabian Bläse
  -1 siblings, 0 replies; 32+ messages in thread
From: Fabian Bläse @ 2023-03-14  9:56 UTC (permalink / raw)
  To: Michael Sit Wei Hong, Giuseppe Cavallaro, Alexandre Torgue,
	Jose Abreu, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Maxime Coquelin, Ong Boon Leong, netdev,
	linux-stm32, linux-arm-kernel, linux-kernel
  Cc: Looi Hong Aun, Voon Weifeng, Lai Peter Jun Ann

On 14.03.23 08:02, Michael Sit Wei Hong wrote:
> xpcs_an_inband value is updated in the speed_mode_2500 function
> which turns on the xpcs_an_inband mode.
> 
> Moving the fixed-link fixup code to right before phylink setup to
> ensure no more fixup will affect the fixed-link mode configurations.
> 
> Fixes: 72edaf39fc65 ("stmmac: intel: add phy-mode and fixed-link ACPI _DSD setting support")
> Signed-off-by: Michael Sit Wei Hong <michael.wei.hong.sit@intel.com>

Tested-by: Fabian Bläse <fabian@blaese.de>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH net v2 1/2] net: stmmac: fix PHY handle parsing
  2023-03-14  7:02   ` Michael Sit Wei Hong
@ 2023-03-17  0:00     ` Jakub Kicinski
  -1 siblings, 0 replies; 32+ messages in thread
From: Jakub Kicinski @ 2023-03-17  0:00 UTC (permalink / raw)
  To: Michael Sit Wei Hong
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Paolo Abeni, Maxime Coquelin,
	Ong Boon Leong, netdev, linux-stm32, linux-arm-kernel,
	linux-kernel, Looi Hong Aun, Voon Weifeng, Lai Peter Jun Ann

On Tue, 14 Mar 2023 15:02:07 +0800 Michael Sit Wei Hong wrote:
> +		fixed_node = fwnode_get_named_child_node(fwnode, "fixed-link");
> +		fwnode_handle_put(fixed_node);

fwnode_property_present() ?


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH net v2 1/2] net: stmmac: fix PHY handle parsing
@ 2023-03-17  0:00     ` Jakub Kicinski
  0 siblings, 0 replies; 32+ messages in thread
From: Jakub Kicinski @ 2023-03-17  0:00 UTC (permalink / raw)
  To: Michael Sit Wei Hong
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Paolo Abeni, Maxime Coquelin,
	Ong Boon Leong, netdev, linux-stm32, linux-arm-kernel,
	linux-kernel, Looi Hong Aun, Voon Weifeng, Lai Peter Jun Ann

On Tue, 14 Mar 2023 15:02:07 +0800 Michael Sit Wei Hong wrote:
> +		fixed_node = fwnode_get_named_child_node(fwnode, "fixed-link");
> +		fwnode_handle_put(fixed_node);

fwnode_property_present() ?


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH net v2 2/2] net: stmmac: move fixed-link support fixup code
  2023-03-14  7:02   ` Michael Sit Wei Hong
@ 2023-03-17  0:01     ` Jakub Kicinski
  -1 siblings, 0 replies; 32+ messages in thread
From: Jakub Kicinski @ 2023-03-17  0:01 UTC (permalink / raw)
  To: Michael Sit Wei Hong, Ong Boon Leong
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Paolo Abeni, Maxime Coquelin,
	netdev, linux-stm32, linux-arm-kernel, linux-kernel,
	Looi Hong Aun, Voon Weifeng, Lai Peter Jun Ann

On Tue, 14 Mar 2023 15:02:08 +0800 Michael Sit Wei Hong wrote:
> xpcs_an_inband value is updated in the speed_mode_2500 function
> which turns on the xpcs_an_inband mode.
> 
> Moving the fixed-link fixup code to right before phylink setup to
> ensure no more fixup will affect the fixed-link mode configurations.
> 
> Fixes: 72edaf39fc65 ("stmmac: intel: add phy-mode and fixed-link ACPI _DSD setting support")
> Signed-off-by: Michael Sit Wei Hong <michael.wei.hong.sit@intel.com>

Ong Boon, since you added the code which gets moved - could we get 
an ack/review tag from you? Helps increase the confidence in the change.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH net v2 2/2] net: stmmac: move fixed-link support fixup code
@ 2023-03-17  0:01     ` Jakub Kicinski
  0 siblings, 0 replies; 32+ messages in thread
From: Jakub Kicinski @ 2023-03-17  0:01 UTC (permalink / raw)
  To: Michael Sit Wei Hong, Ong Boon Leong
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Paolo Abeni, Maxime Coquelin,
	netdev, linux-stm32, linux-arm-kernel, linux-kernel,
	Looi Hong Aun, Voon Weifeng, Lai Peter Jun Ann

On Tue, 14 Mar 2023 15:02:08 +0800 Michael Sit Wei Hong wrote:
> xpcs_an_inband value is updated in the speed_mode_2500 function
> which turns on the xpcs_an_inband mode.
> 
> Moving the fixed-link fixup code to right before phylink setup to
> ensure no more fixup will affect the fixed-link mode configurations.
> 
> Fixes: 72edaf39fc65 ("stmmac: intel: add phy-mode and fixed-link ACPI _DSD setting support")
> Signed-off-by: Michael Sit Wei Hong <michael.wei.hong.sit@intel.com>

Ong Boon, since you added the code which gets moved - could we get 
an ack/review tag from you? Helps increase the confidence in the change.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* RE: [PATCH net v2 1/2] net: stmmac: fix PHY handle parsing
  2023-03-17  0:00     ` Jakub Kicinski
@ 2023-03-17  2:10       ` Sit, Michael Wei Hong
  -1 siblings, 0 replies; 32+ messages in thread
From: Sit, Michael Wei Hong @ 2023-03-17  2:10 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Paolo Abeni, Maxime Coquelin,
	Ong, Boon Leong, netdev, linux-stm32, linux-arm-kernel,
	linux-kernel, Looi, Hong Aun, Voon, Weifeng, Lai, Peter Jun Ann



> -----Original Message-----
> From: Jakub Kicinski <kuba@kernel.org>
> Sent: Friday, March 17, 2023 8:00 AM
> To: Sit, Michael Wei Hong <michael.wei.hong.sit@intel.com>
> Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>; Alexandre
> Torgue <alexandre.torgue@foss.st.com>; Jose Abreu
> <joabreu@synopsys.com>; David S . Miller
> <davem@davemloft.net>; Eric Dumazet
> <edumazet@google.com>; Paolo Abeni <pabeni@redhat.com>;
> Maxime Coquelin <mcoquelin.stm32@gmail.com>; Ong, Boon
> Leong <boon.leong.ong@intel.com>; netdev@vger.kernel.org;
> linux-stm32@st-md-mailman.stormreply.com; linux-arm-
> kernel@lists.infradead.org; linux-kernel@vger.kernel.org; Looi,
> Hong Aun <hong.aun.looi@intel.com>; Voon, Weifeng
> <weifeng.voon@intel.com>; Lai, Peter Jun Ann
> <peter.jun.ann.lai@intel.com>
> Subject: Re: [PATCH net v2 1/2] net: stmmac: fix PHY handle
> parsing
> 
> On Tue, 14 Mar 2023 15:02:07 +0800 Michael Sit Wei Hong wrote:
> > +		fixed_node =
> fwnode_get_named_child_node(fwnode, "fixed-link");
> > +		fwnode_handle_put(fixed_node);
> 
> fwnode_property_present() ?
Good suggestion, will modify and submit in next revision.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* RE: [PATCH net v2 1/2] net: stmmac: fix PHY handle parsing
@ 2023-03-17  2:10       ` Sit, Michael Wei Hong
  0 siblings, 0 replies; 32+ messages in thread
From: Sit, Michael Wei Hong @ 2023-03-17  2:10 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Paolo Abeni, Maxime Coquelin,
	Ong, Boon Leong, netdev, linux-stm32, linux-arm-kernel,
	linux-kernel, Looi, Hong Aun, Voon, Weifeng, Lai, Peter Jun Ann



> -----Original Message-----
> From: Jakub Kicinski <kuba@kernel.org>
> Sent: Friday, March 17, 2023 8:00 AM
> To: Sit, Michael Wei Hong <michael.wei.hong.sit@intel.com>
> Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>; Alexandre
> Torgue <alexandre.torgue@foss.st.com>; Jose Abreu
> <joabreu@synopsys.com>; David S . Miller
> <davem@davemloft.net>; Eric Dumazet
> <edumazet@google.com>; Paolo Abeni <pabeni@redhat.com>;
> Maxime Coquelin <mcoquelin.stm32@gmail.com>; Ong, Boon
> Leong <boon.leong.ong@intel.com>; netdev@vger.kernel.org;
> linux-stm32@st-md-mailman.stormreply.com; linux-arm-
> kernel@lists.infradead.org; linux-kernel@vger.kernel.org; Looi,
> Hong Aun <hong.aun.looi@intel.com>; Voon, Weifeng
> <weifeng.voon@intel.com>; Lai, Peter Jun Ann
> <peter.jun.ann.lai@intel.com>
> Subject: Re: [PATCH net v2 1/2] net: stmmac: fix PHY handle
> parsing
> 
> On Tue, 14 Mar 2023 15:02:07 +0800 Michael Sit Wei Hong wrote:
> > +		fixed_node =
> fwnode_get_named_child_node(fwnode, "fixed-link");
> > +		fwnode_handle_put(fixed_node);
> 
> fwnode_property_present() ?
Good suggestion, will modify and submit in next revision.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH net v2 1/2] net: stmmac: fix PHY handle parsing
  2023-03-14  7:02   ` Michael Sit Wei Hong
@ 2023-03-17 19:56     ` Andrew Lunn
  -1 siblings, 0 replies; 32+ messages in thread
From: Andrew Lunn @ 2023-03-17 19:56 UTC (permalink / raw)
  To: Michael Sit Wei Hong
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Ong Boon Leong, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel, Looi Hong Aun, Voon Weifeng,
	Lai Peter Jun Ann

On Tue, Mar 14, 2023 at 03:02:07PM +0800, Michael Sit Wei Hong wrote:
> phylink_fwnode_phy_connect returns 0 when set to MLO_AN_INBAND.
> This causes the PHY handle parsing to skip and the PHY will not be attached
> to the MAC.

Please could you expand the commit message because i'm having trouble
following this.

phylink_fwnode_phy_connect() says:

	/* Fixed links and 802.3z are handled without needing a PHY */
	if (pl->cfg_link_an_mode == MLO_AN_FIXED ||
	    (pl->cfg_link_an_mode == MLO_AN_INBAND &&
	     phy_interface_mode_is_8023z(pl->link_interface)))
		return 0;

So your first statement is not true. It should be MLO_AN_INBAND
and phy_interface_mode_is_8023z.

> Add additional check for PHY handle parsing when set to MLO_AN_INBAND.

Looking at the patch, there is no reference to MLO_AN_INBAND, or
managed = "in-band-status";

	Andrew

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH net v2 1/2] net: stmmac: fix PHY handle parsing
@ 2023-03-17 19:56     ` Andrew Lunn
  0 siblings, 0 replies; 32+ messages in thread
From: Andrew Lunn @ 2023-03-17 19:56 UTC (permalink / raw)
  To: Michael Sit Wei Hong
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Ong Boon Leong, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel, Looi Hong Aun, Voon Weifeng,
	Lai Peter Jun Ann

On Tue, Mar 14, 2023 at 03:02:07PM +0800, Michael Sit Wei Hong wrote:
> phylink_fwnode_phy_connect returns 0 when set to MLO_AN_INBAND.
> This causes the PHY handle parsing to skip and the PHY will not be attached
> to the MAC.

Please could you expand the commit message because i'm having trouble
following this.

phylink_fwnode_phy_connect() says:

	/* Fixed links and 802.3z are handled without needing a PHY */
	if (pl->cfg_link_an_mode == MLO_AN_FIXED ||
	    (pl->cfg_link_an_mode == MLO_AN_INBAND &&
	     phy_interface_mode_is_8023z(pl->link_interface)))
		return 0;

So your first statement is not true. It should be MLO_AN_INBAND
and phy_interface_mode_is_8023z.

> Add additional check for PHY handle parsing when set to MLO_AN_INBAND.

Looking at the patch, there is no reference to MLO_AN_INBAND, or
managed = "in-band-status";

	Andrew

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH net v2 2/2] net: stmmac: move fixed-link support fixup code
  2023-03-14  7:02   ` Michael Sit Wei Hong
@ 2023-03-17 20:02     ` Andrew Lunn
  -1 siblings, 0 replies; 32+ messages in thread
From: Andrew Lunn @ 2023-03-17 20:02 UTC (permalink / raw)
  To: Michael Sit Wei Hong
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Ong Boon Leong, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel, Looi Hong Aun, Voon Weifeng,
	Lai Peter Jun Ann

On Tue, Mar 14, 2023 at 03:02:08PM +0800, Michael Sit Wei Hong wrote:
> xpcs_an_inband value is updated in the speed_mode_2500 function
> which turns on the xpcs_an_inband mode.
> 
> Moving the fixed-link fixup code to right before phylink setup to
> ensure no more fixup will affect the fixed-link mode configurations.

Please could you explain why this is correct, when you could simple
not set priv->plat->mdio_bus_data->xpcs_an_inband = true;
in intel_speed_mode_2500()?

This all seems like hacks, rather than a clean design.

     Andrew

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH net v2 2/2] net: stmmac: move fixed-link support fixup code
@ 2023-03-17 20:02     ` Andrew Lunn
  0 siblings, 0 replies; 32+ messages in thread
From: Andrew Lunn @ 2023-03-17 20:02 UTC (permalink / raw)
  To: Michael Sit Wei Hong
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Ong Boon Leong, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel, Looi Hong Aun, Voon Weifeng,
	Lai Peter Jun Ann

On Tue, Mar 14, 2023 at 03:02:08PM +0800, Michael Sit Wei Hong wrote:
> xpcs_an_inband value is updated in the speed_mode_2500 function
> which turns on the xpcs_an_inband mode.
> 
> Moving the fixed-link fixup code to right before phylink setup to
> ensure no more fixup will affect the fixed-link mode configurations.

Please could you explain why this is correct, when you could simple
not set priv->plat->mdio_bus_data->xpcs_an_inband = true;
in intel_speed_mode_2500()?

This all seems like hacks, rather than a clean design.

     Andrew

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH net v2 0/2] Fix PHY handle no longer parsing
  2023-03-14  7:02 ` Michael Sit Wei Hong
@ 2023-03-17 20:54   ` Russell King (Oracle)
  -1 siblings, 0 replies; 32+ messages in thread
From: Russell King (Oracle) @ 2023-03-17 20:54 UTC (permalink / raw)
  To: Michael Sit Wei Hong
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Ong Boon Leong, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel, Looi Hong Aun, Voon Weifeng,
	Lai Peter Jun Ann

On Tue, Mar 14, 2023 at 03:02:06PM +0800, Michael Sit Wei Hong wrote:
> After the fixed link support was introduced, it is observed that PHY
> no longer attach to the MAC properly.

You are aware, I hope, that fixed-link and having a PHY are mutually
exclusive?

In other words, you can't use fixed-link to specify parameters for a
PHY.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH net v2 0/2] Fix PHY handle no longer parsing
@ 2023-03-17 20:54   ` Russell King (Oracle)
  0 siblings, 0 replies; 32+ messages in thread
From: Russell King (Oracle) @ 2023-03-17 20:54 UTC (permalink / raw)
  To: Michael Sit Wei Hong
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Ong Boon Leong, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel, Looi Hong Aun, Voon Weifeng,
	Lai Peter Jun Ann

On Tue, Mar 14, 2023 at 03:02:06PM +0800, Michael Sit Wei Hong wrote:
> After the fixed link support was introduced, it is observed that PHY
> no longer attach to the MAC properly.

You are aware, I hope, that fixed-link and having a PHY are mutually
exclusive?

In other words, you can't use fixed-link to specify parameters for a
PHY.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH net v2 1/2] net: stmmac: fix PHY handle parsing
  2023-03-17 19:56     ` Andrew Lunn
@ 2023-03-17 20:57       ` Russell King (Oracle)
  -1 siblings, 0 replies; 32+ messages in thread
From: Russell King (Oracle) @ 2023-03-17 20:57 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Michael Sit Wei Hong, Giuseppe Cavallaro, Alexandre Torgue,
	Jose Abreu, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Maxime Coquelin, Ong Boon Leong, netdev,
	linux-stm32, linux-arm-kernel, linux-kernel, Looi Hong Aun,
	Voon Weifeng, Lai Peter Jun Ann

On Fri, Mar 17, 2023 at 08:56:19PM +0100, Andrew Lunn wrote:
> On Tue, Mar 14, 2023 at 03:02:07PM +0800, Michael Sit Wei Hong wrote:
> > phylink_fwnode_phy_connect returns 0 when set to MLO_AN_INBAND.
> > This causes the PHY handle parsing to skip and the PHY will not be attached
> > to the MAC.
> 
> Please could you expand the commit message because i'm having trouble
> following this.
> 
> phylink_fwnode_phy_connect() says:
> 
> 	/* Fixed links and 802.3z are handled without needing a PHY */
> 	if (pl->cfg_link_an_mode == MLO_AN_FIXED ||
> 	    (pl->cfg_link_an_mode == MLO_AN_INBAND &&
> 	     phy_interface_mode_is_8023z(pl->link_interface)))
> 		return 0;
> 
> So your first statement is not true. It should be MLO_AN_INBAND
> and phy_interface_mode_is_8023z.
> 
> > Add additional check for PHY handle parsing when set to MLO_AN_INBAND.
> 
> Looking at the patch, there is no reference to MLO_AN_INBAND, or
> managed = "in-band-status";

That's the pesky "xpcs_an_inband" which ends up as phylink's
"ovr_an_inband"... I'm sure these are random renames of stuff to make
sure that people struggle to follow the code.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH net v2 1/2] net: stmmac: fix PHY handle parsing
@ 2023-03-17 20:57       ` Russell King (Oracle)
  0 siblings, 0 replies; 32+ messages in thread
From: Russell King (Oracle) @ 2023-03-17 20:57 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Michael Sit Wei Hong, Giuseppe Cavallaro, Alexandre Torgue,
	Jose Abreu, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Maxime Coquelin, Ong Boon Leong, netdev,
	linux-stm32, linux-arm-kernel, linux-kernel, Looi Hong Aun,
	Voon Weifeng, Lai Peter Jun Ann

On Fri, Mar 17, 2023 at 08:56:19PM +0100, Andrew Lunn wrote:
> On Tue, Mar 14, 2023 at 03:02:07PM +0800, Michael Sit Wei Hong wrote:
> > phylink_fwnode_phy_connect returns 0 when set to MLO_AN_INBAND.
> > This causes the PHY handle parsing to skip and the PHY will not be attached
> > to the MAC.
> 
> Please could you expand the commit message because i'm having trouble
> following this.
> 
> phylink_fwnode_phy_connect() says:
> 
> 	/* Fixed links and 802.3z are handled without needing a PHY */
> 	if (pl->cfg_link_an_mode == MLO_AN_FIXED ||
> 	    (pl->cfg_link_an_mode == MLO_AN_INBAND &&
> 	     phy_interface_mode_is_8023z(pl->link_interface)))
> 		return 0;
> 
> So your first statement is not true. It should be MLO_AN_INBAND
> and phy_interface_mode_is_8023z.
> 
> > Add additional check for PHY handle parsing when set to MLO_AN_INBAND.
> 
> Looking at the patch, there is no reference to MLO_AN_INBAND, or
> managed = "in-band-status";

That's the pesky "xpcs_an_inband" which ends up as phylink's
"ovr_an_inband"... I'm sure these are random renames of stuff to make
sure that people struggle to follow the code.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* RE: [PATCH net v2 1/2] net: stmmac: fix PHY handle parsing
  2023-03-17 20:57       ` Russell King (Oracle)
@ 2023-03-21  8:34         ` Sit, Michael Wei Hong
  -1 siblings, 0 replies; 32+ messages in thread
From: Sit, Michael Wei Hong @ 2023-03-21  8:34 UTC (permalink / raw)
  To: Russell King, Andrew Lunn
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Ong, Boon Leong, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel, Looi, Hong Aun, Voon, Weifeng,
	Lai, Peter Jun Ann



> -----Original Message-----
> From: Russell King <linux@armlinux.org.uk>
> Sent: Saturday, March 18, 2023 4:58 AM
> To: Andrew Lunn <andrew@lunn.ch>
> Cc: Sit, Michael Wei Hong <michael.wei.hong.sit@intel.com>;
> Giuseppe Cavallaro <peppe.cavallaro@st.com>; Alexandre
> Torgue <alexandre.torgue@foss.st.com>; Jose Abreu
> <joabreu@synopsys.com>; David S . Miller
> <davem@davemloft.net>; Eric Dumazet
> <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>;
> Paolo Abeni <pabeni@redhat.com>; Maxime Coquelin
> <mcoquelin.stm32@gmail.com>; Ong, Boon Leong
> <boon.leong.ong@intel.com>; netdev@vger.kernel.org; linux-
> stm32@st-md-mailman.stormreply.com; linux-arm-
> kernel@lists.infradead.org; linux-kernel@vger.kernel.org; Looi,
> Hong Aun <hong.aun.looi@intel.com>; Voon, Weifeng
> <weifeng.voon@intel.com>; Lai, Peter Jun Ann
> <peter.jun.ann.lai@intel.com>
> Subject: Re: [PATCH net v2 1/2] net: stmmac: fix PHY handle
> parsing
> 
> On Fri, Mar 17, 2023 at 08:56:19PM +0100, Andrew Lunn wrote:
> > On Tue, Mar 14, 2023 at 03:02:07PM +0800, Michael Sit Wei
> Hong wrote:
> > > phylink_fwnode_phy_connect returns 0 when set to
> MLO_AN_INBAND.
> > > This causes the PHY handle parsing to skip and the PHY will not
> be
> > > attached to the MAC.
> >
> > Please could you expand the commit message because i'm
> having trouble
> > following this.
> >
> > phylink_fwnode_phy_connect() says:
> >
> > 	/* Fixed links and 802.3z are handled without needing a
> PHY */
> > 	if (pl->cfg_link_an_mode == MLO_AN_FIXED ||
> > 	    (pl->cfg_link_an_mode == MLO_AN_INBAND &&
> > 	     phy_interface_mode_is_8023z(pl->link_interface)))
> > 		return 0;
> >
> > So your first statement is not true. It should be
> MLO_AN_INBAND and
> > phy_interface_mode_is_8023z.
> >
> > > Add additional check for PHY handle parsing when set to
> MLO_AN_INBAND.
> >
> > Looking at the patch, there is no reference to
> MLO_AN_INBAND, or
> > managed = "in-band-status";
> 
> That's the pesky "xpcs_an_inband" which ends up as phylink's
> "ovr_an_inband"... I'm sure these are random renames of stuff
> to make sure that people struggle to follow the code.
> 
It is as mentioned above, the "xpcs_an_inband" will end up as
"ovr_an_inband" which will then
set pl->cfg_link_an_mode = MLO_AN_INBAND in the
phylink_parse_mode() in phylink.c

The phylink_fwnode_phy_connect() checks if both
MLO_AN_INBAND && phy_interface_mode_is_8023z() true
before returning 0.

But in our case, we only have MLO_AN_INBAND is true, which
then goes to the next part of the code.

	phy_fwnode = fwnode_get_phy_node(fwnode);
	if (IS_ERR(phy_fwnode)) {
		if (pl->cfg_link_an_mode == MLO_AN_PHY)
			return -ENODEV;
		return 0;
	}

Where here the IS_ERR(phy_fwnode) returns true, then it
Checks for MLO_AN_PHY, which in our case is not, so it returns
a 0.

When returned 0, our driver will then skip the manual phy parsing
due to if (!fwnode || ret)
> --
> RMK's Patch system:
> https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at
> last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* RE: [PATCH net v2 1/2] net: stmmac: fix PHY handle parsing
@ 2023-03-21  8:34         ` Sit, Michael Wei Hong
  0 siblings, 0 replies; 32+ messages in thread
From: Sit, Michael Wei Hong @ 2023-03-21  8:34 UTC (permalink / raw)
  To: Russell King, Andrew Lunn
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Ong, Boon Leong, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel, Looi, Hong Aun, Voon, Weifeng,
	Lai, Peter Jun Ann



> -----Original Message-----
> From: Russell King <linux@armlinux.org.uk>
> Sent: Saturday, March 18, 2023 4:58 AM
> To: Andrew Lunn <andrew@lunn.ch>
> Cc: Sit, Michael Wei Hong <michael.wei.hong.sit@intel.com>;
> Giuseppe Cavallaro <peppe.cavallaro@st.com>; Alexandre
> Torgue <alexandre.torgue@foss.st.com>; Jose Abreu
> <joabreu@synopsys.com>; David S . Miller
> <davem@davemloft.net>; Eric Dumazet
> <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>;
> Paolo Abeni <pabeni@redhat.com>; Maxime Coquelin
> <mcoquelin.stm32@gmail.com>; Ong, Boon Leong
> <boon.leong.ong@intel.com>; netdev@vger.kernel.org; linux-
> stm32@st-md-mailman.stormreply.com; linux-arm-
> kernel@lists.infradead.org; linux-kernel@vger.kernel.org; Looi,
> Hong Aun <hong.aun.looi@intel.com>; Voon, Weifeng
> <weifeng.voon@intel.com>; Lai, Peter Jun Ann
> <peter.jun.ann.lai@intel.com>
> Subject: Re: [PATCH net v2 1/2] net: stmmac: fix PHY handle
> parsing
> 
> On Fri, Mar 17, 2023 at 08:56:19PM +0100, Andrew Lunn wrote:
> > On Tue, Mar 14, 2023 at 03:02:07PM +0800, Michael Sit Wei
> Hong wrote:
> > > phylink_fwnode_phy_connect returns 0 when set to
> MLO_AN_INBAND.
> > > This causes the PHY handle parsing to skip and the PHY will not
> be
> > > attached to the MAC.
> >
> > Please could you expand the commit message because i'm
> having trouble
> > following this.
> >
> > phylink_fwnode_phy_connect() says:
> >
> > 	/* Fixed links and 802.3z are handled without needing a
> PHY */
> > 	if (pl->cfg_link_an_mode == MLO_AN_FIXED ||
> > 	    (pl->cfg_link_an_mode == MLO_AN_INBAND &&
> > 	     phy_interface_mode_is_8023z(pl->link_interface)))
> > 		return 0;
> >
> > So your first statement is not true. It should be
> MLO_AN_INBAND and
> > phy_interface_mode_is_8023z.
> >
> > > Add additional check for PHY handle parsing when set to
> MLO_AN_INBAND.
> >
> > Looking at the patch, there is no reference to
> MLO_AN_INBAND, or
> > managed = "in-band-status";
> 
> That's the pesky "xpcs_an_inband" which ends up as phylink's
> "ovr_an_inband"... I'm sure these are random renames of stuff
> to make sure that people struggle to follow the code.
> 
It is as mentioned above, the "xpcs_an_inband" will end up as
"ovr_an_inband" which will then
set pl->cfg_link_an_mode = MLO_AN_INBAND in the
phylink_parse_mode() in phylink.c

The phylink_fwnode_phy_connect() checks if both
MLO_AN_INBAND && phy_interface_mode_is_8023z() true
before returning 0.

But in our case, we only have MLO_AN_INBAND is true, which
then goes to the next part of the code.

	phy_fwnode = fwnode_get_phy_node(fwnode);
	if (IS_ERR(phy_fwnode)) {
		if (pl->cfg_link_an_mode == MLO_AN_PHY)
			return -ENODEV;
		return 0;
	}

Where here the IS_ERR(phy_fwnode) returns true, then it
Checks for MLO_AN_PHY, which in our case is not, so it returns
a 0.

When returned 0, our driver will then skip the manual phy parsing
due to if (!fwnode || ret)
> --
> RMK's Patch system:
> https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at
> last!

^ permalink raw reply	[flat|nested] 32+ messages in thread

* RE: [PATCH net v2 0/2] Fix PHY handle no longer parsing
  2023-03-17 20:54   ` Russell King (Oracle)
@ 2023-03-21  8:37     ` Sit, Michael Wei Hong
  -1 siblings, 0 replies; 32+ messages in thread
From: Sit, Michael Wei Hong @ 2023-03-21  8:37 UTC (permalink / raw)
  To: Russell King
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Ong, Boon Leong, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel, Looi, Hong Aun, Voon, Weifeng,
	Lai, Peter Jun Ann



> -----Original Message-----
> From: Russell King <linux@armlinux.org.uk>
> Sent: Saturday, March 18, 2023 4:54 AM
> To: Sit, Michael Wei Hong <michael.wei.hong.sit@intel.com>
> Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>; Alexandre
> Torgue <alexandre.torgue@foss.st.com>; Jose Abreu
> <joabreu@synopsys.com>; David S . Miller
> <davem@davemloft.net>; Eric Dumazet
> <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>;
> Paolo Abeni <pabeni@redhat.com>; Maxime Coquelin
> <mcoquelin.stm32@gmail.com>; Ong, Boon Leong
> <boon.leong.ong@intel.com>; netdev@vger.kernel.org; linux-
> stm32@st-md-mailman.stormreply.com; linux-arm-
> kernel@lists.infradead.org; linux-kernel@vger.kernel.org; Looi,
> Hong Aun <hong.aun.looi@intel.com>; Voon, Weifeng
> <weifeng.voon@intel.com>; Lai, Peter Jun Ann
> <peter.jun.ann.lai@intel.com>
> Subject: Re: [PATCH net v2 0/2] Fix PHY handle no longer parsing
> 
> On Tue, Mar 14, 2023 at 03:02:06PM +0800, Michael Sit Wei Hong
> wrote:
> > After the fixed link support was introduced, it is observed that
> PHY
> > no longer attach to the MAC properly.
> 
> You are aware, I hope, that fixed-link and having a PHY are
> mutually exclusive?
> 
> In other words, you can't use fixed-link to specify parameters for
> a PHY.
> 
Yes but when the fixed-link support code was added, all our non
fixed-link devices are not attaching the PHYs to the MACs, hence
the reason for this patch series, to ensure both fixed-link and
non fixed-link scenarios work properly.
> --
> RMK's Patch system:
> https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at
> last!

^ permalink raw reply	[flat|nested] 32+ messages in thread

* RE: [PATCH net v2 0/2] Fix PHY handle no longer parsing
@ 2023-03-21  8:37     ` Sit, Michael Wei Hong
  0 siblings, 0 replies; 32+ messages in thread
From: Sit, Michael Wei Hong @ 2023-03-21  8:37 UTC (permalink / raw)
  To: Russell King
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Ong, Boon Leong, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel, Looi, Hong Aun, Voon, Weifeng,
	Lai, Peter Jun Ann



> -----Original Message-----
> From: Russell King <linux@armlinux.org.uk>
> Sent: Saturday, March 18, 2023 4:54 AM
> To: Sit, Michael Wei Hong <michael.wei.hong.sit@intel.com>
> Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>; Alexandre
> Torgue <alexandre.torgue@foss.st.com>; Jose Abreu
> <joabreu@synopsys.com>; David S . Miller
> <davem@davemloft.net>; Eric Dumazet
> <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>;
> Paolo Abeni <pabeni@redhat.com>; Maxime Coquelin
> <mcoquelin.stm32@gmail.com>; Ong, Boon Leong
> <boon.leong.ong@intel.com>; netdev@vger.kernel.org; linux-
> stm32@st-md-mailman.stormreply.com; linux-arm-
> kernel@lists.infradead.org; linux-kernel@vger.kernel.org; Looi,
> Hong Aun <hong.aun.looi@intel.com>; Voon, Weifeng
> <weifeng.voon@intel.com>; Lai, Peter Jun Ann
> <peter.jun.ann.lai@intel.com>
> Subject: Re: [PATCH net v2 0/2] Fix PHY handle no longer parsing
> 
> On Tue, Mar 14, 2023 at 03:02:06PM +0800, Michael Sit Wei Hong
> wrote:
> > After the fixed link support was introduced, it is observed that
> PHY
> > no longer attach to the MAC properly.
> 
> You are aware, I hope, that fixed-link and having a PHY are
> mutually exclusive?
> 
> In other words, you can't use fixed-link to specify parameters for
> a PHY.
> 
Yes but when the fixed-link support code was added, all our non
fixed-link devices are not attaching the PHYs to the MACs, hence
the reason for this patch series, to ensure both fixed-link and
non fixed-link scenarios work properly.
> --
> RMK's Patch system:
> https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at
> last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* RE: [PATCH net v2 2/2] net: stmmac: move fixed-link support fixup code
  2023-03-17 20:02     ` Andrew Lunn
@ 2023-03-21 10:17       ` Sit, Michael Wei Hong
  -1 siblings, 0 replies; 32+ messages in thread
From: Sit, Michael Wei Hong @ 2023-03-21 10:17 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Ong, Boon Leong, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel, Looi, Hong Aun, Voon, Weifeng,
	Lai, Peter Jun Ann



> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: Saturday, March 18, 2023 4:03 AM
> To: Sit, Michael Wei Hong <michael.wei.hong.sit@intel.com>
> Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>; Alexandre
> Torgue <alexandre.torgue@foss.st.com>; Jose Abreu
> <joabreu@synopsys.com>; David S . Miller
> <davem@davemloft.net>; Eric Dumazet
> <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>;
> Paolo Abeni <pabeni@redhat.com>; Maxime Coquelin
> <mcoquelin.stm32@gmail.com>; Ong, Boon Leong
> <boon.leong.ong@intel.com>; netdev@vger.kernel.org; linux-
> stm32@st-md-mailman.stormreply.com; linux-arm-
> kernel@lists.infradead.org; linux-kernel@vger.kernel.org; Looi,
> Hong Aun <hong.aun.looi@intel.com>; Voon, Weifeng
> <weifeng.voon@intel.com>; Lai, Peter Jun Ann
> <peter.jun.ann.lai@intel.com>
> Subject: Re: [PATCH net v2 2/2] net: stmmac: move fixed-link
> support fixup code
> 
> On Tue, Mar 14, 2023 at 03:02:08PM +0800, Michael Sit Wei Hong
> wrote:
> > xpcs_an_inband value is updated in the speed_mode_2500
> function which
> > turns on the xpcs_an_inband mode.
> >
> > Moving the fixed-link fixup code to right before phylink setup
> to
> > ensure no more fixup will affect the fixed-link mode
> configurations.
> 
> Please could you explain why this is correct, when you could
> simple not set priv->plat->mdio_bus_data->xpcs_an_inband =
> true; in intel_speed_mode_2500()?
> 
> This all seems like hacks, rather than a clean design.
> 
>      Andrew
Makes sense, will test out with your suggestion and submit
the changes in next version, will feedback if there is any
findings.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* RE: [PATCH net v2 2/2] net: stmmac: move fixed-link support fixup code
@ 2023-03-21 10:17       ` Sit, Michael Wei Hong
  0 siblings, 0 replies; 32+ messages in thread
From: Sit, Michael Wei Hong @ 2023-03-21 10:17 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Ong, Boon Leong, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel, Looi, Hong Aun, Voon, Weifeng,
	Lai, Peter Jun Ann



> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: Saturday, March 18, 2023 4:03 AM
> To: Sit, Michael Wei Hong <michael.wei.hong.sit@intel.com>
> Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>; Alexandre
> Torgue <alexandre.torgue@foss.st.com>; Jose Abreu
> <joabreu@synopsys.com>; David S . Miller
> <davem@davemloft.net>; Eric Dumazet
> <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>;
> Paolo Abeni <pabeni@redhat.com>; Maxime Coquelin
> <mcoquelin.stm32@gmail.com>; Ong, Boon Leong
> <boon.leong.ong@intel.com>; netdev@vger.kernel.org; linux-
> stm32@st-md-mailman.stormreply.com; linux-arm-
> kernel@lists.infradead.org; linux-kernel@vger.kernel.org; Looi,
> Hong Aun <hong.aun.looi@intel.com>; Voon, Weifeng
> <weifeng.voon@intel.com>; Lai, Peter Jun Ann
> <peter.jun.ann.lai@intel.com>
> Subject: Re: [PATCH net v2 2/2] net: stmmac: move fixed-link
> support fixup code
> 
> On Tue, Mar 14, 2023 at 03:02:08PM +0800, Michael Sit Wei Hong
> wrote:
> > xpcs_an_inband value is updated in the speed_mode_2500
> function which
> > turns on the xpcs_an_inband mode.
> >
> > Moving the fixed-link fixup code to right before phylink setup
> to
> > ensure no more fixup will affect the fixed-link mode
> configurations.
> 
> Please could you explain why this is correct, when you could
> simple not set priv->plat->mdio_bus_data->xpcs_an_inband =
> true; in intel_speed_mode_2500()?
> 
> This all seems like hacks, rather than a clean design.
> 
>      Andrew
Makes sense, will test out with your suggestion and submit
the changes in next version, will feedback if there is any
findings.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH net v2 0/2] Fix PHY handle no longer parsing
  2023-03-21  8:37     ` Sit, Michael Wei Hong
@ 2023-03-21 10:22       ` Russell King (Oracle)
  -1 siblings, 0 replies; 32+ messages in thread
From: Russell King (Oracle) @ 2023-03-21 10:22 UTC (permalink / raw)
  To: Sit, Michael Wei Hong
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Ong, Boon Leong, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel, Looi, Hong Aun, Voon, Weifeng,
	Lai, Peter Jun Ann

On Tue, Mar 21, 2023 at 08:37:48AM +0000, Sit, Michael Wei Hong wrote:
> 
> 
> > -----Original Message-----
> > From: Russell King <linux@armlinux.org.uk>
> > Sent: Saturday, March 18, 2023 4:54 AM
> > To: Sit, Michael Wei Hong <michael.wei.hong.sit@intel.com>
> > Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>; Alexandre
> > Torgue <alexandre.torgue@foss.st.com>; Jose Abreu
> > <joabreu@synopsys.com>; David S . Miller
> > <davem@davemloft.net>; Eric Dumazet
> > <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>;
> > Paolo Abeni <pabeni@redhat.com>; Maxime Coquelin
> > <mcoquelin.stm32@gmail.com>; Ong, Boon Leong
> > <boon.leong.ong@intel.com>; netdev@vger.kernel.org; linux-
> > stm32@st-md-mailman.stormreply.com; linux-arm-
> > kernel@lists.infradead.org; linux-kernel@vger.kernel.org; Looi,
> > Hong Aun <hong.aun.looi@intel.com>; Voon, Weifeng
> > <weifeng.voon@intel.com>; Lai, Peter Jun Ann
> > <peter.jun.ann.lai@intel.com>
> > Subject: Re: [PATCH net v2 0/2] Fix PHY handle no longer parsing
> > 
> > On Tue, Mar 14, 2023 at 03:02:06PM +0800, Michael Sit Wei Hong
> > wrote:
> > > After the fixed link support was introduced, it is observed that
> > PHY
> > > no longer attach to the MAC properly.
> > 
> > You are aware, I hope, that fixed-link and having a PHY are
> > mutually exclusive?
> > 
> > In other words, you can't use fixed-link to specify parameters for
> > a PHY.
> > 
> Yes but when the fixed-link support code was added, all our non
> fixed-link devices are not attaching the PHYs to the MACs, hence
> the reason for this patch series, to ensure both fixed-link and
> non fixed-link scenarios work properly.

Ah, it's the "there should be a PHY here" case you're trying to cater
for, rather than actually a fixed-link.

So, how about adding a helper that is basically:

bool phylink_expects_phy(struct phylink *phylink)
{
	return pl->cfg_link_an_mode == MLO_AN_PHY;
}
EXPORT_SYMBOL_GPL(phylink_expects_phy);

and use that to test whether you need to manually find a PHY to attach,
rather than trying to detect whether a fixed-link stanza appears in
firmware?

Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH net v2 0/2] Fix PHY handle no longer parsing
@ 2023-03-21 10:22       ` Russell King (Oracle)
  0 siblings, 0 replies; 32+ messages in thread
From: Russell King (Oracle) @ 2023-03-21 10:22 UTC (permalink / raw)
  To: Sit, Michael Wei Hong
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Ong, Boon Leong, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel, Looi, Hong Aun, Voon, Weifeng,
	Lai, Peter Jun Ann

On Tue, Mar 21, 2023 at 08:37:48AM +0000, Sit, Michael Wei Hong wrote:
> 
> 
> > -----Original Message-----
> > From: Russell King <linux@armlinux.org.uk>
> > Sent: Saturday, March 18, 2023 4:54 AM
> > To: Sit, Michael Wei Hong <michael.wei.hong.sit@intel.com>
> > Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>; Alexandre
> > Torgue <alexandre.torgue@foss.st.com>; Jose Abreu
> > <joabreu@synopsys.com>; David S . Miller
> > <davem@davemloft.net>; Eric Dumazet
> > <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>;
> > Paolo Abeni <pabeni@redhat.com>; Maxime Coquelin
> > <mcoquelin.stm32@gmail.com>; Ong, Boon Leong
> > <boon.leong.ong@intel.com>; netdev@vger.kernel.org; linux-
> > stm32@st-md-mailman.stormreply.com; linux-arm-
> > kernel@lists.infradead.org; linux-kernel@vger.kernel.org; Looi,
> > Hong Aun <hong.aun.looi@intel.com>; Voon, Weifeng
> > <weifeng.voon@intel.com>; Lai, Peter Jun Ann
> > <peter.jun.ann.lai@intel.com>
> > Subject: Re: [PATCH net v2 0/2] Fix PHY handle no longer parsing
> > 
> > On Tue, Mar 14, 2023 at 03:02:06PM +0800, Michael Sit Wei Hong
> > wrote:
> > > After the fixed link support was introduced, it is observed that
> > PHY
> > > no longer attach to the MAC properly.
> > 
> > You are aware, I hope, that fixed-link and having a PHY are
> > mutually exclusive?
> > 
> > In other words, you can't use fixed-link to specify parameters for
> > a PHY.
> > 
> Yes but when the fixed-link support code was added, all our non
> fixed-link devices are not attaching the PHYs to the MACs, hence
> the reason for this patch series, to ensure both fixed-link and
> non fixed-link scenarios work properly.

Ah, it's the "there should be a PHY here" case you're trying to cater
for, rather than actually a fixed-link.

So, how about adding a helper that is basically:

bool phylink_expects_phy(struct phylink *phylink)
{
	return pl->cfg_link_an_mode == MLO_AN_PHY;
}
EXPORT_SYMBOL_GPL(phylink_expects_phy);

and use that to test whether you need to manually find a PHY to attach,
rather than trying to detect whether a fixed-link stanza appears in
firmware?

Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH net v2 1/2] net: stmmac: fix PHY handle parsing
  2023-03-21  8:34         ` Sit, Michael Wei Hong
@ 2023-03-21 10:24           ` Russell King (Oracle)
  -1 siblings, 0 replies; 32+ messages in thread
From: Russell King (Oracle) @ 2023-03-21 10:24 UTC (permalink / raw)
  To: Sit, Michael Wei Hong
  Cc: Andrew Lunn, Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Ong, Boon Leong, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel, Looi, Hong Aun, Voon, Weifeng,
	Lai, Peter Jun Ann

On Tue, Mar 21, 2023 at 08:34:49AM +0000, Sit, Michael Wei Hong wrote:
> 
> 
> > -----Original Message-----
> > From: Russell King <linux@armlinux.org.uk>
> > Sent: Saturday, March 18, 2023 4:58 AM
> > To: Andrew Lunn <andrew@lunn.ch>
> > Cc: Sit, Michael Wei Hong <michael.wei.hong.sit@intel.com>;
> > Giuseppe Cavallaro <peppe.cavallaro@st.com>; Alexandre
> > Torgue <alexandre.torgue@foss.st.com>; Jose Abreu
> > <joabreu@synopsys.com>; David S . Miller
> > <davem@davemloft.net>; Eric Dumazet
> > <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>;
> > Paolo Abeni <pabeni@redhat.com>; Maxime Coquelin
> > <mcoquelin.stm32@gmail.com>; Ong, Boon Leong
> > <boon.leong.ong@intel.com>; netdev@vger.kernel.org; linux-
> > stm32@st-md-mailman.stormreply.com; linux-arm-
> > kernel@lists.infradead.org; linux-kernel@vger.kernel.org; Looi,
> > Hong Aun <hong.aun.looi@intel.com>; Voon, Weifeng
> > <weifeng.voon@intel.com>; Lai, Peter Jun Ann
> > <peter.jun.ann.lai@intel.com>
> > Subject: Re: [PATCH net v2 1/2] net: stmmac: fix PHY handle
> > parsing
> > 
> > On Fri, Mar 17, 2023 at 08:56:19PM +0100, Andrew Lunn wrote:
> > > On Tue, Mar 14, 2023 at 03:02:07PM +0800, Michael Sit Wei
> > Hong wrote:
> > > > phylink_fwnode_phy_connect returns 0 when set to
> > MLO_AN_INBAND.
> > > > This causes the PHY handle parsing to skip and the PHY will not
> > be
> > > > attached to the MAC.
> > >
> > > Please could you expand the commit message because i'm
> > having trouble
> > > following this.
> > >
> > > phylink_fwnode_phy_connect() says:
> > >
> > > 	/* Fixed links and 802.3z are handled without needing a
> > PHY */
> > > 	if (pl->cfg_link_an_mode == MLO_AN_FIXED ||
> > > 	    (pl->cfg_link_an_mode == MLO_AN_INBAND &&
> > > 	     phy_interface_mode_is_8023z(pl->link_interface)))
> > > 		return 0;
> > >
> > > So your first statement is not true. It should be
> > MLO_AN_INBAND and
> > > phy_interface_mode_is_8023z.
> > >
> > > > Add additional check for PHY handle parsing when set to
> > MLO_AN_INBAND.
> > >
> > > Looking at the patch, there is no reference to
> > MLO_AN_INBAND, or
> > > managed = "in-band-status";
> > 
> > That's the pesky "xpcs_an_inband" which ends up as phylink's
> > "ovr_an_inband"... I'm sure these are random renames of stuff
> > to make sure that people struggle to follow the code.
> > 
> It is as mentioned above, the "xpcs_an_inband" will end up as
> "ovr_an_inband" which will then
> set pl->cfg_link_an_mode = MLO_AN_INBAND in the
> phylink_parse_mode() in phylink.c

Let me make my comment more clear, because I don't think you understood
it correctly.

Please rename "xpcs_an_inband" to "ovr_an_inband" or
"phylink_ovr_an_inband" so it's obvious what it is and where it ends up.

Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH net v2 1/2] net: stmmac: fix PHY handle parsing
@ 2023-03-21 10:24           ` Russell King (Oracle)
  0 siblings, 0 replies; 32+ messages in thread
From: Russell King (Oracle) @ 2023-03-21 10:24 UTC (permalink / raw)
  To: Sit, Michael Wei Hong
  Cc: Andrew Lunn, Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Ong, Boon Leong, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel, Looi, Hong Aun, Voon, Weifeng,
	Lai, Peter Jun Ann

On Tue, Mar 21, 2023 at 08:34:49AM +0000, Sit, Michael Wei Hong wrote:
> 
> 
> > -----Original Message-----
> > From: Russell King <linux@armlinux.org.uk>
> > Sent: Saturday, March 18, 2023 4:58 AM
> > To: Andrew Lunn <andrew@lunn.ch>
> > Cc: Sit, Michael Wei Hong <michael.wei.hong.sit@intel.com>;
> > Giuseppe Cavallaro <peppe.cavallaro@st.com>; Alexandre
> > Torgue <alexandre.torgue@foss.st.com>; Jose Abreu
> > <joabreu@synopsys.com>; David S . Miller
> > <davem@davemloft.net>; Eric Dumazet
> > <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>;
> > Paolo Abeni <pabeni@redhat.com>; Maxime Coquelin
> > <mcoquelin.stm32@gmail.com>; Ong, Boon Leong
> > <boon.leong.ong@intel.com>; netdev@vger.kernel.org; linux-
> > stm32@st-md-mailman.stormreply.com; linux-arm-
> > kernel@lists.infradead.org; linux-kernel@vger.kernel.org; Looi,
> > Hong Aun <hong.aun.looi@intel.com>; Voon, Weifeng
> > <weifeng.voon@intel.com>; Lai, Peter Jun Ann
> > <peter.jun.ann.lai@intel.com>
> > Subject: Re: [PATCH net v2 1/2] net: stmmac: fix PHY handle
> > parsing
> > 
> > On Fri, Mar 17, 2023 at 08:56:19PM +0100, Andrew Lunn wrote:
> > > On Tue, Mar 14, 2023 at 03:02:07PM +0800, Michael Sit Wei
> > Hong wrote:
> > > > phylink_fwnode_phy_connect returns 0 when set to
> > MLO_AN_INBAND.
> > > > This causes the PHY handle parsing to skip and the PHY will not
> > be
> > > > attached to the MAC.
> > >
> > > Please could you expand the commit message because i'm
> > having trouble
> > > following this.
> > >
> > > phylink_fwnode_phy_connect() says:
> > >
> > > 	/* Fixed links and 802.3z are handled without needing a
> > PHY */
> > > 	if (pl->cfg_link_an_mode == MLO_AN_FIXED ||
> > > 	    (pl->cfg_link_an_mode == MLO_AN_INBAND &&
> > > 	     phy_interface_mode_is_8023z(pl->link_interface)))
> > > 		return 0;
> > >
> > > So your first statement is not true. It should be
> > MLO_AN_INBAND and
> > > phy_interface_mode_is_8023z.
> > >
> > > > Add additional check for PHY handle parsing when set to
> > MLO_AN_INBAND.
> > >
> > > Looking at the patch, there is no reference to
> > MLO_AN_INBAND, or
> > > managed = "in-band-status";
> > 
> > That's the pesky "xpcs_an_inband" which ends up as phylink's
> > "ovr_an_inband"... I'm sure these are random renames of stuff
> > to make sure that people struggle to follow the code.
> > 
> It is as mentioned above, the "xpcs_an_inband" will end up as
> "ovr_an_inband" which will then
> set pl->cfg_link_an_mode = MLO_AN_INBAND in the
> phylink_parse_mode() in phylink.c

Let me make my comment more clear, because I don't think you understood
it correctly.

Please rename "xpcs_an_inband" to "ovr_an_inband" or
"phylink_ovr_an_inband" so it's obvious what it is and where it ends up.

Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2023-03-21 10:26 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-14  7:02 [PATCH net v2 0/2] Fix PHY handle no longer parsing Michael Sit Wei Hong
2023-03-14  7:02 ` Michael Sit Wei Hong
2023-03-14  7:02 ` [PATCH net v2 1/2] net: stmmac: fix PHY handle parsing Michael Sit Wei Hong
2023-03-14  7:02   ` Michael Sit Wei Hong
2023-03-14  9:56   ` Fabian Bläse
2023-03-17  0:00   ` Jakub Kicinski
2023-03-17  0:00     ` Jakub Kicinski
2023-03-17  2:10     ` Sit, Michael Wei Hong
2023-03-17  2:10       ` Sit, Michael Wei Hong
2023-03-17 19:56   ` Andrew Lunn
2023-03-17 19:56     ` Andrew Lunn
2023-03-17 20:57     ` Russell King (Oracle)
2023-03-17 20:57       ` Russell King (Oracle)
2023-03-21  8:34       ` Sit, Michael Wei Hong
2023-03-21  8:34         ` Sit, Michael Wei Hong
2023-03-21 10:24         ` Russell King (Oracle)
2023-03-21 10:24           ` Russell King (Oracle)
2023-03-14  7:02 ` [PATCH net v2 2/2] net: stmmac: move fixed-link support fixup code Michael Sit Wei Hong
2023-03-14  7:02   ` Michael Sit Wei Hong
2023-03-14  9:56   ` Fabian Bläse
2023-03-17  0:01   ` Jakub Kicinski
2023-03-17  0:01     ` Jakub Kicinski
2023-03-17 20:02   ` Andrew Lunn
2023-03-17 20:02     ` Andrew Lunn
2023-03-21 10:17     ` Sit, Michael Wei Hong
2023-03-21 10:17       ` Sit, Michael Wei Hong
2023-03-17 20:54 ` [PATCH net v2 0/2] Fix PHY handle no longer parsing Russell King (Oracle)
2023-03-17 20:54   ` Russell King (Oracle)
2023-03-21  8:37   ` Sit, Michael Wei Hong
2023-03-21  8:37     ` Sit, Michael Wei Hong
2023-03-21 10:22     ` Russell King (Oracle)
2023-03-21 10:22       ` Russell King (Oracle)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.