Hello!

On 31.05.2019 22:18, Robert Hancock wrote:

Some copper SFP modules support both SGMII and 1000BaseX, but some
drivers/devices only support the 1000BaseX mode. Currently SGMII mode is
always being selected as the desired mode for such modules, and this
fails if the controller doesn't support SGMII. Add a fallback for this
case by trying 1000BaseX instead if the controller rejects SGMII mode.

Signed-off-by: Robert Hancock <hanc...@sedsystems.ca>
---
  drivers/net/phy/phylink.c | 21 +++++++++++++++++++++
  1 file changed, 21 insertions(+)

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 68d0a89..4fd72c2 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
[...]
@@ -1663,6 +1665,25 @@ static int phylink_sfp_module_insert(void *upstream,
config.interface = iface;
        ret = phylink_validate(pl, support, &config);
+
+       if (ret && iface == PHY_INTERFACE_MODE_SGMII &&
+           phylink_test(orig_support, 1000baseX_Full)) {
+               /* Copper modules may select SGMII but the interface may not
+                * support that mode, try 1000BaseX if supported.
+                */
+
+               netdev_warn(pl->netdev, "validation of %s/%s with support %*pb "
+                           "failed: %d, trying 1000BaseX\n",

Don't break the messages like this, scripts/checkpatch.pl shouldn't complain about too long lines in this case.

[...]

MBR, Sergei

Reply via email to