Skip to content

Commit 9525ae8

Browse files
Russell Kingdavem330
authored andcommitted
phylink: add phylink infrastructure
The link between the ethernet MAC and its PHY has become more complex as the interface evolves. This is especially true with serdes links, where the part of the PHY is effectively integrated into the MAC. Serdes links can be connected to a variety of devices, including SFF modules soldered down onto the board with the MAC, a SFP cage with a hotpluggable SFP module which may contain a PHY or directly modulate the serdes signals onto optical media with or without a PHY, or even a classical PHY connection. Moreover, the negotiation information on serdes links comes in two varieties - SGMII mode, where the PHY provides its speed/duplex/flow control information to the MAC, and 1000base-X mode where both ends exchange their abilities and each resolve the link capabilities. This means we need a more flexible means to support these arrangements, particularly with the hotpluggable nature of SFP, where the PHY can be attached or detached after the network device has been brought up. Ethtool information can come from multiple sources: - we may have a PHY operating in either SGMII or 1000base-X mode, in which case we take ethtool/mii data directly from the PHY. - we may have a optical SFP module without a PHY, with the MAC operating in 1000base-X mode - the ethtool/mii data needs to come from the MAC. - we may have a copper SFP module with a PHY whic can't be accessed, which means we need to take ethtool/mii data from the MAC. Phylink aims to solve this by providing an intermediary between the MAC and PHY, providing a safe way for PHYs to be hotplugged, and allowing a SFP driver to reconfigure the serdes connection. Phylink also takes over support of fixed link connections, where the speed/duplex/flow control are fixed, but link status may be controlled by a GPIO signal. By avoiding the fixed-phy implementation, phylink can provide a faster response to link events: fixed-phy has to wait for phylib to operate its state machine, which can take several seconds. In comparison, phylink takes milliseconds. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> - remove sync status - rework supported and advertisment handling - add 1000base-x speed for fixed links - use functionality exported from phy-core, reworking __phylink_ethtool_ksettings_set for it Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 453d00d commit 9525ae8

File tree

6 files changed

+1328
-0
lines changed

6 files changed

+1328
-0
lines changed

drivers/net/phy/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,16 @@ menuconfig PHYLIB
169169
devices. This option provides infrastructure for
170170
managing PHY devices.
171171

172+
config PHYLINK
173+
tristate
174+
depends on NETDEVICES
175+
select PHYLIB
176+
select SWPHY
177+
help
178+
PHYlink models the link between the PHY and MAC, allowing fixed
179+
configuration links, PHYs, and Serdes links with MAC level
180+
autonegotiation modes.
181+
172182
if PHYLIB
173183

174184
config SWPHY

drivers/net/phy/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ endif
1818
libphy-$(CONFIG_SWPHY) += swphy.o
1919
libphy-$(CONFIG_LED_TRIGGER_PHY) += phy_led_triggers.o
2020

21+
obj-$(CONFIG_PHYLINK) += phylink.o
2122
obj-$(CONFIG_PHYLIB) += libphy.o
2223

2324
obj-$(CONFIG_MDIO_BCM_IPROC) += mdio-bcm-iproc.o

drivers/net/phy/phy_device.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,6 +1084,7 @@ void phy_detach(struct phy_device *phydev)
10841084
phydev->attached_dev->phydev = NULL;
10851085
phydev->attached_dev = NULL;
10861086
phy_suspend(phydev);
1087+
phydev->phylink = NULL;
10871088

10881089
phy_led_triggers_unregister(phydev);
10891090

0 commit comments

Comments
 (0)