* [PATCH net-next v5] net: pcs: xpcs: make supported_interfaces authoritative
@ 2026-11-17 17:52 ` Coia Prant
0 siblings, 0 replies; 4+ messages in thread
From: Coia Prant @ 2026-11-17 17:52 UTC (permalink / raw)
To: Jakub Kicinski, Paolo Abeni
Cc: Andrew Lunn, Heiner Kallweit, Russell King, David S . Miller,
Eric Dumazet, Heiko Stuebner, netdev, linux-rockchip,
linux-arm-kernel, linux-kernel, Coia Prant
pcs.supported_interfaces is the mask of interfaces a given xpcs
instance actually supports. The compat table describes what the
Synopsys IP can do in general, but a specific integration may support
a different subset. For example, the RK3568 XPCS supports 1000BASE-X,
SGMII and QSGMII in hardware, but does not implement the C73,
10GBASE-R or 2500BASE-X modes that the Synopsys compat table
advertises.
However, xpcs_find_compat() only walks desc->compat[] and does not look
at pcs.supported_interfaces. If a caller ever passes an interface
outside the mask, the core would still find and configure a compat
entry for it, contradicting the mask the glue already set. This was a
known gap: the mask was written but never consulted by the core.
Fix both sides:
- In xpcs_find_compat(), return NULL when the interface is not in
pcs.supported_interfaces, so the mask is authoritative for what the
core will configure.
- In the Rockchip glue, build a platform mask with the three modes
supported by RK3568 (1000BASE-X, SGMII, QSGMII) and intersect it
with the core's supported_interfaces using phy_interface_and().
This narrows the mask inherited from the generic compat table so it
reflects the actual SoC capabilities.
Note that QSGMII is currently filtered out (a no-op) because the core's
compat table does not support it yet, which demonstrates the intended
filtering behavior of this intersection.
Signed-off-by: Coia Prant <coiaprant@gmail.com>
---
Changes since v4:
- replace DECLARE_PHY_INTERFACE_MASK_ZERO with DECLARE_PHY_INTERFACE_MASK and initialize it to { 0, }.
Links:
- https://lore.kernel.org/all/20261029094916.3127193-2-coiaprant@gmail.com/ (v1)
- https://lore.kernel.org/all/20261029102728.3189359-2-coiaprant@gmail.com/ (v2)
- https://lore.kernel.org/all/20261102212506.3348537-1-coiaprant@gmail.com/ (v3)
- https://lore.kernel.org/all/20261110160554.918652-1-coiaprant@gmail.com/ (v4)
drivers/net/pcs/pcs-xpcs-rk.c | 10 ++++++++++
drivers/net/pcs/pcs-xpcs.c | 3 +++
2 files changed, 13 insertions(+)
diff --git a/drivers/net/pcs/pcs-xpcs-rk.c b/drivers/net/pcs/pcs-xpcs-rk.c
index ad187fba4e9d..e0057545329a 100644
--- a/drivers/net/pcs/pcs-xpcs-rk.c
+++ b/drivers/net/pcs/pcs-xpcs-rk.c
@@ -480,6 +480,7 @@ MODULE_DEVICE_TABLE(of, xpcs_rk_of_ids);
struct dw_xpcs *xpcs_rk_create(struct device *dev, struct device_node *pcs, int port)
{
+ DECLARE_PHY_INTERFACE_MASK(supported_interfaces) = { 0, };
struct platform_device *pdev;
struct dw_xpcs_rk *pxpcs;
struct dw_xpcs *xpcs;
@@ -536,6 +537,15 @@ struct dw_xpcs *xpcs_rk_create(struct device *dev, struct device_node *pcs, int
return xpcs;
}
+ /*
+ * The RK3568 XPCS supports 1000BASE-X, SGMII and QSGMII.
+ */
+ __set_bit(PHY_INTERFACE_MODE_1000BASEX, supported_interfaces);
+ __set_bit(PHY_INTERFACE_MODE_SGMII, supported_interfaces);
+ __set_bit(PHY_INTERFACE_MODE_QSGMII, supported_interfaces);
+ phy_interface_and(xpcs->pcs.supported_interfaces, xpcs->pcs.supported_interfaces,
+ supported_interfaces);
+
xpcs_config_eee_mult_fact(xpcs, pxpcs->eee_mult_fact);
put_device(&pdev->dev);
return xpcs;
diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c
index 6466e0ff2a98..46878a66064e 100644
--- a/drivers/net/pcs/pcs-xpcs.c
+++ b/drivers/net/pcs/pcs-xpcs.c
@@ -169,6 +169,9 @@ xpcs_find_compat(struct dw_xpcs *xpcs, phy_interface_t interface)
{
const struct dw_xpcs_compat *compat;
+ if (!test_bit(interface, xpcs->pcs.supported_interfaces))
+ return NULL;
+
for (compat = xpcs->desc->compat; compat->supported; compat++)
if (compat->interface == interface)
return compat;
--
2.47.3
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH net-next v5] net: pcs: xpcs: make supported_interfaces authoritative
@ 2026-11-17 17:52 ` Coia Prant
0 siblings, 0 replies; 4+ messages in thread
From: Coia Prant @ 2026-11-17 17:52 UTC (permalink / raw)
To: Jakub Kicinski, Paolo Abeni
Cc: Andrew Lunn, Heiner Kallweit, Russell King, David S . Miller,
Eric Dumazet, Heiko Stuebner, netdev, linux-rockchip,
linux-arm-kernel, linux-kernel, Coia Prant
pcs.supported_interfaces is the mask of interfaces a given xpcs
instance actually supports. The compat table describes what the
Synopsys IP can do in general, but a specific integration may support
a different subset. For example, the RK3568 XPCS supports 1000BASE-X,
SGMII and QSGMII in hardware, but does not implement the C73,
10GBASE-R or 2500BASE-X modes that the Synopsys compat table
advertises.
However, xpcs_find_compat() only walks desc->compat[] and does not look
at pcs.supported_interfaces. If a caller ever passes an interface
outside the mask, the core would still find and configure a compat
entry for it, contradicting the mask the glue already set. This was a
known gap: the mask was written but never consulted by the core.
Fix both sides:
- In xpcs_find_compat(), return NULL when the interface is not in
pcs.supported_interfaces, so the mask is authoritative for what the
core will configure.
- In the Rockchip glue, build a platform mask with the three modes
supported by RK3568 (1000BASE-X, SGMII, QSGMII) and intersect it
with the core's supported_interfaces using phy_interface_and().
This narrows the mask inherited from the generic compat table so it
reflects the actual SoC capabilities.
Note that QSGMII is currently filtered out (a no-op) because the core's
compat table does not support it yet, which demonstrates the intended
filtering behavior of this intersection.
Signed-off-by: Coia Prant <coiaprant@gmail.com>
---
Changes since v4:
- replace DECLARE_PHY_INTERFACE_MASK_ZERO with DECLARE_PHY_INTERFACE_MASK and initialize it to { 0, }.
Links:
- https://lore.kernel.org/all/20261029094916.3127193-2-coiaprant@gmail.com/ (v1)
- https://lore.kernel.org/all/20261029102728.3189359-2-coiaprant@gmail.com/ (v2)
- https://lore.kernel.org/all/20261102212506.3348537-1-coiaprant@gmail.com/ (v3)
- https://lore.kernel.org/all/20261110160554.918652-1-coiaprant@gmail.com/ (v4)
drivers/net/pcs/pcs-xpcs-rk.c | 10 ++++++++++
drivers/net/pcs/pcs-xpcs.c | 3 +++
2 files changed, 13 insertions(+)
diff --git a/drivers/net/pcs/pcs-xpcs-rk.c b/drivers/net/pcs/pcs-xpcs-rk.c
index ad187fba4e9d..e0057545329a 100644
--- a/drivers/net/pcs/pcs-xpcs-rk.c
+++ b/drivers/net/pcs/pcs-xpcs-rk.c
@@ -480,6 +480,7 @@ MODULE_DEVICE_TABLE(of, xpcs_rk_of_ids);
struct dw_xpcs *xpcs_rk_create(struct device *dev, struct device_node *pcs, int port)
{
+ DECLARE_PHY_INTERFACE_MASK(supported_interfaces) = { 0, };
struct platform_device *pdev;
struct dw_xpcs_rk *pxpcs;
struct dw_xpcs *xpcs;
@@ -536,6 +537,15 @@ struct dw_xpcs *xpcs_rk_create(struct device *dev, struct device_node *pcs, int
return xpcs;
}
+ /*
+ * The RK3568 XPCS supports 1000BASE-X, SGMII and QSGMII.
+ */
+ __set_bit(PHY_INTERFACE_MODE_1000BASEX, supported_interfaces);
+ __set_bit(PHY_INTERFACE_MODE_SGMII, supported_interfaces);
+ __set_bit(PHY_INTERFACE_MODE_QSGMII, supported_interfaces);
+ phy_interface_and(xpcs->pcs.supported_interfaces, xpcs->pcs.supported_interfaces,
+ supported_interfaces);
+
xpcs_config_eee_mult_fact(xpcs, pxpcs->eee_mult_fact);
put_device(&pdev->dev);
return xpcs;
diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c
index 6466e0ff2a98..46878a66064e 100644
--- a/drivers/net/pcs/pcs-xpcs.c
+++ b/drivers/net/pcs/pcs-xpcs.c
@@ -169,6 +169,9 @@ xpcs_find_compat(struct dw_xpcs *xpcs, phy_interface_t interface)
{
const struct dw_xpcs_compat *compat;
+ if (!test_bit(interface, xpcs->pcs.supported_interfaces))
+ return NULL;
+
for (compat = xpcs->desc->compat; compat->supported; compat++)
if (compat->interface == interface)
return compat;
--
2.47.3
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH net-next v5] net: pcs: xpcs: make supported_interfaces authoritative
2026-11-17 17:52 ` Coia Prant
@ 2026-11-21 1:50 ` patchwork-bot+netdevbpf
-1 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-11-21 1:50 UTC (permalink / raw)
To: Coia Prant
Cc: kuba, pabeni, andrew, hkallweit1, linux, davem, edumazet, heiko,
netdev, linux-rockchip, linux-arm-kernel, linux-kernel
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 18 Nov 2026 01:52:15 +0800 you wrote:
> pcs.supported_interfaces is the mask of interfaces a given xpcs
> instance actually supports. The compat table describes what the
> Synopsys IP can do in general, but a specific integration may support
> a different subset. For example, the RK3568 XPCS supports 1000BASE-X,
> SGMII and QSGMII in hardware, but does not implement the C73,
> 10GBASE-R or 2500BASE-X modes that the Synopsys compat table
> advertises.
>
> [...]
Here is the summary with links:
- [net-next,v5] net: pcs: xpcs: make supported_interfaces authoritative
https://git.kernel.org/netdev/net-next/c/b09a65056479
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH net-next v5] net: pcs: xpcs: make supported_interfaces authoritative
@ 2026-11-21 1:50 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-11-21 1:50 UTC (permalink / raw)
To: Coia Prant
Cc: kuba, pabeni, andrew, hkallweit1, linux, davem, edumazet, heiko,
netdev, linux-rockchip, linux-arm-kernel, linux-kernel
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 18 Nov 2026 01:52:15 +0800 you wrote:
> pcs.supported_interfaces is the mask of interfaces a given xpcs
> instance actually supports. The compat table describes what the
> Synopsys IP can do in general, but a specific integration may support
> a different subset. For example, the RK3568 XPCS supports 1000BASE-X,
> SGMII and QSGMII in hardware, but does not implement the C73,
> 10GBASE-R or 2500BASE-X modes that the Synopsys compat table
> advertises.
>
> [...]
Here is the summary with links:
- [net-next,v5] net: pcs: xpcs: make supported_interfaces authoritative
https://git.kernel.org/netdev/net-next/c/b09a65056479
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-21 1:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-17 17:52 [PATCH net-next v5] net: pcs: xpcs: make supported_interfaces authoritative Coia Prant
2026-11-17 17:52 ` Coia Prant
2026-11-21 1:50 ` patchwork-bot+netdevbpf
2026-11-21 1:50 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.