diff options
| author | Maxime Chevallier <maxime.chevallier@bootlin.com> | 2026-10-16 15:31:01 +0200 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-10-21 16:32:04 -0700 |
| commit | 9e7cd33fafb2ce1fd6cf19fd20f486ea341e6c0c (patch) | |
| tree | 5704356196210e8f0c2b226f1a7404f3ca634e10 /include/linux | |
| parent | 51ebb13c1d9658328b66b8f67e7992f708567807 (diff) | |
| download | linux-9e7cd33fafb2ce1fd6cf19fd20f486ea341e6c0c.tar.gz linux-9e7cd33fafb2ce1fd6cf19fd20f486ea341e6c0c.zip | |
net: phy: phy_port: Store information about a port's upstream
MII phy_ports are not meant to be connected directly to a link partner.
They are meant to feed into some media converter devices that will
expose an MDI phy_port, so far we only support SFP modules for that.
In the case an MDI phy_port is backed by an MII port (e.g. a SFP
module's port, backed by the SFP cage port), let's keep track of the
port id of the MII port backing it.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Aleksei Sviridkin <f@lex.la>
Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Tested-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Link: https://patch.msgid.link/20261016133107.54054-7-maxime.chevallier@bootlin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/phy.h | 4 | ||||
| -rw-r--r-- | include/linux/phy_port.h | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/phy.h b/include/linux/phy.h index 782d3ea2964e..21afc2082b17 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -616,6 +616,7 @@ struct phy_oatc14_sqi_capability { * @sfp_bus: SFP bus attached to this PHY's fiber port * @sfp_cage_port: The phy_port connected to the downstream SFP cage * @mod_port: phy_port representing the SFP module, if it is phy-less + * @upstream_port: phy_port this PHY's MII attaches to, if any * @attached_dev: The attached enet driver's device instance ptr * @adjust_link: Callback for the enet controller to respond to changes: in the * link state. @@ -811,6 +812,7 @@ struct phy_device { struct sfp_bus *sfp_bus; struct phy_port *sfp_cage_port; struct phy_port *mod_port; + struct phy_port *upstream_port; struct phylink *phylink; struct net_device *attached_dev; struct mii_timestamper *mii_ts; @@ -2495,6 +2497,8 @@ int __phy_hwtstamp_set(struct phy_device *phydev, struct phy_port *phy_get_sfp_port(struct phy_device *phydev); +void phy_set_upstream_port(struct phy_device *phydev, struct phy_port *port); + /** * phy_module_driver() - Helper macro for registering PHY drivers * @__phy_drivers: array of PHY drivers to register diff --git a/include/linux/phy_port.h b/include/linux/phy_port.h index 4e2a3fdd2f2e..8f45c031cbc1 100644 --- a/include/linux/phy_port.h +++ b/include/linux/phy_port.h @@ -40,6 +40,8 @@ struct phy_port_ops { * @head: Used by the port's parent to list ports * @parent_type: The type of device this port is directly connected to * @phy: If the parent is PHY_PORT_PHYDEV, the PHY controlling that port + * @upstream_port: Indicates the MII port that feeds this port, if any, + * e.g. the SFP cage port for a SFP module port. * @ops: Callback ops implemented by the port controller * @pairs: The number of pairs this port has, 0 if not applicable * @mediums: Bitmask of the physical mediums this port provides access to @@ -59,6 +61,7 @@ struct phy_port { union { struct phy_device *phy; }; + struct phy_port *upstream_port; const struct phy_port_ops *ops; |
