netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: phy: populate host_interfaces when attaching PHY
@ 2024-10-09  1:57 Daniel Golle
  2024-10-09  9:01 ` Russell King (Oracle)
  0 siblings, 1 reply; 12+ messages in thread
From: Daniel Golle @ 2024-10-09  1:57 UTC (permalink / raw)
  To: Russell King, Andrew Lunn, Heiner Kallweit, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-kernel

Use bitmask of interfaces supported by the MAC for the PHY to choose
from if the declared interface mode is among those using a single pair
of SerDes lanes.
This will allow 2500Base-T PHYs to switch to SGMII on most hosts, which
results in half-duplex being supported in case the MAC supports that.
Without this change, 2500Base-T PHYs will always operate in 2500Base-X
mode with rate-matching, which is not only wasteful in terms of energy
consumption, but also limits the supported interface modes to
full-duplex only.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
 drivers/net/phy/phylink.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 4309317de3d1..5d043c47a727 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -2111,6 +2111,13 @@ int phylink_fwnode_phy_connect(struct phylink *pl,
 		pl->link_config.interface = pl->link_interface;
 	}
 
+	/* Assume SerDes interface modes share the same lanes and allow
+	 * the PHY to switch between the
+	 */
+	if (test_bit(pl->link_interface, phylink_sfp_interfaces))
+		phy_interface_and(phy_dev->host_interfaces, phylink_sfp_interfaces,
+				  pl->config->supported_interfaces);
+
 	if (pl->config->mac_requires_rxc)
 		flags |= PHY_F_RXC_ALWAYS_ON;
 
-- 
2.47.0


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

end of thread, other threads:[~2024-10-10 16:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-09  1:57 [PATCH net-next] net: phy: populate host_interfaces when attaching PHY Daniel Golle
2024-10-09  9:01 ` Russell King (Oracle)
2024-10-09 11:52   ` Daniel Golle
2024-10-09 17:34     ` Russell King (Oracle)
2024-10-09 18:52       ` Daniel Golle
2024-10-09 20:12         ` Russell King (Oracle)
2024-10-09 21:31           ` Daniel Golle
2024-10-09 23:23             ` Russell King (Oracle)
2024-10-10 14:07               ` Daniel Golle
2024-10-10 14:58                 ` Russell King (Oracle)
2024-10-10 16:28                   ` Daniel Golle
2024-10-10 16:58                     ` Andrew Lunn

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