]> git.ipfire.org Git - thirdparty/linux.git/commit - drivers/net/dsa/sja1105/sja1105_main.c
net: dsa: sja1105: Fix broken fixed-link interfaces on user ports
authorVladimir Oltean <olteanv@gmail.com>
Tue, 28 May 2019 17:38:17 +0000 (20:38 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 30 May 2019 04:48:54 +0000 (21:48 -0700)
commitaf7cd0366ee994e8b35985d407261dc0ed9dfb4d
treeb6b573939331f9c4bba2a181a3df63a7713f6e73
parent0e27921816ad99f78140e0c61ddf2bc515cc7e22
net: dsa: sja1105: Fix broken fixed-link interfaces on user ports

PHYLIB and PHYLINK handle fixed-link interfaces differently. PHYLIB
wraps them in a software PHY ("pseudo fixed link") phydev construct such
that .adjust_link driver callbacks see an unified API. Whereas PHYLINK
simply creates a phylink_link_state structure and passes it to
.mac_config.

At the time the driver was introduced, DSA was using PHYLIB for the
CPU/cascade ports (the ones with no net devices) and PHYLINK for
everything else.

As explained below:

commit aab9c4067d2389d0adfc9c53806437df7b0fe3d5
Author: Florian Fainelli <f.fainelli@gmail.com>
Date:   Thu May 10 13:17:36 2018 -0700

  net: dsa: Plug in PHYLINK support

  Drivers that utilize fixed links for user-facing ports (e.g: bcm_sf2)
  will need to implement phylink_mac_ops from now on to preserve
  functionality, since PHYLINK *does not* create a phy_device instance
  for fixed links.

In the above patch, DSA guards the .phylink_mac_config callback against
a NULL phydev pointer.  Therefore, .adjust_link is not called in case of
a fixed-link user port.

This patch fixes the situation by converting the driver from using
.adjust_link to .phylink_mac_config.  This can be done now in a unified
fashion for both slave and CPU/cascade ports because DSA now uses
PHYLINK for all ports.

Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/sja1105/sja1105_main.c