[PATCH net-next 0/3] net: ocelot_net: phylink validate implementation updates

STALE1726d

5 messages, 3 authors, 2021-11-17 · open the first message on its own page

[PATCH net-next 0/3] net: ocelot_net: phylink validate implementation updates

From: "Russell King (Oracle)" <linux@armlinux.org.uk>
Date: 2021-11-16 10:09:07

Hi,

This series converts ocelot_net to fill in the supported_interfaces
member of phylink_config, cleans up the validate() implementation,
and then converts to phylink_generic_validate().

 drivers/net/ethernet/mscc/ocelot_net.c | 41 +++++-----------------------------
 1 file changed, 6 insertions(+), 35 deletions(-)

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

[PATCH net-next 1/3] net: ocelot_net: populate supported_interfaces member

From: Russell King (Oracle) <hidden>
Date: 2021-11-16 10:09:37

Populate the phy interface mode bitmap for the MSCC Ocelot driver with
the interface modes supported by the MAC.

Signed-off-by: Russell King (Oracle) <redacted>
---
 drivers/net/ethernet/mscc/ocelot_net.c | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/mscc/ocelot_net.c b/drivers/net/ethernet/mscc/ocelot_net.c
index eaeba60b1bba..37c158df60ce 100644
--- a/drivers/net/ethernet/mscc/ocelot_net.c
+++ b/drivers/net/ethernet/mscc/ocelot_net.c
@@ -1655,6 +1655,9 @@ static int ocelot_port_phylink_create(struct ocelot *ocelot, int port,
 	priv->phylink_config.dev = &priv->dev->dev;
 	priv->phylink_config.type = PHYLINK_NETDEV;
 
+	__set_bit(ocelot_port->phy_mode,
+		  priv->phylink_config.supported_interfaces);
+
 	phylink = phylink_create(&priv->phylink_config,
 				 of_fwnode_handle(portnp),
 				 phy_mode, &ocelot_phylink_ops);
-- 
2.30.2

[PATCH net-next 2/3] net: ocelot_net: remove interface checks in macb_validate()

From: Russell King (Oracle) <hidden>
Date: 2021-11-16 10:09:42

As phylink checks the interface mode against the supported_interfaces
bitmap, we no longer need to validate the interface mode in the
validation function. Remove this to simplify it.

Signed-off-by: Russell King (Oracle) <redacted>
---
 drivers/net/ethernet/mscc/ocelot_net.c | 9 ---------
 1 file changed, 9 deletions(-)
diff --git a/drivers/net/ethernet/mscc/ocelot_net.c b/drivers/net/ethernet/mscc/ocelot_net.c
index 37c158df60ce..21df548dcf64 100644
--- a/drivers/net/ethernet/mscc/ocelot_net.c
+++ b/drivers/net/ethernet/mscc/ocelot_net.c
@@ -1502,17 +1502,8 @@ static void vsc7514_phylink_validate(struct phylink_config *config,
 				     unsigned long *supported,
 				     struct phylink_link_state *state)
 {
-	struct net_device *ndev = to_net_dev(config->dev);
-	struct ocelot_port_private *priv = netdev_priv(ndev);
-	struct ocelot_port *ocelot_port = &priv->port;
 	__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = {};
 
-	if (state->interface != PHY_INTERFACE_MODE_NA &&
-	    state->interface != ocelot_port->phy_mode) {
-		linkmode_zero(supported);
-		return;
-	}
-
 	phylink_set_port_modes(mask);
 
 	phylink_set(mask, Pause);
-- 
2.30.2

[PATCH net-next 3/3] net: ocelot_net: use phylink_generic_validate()

From: Russell King (Oracle) <hidden>
Date: 2021-11-16 10:09:52

ocelot_net has no special behaviour in its validation implementation, so
can be switched to phylink_generic_validate().

Signed-off-by: Russell King (Oracle) <redacted>
---
 drivers/net/ethernet/mscc/ocelot_net.c | 29 +++-----------------------
 1 file changed, 3 insertions(+), 26 deletions(-)
diff --git a/drivers/net/ethernet/mscc/ocelot_net.c b/drivers/net/ethernet/mscc/ocelot_net.c
index 21df548dcf64..0fcf359a6975 100644
--- a/drivers/net/ethernet/mscc/ocelot_net.c
+++ b/drivers/net/ethernet/mscc/ocelot_net.c
@@ -1498,31 +1498,6 @@ struct notifier_block ocelot_switchdev_blocking_nb __read_mostly = {
 	.notifier_call = ocelot_switchdev_blocking_event,
 };
 
-static void vsc7514_phylink_validate(struct phylink_config *config,
-				     unsigned long *supported,
-				     struct phylink_link_state *state)
-{
-	__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = {};
-
-	phylink_set_port_modes(mask);
-
-	phylink_set(mask, Pause);
-	phylink_set(mask, Autoneg);
-	phylink_set(mask, Asym_Pause);
-	phylink_set(mask, 10baseT_Half);
-	phylink_set(mask, 10baseT_Full);
-	phylink_set(mask, 100baseT_Half);
-	phylink_set(mask, 100baseT_Full);
-	phylink_set(mask, 1000baseT_Half);
-	phylink_set(mask, 1000baseT_Full);
-	phylink_set(mask, 1000baseX_Full);
-	phylink_set(mask, 2500baseT_Full);
-	phylink_set(mask, 2500baseX_Full);
-
-	linkmode_and(supported, supported, mask);
-	linkmode_and(state->advertising, state->advertising, mask);
-}
-
 static void vsc7514_phylink_mac_config(struct phylink_config *config,
 				       unsigned int link_an_mode,
 				       const struct phylink_link_state *state)
@@ -1581,7 +1556,7 @@ static void vsc7514_phylink_mac_link_up(struct phylink_config *config,
 }
 
 static const struct phylink_mac_ops ocelot_phylink_ops = {
-	.validate		= vsc7514_phylink_validate,
+	.validate		= phylink_generic_validate,
 	.mac_config		= vsc7514_phylink_mac_config,
 	.mac_link_down		= vsc7514_phylink_mac_link_down,
 	.mac_link_up		= vsc7514_phylink_mac_link_up,
@@ -1645,6 +1620,8 @@ static int ocelot_port_phylink_create(struct ocelot *ocelot, int port,
 
 	priv->phylink_config.dev = &priv->dev->dev;
 	priv->phylink_config.type = PHYLINK_NETDEV;
+	priv->phylink_config.mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE |
+		MAC_10 | MAC_100 | MAC_1000FD | MAC_2500FD;
 
 	__set_bit(ocelot_port->phy_mode,
 		  priv->phylink_config.supported_interfaces);
-- 
2.30.2

Re: [PATCH net-next 0/3] net: ocelot_net: phylink validate implementation updates

From: patchwork-bot+netdevbpf@kernel.org
Date: 2021-11-17 11:30:22

Hello:

This series was applied to netdev/net-next.git (master)
by David S. Miller [off-list ref]:

On Tue, 16 Nov 2021 10:08:58 +0000 you wrote:
Hi,

This series converts ocelot_net to fill in the supported_interfaces
member of phylink_config, cleans up the validate() implementation,
and then converts to phylink_generic_validate().

 drivers/net/ethernet/mscc/ocelot_net.c | 41 +++++-----------------------------
 1 file changed, 6 insertions(+), 35 deletions(-)
Here is the summary with links:
  - [net-next,1/3] net: ocelot_net: populate supported_interfaces member
    https://git.kernel.org/netdev/net-next/c/8ea8c5b492d4
  - [net-next,2/3] net: ocelot_net: remove interface checks in macb_validate()
    https://git.kernel.org/netdev/net-next/c/a6f5248bc0a3
  - [net-next,3/3] net: ocelot_net: use phylink_generic_validate()
    https://git.kernel.org/netdev/net-next/c/7258aa5094db

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help