mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chih Kai Hsu <hsu.chih.kai@realtek.com>
To: "netdev-bot+sashiko@kernel.org" <netdev-bot+sashiko@kernel.org>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	nic_swsd <nic_swsd@realtek.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"edumazet@google.com" <edumazet@google.com>,
	"bjorn@mork.no" <bjorn@mork.no>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"andrew+netdev@lunn.ch" <andrew+netdev@lunn.ch>
Subject: RE: [PATCH net-next v5 1/9] r8152: split r8156_init per chip and add missing init writes
Date: Tue, 6 Oct 2026 09:18:41 +0000	[thread overview]
Message-ID: <aa4a0fe95052494b9544bdeec8babf9b@realtek.com> (raw)
In-Reply-To: <179119423934.434549.8623262119068946046@kernel.org>

> Thank you for your contribution! Sashiko AI review found 1 potential
> issue(s) to consider.
> 
> Critical: 0 · High: 0 · Medium: 1 · Low: 0
> 
> If you believe none of the issues are legitimate, please reply to each issue of
> Medium severity or higher and explain why the AI is wrong.
> If any of them are legitimate and you plan to respin, please let patchwork
> know by including "pw-bot: cr" as a separate line at the end of your reply (one
> such reply per series is enough).
> 
> - [Medium] This patch is presented as splitting r8156_init() per chip,
>   but it also changes hardware behaviour for all four chip families, and…
> 
> --
> 
> r8152: split r8156_init per chip and add missing init writes
> 
> This commit splits the shared r8156_init() into separate init functions for
> RTL8156, RTL8156B, RTL8157 and RTL8159. It also moves the
> AUTOLOAD_DONE polling into a new wait_autoload_done() helper. While
> splitting, it adds several new register writes to the per-chip init paths, including
> clearing RX_END_TRANSFER_EN on RTL8157.
> 
> > diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index
> > af3d7dcb2f141..4d8f0815d79d1 100644
> > --- a/drivers/net/usb/r8152.c
> > +++ b/drivers/net/usb/r8152.c
> 
> [ ... ]
> 
> > @@ -8421,73 +8444,261 @@ static void r8156_init(struct r8152 *tp)
> 
> [ ... ]
> 
> >       set_bit(GREEN_ETHERNET, &tp->flags);
> >
> > -     /* RX aggregation / 16 bytes RX descriptor
> > -      * BIT(11) is specific to RTL8159, with unknown meaning
> > -      */
> > -     if (tp->version == RTL_VER_17)
> > -             ocp_word_clr_bits(tp, MCU_TYPE_USB, USB_USB_CTRL,
> > -                               RX_AGG_DISABLE | RX_DESC_16B |
> BIT(11));
> > -     else if (tp->version == RTL_VER_16)
> > -             ocp_word_clr_bits(tp, MCU_TYPE_USB, USB_USB_CTRL,
> RX_AGG_DISABLE | RX_DESC_16B);
> > +     ocp_word_clr_bits(tp, MCU_TYPE_USB, USB_USB_CTRL,
> > +                       RX_AGG_DISABLE | RX_ZERO_EN);
> 
> [ ... ]
> 
> > +static void r8157_init(struct r8152 *tp) {
> 
> [ ... ]
> 
> > +     /* RX aggregation / 16 bytes RX descriptor / Bulk In End transfer */
> > +     ocp_word_clr_bits(tp, MCU_TYPE_USB, USB_USB_CTRL,
> > +                       RX_AGG_DISABLE | RX_DESC_16B |
> > + RX_END_TRANSFER_EN);
> 
> [Severity: Medium]
> Is this a functional fix for RTL8157 that should go in as its own patch with a
> Fixes: tag?
> 
> Before this patch, the RTL_VER_16 branch in r8156_init() cleared only
> RX_AGG_DISABLE | RX_DESC_16B. BIT(11) was cleared only for RTL_VER_17,
> and the comment said its meaning was unknown. r8157_init() now clears
> RX_END_TRANSFER_EN as well.
> 
> The commit message says that while this bit is set, "Bulk-in transfers are
> suspended", and that "the driver must manually clear it to resume Bulk-in
> transfers".
> 
> That sounds like an RX stall on RTL8157 that goes back to commit
> fd3c7d080df5 ("r8152: Add support for the RTL8157 hardware"). This fix has
> no Fixes: tag and is part of a refactor touching about 490 lines, so it seems
> unlikely to reach net or stable.
> 
> Later patches in this series do carry Fixes: tags: "r8152: fix up and down
> register settings for RTL8156/8156B/8157/8159" and "r8152: add
> rtl8157_unload and rtl8157_change_mtu".
> 
> Could this change be sent as a small standalone fix ahead of the split?

The hardware uses this bit to preserve packet integrity across runtime
suspend/resume, and it is not self-clearing. However, the driver doesn't
use this bit now; this is a defensive clearing.

> 
> The other new hardware writes raise the same question. The commit message
> lists them, but it doesn't say what problem or symptom each one
> fixes:
> 
>     PREBOOT_OPTION and RMT_WAKE_EN, cleared in all four init functions
>     r8156b_u2phy_backup() writing 0xd3ce/0xd3d0/0xd3d4/0xd3d8/0xd3dc
>     0xcf04 interrupt mitigation disable in r8157_init()/r8159_init()
>     0xcd06 BIT(11) in r8157_init()/r8159_init()
>     0xb9a6 BIT(0) and 0xb9a2 = 0x0448 in r8159_init()
> 
> Could these be split out, or have their purpose explained? If one of them
> causes a regression, a bisect would land on this large mixed commit.
> 
> r8156b_init() also moves the AUTO_SPEEDUP clear. It used to be part of the
> USB_FW_CTRL read-modify-write that ran after usb_enable_lpm() and the
> flow control setup:
> 
>     ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_FW_CTRL);
>     ...
>     ocp_data &= ~AUTO_SPEEDUP;
>     ocp_write_word(tp, MCU_TYPE_USB, USB_FW_CTRL, ocp_data);
> 
> Now it runs right after r8153_u2p3en():
> 
>     r8153_u2p3en(tp, false);
> 
>     /* Disable Auto Speed up */
>     ocp_word_clr_bits(tp, MCU_TYPE_USB, USB_FW_CTRL, AUTO_SPEEDUP);
> 
> That is before the MSC timer, r8156b_u2phy_backup(), power-cut, UPS and
> LPM setup. Is this reordering intended for RTL8156B? The commit message
> doesn't mention it.

Will fix.

> 
> --
> Sashiko AI review ·
> https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261001091144.28191-
> 1-nic_swsd%40realtek.com

Best Regards,
Chih-Kai

  reply	other threads:[~2026-10-06  9:19 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01  9:11 [PATCH net-next v5 0/9] r8152: refactor and extend RTL8157/8159 support Chih Kai Hsu
2026-10-01  9:11 ` [PATCH net-next v5 1/9] r8152: split r8156_init per chip and add missing init writes Chih Kai Hsu
2026-10-05  9:57   ` netdev-bot+sashiko
2026-10-06  9:18     ` Chih Kai Hsu [this message]
2026-10-01  9:11 ` [PATCH net-next v5 2/9] r8152: split RTL_VER_17 into QFN68 and QFN100 package variants Chih Kai Hsu
2026-10-05  9:57   ` netdev-bot+sashiko
2026-10-06  9:23     ` Chih Kai Hsu
2026-10-01  9:11 ` [PATCH net-next v5 3/9] r8152: split rtl8156_enable/up/down into per-chip-family functions Chih Kai Hsu
2026-10-01  9:11 ` [PATCH net-next v5 4/9] r8152: fix up and down register settings for RTL8156/8156B/8157/8159 Chih Kai Hsu
2026-10-01  9:11 ` [PATCH net-next v5 5/9] r8152: split r8157_hw_phy_cfg into RTL8157 and RTL8159 variants Chih Kai Hsu
2026-10-05  9:57   ` netdev-bot+sashiko
2026-10-06  9:24     ` Chih Kai Hsu
2026-10-01  9:11 ` [PATCH net-next v5 6/9] r8152: add rtl8157_unload and rtl8157_change_mtu Chih Kai Hsu
2026-10-05  9:57   ` netdev-bot+sashiko
2026-10-01  9:11 ` [PATCH net-next v5 7/9] r8152: add TGPHY register access for RTL8157 and RTL8159 Chih Kai Hsu
2026-10-05  9:57   ` netdev-bot+sashiko
2026-10-06  9:41     ` Chih Kai Hsu
2026-10-01  9:11 ` [PATCH net-next v5 8/9] r8152: extract rtl_fc_pause_pkt_en() and apply it to RTL8156/8157/8159 Chih Kai Hsu
2026-10-05  9:57   ` netdev-bot+sashiko
2026-10-01  9:11 ` [PATCH net-next v5 9/9] r8152: enable UPS for RTL8157 and RTL8159 QFN68 Chih Kai Hsu
2026-10-05  9:57   ` netdev-bot+sashiko
2026-10-06  9:43     ` Chih Kai Hsu
2026-10-01  9:13 ` [PATCH net-next v5 0/9] r8152: refactor and extend RTL8157/8159 support netdev-bot+sinfo

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=aa4a0fe95052494b9544bdeec8babf9b@realtek.com \
    --to=hsu.chih.kai@realtek.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=bjorn@mork.no \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev-bot+sashiko@kernel.org \
    --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

all inboxes | Powered by JetHome®