Skip to content

net: phy: fix PHY interface mask initialization and XPCS usage

Coia Prant linux-arm-kernel linux-rockchip lkml netdev 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest2 patches 4 repliesIn review
  2. v32 patches 2 repliesSuperseded

Changes in v4 from the cover letter

- Rebased onto net-next as suggested by Paolo.
- Patch 1: drop the Fixes tag, as this is a cleanup/optimization rather than a bug fix.
- Patch 2: move DECLARE_PHY_INTERFACE_MASK_ZERO() to the top of the function to comply with the reverse Christmas tree order.
- Patch 2: clarify in the commit message that QSGMII is currently a no-op because the core does not support it, demonstrating the intersection behavior.
---
Coia Prant (2):
net: phy: move DECLARE_PHY_INTERFACE_MASK_ZERO to core
net: pcs: xpcs: make supported_interfaces authoritative

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2net: phy: move DECLARE_PHY_INTERFACE_MASK_ZERO to coredrivers/net/ethernet/wangxun/txgbe/txgbe_type.h include/linux/phy.h+3 -34 replies
2/2net: pcs: xpcs: make supported_interfaces authoritativedrivers/net/pcs/pcs-xpcs-rk.c drivers/net/pcs/pcs-xpcs.c+13 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH net-next v4 0/2] net: phy: fix PHY interface mask initialization and XPCS usage

This series fixes issues related to the handling of the PHY interface mask (supported_interfaces) at the core level and in the XPCS driver.

Patch 1 fixes a local macro in the txgbe driver. DECLARE_PHY_INTERFACE_MASK_ZERO() incorrectly uses PHY_INTERFACE_MODE_MAX as the array length instead of BITS_TO_LONGS(), which wastes stack space. Move it to include/linux/phy.h and base it on DECLARE_PHY_INTERFACE_MASK() so the bitmap is correctly sized while still being zero-initialized.

Patch 2 makes the XPCS supported_interfaces mask authoritative. The generic compat table advertises modes that a specific integration may not support. The Rockchip glue now builds a platform mask (1000BASE-X, SGMII, QSGMII) and intersects it with the inherited core mask using phy_interface_and(). In addition, xpcs_find_compat() now checks supported_interfaces before looking up the compat table, ensuring the core respects the narrowed mask.

Note: checkpatch.pl reports "Macros with complex values should be enclosed in parentheses" for the new macro in Patch 1. This is a known false positive for declarative macros that expand to variable declarations; wrapping it would break compilation.

Changes since v3:
- Rebased onto net-next as suggested by Paolo.
- Patch 1: drop the Fixes tag, as this is a cleanup/optimization rather than a bug fix.
- Patch 2: move DECLARE_PHY_INTERFACE_MASK_ZERO() to the top of the function to comply with the reverse Christmas tree order.
- Patch 2: clarify in the commit message that QSGMII is currently a no-op because the core does not support it, demonstrating the intersection behavior.
---
Coia Prant (2):
net: phy: move DECLARE_PHY_INTERFACE_MASK_ZERO to core
net: pcs: xpcs: make supported_interfaces authoritative

 drivers/net/ethernet/wangxun/txgbe/txgbe_type.h |  3 ---
 drivers/net/pcs/pcs-xpcs-rk.c                   | 10 ++++++++++
 drivers/net/pcs/pcs-xpcs.c                      |  3 +++
 include/linux/phy.h                             |  3 +++
 4 files changed, 16 insertions(+), 3 deletions(-)
Signature · 1 line
2.47.3