On Wed, 25 Nov 2026 19:11:03 +0800
Zaiyu Wang <[email protected]> wrote:

> Two PHYs have interrupt-related configuration issues, each fixed by an
> independent patch in this series.
> 
> Zaiyu Wang (2):
>   net/ngbe: mask unused internal PHY interrupts
>   net/ngbe: fix YT8531S-CA interrupt in combo mode
> 
>  drivers/net/ngbe/base/ngbe_phy_rtl.c |  2 ++
>  drivers/net/ngbe/base/ngbe_phy_yt.c  | 17 +++++++++++++++++
>  2 files changed, 19 insertions(+)
> 

AI review spotted some issues here.

Subject: Re: [PATCH 2/2] net/ngbe: fix YT8531S-CA interrupt in combo mode

Series applies to main and builds with -Dwerror=true. Patch 1/2 has
no findings.

[PATCH 2/2] net/ngbe: fix YT8531S-CA interrupt in combo mode

Warning: the new block runs for every YT PHY in every chip mode, not
only YT8531S-CA in UTP_FIBER_TO_RGMII mode.

    ngbe_write_phy_reg_ext_yt(hw, YT_SPEC_CONF, 0,
                              YT_SPEC_CONF_8531SH_CA);
    ...
    ngbe_write_phy_reg_ext_yt(hw, YT_MISC, 0, 0x10d);

ngbe_init_phy_yt() is the init_hw hook for both ngbe_phy_yt8521s and
ngbe_phy_yt8521s_sfi, so UTP-only (mode 0), fiber-to-RGMII (mode 1)
and SGMII (mode 4) boards now get the 8531SH-CA config, and
YT_MISC = 0x10d sets YT_MISC_FIBER_PRIO on UTP-only parts. The
existing YT_SPEC_CONF write in ngbe_setup_phy_link_yt() is limited
to the mode 2 branch. Gate the new code the same way:

    rte_spinlock_lock(&hw->phy_lock);
    ngbe_read_phy_reg_ext_yt(hw, YT_CHIP, 0, &value);
    if ((value & YT_CHIP_MODE_MASK) == YT_CHIP_MODE_SEL(2)) {
            ngbe_write_phy_reg_ext_yt(hw, YT_SPEC_CONF, 0,
                                      YT_SPEC_CONF_8531SH_CA);
            ...
    }
    rte_spinlock_unlock(&hw->phy_lock);

Warning: YT_INTR is not a stable way to identify the part.

    ngbe_read_phy_reg_mdi(hw, YT_INTR, 0, &value);

    if (value != 0x31 && value != 0x32) {

YT_INTR is the interrupt enable register, and this same function
writes YT_INTR_ENA_MASK | YT_SDS_INTR_ENA_MASK (0x0c0c) to it when
hw->lsc is set. ngbe_dev_start() calls phy.init_hw() on every start,
so on a stop/start cycle with LSC enabled the read returns 0x0c0c
unless something resets the PHY in between, and a 0x31/0x32 part
then gets the extra config. If a chip ID or revision register
exists, use it; otherwise decide once at first init and cache the
result in hw.

Also say what 0x31/0x32 identify, and give 0xa071, 0x52, 0x51, 0x57
and the 0x10d value names or at least a comment. As written,
nobody can tell from the code or the commit message which parts are
excluded or why.

Review-Result: WARNING

Reply via email to