netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* C45 Phys and PHY_FORCING state
@ 2018-10-19 12:02 Jose Abreu
  2018-10-19 18:43 ` Florian Fainelli
  0 siblings, 1 reply; 2+ messages in thread
From: Jose Abreu @ 2018-10-19 12:02 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli
  Cc: David S. Miller, netdev@vger.kernel.org, Joao Pinto

[-- Attachment #1: Type: text/plain, Size: 516 bytes --]

Hello Andrew and Florian,

Currently I have a 10G C45 phy that is fixed at 10G link. This
version does not support auto negotiation so I'm turning off the
feature in phydev struct field. I found out that when I do this
phylib is not composing C45 frames and is instead using C22. This
is due to call to genphy_udpate_link() which doesn't work on my
phy because it doesn't support C22.

If I apply attached patch then things work perfectly fine. Can
you please review it ?

Thanks and Best Regards,
Jose Miguel Abreu

[-- Attachment #2: 0005-net-phy-Use-C45-Helpers-when-forcing-PHY.patch --]
[-- Type: text/x-patch, Size: 1109 bytes --]

>From cccf07f4d7335cbc36f3856da6d368cb01570760 Mon Sep 17 00:00:00 2001
Message-Id: <cccf07f4d7335cbc36f3856da6d368cb01570760.1539949939.git.joabreu@synopsys.com>
In-Reply-To: <cover.1539949939.git.joabreu@synopsys.com>
References: <cover.1539949939.git.joabreu@synopsys.com>
From: Jose Abreu <joabreu@synopsys.com>
Date: Thu, 18 Oct 2018 17:36:21 +0200
Subject: [PATCH 5/8] net: phy: Use C45 Helpers when forcing PHY

If PHY is in force state and we have a C45 phy we need to use the
standard C45 helpers and not the C22 ones.

Signed-off-by: Jose Abreu <joabreu@synopsys.com>
---
 drivers/net/phy/phy.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 1ee25877c4d1..28ed957bc0f6 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -1007,7 +1007,11 @@ void phy_state_machine(struct work_struct *work)
 		}
 		break;
 	case PHY_FORCING:
-		err = genphy_update_link(phydev);
+		if (phydev->is_c45)
+			err = gen10g_read_status(phydev);
+		else
+			err = genphy_update_link(phydev);
+
 		if (err)
 			break;
 
-- 
2.7.4


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

* Re: C45 Phys and PHY_FORCING state
  2018-10-19 12:02 C45 Phys and PHY_FORCING state Jose Abreu
@ 2018-10-19 18:43 ` Florian Fainelli
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Fainelli @ 2018-10-19 18:43 UTC (permalink / raw)
  To: Jose Abreu, Andrew Lunn
  Cc: David S. Miller, netdev@vger.kernel.org, Joao Pinto

On 10/19/2018 05:02 AM, Jose Abreu wrote:
> Hello Andrew and Florian,
> 
> Currently I have a 10G C45 phy that is fixed at 10G link. This
> version does not support auto negotiation so I'm turning off the
> feature in phydev struct field. I found out that when I do this
> phylib is not composing C45 frames and is instead using C22. This
> is due to call to genphy_udpate_link() which doesn't work on my
> phy because it doesn't support C22.
> 
> If I apply attached patch then things work perfectly fine. Can
> you please review it ?

Looks reasonable, I could not find other functions in the state machine
that were not already abstracting the clause type, or letting a driver
callback be called. Can you submit this as a formal patch against
net-next (and not attached, but inline)?

I would suggest creating a helper, e.g: phy_update_link() that way
everything is well namespaced and clear within the state machine itself.
-- 
Florian

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

end of thread, other threads:[~2018-10-20  2:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-19 12:02 C45 Phys and PHY_FORCING state Jose Abreu
2018-10-19 18:43 ` Florian Fainelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).