Skip to content

net: phy: Introduce PHY ports representation

Maxime Chevallier linux-arm-kernel linux-arm-msm linux-devicetree lkml netdev 20 versions – Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v22 Latest14 patches 3 repliesApplied 14/14
  2. v2114 patches 7 repliesSuperseded
  3. v2014 patches 7 repliesSuperseded
Earlier versions · 17
VersionPostedPatchesRepliesStatus
v1915 patches9 repliesSuperseded
v1815 patches1 replySuperseded
v1715 patches5 repliesSuperseded
v1615 patches15 repliesSuperseded
v1515 patches20 repliesSuperseded
v1416 patches10 repliesSuperseded
v1318 patches2 repliesSuperseded
v1218 patches13 repliesSuperseded
v1116 patches3 repliesSuperseded
v1015 patches23 repliesSuperseded
v915 patches6 repliesSuperseded
v815 patches1 replySuperseded
v715 patches5 repliesSuperseded
v614 patches19 repliesSuperseded
v514 patches4 repliesSuperseded
v415 patches13 repliesSuperseded
v113 patches13 repliesSuperseded

Changes in v22 from the cover letter

- remove 'contains' in DT binding, as per AI review
- Added a comment indicating that phy_port parameters will be initialized eventually, as per AI review.

Patches in v22 All 14 applied

#Subject and filesSizeRepliesApplied
1/14dt-bindings: net: Introduce the ethernet-connector descriptionDocumentation/devicetree/bindings/net/ethernet-connector.yaml Documentation/devicetree/bindings/net/ethernet-phy.yaml MAINTAINERS+75 -01 replyApplied
2/14net: ethtool: Introduce ETHTOOL_LINK_MEDIUM_* valuesdrivers/net/phy/phy_caps.c include/linux/ethtool.h net/ethtool/common.c+177 -1161 replyApplied
3/14net: phy: Introduce PHY ports representationMAINTAINERS drivers/net/phy/Makefile drivers/net/phy/phy-caps.h +8 more+610 -11 replyApplied
4/14net: phy: dp83822: Add support for phy_port representationdrivers/net/phy/dp83822.c+45 -260 repliesApplied
5/14dt-bindings: net: dp83822: Deprecate ti,fiber-modeDocumentation/devicetree/bindings/net/ti,dp83822.yaml+8 -10 repliesApplied
6/14net: phy: Create a phy_port for PHY-driven SFPsdrivers/net/phy/phy_device.c drivers/net/phy/phy_port.c+45 -00 repliesApplied
7/14net: phy: Introduce generic SFP handling for PHY driversdrivers/net/phy/phy_device.c include/linux/phy.h include/linux/phy_port.h+111 -00 repliesApplied
8/14net: phy: marvell-88x2222: Support SFP through phy_port interfacedrivers/net/phy/marvell-88x2222.c+38 -560 repliesApplied
9/14net: phy: marvell: Support SFP through phy_port interfacedrivers/net/phy/marvell.c+32 -600 repliesApplied
10/14net: phy: marvell10g: Support SFP through phy_portdrivers/net/phy/marvell10g.c drivers/net/phy/phy_port.c include/linux/phy_port.h+74 -200 repliesApplied
11/14net: phy: at803x: Support SFP through phy_port interfacedrivers/net/phy/qcom/at803x.c+32 -450 repliesApplied
12/14net: phy: qca807x: Support SFP through phy_port interfacedrivers/net/phy/qcom/qca807x.c+30 -420 repliesApplied
13/14net: phy: Only rely on phy_port for PHY-driven SFPdrivers/net/phy/phy_device.c include/linux/phy.h+9 -250 repliesApplied
14/14Documentation: networking: Document the phy_port infrastructureDocumentation/networking/index.rst Documentation/networking/phy-port.rst MAINTAINERS+114 -00 repliesApplied

Reviews trailers per patch

All 14 patches have a Reviewed-by or Acked-by.

PatchChristophe LeroyAndrew LunnRob Herring (Arm)
1/14R-b
2/14R-b R-b
3/14R-b R-b
4/14R-b T-b R-b
5/14R-b T-b R-b
6/14R-b T-b R-b
7/14R-b T-b R-b
8/14R-b T-b R-b
9/14R-b T-b R-b
10/14R-b T-b R-b
11/14R-b T-b R-b
12/14R-b T-b R-b
13/14R-b T-b R-b
14/14R-b T-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v22 thread

Cover letter [PATCH net-next v22 00/14] net: phy: Introduce PHY ports representation

Hi everyone,

This is v22 of the phy_port work. Main items from this versions are :

- Rebase on net-next :)
- Removed a "contains" keyword in the binding
- Added a comment for phy_port SFP implementation

Patch 1 now lacks DT maintainer ACK,
Patches 2 and 3 lack PHY maintainer ACK

As a remainder, a few important notes :

- This is only a first phase. It instantiates the port, and leverage that to make the MAC <-> PHY <-> SFP usecase simpler.

- Next phase will deal with controlling the port state, as well as the netlink uAPI for that.

- The end-goal is to enable support for complex port MUX. This preliminary work focuses on PHY-driven ports, but this will be extended to support muxing at the MII level (Multi-phy, or compo PHY
+ SFP as found on Turris Omnia for example).

- The naming is definitely not set in stone. I named that "phy_port", but this may convey the false sense that this is phylib-specific. Even the word "port" is not that great, as it already has several different meanings in the net world (switch port, devlink port, etc.). I used the term "connector" in the binding.

A bit of history on that work :

The end goal that I personnaly want to achieve is :

+ PHY - RJ45
|
MAC - MUX -+ PHY - RJ45

After many discussions here on netdev@, but also at netdevconf[1] and LPC[2], there appears to be several analoguous designs that exist out there.

[1] : https://netdevconf.info/0x17/sessions/talk/improving-multi-phy-and-multi-port-interfaces.html
[2] : https://lpc.events/event/18/contributions/1964/ (video isn't the
right one)

Take the MAchiatobin, it has 2 interfaces that looks like this :

MAC - PHY -+ RJ45
|
+ SFP - Whatever the module does

Now, looking at the Turris Omnia, we have :

MAC - MUX -+ PHY - RJ45
|
+ SFP - Whatever the module does

We can find more example of this kind of designs, the common part is that we expose multiple front-facing media ports. This is what this current work aims at supporting. As of right now, it does'nt add any support for muxing, but this will come later on.

This first phase focuses on phy-driven ports only, but there are already quite some challenges already. For one, we can't really autodetect how many ports are sitting behind a PHY. That's why this series introduces a new binding. Describing ports in DT should however be a last-resort thing when we need to clear some ambiguity about the PHY media-side.

The only use-cases that we have today for multi-port PHYs are combo PHYs that drive both a Copper port and an SFP (the Macchiatobin case). This in itself is challenging and this series only addresses part of this support, by registering a phy_port for the PHY <-> SFP connection. The SFP module should in the end be considered as a port as well, but that's not yet the case.

However, because now PHYs can register phy_ports for every media-side interface they have, they can register the capabilities of their ports, which allows making the PHY-driver SFP case much more generic.

Let me know what you think, I'm all in for discussions :)

Regards,

Changes in v22:
- remove 'contains' in DT binding, as per AI review
- Added a comment indicating that phy_port parameters will be initialized eventually, as per AI review.

Changes in v21:
- Drop unused variable in marvell10g.c
- Address Russell's comments on 100BaseTX and 1000BaseX in commit logs

Changes in V20:
- Drop dp83822 SFP support, untested for too long
- Fix some cleanup sequences following claude's review

Changes in v19:
- Rebase on net-next, add the 4 new 1600G linkmodes

Changes in v18:
- Added a missing 'static' when declaring the medium names.

Changes in v17:
- Moved the medium names to patch 3
- Moved some mediums helpers out of uapi, and the logic into net/ethtool/common.c instead of inline functions in headers
- Added a MAINTAINERS entry
- Aggregated reviews/tests
- Rebased on net-next

Changes in v16:
- From Andrew, relaxed the check on the number of pairs so that we only fail when baseT is missing pairs
- Add a check for either 1, 2 or 4 pairs
- Lots of typos (mostly lanes -> pairs)
- Added Andrew's review tags (thanks again)
- From Rob, added an "else" statement in the ethernet-connector binding
- Changed the node name for ethernet connectors to be decimal

Changes in V15:
- Update bindings, docs and code to use pairs instead of lanes
- Make pairs only relevant for BaseT

Changes in V14:
- Fixed kdoc
- Use the sfp module_caps feature.

Changes in V13:
- Added phy_caps support for interface selection
- Aggregated tested-by tags

Changes in V12:
- Moved some of phylink's internal helpers to phy_caps for reuse in phylib
- Fixed SFP interface selection
- Added Rob's review and changes in patch 6

Changes in V11:
- The ti,fiber-mode property was deprecated in favor of the ethernet-connector binding
- The .attach_port was split into an MDI and an MII version
- I added the warning back in the AR8031 PHY driver
- There is now an init-time check on the number of lanes associated to every linkmode, making sure the number of lanes is above or equal to the minimum required
- Various typos were fixed all around
- We no longer use sfp_select_interface() for SFP interface validation

Changes in V10:
- Rebase on net-next
- Fix a typo reported by Köry
- Aggregate all reviews
- Fix the conflict on the qcom driver

Changes in V9:
- Removed maxItems and items from the connector binding
- Fixed a typo in the binding

Changes in V8:
- Added maxItems on the connector media binding
- Made sure we parse a single medium
- Added a missing bitwise macro

Changes in V7:
- Move ethtool_medium_get_supported to phy_caps
- support combo-ports, each with a given set of supported modes
- Introduce the notion of 'not-described' ports

Changes in V6:

- Fixed kdoc on patch 3
- Addressed a missing port-ops registration for the Marvell 88x2222 driver
- Addressed a warning reported by Simon on the DP83822 when building without CONFIG_OF_MDIO

Changes in V5 :

- renamed the bindings to use the term "connector" instead of "port"
- Rebased, and fixed some issues reported on the 83822 driver
- Use phy_caps

Changes in V4 :

- Introduced a kernel doc
- Reworked the mediums definitions in patch 2
- QCA807x now uses the generic SFP support
- Fixed some implementation bugs to build the support list based on the interfaces supported on a port

V21: https://lore.kernel.org/netdev/[email protected]/
V20: https://lore.kernel.org/r/[email protected]
V19: https://lore.kernel.org/r/[email protected]
V18: https://lore.kernel.org/r/[email protected]
V17: https://lore.kernel.org/all/[email protected]/
V16: https://lore.kernel.org/all/[email protected]/
V15: https://lore.kernel.org/all/[email protected]/
V14: https://lore.kernel.org/netdev/[email protected]/
V13: https://lore.kernel.org/netdev/[email protected]/
V12: https://lore.kernel.org/netdev/[email protected]/
V11: https://lore.kernel.org/netdev/[email protected]/
V10: https://lore.kernel.org/netdev/[email protected]/
V9: https://lore.kernel.org/netdev/[email protected]/
V8: https://lore.kernel.org/netdev/[email protected]/
v7: https://lore.kernel.org/netdev/[email protected]/
V6: https://lore.kernel.org/netdev/[email protected]/
V5: https://lore.kernel.org/netdev/[email protected]/
V4: https://lore.kernel.org/netdev/[email protected]/
V3: https://lore.kernel.org/netdev/[email protected]/
RFC V2: https://lore.kernel.org/netdev/[email protected]/
RFC V1: https://lore.kernel.org/netdev/[email protected]/

Maxime Chevallier (14):
dt-bindings: net: Introduce the ethernet-connector description
net: ethtool: Introduce ETHTOOL_LINK_MEDIUM_* values
net: phy: Introduce PHY ports representation
net: phy: dp83822: Add support for phy_port representation
dt-bindings: net: dp83822: Deprecate ti,fiber-mode
net: phy: Create a phy_port for PHY-driven SFPs
net: phy: Introduce generic SFP handling for PHY drivers
net: phy: marvell-88x2222: Support SFP through phy_port interface
net: phy: marvell: Support SFP through phy_port interface
net: phy: marvell10g: Support SFP through phy_port
net: phy: at803x: Support SFP through phy_port interface
net: phy: qca807x: Support SFP through phy_port interface
net: phy: Only rely on phy_port for PHY-driven SFP
Documentation: networking: Document the phy_port infrastructure

 .../bindings/net/ethernet-connector.yaml      |  56 +++
 .../devicetree/bindings/net/ethernet-phy.yaml |  18 +
 .../devicetree/bindings/net/ti,dp83822.yaml   |   9 +-
 Documentation/networking/index.rst            |   1 +
 Documentation/networking/phy-port.rst         | 111 ++++++
 MAINTAINERS                                   |  10 +
 drivers/net/phy/Makefile                      |   2 +-
 drivers/net/phy/dp83822.c                     |  71 ++--
 drivers/net/phy/marvell-88x2222.c             |  94 ++---
 drivers/net/phy/marvell.c                     |  92 ++---
 drivers/net/phy/marvell10g.c                  |  49 ++-
 drivers/net/phy/phy-caps.h                    |   5 +
 drivers/net/phy/phy-core.c                    |   6 +
 drivers/net/phy/phy_caps.c                    |  65 ++++
 drivers/net/phy/phy_device.c                  | 345 +++++++++++++++++-
 drivers/net/phy/phy_port.c                    | 212 +++++++++++
 drivers/net/phy/qcom/at803x.c                 |  77 ++--
 drivers/net/phy/qcom/qca807x.c                |  72 ++--
 include/linux/ethtool.h                       |  36 +-
 include/linux/phy.h                           |  63 +++-
 include/linux/phy_port.h                      |  99 +++++
 net/ethtool/common.c                          | 287 +++++++++------
 22 files changed, 1394 insertions(+), 386 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/ethernet-connector.yaml
 create mode 100644 Documentation/networking/phy-port.rst
 create mode 100644 drivers/net/phy/phy_port.c
 create mode 100644 include/linux/phy_port.h
Signature · 1 line
2.49.0