netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] net: ocelot_net: phylink validate implementation updates
@ 2021-11-16 10:08 Russell King (Oracle)
  2021-11-16 10:09 ` [PATCH net-next 1/3] net: ocelot_net: populate supported_interfaces member Russell King (Oracle)
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Russell King (Oracle) @ 2021-11-16 10:08 UTC (permalink / raw)
  To: Alexandre Belloni, Claudiu Manoil, Vladimir Oltean
  Cc: David S. Miller, Jakub Kicinski, netdev, UNGLinuxDriver

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!

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

* [PATCH net-next 1/3] net: ocelot_net: populate supported_interfaces member
  2021-11-16 10:08 [PATCH net-next 0/3] net: ocelot_net: phylink validate implementation updates Russell King (Oracle)
@ 2021-11-16 10:09 ` Russell King (Oracle)
  2021-11-16 10:09 ` [PATCH net-next 2/3] net: ocelot_net: remove interface checks in macb_validate() Russell King (Oracle)
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Russell King (Oracle) @ 2021-11-16 10:09 UTC (permalink / raw)
  To: Alexandre Belloni, Claudiu Manoil, Vladimir Oltean
  Cc: UNGLinuxDriver, David S. Miller, Jakub Kicinski, netdev

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) <rmk+kernel@armlinux.org.uk>
---
 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


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

* [PATCH net-next 2/3] net: ocelot_net: remove interface checks in macb_validate()
  2021-11-16 10:08 [PATCH net-next 0/3] net: ocelot_net: phylink validate implementation updates Russell King (Oracle)
  2021-11-16 10:09 ` [PATCH net-next 1/3] net: ocelot_net: populate supported_interfaces member Russell King (Oracle)
@ 2021-11-16 10:09 ` Russell King (Oracle)
  2021-11-16 10:09 ` [PATCH net-next 3/3] net: ocelot_net: use phylink_generic_validate() Russell King (Oracle)
  2021-11-17 11:30 ` [PATCH net-next 0/3] net: ocelot_net: phylink validate implementation updates patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Russell King (Oracle) @ 2021-11-16 10:09 UTC (permalink / raw)
  To: Alexandre Belloni, Claudiu Manoil, Vladimir Oltean
  Cc: UNGLinuxDriver, David S. Miller, Jakub Kicinski, netdev

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) <rmk+kernel@armlinux.org.uk>
---
 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


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

* [PATCH net-next 3/3] net: ocelot_net: use phylink_generic_validate()
  2021-11-16 10:08 [PATCH net-next 0/3] net: ocelot_net: phylink validate implementation updates Russell King (Oracle)
  2021-11-16 10:09 ` [PATCH net-next 1/3] net: ocelot_net: populate supported_interfaces member Russell King (Oracle)
  2021-11-16 10:09 ` [PATCH net-next 2/3] net: ocelot_net: remove interface checks in macb_validate() Russell King (Oracle)
@ 2021-11-16 10:09 ` Russell King (Oracle)
  2021-11-17 11:30 ` [PATCH net-next 0/3] net: ocelot_net: phylink validate implementation updates patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Russell King (Oracle) @ 2021-11-16 10:09 UTC (permalink / raw)
  To: Alexandre Belloni, Claudiu Manoil, Vladimir Oltean
  Cc: UNGLinuxDriver, David S. Miller, Jakub Kicinski, netdev

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

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 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


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

* Re: [PATCH net-next 0/3] net: ocelot_net: phylink validate implementation updates
  2021-11-16 10:08 [PATCH net-next 0/3] net: ocelot_net: phylink validate implementation updates Russell King (Oracle)
                   ` (2 preceding siblings ...)
  2021-11-16 10:09 ` [PATCH net-next 3/3] net: ocelot_net: use phylink_generic_validate() Russell King (Oracle)
@ 2021-11-17 11:30 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-11-17 11:30 UTC (permalink / raw)
  To: Russell King
  Cc: alexandre.belloni, claudiu.manoil, vladimir.oltean, davem, kuba,
	netdev, UNGLinuxDriver

Hello:

This series was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

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



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

end of thread, other threads:[~2021-11-17 11:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-16 10:08 [PATCH net-next 0/3] net: ocelot_net: phylink validate implementation updates Russell King (Oracle)
2021-11-16 10:09 ` [PATCH net-next 1/3] net: ocelot_net: populate supported_interfaces member Russell King (Oracle)
2021-11-16 10:09 ` [PATCH net-next 2/3] net: ocelot_net: remove interface checks in macb_validate() Russell King (Oracle)
2021-11-16 10:09 ` [PATCH net-next 3/3] net: ocelot_net: use phylink_generic_validate() Russell King (Oracle)
2021-11-17 11:30 ` [PATCH net-next 0/3] net: ocelot_net: phylink validate implementation updates patchwork-bot+netdevbpf

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).