netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC net-next 0/4] net: dsa: ocelot: phylink updates
@ 2022-02-25 14:34 Russell King (Oracle)
  2022-02-25 14:35 ` [PATCH RFC net-next 1/4] net: dsa: ocelot: populate supported_interfaces Russell King (Oracle)
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Russell King (Oracle) @ 2022-02-25 14:34 UTC (permalink / raw)
  To: Alexandre Belloni, Claudiu Manoil, Vladimir Oltean
  Cc: Andrew Lunn, David S. Miller, Florian Fainelli, Jakub Kicinski,
	Marek Behún, netdev, UNGLinuxDriver, Vivien Didelot

Hi,

This series updates the Ocelot DSA driver for some of the recent
phylink changes. Specifically, we fill in the supported_interfaces
fields, convert to mac_select_pcs and mark the driver as non-legacy.
We do not convert to phylink_generic_validate() as Ocelot has
special support for its rate adapting PCS which makes the generic
validate method unsuitable for this driver.

The three changes mentioned above are implemented in their own
separate patches with one additional cleanup:

1) Populate the supported_interfaces bitmap
2) Remove the now unnecessary interface checks in the validate methods
3) Convert from phylink_set_pcs() to .mac_select_pcs.
4) Mark the driver as non-legacy

Thanks.

 drivers/net/dsa/ocelot/felix.c           | 31 +++++++++++++++++++++++++------
 drivers/net/dsa/ocelot/felix.h           |  2 ++
 drivers/net/dsa/ocelot/felix_vsc9959.c   | 16 ++++++++++------
 drivers/net/dsa/ocelot/seville_vsc9953.c | 16 ++++++++++------
 4 files changed, 47 insertions(+), 18 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] 12+ messages in thread

* [PATCH RFC net-next 1/4] net: dsa: ocelot: populate supported_interfaces
  2022-02-25 14:34 [PATCH RFC net-next 0/4] net: dsa: ocelot: phylink updates Russell King (Oracle)
@ 2022-02-25 14:35 ` Russell King (Oracle)
  2022-02-25 15:25   ` Vladimir Oltean
  2022-02-25 14:35 ` [PATCH RFC net-next 2/4] net: dsa: ocelot: remove interface checks Russell King (Oracle)
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 12+ messages in thread
From: Russell King (Oracle) @ 2022-02-25 14:35 UTC (permalink / raw)
  To: Alexandre Belloni, Claudiu Manoil, Vladimir Oltean
  Cc: Marek Behún, UNGLinuxDriver, Andrew Lunn, Vivien Didelot,
	Florian Fainelli, David S. Miller, Jakub Kicinski, netdev

Populate the supported interfaces bitmap for the Ocelot DSA switches.

The felix_vsc9959 and seville_vsc9953 sub-drivers only supports a
single interface mode, defined by ocelot_port->phy_mode, so we indicate
only this interface mode to phylink.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/dsa/ocelot/felix.c           | 11 +++++++++++
 drivers/net/dsa/ocelot/felix.h           |  2 ++
 drivers/net/dsa/ocelot/felix_vsc9959.c   | 10 ++++++++++
 drivers/net/dsa/ocelot/seville_vsc9953.c | 10 ++++++++++
 4 files changed, 33 insertions(+)

diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
index 9959407fede8..9e05b18940c1 100644
--- a/drivers/net/dsa/ocelot/felix.c
+++ b/drivers/net/dsa/ocelot/felix.c
@@ -778,6 +778,16 @@ static int felix_vlan_del(struct dsa_switch *ds, int port,
 	return ocelot_vlan_del(ocelot, port, vlan->vid);
 }
 
+static void felix_phylink_get_caps(struct dsa_switch *ds, int port,
+				   struct phylink_config *config)
+{
+	struct ocelot *ocelot = ds->priv;
+	struct felix *felix = ocelot_to_felix(ocelot);
+
+	if (felix->info->phylink_get_caps)
+		felix->info->phylink_get_caps(ocelot, port, config);
+}
+
 static void felix_phylink_validate(struct dsa_switch *ds, int port,
 				   unsigned long *supported,
 				   struct phylink_link_state *state)
@@ -1587,6 +1597,7 @@ const struct dsa_switch_ops felix_switch_ops = {
 	.get_ethtool_stats		= felix_get_ethtool_stats,
 	.get_sset_count			= felix_get_sset_count,
 	.get_ts_info			= felix_get_ts_info,
+	.phylink_get_caps		= felix_phylink_get_caps,
 	.phylink_validate		= felix_phylink_validate,
 	.phylink_mac_config		= felix_phylink_mac_config,
 	.phylink_mac_link_down		= felix_phylink_mac_link_down,
diff --git a/drivers/net/dsa/ocelot/felix.h b/drivers/net/dsa/ocelot/felix.h
index 9395ac119d33..b195e3f4df7f 100644
--- a/drivers/net/dsa/ocelot/felix.h
+++ b/drivers/net/dsa/ocelot/felix.h
@@ -41,6 +41,8 @@ struct felix_info {
 
 	int	(*mdio_bus_alloc)(struct ocelot *ocelot);
 	void	(*mdio_bus_free)(struct ocelot *ocelot);
+	void	(*phylink_get_caps)(struct ocelot *ocelot, int port,
+				    struct phylink_config *config);
 	void	(*phylink_validate)(struct ocelot *ocelot, int port,
 				    unsigned long *supported,
 				    struct phylink_link_state *state);
diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c
index 33f0ceae381d..a1be0e91dde6 100644
--- a/drivers/net/dsa/ocelot/felix_vsc9959.c
+++ b/drivers/net/dsa/ocelot/felix_vsc9959.c
@@ -940,6 +940,15 @@ static int vsc9959_reset(struct ocelot *ocelot)
 	return 0;
 }
 
+static void vsc9959_phylink_get_caps(struct ocelot *ocelot, int port,
+				     struct phylink_config *config)
+{
+	struct ocelot_port *ocelot_port = ocelot->ports[port];
+
+	__set_bit(ocelot_port->phy_mode,
+		  config->supported_interfaces);
+}
+
 static void vsc9959_phylink_validate(struct ocelot *ocelot, int port,
 				     unsigned long *supported,
 				     struct phylink_link_state *state)
@@ -2237,6 +2246,7 @@ static const struct felix_info felix_info_vsc9959 = {
 	.ptp_caps		= &vsc9959_ptp_caps,
 	.mdio_bus_alloc		= vsc9959_mdio_bus_alloc,
 	.mdio_bus_free		= vsc9959_mdio_bus_free,
+	.phylink_get_caps	= vsc9959_phylink_get_caps,
 	.phylink_validate	= vsc9959_phylink_validate,
 	.prevalidate_phy_mode	= vsc9959_prevalidate_phy_mode,
 	.port_setup_tc		= vsc9959_port_setup_tc,
diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c
index f2f1608a476c..2db51494b1a9 100644
--- a/drivers/net/dsa/ocelot/seville_vsc9953.c
+++ b/drivers/net/dsa/ocelot/seville_vsc9953.c
@@ -913,6 +913,15 @@ static int vsc9953_reset(struct ocelot *ocelot)
 	return 0;
 }
 
+static void vsc9953_phylink_get_caps(struct ocelot *ocelot, int port,
+				     struct phylink_config *config)
+{
+	struct ocelot_port *ocelot_port = ocelot->ports[port];
+
+	__set_bit(ocelot_port->phy_mode,
+		  config->supported_interfaces);
+}
+
 static void vsc9953_phylink_validate(struct ocelot *ocelot, int port,
 				     unsigned long *supported,
 				     struct phylink_link_state *state)
@@ -1105,6 +1114,7 @@ static const struct felix_info seville_info_vsc9953 = {
 	.num_tx_queues		= OCELOT_NUM_TC,
 	.mdio_bus_alloc		= vsc9953_mdio_bus_alloc,
 	.mdio_bus_free		= vsc9953_mdio_bus_free,
+	.phylink_get_caps	= vsc9953_phylink_get_caps,
 	.phylink_validate	= vsc9953_phylink_validate,
 	.prevalidate_phy_mode	= vsc9953_prevalidate_phy_mode,
 	.init_regmap		= ocelot_regmap_init,
-- 
2.30.2


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

* [PATCH RFC net-next 2/4] net: dsa: ocelot: remove interface checks
  2022-02-25 14:34 [PATCH RFC net-next 0/4] net: dsa: ocelot: phylink updates Russell King (Oracle)
  2022-02-25 14:35 ` [PATCH RFC net-next 1/4] net: dsa: ocelot: populate supported_interfaces Russell King (Oracle)
@ 2022-02-25 14:35 ` Russell King (Oracle)
  2022-02-25 14:37   ` Russell King (Oracle)
  2022-02-25 15:30   ` Vladimir Oltean
  2022-02-25 14:35 ` [PATCH RFC net-next 3/4] net: dsa: ocelot: convert to mac_select_pcs() Russell King (Oracle)
  2022-02-25 14:35 ` [PATCH RFC net-next 4/4] net: dsa: ocelot: mark as non-legacy Russell King (Oracle)
  3 siblings, 2 replies; 12+ messages in thread
From: Russell King (Oracle) @ 2022-02-25 14:35 UTC (permalink / raw)
  To: Alexandre Belloni, Claudiu Manoil, Vladimir Oltean
  Cc: Marek Behún, UNGLinuxDriver, Andrew Lunn, Vivien Didelot,
	Florian Fainelli, David S. Miller, Jakub Kicinski, netdev

When the supported interfaces bitmap is populated, phylink will itself
check that the interface mode is present in this bitmap. Drivers no
longer need to perform this check themselves. Remove these checks.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/dsa/ocelot/felix_vsc9959.c   | 6 ------
 drivers/net/dsa/ocelot/seville_vsc9953.c | 6 ------
 2 files changed, 12 deletions(-)

diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c
index a1be0e91dde6..4c635c46705e 100644
--- a/drivers/net/dsa/ocelot/felix_vsc9959.c
+++ b/drivers/net/dsa/ocelot/felix_vsc9959.c
@@ -956,12 +956,6 @@ static void vsc9959_phylink_validate(struct ocelot *ocelot, int port,
 	struct ocelot_port *ocelot_port = ocelot->ports[port];
 	__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
 
-	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, Autoneg);
 	phylink_set(mask, Pause);
diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c
index 2db51494b1a9..0ae8424c47e2 100644
--- a/drivers/net/dsa/ocelot/seville_vsc9953.c
+++ b/drivers/net/dsa/ocelot/seville_vsc9953.c
@@ -929,12 +929,6 @@ static void vsc9953_phylink_validate(struct ocelot *ocelot, int port,
 	struct ocelot_port *ocelot_port = ocelot->ports[port];
 	__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
 
-	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, Autoneg);
 	phylink_set(mask, Pause);
-- 
2.30.2


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

* [PATCH RFC net-next 3/4] net: dsa: ocelot: convert to mac_select_pcs()
  2022-02-25 14:34 [PATCH RFC net-next 0/4] net: dsa: ocelot: phylink updates Russell King (Oracle)
  2022-02-25 14:35 ` [PATCH RFC net-next 1/4] net: dsa: ocelot: populate supported_interfaces Russell King (Oracle)
  2022-02-25 14:35 ` [PATCH RFC net-next 2/4] net: dsa: ocelot: remove interface checks Russell King (Oracle)
@ 2022-02-25 14:35 ` Russell King (Oracle)
  2022-02-25 15:31   ` Vladimir Oltean
  2022-02-25 14:35 ` [PATCH RFC net-next 4/4] net: dsa: ocelot: mark as non-legacy Russell King (Oracle)
  3 siblings, 1 reply; 12+ messages in thread
From: Russell King (Oracle) @ 2022-02-25 14:35 UTC (permalink / raw)
  To: Alexandre Belloni, Claudiu Manoil, Vladimir Oltean
  Cc: Marek Behún, UNGLinuxDriver, Andrew Lunn, Vivien Didelot,
	Florian Fainelli, David S. Miller, Jakub Kicinski, netdev

Convert the PCS selection to use mac_select_pcs, which allows the PCS
to perform any validation it needs, and removes the need to set the PCS
in the mac_config() callback, delving into the higher DSA levels to do
so.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/dsa/ocelot/felix.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
index 9e05b18940c1..20ac74ee322d 100644
--- a/drivers/net/dsa/ocelot/felix.c
+++ b/drivers/net/dsa/ocelot/felix.c
@@ -799,16 +799,18 @@ static void felix_phylink_validate(struct dsa_switch *ds, int port,
 		felix->info->phylink_validate(ocelot, port, supported, state);
 }
 
-static void felix_phylink_mac_config(struct dsa_switch *ds, int port,
-				     unsigned int link_an_mode,
-				     const struct phylink_link_state *state)
+static struct phylink_pcs *felix_phylink_mac_select_pcs(struct dsa_switch *ds,
+							int port,
+							phy_interface_t iface)
 {
 	struct ocelot *ocelot = ds->priv;
 	struct felix *felix = ocelot_to_felix(ocelot);
-	struct dsa_port *dp = dsa_to_port(ds, port);
+	struct phylink_pcs *pcs = NULL;
 
 	if (felix->pcs && felix->pcs[port])
-		phylink_set_pcs(dp->pl, felix->pcs[port]);
+		pcs = felix->pcs[port];
+
+	return pcs;
 }
 
 static void felix_phylink_mac_link_down(struct dsa_switch *ds, int port,
@@ -1599,7 +1601,7 @@ const struct dsa_switch_ops felix_switch_ops = {
 	.get_ts_info			= felix_get_ts_info,
 	.phylink_get_caps		= felix_phylink_get_caps,
 	.phylink_validate		= felix_phylink_validate,
-	.phylink_mac_config		= felix_phylink_mac_config,
+	.phylink_mac_select_pcs		= felix_phylink_mac_select_pcs,
 	.phylink_mac_link_down		= felix_phylink_mac_link_down,
 	.phylink_mac_link_up		= felix_phylink_mac_link_up,
 	.port_fast_age			= felix_port_fast_age,
-- 
2.30.2


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

* [PATCH RFC net-next 4/4] net: dsa: ocelot: mark as non-legacy
  2022-02-25 14:34 [PATCH RFC net-next 0/4] net: dsa: ocelot: phylink updates Russell King (Oracle)
                   ` (2 preceding siblings ...)
  2022-02-25 14:35 ` [PATCH RFC net-next 3/4] net: dsa: ocelot: convert to mac_select_pcs() Russell King (Oracle)
@ 2022-02-25 14:35 ` Russell King (Oracle)
  2022-02-25 15:46   ` Vladimir Oltean
  3 siblings, 1 reply; 12+ messages in thread
From: Russell King (Oracle) @ 2022-02-25 14:35 UTC (permalink / raw)
  To: Alexandre Belloni, Claudiu Manoil, Vladimir Oltean
  Cc: Marek Behún, UNGLinuxDriver, Andrew Lunn, Vivien Didelot,
	Florian Fainelli, David S. Miller, Jakub Kicinski, netdev

The ocelot DSA driver does not make use of the speed, duplex, pause or
advertisement in its phylink_mac_config() implementation, so it can be
marked as a non-legacy driver.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/dsa/ocelot/felix.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
index 20ac74ee322d..f517bf902812 100644
--- a/drivers/net/dsa/ocelot/felix.c
+++ b/drivers/net/dsa/ocelot/felix.c
@@ -784,6 +784,12 @@ static void felix_phylink_get_caps(struct dsa_switch *ds, int port,
 	struct ocelot *ocelot = ds->priv;
 	struct felix *felix = ocelot_to_felix(ocelot);
 
+	/* This driver does not make use of the speed, duplex, pause or the
+	 * advertisement in its mac_config, so it is safe to mark this driver
+	 * as non-legacy.
+	 */
+	config->legacy_pre_march2020 = false;
+
 	if (felix->info->phylink_get_caps)
 		felix->info->phylink_get_caps(ocelot, port, config);
 }
-- 
2.30.2


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

* Re: [PATCH RFC net-next 2/4] net: dsa: ocelot: remove interface checks
  2022-02-25 14:35 ` [PATCH RFC net-next 2/4] net: dsa: ocelot: remove interface checks Russell King (Oracle)
@ 2022-02-25 14:37   ` Russell King (Oracle)
  2022-02-25 15:30   ` Vladimir Oltean
  1 sibling, 0 replies; 12+ messages in thread
From: Russell King (Oracle) @ 2022-02-25 14:37 UTC (permalink / raw)
  To: Alexandre Belloni, Claudiu Manoil, Vladimir Oltean
  Cc: Marek Behún, UNGLinuxDriver, Andrew Lunn, Vivien Didelot,
	Florian Fainelli, David S. Miller, Jakub Kicinski, netdev

On Fri, Feb 25, 2022 at 02:35:21PM +0000, Russell King (Oracle) wrote:
> When the supported interfaces bitmap is populated, phylink will itself
> check that the interface mode is present in this bitmap. Drivers no
> longer need to perform this check themselves. Remove these checks.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Sorry, just realised I should've deleted "ocelot_port" here as well, for
some reason my build testing didn't find that. Please assume that I've
deleted it (I've updated the patch locally.) Thanks.

> ---
>  drivers/net/dsa/ocelot/felix_vsc9959.c   | 6 ------
>  drivers/net/dsa/ocelot/seville_vsc9953.c | 6 ------
>  2 files changed, 12 deletions(-)
> 
> diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c
> index a1be0e91dde6..4c635c46705e 100644
> --- a/drivers/net/dsa/ocelot/felix_vsc9959.c
> +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c
> @@ -956,12 +956,6 @@ static void vsc9959_phylink_validate(struct ocelot *ocelot, int port,
>  	struct ocelot_port *ocelot_port = ocelot->ports[port];
>  	__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
>  
> -	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, Autoneg);
>  	phylink_set(mask, Pause);
> diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c
> index 2db51494b1a9..0ae8424c47e2 100644
> --- a/drivers/net/dsa/ocelot/seville_vsc9953.c
> +++ b/drivers/net/dsa/ocelot/seville_vsc9953.c
> @@ -929,12 +929,6 @@ static void vsc9953_phylink_validate(struct ocelot *ocelot, int port,
>  	struct ocelot_port *ocelot_port = ocelot->ports[port];
>  	__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
>  
> -	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, Autoneg);
>  	phylink_set(mask, Pause);
> -- 
> 2.30.2
> 
> 

-- 
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] 12+ messages in thread

* Re: [PATCH RFC net-next 1/4] net: dsa: ocelot: populate supported_interfaces
  2022-02-25 14:35 ` [PATCH RFC net-next 1/4] net: dsa: ocelot: populate supported_interfaces Russell King (Oracle)
@ 2022-02-25 15:25   ` Vladimir Oltean
  0 siblings, 0 replies; 12+ messages in thread
From: Vladimir Oltean @ 2022-02-25 15:25 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Alexandre Belloni, Claudiu Manoil, Marek BehĂșn,
	UNGLinuxDriver@microchip.com, Andrew Lunn, Vivien Didelot,
	Florian Fainelli, David S. Miller, Jakub Kicinski,
	netdev@vger.kernel.org

On Fri, Feb 25, 2022 at 02:35:16PM +0000, Russell King (Oracle) wrote:
> Populate the supported interfaces bitmap for the Ocelot DSA switches.
> 
> The felix_vsc9959 and seville_vsc9953 sub-drivers only supports a
> single interface mode, defined by ocelot_port->phy_mode, so we indicate
> only this interface mode to phylink.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>  drivers/net/dsa/ocelot/felix.c           | 11 +++++++++++
>  drivers/net/dsa/ocelot/felix.h           |  2 ++
>  drivers/net/dsa/ocelot/felix_vsc9959.c   | 10 ++++++++++
>  drivers/net/dsa/ocelot/seville_vsc9953.c | 10 ++++++++++
>  4 files changed, 33 insertions(+)
> 
> diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
> index 9959407fede8..9e05b18940c1 100644
> --- a/drivers/net/dsa/ocelot/felix.c
> +++ b/drivers/net/dsa/ocelot/felix.c
> @@ -778,6 +778,16 @@ static int felix_vlan_del(struct dsa_switch *ds, int port,
>  	return ocelot_vlan_del(ocelot, port, vlan->vid);
>  }
>  
> +static void felix_phylink_get_caps(struct dsa_switch *ds, int port,
> +				   struct phylink_config *config)
> +{
> +	struct ocelot *ocelot = ds->priv;
> +	struct felix *felix = ocelot_to_felix(ocelot);
> +
> +	if (felix->info->phylink_get_caps)
> +		felix->info->phylink_get_caps(ocelot, port, config);
> +}

Up until the end the implementations for vsc9953 and vsc9959 remain
identical, so please remove felix->info->phylink_get_caps and keep a
common implementation for both.

> +
>  static void felix_phylink_validate(struct dsa_switch *ds, int port,
>  				   unsigned long *supported,
>  				   struct phylink_link_state *state)
> @@ -1587,6 +1597,7 @@ const struct dsa_switch_ops felix_switch_ops = {
>  	.get_ethtool_stats		= felix_get_ethtool_stats,
>  	.get_sset_count			= felix_get_sset_count,
>  	.get_ts_info			= felix_get_ts_info,
> +	.phylink_get_caps		= felix_phylink_get_caps,
>  	.phylink_validate		= felix_phylink_validate,
>  	.phylink_mac_config		= felix_phylink_mac_config,
>  	.phylink_mac_link_down		= felix_phylink_mac_link_down,
> diff --git a/drivers/net/dsa/ocelot/felix.h b/drivers/net/dsa/ocelot/felix.h
> index 9395ac119d33..b195e3f4df7f 100644
> --- a/drivers/net/dsa/ocelot/felix.h
> +++ b/drivers/net/dsa/ocelot/felix.h
> @@ -41,6 +41,8 @@ struct felix_info {
>  
>  	int	(*mdio_bus_alloc)(struct ocelot *ocelot);
>  	void	(*mdio_bus_free)(struct ocelot *ocelot);
> +	void	(*phylink_get_caps)(struct ocelot *ocelot, int port,
> +				    struct phylink_config *config);
>  	void	(*phylink_validate)(struct ocelot *ocelot, int port,
>  				    unsigned long *supported,
>  				    struct phylink_link_state *state);
> diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c
> index 33f0ceae381d..a1be0e91dde6 100644
> --- a/drivers/net/dsa/ocelot/felix_vsc9959.c
> +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c
> @@ -940,6 +940,15 @@ static int vsc9959_reset(struct ocelot *ocelot)
>  	return 0;
>  }
>  
> +static void vsc9959_phylink_get_caps(struct ocelot *ocelot, int port,
> +				     struct phylink_config *config)
> +{
> +	struct ocelot_port *ocelot_port = ocelot->ports[port];
> +
> +	__set_bit(ocelot_port->phy_mode,
> +		  config->supported_interfaces);
> +}
> +
>  static void vsc9959_phylink_validate(struct ocelot *ocelot, int port,
>  				     unsigned long *supported,
>  				     struct phylink_link_state *state)
> @@ -2237,6 +2246,7 @@ static const struct felix_info felix_info_vsc9959 = {
>  	.ptp_caps		= &vsc9959_ptp_caps,
>  	.mdio_bus_alloc		= vsc9959_mdio_bus_alloc,
>  	.mdio_bus_free		= vsc9959_mdio_bus_free,
> +	.phylink_get_caps	= vsc9959_phylink_get_caps,
>  	.phylink_validate	= vsc9959_phylink_validate,
>  	.prevalidate_phy_mode	= vsc9959_prevalidate_phy_mode,
>  	.port_setup_tc		= vsc9959_port_setup_tc,
> diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c
> index f2f1608a476c..2db51494b1a9 100644
> --- a/drivers/net/dsa/ocelot/seville_vsc9953.c
> +++ b/drivers/net/dsa/ocelot/seville_vsc9953.c
> @@ -913,6 +913,15 @@ static int vsc9953_reset(struct ocelot *ocelot)
>  	return 0;
>  }
>  
> +static void vsc9953_phylink_get_caps(struct ocelot *ocelot, int port,
> +				     struct phylink_config *config)
> +{
> +	struct ocelot_port *ocelot_port = ocelot->ports[port];
> +
> +	__set_bit(ocelot_port->phy_mode,
> +		  config->supported_interfaces);
> +}
> +
>  static void vsc9953_phylink_validate(struct ocelot *ocelot, int port,
>  				     unsigned long *supported,
>  				     struct phylink_link_state *state)
> @@ -1105,6 +1114,7 @@ static const struct felix_info seville_info_vsc9953 = {
>  	.num_tx_queues		= OCELOT_NUM_TC,
>  	.mdio_bus_alloc		= vsc9953_mdio_bus_alloc,
>  	.mdio_bus_free		= vsc9953_mdio_bus_free,
> +	.phylink_get_caps	= vsc9953_phylink_get_caps,
>  	.phylink_validate	= vsc9953_phylink_validate,
>  	.prevalidate_phy_mode	= vsc9953_prevalidate_phy_mode,
>  	.init_regmap		= ocelot_regmap_init,
> -- 
> 2.30.2
>

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

* Re: [PATCH RFC net-next 2/4] net: dsa: ocelot: remove interface checks
  2022-02-25 14:35 ` [PATCH RFC net-next 2/4] net: dsa: ocelot: remove interface checks Russell King (Oracle)
  2022-02-25 14:37   ` Russell King (Oracle)
@ 2022-02-25 15:30   ` Vladimir Oltean
  1 sibling, 0 replies; 12+ messages in thread
From: Vladimir Oltean @ 2022-02-25 15:30 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Alexandre Belloni, Claudiu Manoil, Marek BehĂșn,
	UNGLinuxDriver@microchip.com, Andrew Lunn, Vivien Didelot,
	Florian Fainelli, David S. Miller, Jakub Kicinski,
	netdev@vger.kernel.org

On Fri, Feb 25, 2022 at 02:35:21PM +0000, Russell King (Oracle) wrote:
> When the supported interfaces bitmap is populated, phylink will itself
> check that the interface mode is present in this bitmap. Drivers no
> longer need to perform this check themselves. Remove these checks.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---

Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>

>  drivers/net/dsa/ocelot/felix_vsc9959.c   | 6 ------
>  drivers/net/dsa/ocelot/seville_vsc9953.c | 6 ------
>  2 files changed, 12 deletions(-)
> 
> diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c
> index a1be0e91dde6..4c635c46705e 100644
> --- a/drivers/net/dsa/ocelot/felix_vsc9959.c
> +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c
> @@ -956,12 +956,6 @@ static void vsc9959_phylink_validate(struct ocelot *ocelot, int port,
>  	struct ocelot_port *ocelot_port = ocelot->ports[port];
>  	__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
>  
> -	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, Autoneg);
>  	phylink_set(mask, Pause);
> diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c
> index 2db51494b1a9..0ae8424c47e2 100644
> --- a/drivers/net/dsa/ocelot/seville_vsc9953.c
> +++ b/drivers/net/dsa/ocelot/seville_vsc9953.c
> @@ -929,12 +929,6 @@ static void vsc9953_phylink_validate(struct ocelot *ocelot, int port,
>  	struct ocelot_port *ocelot_port = ocelot->ports[port];
>  	__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
>  
> -	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, Autoneg);
>  	phylink_set(mask, Pause);
> -- 
> 2.30.2
>

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

* Re: [PATCH RFC net-next 3/4] net: dsa: ocelot: convert to mac_select_pcs()
  2022-02-25 14:35 ` [PATCH RFC net-next 3/4] net: dsa: ocelot: convert to mac_select_pcs() Russell King (Oracle)
@ 2022-02-25 15:31   ` Vladimir Oltean
  0 siblings, 0 replies; 12+ messages in thread
From: Vladimir Oltean @ 2022-02-25 15:31 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Alexandre Belloni, Claudiu Manoil, Marek BehĂșn,
	UNGLinuxDriver@microchip.com, Andrew Lunn, Vivien Didelot,
	Florian Fainelli, David S. Miller, Jakub Kicinski,
	netdev@vger.kernel.org

On Fri, Feb 25, 2022 at 02:35:26PM +0000, Russell King (Oracle) wrote:
> Convert the PCS selection to use mac_select_pcs, which allows the PCS
> to perform any validation it needs, and removes the need to set the PCS
> in the mac_config() callback, delving into the higher DSA levels to do
> so.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---

Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>

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

* Re: [PATCH RFC net-next 4/4] net: dsa: ocelot: mark as non-legacy
  2022-02-25 14:35 ` [PATCH RFC net-next 4/4] net: dsa: ocelot: mark as non-legacy Russell King (Oracle)
@ 2022-02-25 15:46   ` Vladimir Oltean
  2022-02-25 15:59     ` Russell King (Oracle)
  0 siblings, 1 reply; 12+ messages in thread
From: Vladimir Oltean @ 2022-02-25 15:46 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Alexandre Belloni, Claudiu Manoil, Marek BehĂșn,
	UNGLinuxDriver@microchip.com, Andrew Lunn, Vivien Didelot,
	Florian Fainelli, David S. Miller, Jakub Kicinski,
	netdev@vger.kernel.org

On Fri, Feb 25, 2022 at 02:35:31PM +0000, Russell King (Oracle) wrote:
> The ocelot DSA driver does not make use of the speed, duplex, pause or
> advertisement in its phylink_mac_config() implementation, so it can be
> marked as a non-legacy driver.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---

Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com>

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

* Re: [PATCH RFC net-next 4/4] net: dsa: ocelot: mark as non-legacy
  2022-02-25 15:46   ` Vladimir Oltean
@ 2022-02-25 15:59     ` Russell King (Oracle)
  2022-02-25 16:00       ` Vladimir Oltean
  0 siblings, 1 reply; 12+ messages in thread
From: Russell King (Oracle) @ 2022-02-25 15:59 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: Alexandre Belloni, Claudiu Manoil, Marek BehĂșn,
	UNGLinuxDriver@microchip.com, Andrew Lunn, Vivien Didelot,
	Florian Fainelli, David S. Miller, Jakub Kicinski,
	netdev@vger.kernel.org

On Fri, Feb 25, 2022 at 03:46:50PM +0000, Vladimir Oltean wrote:
> On Fri, Feb 25, 2022 at 02:35:31PM +0000, Russell King (Oracle) wrote:
> > The ocelot DSA driver does not make use of the speed, duplex, pause or
> > advertisement in its phylink_mac_config() implementation, so it can be
> > marked as a non-legacy driver.
> > 
> > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > ---
> 
> Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Hi Vladimir,

Shall I assume the tested-by applies to patch 2 and 3 as well?

Thanks.

-- 
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] 12+ messages in thread

* Re: [PATCH RFC net-next 4/4] net: dsa: ocelot: mark as non-legacy
  2022-02-25 15:59     ` Russell King (Oracle)
@ 2022-02-25 16:00       ` Vladimir Oltean
  0 siblings, 0 replies; 12+ messages in thread
From: Vladimir Oltean @ 2022-02-25 16:00 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Alexandre Belloni, Claudiu Manoil, Marek BehĂșn,
	UNGLinuxDriver@microchip.com, Andrew Lunn, Vivien Didelot,
	Florian Fainelli, David S. Miller, Jakub Kicinski,
	netdev@vger.kernel.org

On Fri, Feb 25, 2022 at 03:59:42PM +0000, Russell King (Oracle) wrote:
> On Fri, Feb 25, 2022 at 03:46:50PM +0000, Vladimir Oltean wrote:
> > On Fri, Feb 25, 2022 at 02:35:31PM +0000, Russell King (Oracle) wrote:
> > > The ocelot DSA driver does not make use of the speed, duplex, pause or
> > > advertisement in its phylink_mac_config() implementation, so it can be
> > > marked as a non-legacy driver.
> > > 
> > > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > > ---
> > 
> > Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> > Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> 
> Hi Vladimir,
> 
> Shall I assume the tested-by applies to patch 2 and 3 as well?
> 
> Thanks.

Yes.

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

end of thread, other threads:[~2022-02-25 16:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-25 14:34 [PATCH RFC net-next 0/4] net: dsa: ocelot: phylink updates Russell King (Oracle)
2022-02-25 14:35 ` [PATCH RFC net-next 1/4] net: dsa: ocelot: populate supported_interfaces Russell King (Oracle)
2022-02-25 15:25   ` Vladimir Oltean
2022-02-25 14:35 ` [PATCH RFC net-next 2/4] net: dsa: ocelot: remove interface checks Russell King (Oracle)
2022-02-25 14:37   ` Russell King (Oracle)
2022-02-25 15:30   ` Vladimir Oltean
2022-02-25 14:35 ` [PATCH RFC net-next 3/4] net: dsa: ocelot: convert to mac_select_pcs() Russell King (Oracle)
2022-02-25 15:31   ` Vladimir Oltean
2022-02-25 14:35 ` [PATCH RFC net-next 4/4] net: dsa: ocelot: mark as non-legacy Russell King (Oracle)
2022-02-25 15:46   ` Vladimir Oltean
2022-02-25 15:59     ` Russell King (Oracle)
2022-02-25 16:00       ` Vladimir Oltean

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