All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] net: enetc: phylink validate implementation updates
@ 2021-11-16  9:58 Russell King (Oracle)
  2021-11-16  9:58 ` [PATCH net-next 1/3] net: enetc: 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  9:58 UTC (permalink / raw)
  To: Claudiu Manoil
  Cc: Andrew Lunn, Heiner Kallweit, David S. Miller, Jakub Kicinski, netdev

This series converts enetc 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/freescale/enetc/enetc_pf.c | 53 ++++++-------------------
 1 file changed, 13 insertions(+), 40 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: enetc: populate supported_interfaces member
  2021-11-16  9:58 [PATCH net-next 0/3] net: enetc: phylink validate implementation updates Russell King (Oracle)
@ 2021-11-16  9:58 ` Russell King (Oracle)
  2021-11-16  9:59 ` [PATCH net-next 2/3] net: enetc: remove interface checks in enetc_pl_mac_validate() Russell King (Oracle)
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Russell King (Oracle) @ 2021-11-16  9:58 UTC (permalink / raw)
  To: Claudiu Manoil; +Cc: David S. Miller, Jakub Kicinski, netdev

Populate the phy_interface_t bitmap for the Freescale enetc driver with
interfaces modes supported by the MAC.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/freescale/enetc/enetc_pf.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
index 0e87c7043b77..536454205590 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
@@ -1112,6 +1112,16 @@ static int enetc_phylink_create(struct enetc_ndev_priv *priv,
 	pf->phylink_config.dev = &priv->ndev->dev;
 	pf->phylink_config.type = PHYLINK_NETDEV;
 
+	__set_bit(PHY_INTERFACE_MODE_INTERNAL,
+		  pf->phylink_config.supported_interfaces);
+	__set_bit(PHY_INTERFACE_MODE_SGMII,
+		  pf->phylink_config.supported_interfaces);
+	__set_bit(PHY_INTERFACE_MODE_2500BASEX,
+		  pf->phylink_config.supported_interfaces);
+	__set_bit(PHY_INTERFACE_MODE_USXGMII,
+		  pf->phylink_config.supported_interfaces);
+	phy_interface_set_rgmii(pf->phylink_config.supported_interfaces);
+
 	phylink = phylink_create(&pf->phylink_config, of_fwnode_handle(node),
 				 pf->if_mode, &enetc_mac_phylink_ops);
 	if (IS_ERR(phylink)) {
-- 
2.30.2


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

* [PATCH net-next 2/3] net: enetc: remove interface checks in enetc_pl_mac_validate()
  2021-11-16  9:58 [PATCH net-next 0/3] net: enetc: phylink validate implementation updates Russell King (Oracle)
  2021-11-16  9:58 ` [PATCH net-next 1/3] net: enetc: populate supported_interfaces member Russell King (Oracle)
@ 2021-11-16  9:59 ` Russell King (Oracle)
  2021-11-16  9:59 ` [PATCH net-next 3/3] net: enetc: use phylink_generic_validate() Russell King (Oracle)
  2021-11-17 11:30 ` [PATCH net-next 0/3] net: enetc: phylink validate implementation updates patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Russell King (Oracle) @ 2021-11-16  9:59 UTC (permalink / raw)
  To: Claudiu Manoil; +Cc: 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/freescale/enetc/enetc_pf.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
index 536454205590..61f05a021779 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
@@ -936,16 +936,6 @@ static void enetc_pl_mac_validate(struct phylink_config *config,
 {
 	__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
 
-	if (state->interface != PHY_INTERFACE_MODE_NA &&
-	    state->interface != PHY_INTERFACE_MODE_INTERNAL &&
-	    state->interface != PHY_INTERFACE_MODE_SGMII &&
-	    state->interface != PHY_INTERFACE_MODE_2500BASEX &&
-	    state->interface != PHY_INTERFACE_MODE_USXGMII &&
-	    !phy_interface_mode_is_rgmii(state->interface)) {
-		linkmode_zero(supported);
-		return;
-	}
-
 	phylink_set_port_modes(mask);
 	phylink_set(mask, Autoneg);
 	phylink_set(mask, Pause);
-- 
2.30.2


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

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

enetc 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>
---
 .../net/ethernet/freescale/enetc/enetc_pf.c   | 33 ++-----------------
 1 file changed, 3 insertions(+), 30 deletions(-)

diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
index 61f05a021779..fe6a544f37f0 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
@@ -930,35 +930,6 @@ static void enetc_mdiobus_destroy(struct enetc_pf *pf)
 	enetc_imdio_remove(pf);
 }
 
-static void enetc_pl_mac_validate(struct phylink_config *config,
-				  unsigned long *supported,
-				  struct phylink_link_state *state)
-{
-	__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
-
-	phylink_set_port_modes(mask);
-	phylink_set(mask, Autoneg);
-	phylink_set(mask, Pause);
-	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, 100baseT_Half);
-	phylink_set(mask, 1000baseT_Half);
-	phylink_set(mask, 1000baseT_Full);
-
-	if (state->interface == PHY_INTERFACE_MODE_INTERNAL ||
-	    state->interface == PHY_INTERFACE_MODE_2500BASEX ||
-	    state->interface == PHY_INTERFACE_MODE_USXGMII) {
-		phylink_set(mask, 2500baseT_Full);
-		phylink_set(mask, 2500baseX_Full);
-	}
-
-	linkmode_and(supported, supported, mask);
-	linkmode_and(state->advertising, state->advertising, mask);
-}
-
 static void enetc_pl_mac_config(struct phylink_config *config,
 				unsigned int mode,
 				const struct phylink_link_state *state)
@@ -1086,7 +1057,7 @@ static void enetc_pl_mac_link_down(struct phylink_config *config,
 }
 
 static const struct phylink_mac_ops enetc_mac_phylink_ops = {
-	.validate = enetc_pl_mac_validate,
+	.validate = phylink_generic_validate,
 	.mac_config = enetc_pl_mac_config,
 	.mac_link_up = enetc_pl_mac_link_up,
 	.mac_link_down = enetc_pl_mac_link_down,
@@ -1101,6 +1072,8 @@ static int enetc_phylink_create(struct enetc_ndev_priv *priv,
 
 	pf->phylink_config.dev = &priv->ndev->dev;
 	pf->phylink_config.type = PHYLINK_NETDEV;
+	pf->phylink_config.mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE |
+		MAC_10 | MAC_100 | MAC_1000 | MAC_2500FD;
 
 	__set_bit(PHY_INTERFACE_MODE_INTERNAL,
 		  pf->phylink_config.supported_interfaces);
-- 
2.30.2


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

* Re: [PATCH net-next 0/3] net: enetc: phylink validate implementation updates
  2021-11-16  9:58 [PATCH net-next 0/3] net: enetc: phylink validate implementation updates Russell King (Oracle)
                   ` (2 preceding siblings ...)
  2021-11-16  9:59 ` [PATCH net-next 3/3] net: enetc: 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: claudiu.manoil, andrew, hkallweit1, davem, kuba, netdev

Hello:

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

On Tue, 16 Nov 2021 09:58:29 +0000 you wrote:
> This series converts enetc 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/freescale/enetc/enetc_pf.c | 53 ++++++-------------------
>  1 file changed, 13 insertions(+), 40 deletions(-)

Here is the summary with links:
  - [net-next,1/3] net: enetc: populate supported_interfaces member
    https://git.kernel.org/netdev/net-next/c/4e5015df5211
  - [net-next,2/3] net: enetc: remove interface checks in enetc_pl_mac_validate()
    https://git.kernel.org/netdev/net-next/c/5a94c1ba8e33
  - [net-next,3/3] net: enetc: use phylink_generic_validate()
    https://git.kernel.org/netdev/net-next/c/75021cf02ff8

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  9:58 [PATCH net-next 0/3] net: enetc: phylink validate implementation updates Russell King (Oracle)
2021-11-16  9:58 ` [PATCH net-next 1/3] net: enetc: populate supported_interfaces member Russell King (Oracle)
2021-11-16  9:59 ` [PATCH net-next 2/3] net: enetc: remove interface checks in enetc_pl_mac_validate() Russell King (Oracle)
2021-11-16  9:59 ` [PATCH net-next 3/3] net: enetc: use phylink_generic_validate() Russell King (Oracle)
2021-11-17 11:30 ` [PATCH net-next 0/3] net: enetc: phylink validate implementation updates patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.