phy-port.rst 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. .. SPDX-License-Identifier: GPL-2.0
  2. .. _phy_port:
  3. =================
  4. Ethernet ports
  5. =================
  6. This document is a basic description of the phy_port infrastructure,
  7. introduced to represent physical interfaces of Ethernet devices.
  8. Without phy_port, we already have quite a lot of information about what the
  9. media-facing interface of a NIC can do and looks like, through the
  10. :c:type:`struct ethtool_link_ksettings <ethtool_link_ksettings>` attributes,
  11. which includes :
  12. - What the NIC can do through the :c:member:`supported` field
  13. - What the Link Partner advertises through :c:member:`lp_advertising`
  14. - Which features we're advertising through :c:member:`advertising`
  15. We also have info about the number of pairs and the PORT type. These settings
  16. are built by aggregating together information reported by various devices that
  17. are sitting on the link :
  18. - The NIC itself, through the :c:member:`get_link_ksettings` callback
  19. - Precise information from the MAC and PCS by using phylink in the MAC driver
  20. - Information reported by the PHY device
  21. - Information reported by an SFP module (which can itself include a PHY)
  22. This model however starts showing its limitations when we consider devices that
  23. have more than one media interface. In such a case, only information about the
  24. actively used interface is reported, and it's not possible to know what the
  25. other interfaces can do. In fact, we have very little information about whether
  26. or not there are any other media interfaces.
  27. The goal of the phy_port representation is to provide a way of representing a
  28. physical interface of a NIC, regardless of what is driving the port (NIC through
  29. a firmware, SFP module, Ethernet PHY).
  30. Multi-port interfaces examples
  31. ==============================
  32. Several cases of multi-interface NICs have been observed so far :
  33. Internal MII Mux::
  34. +------------------+
  35. | SoC |
  36. | +-----+ | +-----+
  37. | +-----+ | |-------------| PHY |
  38. | | MAC |--| Mux | | +-----+ +-----+
  39. | +-----+ | |-----| SFP |
  40. | +-----+ | +-----+
  41. +------------------+
  42. Internal Mux with internal PHY::
  43. +------------------------+
  44. | SoC |
  45. | +-----+ +-----+
  46. | +-----+ | |-| PHY |
  47. | | MAC |--| Mux | +-----+ +-----+
  48. | +-----+ | |-----------| SFP |
  49. | +-----+ | +-----+
  50. +------------------------+
  51. External Mux::
  52. +---------+
  53. | SoC | +-----+ +-----+
  54. | | | |--| PHY |
  55. | +-----+ | | | +-----+
  56. | | MAC |----| Mux | +-----+
  57. | +-----+ | | |--| PHY |
  58. | | +-----+ +-----+
  59. | | |
  60. | GPIO-------+
  61. +---------+
  62. Double-port PHY::
  63. +---------+
  64. | SoC | +-----+
  65. | | | |--- RJ45
  66. | +-----+ | | |
  67. | | MAC |---| PHY | +-----+
  68. | +-----+ | | |---| SFP |
  69. +---------+ +-----+ +-----+
  70. phy_port aims at providing a path to support all the above topologies, by
  71. representing the media interfaces in a way that's agnostic to what's driving
  72. the interface. the struct phy_port object has its own set of callback ops, and
  73. will eventually be able to report its own ksettings::
  74. _____ +------+
  75. ( )-----| Port |
  76. +-----+ ( ) +------+
  77. | MAC |--( ??? )
  78. +-----+ ( ) +------+
  79. (_____)-----| Port |
  80. +------+
  81. Next steps
  82. ==========
  83. As of writing this documentation, only ports controlled by PHY devices are
  84. supported. The next steps will be to add the Netlink API to expose these
  85. to userspace and add support for raw ports (controlled by some firmware, and directly
  86. managed by the NIC driver).
  87. Another parallel task is the introduction of a MII muxing framework to allow the
  88. control of non-PHY driver multi-port setups.