From: Jakub Kicinski <kuba@kernel.org>
To: javen_xu@realsil.com.cn
Cc: Jakub Kicinski <kuba@kernel.org>,
hkallweit1@gmail.com, nic_swsd@realtek.com,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, maxime.chevallier@bootlin.com,
horms@kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2 3/6] r8169: add support for phylink
Date: Sat, 13 Jun 2026 15:05:59 -0700 [thread overview]
Message-ID: <20260613220559.219642-1-kuba@kernel.org> (raw)
In-Reply-To: <20260611094345.880-4-javen_xu@realsil.com.cn>
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
---
r8169: add support for phylink
Transfer old framework to phylink. Phylink can support fiber mode card
which can not get link status or link speed from standard phy registers.
> diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
> index 560f987437b63..615bd4107359a 100644
> --- a/drivers/net/ethernet/realtek/r8169_main.c
> +++ b/drivers/net/ethernet/realtek/r8169_main.c
[ ... ]
> @@ -2661,13 +2672,10 @@ static void rtl_jumbo_config(struct rtl8169_private *tp)
> pcie_set_readrq(tp->pci_dev, readrq);
>
> /* Chip doesn't support pause in jumbo mode */
> - if (jumbo) {
> - linkmode_clear_bit(ETHTOOL_LINK_MODE_Pause_BIT,
> - tp->phydev->advertising);
> - linkmode_clear_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT,
> - tp->phydev->advertising);
> - phy_start_aneg(tp->phydev);
> - }
> + if (jumbo)
> + tp->phylink_config.mac_capabilities &= ~(MAC_SYM_PAUSE | MAC_ASYM_PAUSE);
> + else
> + tp->phylink_config.mac_capabilities |= (MAC_SYM_PAUSE | MAC_ASYM_PAUSE);
> }
[Severity: High]
Does phylink re-read mac_capabilities on start?
It looks like dynamic bitwise modifications to tp->phylink_config.mac_capabilities
made here are ignored by phylink. Since phylink does not update the pl->supported
link mode mask during phylink_start(), won't the PHY continue to incorrectly
advertise pause capabilities to the link partner when jumbo frames are enabled?
[ ... ]
> @@ -4142,11 +4150,17 @@ static int rtl8169_change_mtu(struct net_device *dev, int new_mtu)
> {
> struct rtl8169_private *tp = netdev_priv(dev);
>
> + if (netif_running(dev))
> + phylink_stop(tp->phylink);
> +
> WRITE_ONCE(dev->mtu, new_mtu);
> netdev_update_features(dev);
> rtl_jumbo_config(tp);
> rtl_set_eee_txidle_timer(tp);
>
> + if (netif_running(dev))
> + phylink_start(tp->phylink);
> +
> return 0;
> }
[ ... ]
> +static int rtl_init_phylink(struct rtl8169_private *tp)
> +{
> + struct phylink *pl;
> + phy_interface_t phy_mode;
> +
> + tp->phylink_config.dev = &tp->dev->dev;
> + tp->phylink_config.type = PHYLINK_NETDEV;
> + tp->phylink_config.mac_managed_pm = true;
> + tp->phylink_config.lpi_capabilities = rtl8169_get_lpi_caps(tp);
> + tp->phylink_config.mac_capabilities |= MAC_ASYM_PAUSE | MAC_SYM_PAUSE;
> +
> + if (tp->sfp_mode) {
> + phy_mode = PHY_INTERFACE_MODE_INTERNAL;
> + tp->phylink_config.mac_capabilities |= MAC_10000FD;
> + } else {
> + tp->phylink_config.mac_capabilities |= MAC_10 | MAC_100;
> + phy_mode = PHY_INTERFACE_MODE_INTERNAL;
[Severity: High]
Does hardcoding phy_mode to PHY_INTERFACE_MODE_INTERNAL here break older
adapters that use discrete PHYs over GMII or MII?
Prior to this patch, the driver dynamically checked tp->supports_gmii to set
either PHY_INTERFACE_MODE_GMII or PHY_INTERFACE_MODE_MII. Forcing INTERNAL
might tell the PHY driver that the PHY is integrated into the MAC, which could
cause discrete PHY drivers to skip necessary initializations, fail validation
checks, or misconfigure interface delays.
> +
> + if (tp->mac_version == RTL_GIGA_MAC_VER_80)
> + tp->phylink_config.mac_capabilities |= MAC_1000FD | MAC_2500FD |
> + MAC_5000FD | MAC_10000FD;
next prev parent reply other threads:[~2026-06-13 22:06 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-11 9:43 [PATCH net-next v2 0/6] r8169: add support for phylink javen
2026-06-11 9:43 ` [PATCH net-next v2 1/6] r8169: add speed in private struct javen
2026-06-11 9:43 ` [PATCH net-next v2 2/6] r8169: create a virtual interrupt for linkchg javen
2026-06-13 22:05 ` Jakub Kicinski
2026-06-13 22:06 ` Jakub Kicinski
2026-06-11 9:43 ` [PATCH net-next v2 3/6] r8169: add support for phylink javen
2026-06-12 8:13 ` Maxime Chevallier
2026-06-13 22:05 ` Jakub Kicinski [this message]
2026-06-13 22:06 ` Jakub Kicinski
2026-06-11 9:43 ` [PATCH net-next v2 4/6] r8169: add support for RTL8116af javen
2026-06-13 22:06 ` Jakub Kicinski
2026-06-13 22:06 ` Jakub Kicinski
2026-06-11 9:43 ` [PATCH net-next v2 5/6] r8169: add ltr " javen
2026-06-13 22:06 ` Jakub Kicinski
2026-06-13 22:06 ` Jakub Kicinski
2026-06-11 9:43 ` [PATCH net-next v2 6/6] r8169: fix RTL8116af can not enter s0idle and c10 javen
2026-06-13 22:06 ` Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260613220559.219642-1-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=horms@kernel.org \
--cc=javen_xu@realsil.com.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime.chevallier@bootlin.com \
--cc=netdev@vger.kernel.org \
--cc=nic_swsd@realtek.com \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox