Thread (11 messages) 11 messages, 2 authors, 4d ago

Re: [PATCH net-next v5 2/8] net: phy: phylink: add helper to modify pause

From: Maxime Chevallier <maxime.chevallier@bootlin.com>
Date: 2026-07-07 11:10:13
Also in: lkml

Hi, 

On 7/7/26 11:16, javen wrote:
quoted hunk ↗ jump to hunk
From: Javen Xu <redacted>

For Realtek nics, when we enable jumbo, pause are not supported. So we
must check the pause capabilities from ourself and lp.

Signed-off-by: Javen Xu <redacted>
---
Changes in v5:
 - no changes, new file
---
 drivers/net/phy/phylink.c | 66 +++++++++++++++++++++++++++++++++++++++
 include/linux/phylink.h   |  2 ++
 2 files changed, 68 insertions(+)
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 59dfe35afa54..c450ee33b75c 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -1828,6 +1828,72 @@ int phylink_set_fixed_link(struct phylink *pl,
 }
 EXPORT_SYMBOL_GPL(phylink_set_fixed_link);
 
+/**
+ * phylink_set_mac_capabilities() - Dynamically update MAC capabilities
+ * @pl: a pointer to a &struct phylink returned from phylink_create()
+ * @mac_capabilities: the new MAC capabilities mask
+ *
+ * This function allows a MAC driver to dynamically change its capabilities,
+ * such as losing/gaining Pause frame support based on MTU size.
+ * It recalculates supported link modes and triggers renegotiation if needed.
+ */
+void phylink_set_mac_capabilities(struct phylink *pl, unsigned long mac_capabilities)
This is a step in the right direction, but this is maybe too generic, as
mac_capabilities represent both the MAC's Pause support as well as Speed/Duplex
support.

The speed/duplex parts shouldn't be changed dynamically, I think the helper
needs to be specific in its naming that this is strictly about changing the MAC's
Pause / Asym capabilities dynamically, and be either passed some booleans, one for
rx one for tx, or fail if we try to change anything other than MAC_SYM_PAUSE and
MAC_ASYM_PAUSE.

Maybe something like "phylink_update_mac_pause_capabilities" ?

The 'update' part makes it clear this may trigger re-negotiation.


Maxime
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help