* [PATCH net-next 0/3] Convert mvpp2 to phylink supported_interfaces
@ 2021-10-27 9:48 Russell King (Oracle)
2021-10-27 9:49 ` [PATCH net-next 1/4] net: mvpp2: populate supported_interfaces member Russell King
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Russell King (Oracle) @ 2021-10-27 9:48 UTC (permalink / raw)
To: Marcin Wojtas; +Cc: David S. Miller, Jakub Kicinski, netdev
Hi,
This patch series converts mvpp2 to use phylinks supported_interfaces
bitmap to simplify the validate() implementation. The patches:
1) Add the supported interface modes the supported_interfaces bitmap.
2) Removes the checks for the interface type being supported from
the validate callback
3) Removes the now unnecessary checks and call to
phylink_helper_basex_speed() to support switching between
1000base-X and 2500base-X for SFPs
4) Cleans up the resulting validate() code.
(3) becomes possible because when asking the MAC for its complete
support, we walk all supported interfaces which will include 1000base-X
and 2500base-X only if the comphy is present.
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 95 +++++++++++++------------
1 file changed, 50 insertions(+), 45 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] 6+ messages in thread
* [PATCH net-next 1/4] net: mvpp2: populate supported_interfaces member
2021-10-27 9:48 [PATCH net-next 0/3] Convert mvpp2 to phylink supported_interfaces Russell King (Oracle)
@ 2021-10-27 9:49 ` Russell King
2021-10-27 9:49 ` [PATCH net-next 2/4] net: mvpp2: remove interface checks in mvpp2_phylink_validate() Russell King (Oracle)
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Russell King @ 2021-10-27 9:49 UTC (permalink / raw)
To: Marcin Wojtas; +Cc: David S. Miller, Jakub Kicinski, netdev
Populate the phy interface mode bitmap for the Marvell mvpp2 driver
with interfaces modes supported by the MAC.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
.../net/ethernet/marvell/mvpp2/mvpp2_main.c | 34 +++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 8ddf58f379ac..43ffff01bd44 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -6937,6 +6937,40 @@ static int mvpp2_port_probe(struct platform_device *pdev,
port->phylink_config.dev = &dev->dev;
port->phylink_config.type = PHYLINK_NETDEV;
+ if (mvpp2_port_supports_xlg(port)) {
+ __set_bit(PHY_INTERFACE_MODE_10GBASER,
+ port->phylink_config.supported_interfaces);
+ __set_bit(PHY_INTERFACE_MODE_XAUI,
+ port->phylink_config.supported_interfaces);
+ }
+
+ if (mvpp2_port_supports_rgmii(port))
+ phy_interface_set_rgmii(port->phylink_config.supported_interfaces);
+
+ if (comphy) {
+ /* If a COMPHY is present, we can support any of the
+ * serdes modes and switch between them.
+ */
+ __set_bit(PHY_INTERFACE_MODE_SGMII,
+ port->phylink_config.supported_interfaces);
+ __set_bit(PHY_INTERFACE_MODE_1000BASEX,
+ port->phylink_config.supported_interfaces);
+ __set_bit(PHY_INTERFACE_MODE_2500BASEX,
+ port->phylink_config.supported_interfaces);
+ } else if (phy_mode == PHY_INTERFACE_MODE_2500BASEX) {
+ /* No COMPHY, with only 2500BASE-X mode supported */
+ __set_bit(PHY_INTERFACE_MODE_2500BASEX,
+ port->phylink_config.supported_interfaces);
+ } else if (phy_mode == PHY_INTERFACE_MODE_1000BASEX ||
+ phy_mode == PHY_INTERFACE_MODE_SGMII) {
+ /* No COMPHY, we can switch between 1000BASE-X and SGMII
+ */
+ __set_bit(PHY_INTERFACE_MODE_1000BASEX,
+ port->phylink_config.supported_interfaces);
+ __set_bit(PHY_INTERFACE_MODE_SGMII,
+ port->phylink_config.supported_interfaces);
+ }
+
phylink = phylink_create(&port->phylink_config, port_fwnode,
phy_mode, &mvpp2_phylink_ops);
if (IS_ERR(phylink)) {
--
2.30.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next 2/4] net: mvpp2: remove interface checks in mvpp2_phylink_validate()
2021-10-27 9:48 [PATCH net-next 0/3] Convert mvpp2 to phylink supported_interfaces Russell King (Oracle)
2021-10-27 9:49 ` [PATCH net-next 1/4] net: mvpp2: populate supported_interfaces member Russell King
@ 2021-10-27 9:49 ` Russell King (Oracle)
2021-10-27 9:49 ` [PATCH net-next 3/4] net: mvpp2: drop use of phylink_helper_basex_speed() Russell King (Oracle)
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Russell King (Oracle) @ 2021-10-27 9:49 UTC (permalink / raw)
To: Marcin Wojtas; +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>
---
.../net/ethernet/marvell/mvpp2/mvpp2_main.c | 33 ++++---------------
1 file changed, 7 insertions(+), 26 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 43ffff01bd44..48703b6dff1e 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -6261,32 +6261,13 @@ static void mvpp2_phylink_validate(struct phylink_config *config,
struct mvpp2_port *port = mvpp2_phylink_to_port(config);
__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
- /* Invalid combinations */
- switch (state->interface) {
- case PHY_INTERFACE_MODE_10GBASER:
- case PHY_INTERFACE_MODE_XAUI:
- if (!mvpp2_port_supports_xlg(port))
- goto empty_set;
- break;
- case PHY_INTERFACE_MODE_RGMII:
- case PHY_INTERFACE_MODE_RGMII_ID:
- case PHY_INTERFACE_MODE_RGMII_RXID:
- case PHY_INTERFACE_MODE_RGMII_TXID:
- if (!mvpp2_port_supports_rgmii(port))
- goto empty_set;
- break;
- case PHY_INTERFACE_MODE_1000BASEX:
- case PHY_INTERFACE_MODE_2500BASEX:
- /* When in 802.3z mode, we must have AN enabled:
- * Bit 2 Field InBandAnEn In-band Auto-Negotiation enable. ...
- * When <PortType> = 1 (1000BASE-X) this field must be set to 1.
- */
- if (!phylink_test(state->advertising, Autoneg))
- goto empty_set;
- break;
- default:
- break;
- }
+ /* When in 802.3z mode, we must have AN enabled:
+ * Bit 2 Field InBandAnEn In-band Auto-Negotiation enable. ...
+ * When <PortType> = 1 (1000BASE-X) this field must be set to 1.
+ */
+ if (phy_interface_mode_is_8023z(state->interface) &&
+ !phylink_test(state->advertising, Autoneg))
+ goto empty_set;
phylink_set(mask, Autoneg);
phylink_set_port_modes(mask);
--
2.30.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next 3/4] net: mvpp2: drop use of phylink_helper_basex_speed()
2021-10-27 9:48 [PATCH net-next 0/3] Convert mvpp2 to phylink supported_interfaces Russell King (Oracle)
2021-10-27 9:49 ` [PATCH net-next 1/4] net: mvpp2: populate supported_interfaces member Russell King
2021-10-27 9:49 ` [PATCH net-next 2/4] net: mvpp2: remove interface checks in mvpp2_phylink_validate() Russell King (Oracle)
@ 2021-10-27 9:49 ` Russell King (Oracle)
2021-10-27 9:49 ` [PATCH net-next 4/4] net: mvpp2: clean up mvpp2_phylink_validate() Russell King (Oracle)
2021-10-28 12:20 ` [PATCH net-next 0/3] Convert mvpp2 to phylink supported_interfaces patchwork-bot+netdevbpf
4 siblings, 0 replies; 6+ messages in thread
From: Russell King (Oracle) @ 2021-10-27 9:49 UTC (permalink / raw)
To: Marcin Wojtas; +Cc: David S. Miller, Jakub Kicinski, netdev
Now that we have a better method to select SFP interface modes, we
no longer need to use phylink_helper_basex_speed() in a driver's
validation function, and we can also get rid of our hack to indicate
both 1000base-X and 2500base-X if the comphy is present to make that
work. Remove this hack and use of phylink_helper_basex_speed().
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
.../net/ethernet/marvell/mvpp2/mvpp2_main.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 48703b6dff1e..d5904408e3a5 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -6303,17 +6303,14 @@ static void mvpp2_phylink_validate(struct phylink_config *config,
break;
fallthrough;
case PHY_INTERFACE_MODE_1000BASEX:
+ phylink_set(mask, 1000baseT_Full);
+ phylink_set(mask, 1000baseX_Full);
+ if (state->interface != PHY_INTERFACE_MODE_NA)
+ break;
+ fallthrough;
case PHY_INTERFACE_MODE_2500BASEX:
- if (port->comphy ||
- state->interface != PHY_INTERFACE_MODE_2500BASEX) {
- phylink_set(mask, 1000baseT_Full);
- phylink_set(mask, 1000baseX_Full);
- }
- if (port->comphy ||
- state->interface == PHY_INTERFACE_MODE_2500BASEX) {
- phylink_set(mask, 2500baseT_Full);
- phylink_set(mask, 2500baseX_Full);
- }
+ phylink_set(mask, 2500baseT_Full);
+ phylink_set(mask, 2500baseX_Full);
break;
default:
goto empty_set;
@@ -6321,8 +6318,6 @@ static void mvpp2_phylink_validate(struct phylink_config *config,
linkmode_and(supported, supported, mask);
linkmode_and(state->advertising, state->advertising, mask);
-
- phylink_helper_basex_speed(state);
return;
empty_set:
--
2.30.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next 4/4] net: mvpp2: clean up mvpp2_phylink_validate()
2021-10-27 9:48 [PATCH net-next 0/3] Convert mvpp2 to phylink supported_interfaces Russell King (Oracle)
` (2 preceding siblings ...)
2021-10-27 9:49 ` [PATCH net-next 3/4] net: mvpp2: drop use of phylink_helper_basex_speed() Russell King (Oracle)
@ 2021-10-27 9:49 ` Russell King (Oracle)
2021-10-28 12:20 ` [PATCH net-next 0/3] Convert mvpp2 to phylink supported_interfaces patchwork-bot+netdevbpf
4 siblings, 0 replies; 6+ messages in thread
From: Russell King (Oracle) @ 2021-10-27 9:49 UTC (permalink / raw)
To: Marcin Wojtas; +Cc: David S. Miller, Jakub Kicinski, netdev
mvpp2_phylink_validate() no longer needs to check for
PHY_INTERFACE_MODE_NA as phylink will walk the supported interface
types to discover the link mode capabilities. Remove these checks.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index d5904408e3a5..587def69a6f7 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -6280,14 +6280,12 @@ static void mvpp2_phylink_validate(struct phylink_config *config,
switch (state->interface) {
case PHY_INTERFACE_MODE_10GBASER:
case PHY_INTERFACE_MODE_XAUI:
- case PHY_INTERFACE_MODE_NA:
if (mvpp2_port_supports_xlg(port)) {
phylink_set_10g_modes(mask);
phylink_set(mask, 10000baseKR_Full);
}
- if (state->interface != PHY_INTERFACE_MODE_NA)
- break;
- fallthrough;
+ break;
+
case PHY_INTERFACE_MODE_RGMII:
case PHY_INTERFACE_MODE_RGMII_ID:
case PHY_INTERFACE_MODE_RGMII_RXID:
@@ -6299,19 +6297,18 @@ static void mvpp2_phylink_validate(struct phylink_config *config,
phylink_set(mask, 100baseT_Full);
phylink_set(mask, 1000baseT_Full);
phylink_set(mask, 1000baseX_Full);
- if (state->interface != PHY_INTERFACE_MODE_NA)
- break;
- fallthrough;
+ break;
+
case PHY_INTERFACE_MODE_1000BASEX:
phylink_set(mask, 1000baseT_Full);
phylink_set(mask, 1000baseX_Full);
- if (state->interface != PHY_INTERFACE_MODE_NA)
- break;
- fallthrough;
+ break;
+
case PHY_INTERFACE_MODE_2500BASEX:
phylink_set(mask, 2500baseT_Full);
phylink_set(mask, 2500baseX_Full);
break;
+
default:
goto empty_set;
}
--
2.30.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 0/3] Convert mvpp2 to phylink supported_interfaces
2021-10-27 9:48 [PATCH net-next 0/3] Convert mvpp2 to phylink supported_interfaces Russell King (Oracle)
` (3 preceding siblings ...)
2021-10-27 9:49 ` [PATCH net-next 4/4] net: mvpp2: clean up mvpp2_phylink_validate() Russell King (Oracle)
@ 2021-10-28 12:20 ` patchwork-bot+netdevbpf
4 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-10-28 12:20 UTC (permalink / raw)
To: Russell King; +Cc: mw, davem, kuba, netdev
Hello:
This series was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:
On Wed, 27 Oct 2021 10:48:38 +0100 you wrote:
> Hi,
>
> This patch series converts mvpp2 to use phylinks supported_interfaces
> bitmap to simplify the validate() implementation. The patches:
>
> 1) Add the supported interface modes the supported_interfaces bitmap.
> 2) Removes the checks for the interface type being supported from
> the validate callback
> 3) Removes the now unnecessary checks and call to
> phylink_helper_basex_speed() to support switching between
> 1000base-X and 2500base-X for SFPs
> 4) Cleans up the resulting validate() code.
>
> [...]
Here is the summary with links:
- [net-next,1/4] net: mvpp2: populate supported_interfaces member
https://git.kernel.org/netdev/net-next/c/8498e17ed4c5
- [net-next,2/4] net: mvpp2: remove interface checks in mvpp2_phylink_validate()
https://git.kernel.org/netdev/net-next/c/6c0c4b7ac06f
- [net-next,3/4] net: mvpp2: drop use of phylink_helper_basex_speed()
https://git.kernel.org/netdev/net-next/c/76947a635874
- [net-next,4/4] net: mvpp2: clean up mvpp2_phylink_validate()
https://git.kernel.org/netdev/net-next/c/b63f1117aefc
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] 6+ messages in thread
end of thread, other threads:[~2021-10-28 12:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-27 9:48 [PATCH net-next 0/3] Convert mvpp2 to phylink supported_interfaces Russell King (Oracle)
2021-10-27 9:49 ` [PATCH net-next 1/4] net: mvpp2: populate supported_interfaces member Russell King
2021-10-27 9:49 ` [PATCH net-next 2/4] net: mvpp2: remove interface checks in mvpp2_phylink_validate() Russell King (Oracle)
2021-10-27 9:49 ` [PATCH net-next 3/4] net: mvpp2: drop use of phylink_helper_basex_speed() Russell King (Oracle)
2021-10-27 9:49 ` [PATCH net-next 4/4] net: mvpp2: clean up mvpp2_phylink_validate() Russell King (Oracle)
2021-10-28 12:20 ` [PATCH net-next 0/3] Convert mvpp2 to phylink supported_interfaces 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.