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 v3 5/8] r8152: support rtl8157_unload and rtl8157_change_mtu
Date: Tue, 15 Sep 2026 11:37:53 +0000 [thread overview]
Message-ID: <8bac7d369ad24a85971ccb2ed94635bc@realtek.com> (raw)
In-Reply-To: <178924439287.3125.1065367731882815038@kernel.org>
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue(s) to consider:
>
> Critical: 0 · High: 0 · Medium: 0 · Low: 1
>
> - [Low] Commit message understates the impact of the change and carries
> no Fixes: tag, even though it silently alters the register programming…
>
> --
>
> r8152: support rtl8157_unload and rtl8157_change_mtu
>
> This adds rtl8157_unload() and rtl8157_change_mtu() and wires them into the
> RTL_VER_16 (RTL8157) and RTL_VER_17 (RTL8159) op tables, replacing
> rtl8153_unload() and rtl8156_change_mtu(). The interrupt mitigation clear
> of USB register 0xcf04 is moved out of rtl8153_unload() into the new callback.
>
> > diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index
> > 679aead731f73..06fad895fce09 100644
> > --- a/drivers/net/usb/r8152.c
> > +++ b/drivers/net/usb/r8152.c
> > @@ -7024,6 +7024,28 @@ static void rtl8156_down(struct r8152 *tp)
> > r8153_aldps_en(tp, true);
> > }
> >
> > +static void rtl8157_change_mtu(struct r8152 *tp) {
> > + u32 max_pkt_size = mtu_to_size(tp->netdev->mtu);
> > + u32 ocp_data;
> > +
> > + ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, max_pkt_size);
> > +
> > + /* Use at least 10K for MTPS */
> > + ocp_data = max_t(u32, max_pkt_size, 10 * 1024) / 64;
> > +
> > + /* 16 * 1024 / 64 = 0x100, so the max is 0xff for 8 bits data */
> > + ocp_data = min_t(u32, ocp_data, 0xff);
> > +
> > + ocp_write_byte(tp, MCU_TYPE_PLA, PLA_MTPS, ocp_data);
> > + r8156_fc_parameter(tp);
>
> [ ... ]
>
> > @@ -10174,11 +10196,6 @@ static void rtl8153_unload(struct r8152 *tp)
> > return;
> >
> > r8153_power_cut_en(tp, false);
> > -
> > - if (tp->version >= RTL_VER_16) {
> > - /* Disable Interrupt Mitigation */
> > - ocp_byte_clr_bits(tp, MCU_TYPE_USB, 0xcf04, BIT(0) | BIT(1)
> | BIT(2) | BIT(7));
> > - }
> > }
>
> [ ... ]
>
> > +static void rtl8157_unload(struct r8152 *tp) {
> > + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
> > + return;
> > +
> > + r8157_power_cut_en(tp, false);
> > + ocp_byte_clr_bits(tp, MCU_TYPE_USB, 0xcf04,
> > + BIT(0) | BIT(1) | BIT(2) | BIT(7)); }
>
> [Severity: Low]
> Could the changelog say what misbehaves today on these chips, and carry
> Fixes: tags? RTL_VER_16 and RTL_VER_17 are already supported in-tree
> (added by fd3c7d080df531 and ad2a55b63b41af), and both assigned
> ops->unload = rtl8153_unload and ops->change_mtu = rtl8156_change_mtu,
> ops->so
> this changes the register programming of shipped hardware rather than
> enabling something new.
>
> The commit message says the dedicated unload is needed "to disable interrupt
> mitigation", but rtl8153_unload() already did that for
> tp->version >= RTL_VER_16:
>
> if (tp->version >= RTL_VER_16) {
> /* Disable Interrupt Mitigation */
> ocp_byte_clr_bits(tp, MCU_TYPE_USB, 0xcf04, BIT(0) |
> BIT(1) | BIT(2) | BIT(7));
> }
>
> so that part is only relocated. The behaviour that actually changes is the
> power cut disable sequence:
>
> r8153_power_cut_en(tp, false):
> ocp_word_clr_bits(tp, MCU_TYPE_USB, USB_POWER_CUT, PWR_EN
> | PHASE2_EN);
> ocp_word_clr_bits(tp, MCU_TYPE_USB, USB_MISC_0, PCUT_STATUS);
>
> r8157_power_cut_en(tp, false):
> ocp_word_clr_bits(tp, MCU_TYPE_USB, USB_POWER_CUT, PWR_EN);
> ocp_word_clr_bits(tp, MCU_TYPE_USB, USB_MISC_0, PCUT_STATUS);
> ocp_byte_clr_bits(tp, MCU_TYPE_USB, USB_MISC_2, BIT(1));
>
> PHASE2_EN is now left set on the unload/disconnect path for these chips.
> Is that intentional, and is there an observable symptom with the old sequence?
It's intentional. RTL8157 and RTL8159 have different sequences to disable power cut.
>
> Similarly, rtl8157_change_mtu() replaces the fixed MTPS_JUMBO (12 * 1024 /
> 64 = 0xc0) that rtl8156_change_mtu() programmed with an MTU derived value:
> at the default 1500 byte MTU, max_t(u32, mtu_to_size(1500), 10 * 1024) / 64
> gives 0xa0, and it saturates at 0xff for a 16K MTU. Both paths are live at
> runtime, via rtl8157_up() on every bring-up and via rtl8152_change_mtu() ->
> tp->rtl_ops.change_mtu() on every MTU change. What does the old MTPS
> tp->value
> break on these chips?
RTL8157 and RTL8159 support a new formula to compute PLA_MTPS.
>
> As written it is hard to tell whether this is net-next tuning or a fix for a user
> visible defect on released kernels, and there is nothing for stable backports to
> key on. Note that this wording is unchanged at the end of the series, so no
> later patch adds the missing justification.
>
> --
> Sashiko AI review ·
> https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260908075634.23740-1
> -nic_swsd%40realtek.com
Best,
Chih-Kai
next prev parent reply other threads:[~2026-09-15 11:38 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 7:56 [PATCH net-next v3 0/8] r8152: refactor and extend RTL8157/8159 support Chih Kai Hsu
2026-09-08 7:56 ` [PATCH net-next v3 1/8] r8152: refactor r8156_init Chih Kai Hsu
2026-09-12 20:19 ` netdev-bot+sashiko
2026-09-15 9:48 ` Chih Kai Hsu
2026-09-08 7:56 ` [PATCH net-next v3 2/8] r8152: support RTL8159 for different packages Chih Kai Hsu
2026-09-12 20:19 ` netdev-bot+sashiko
2026-09-15 11:03 ` Chih Kai Hsu
2026-09-08 7:56 ` [PATCH net-next v3 3/8] r8152: refactor rtl8156_enable, rtl8156_up, and rtl8156_down Chih Kai Hsu
2026-09-12 20:19 ` netdev-bot+sashiko
2026-09-15 11:24 ` Chih Kai Hsu
2026-09-08 7:56 ` [PATCH net-next v3 4/8] r8152: refactor r8157_hw_phy_cfg Chih Kai Hsu
2026-09-12 20:19 ` netdev-bot+sashiko
2026-09-15 11:30 ` Chih Kai Hsu
2026-09-08 7:56 ` [PATCH net-next v3 5/8] r8152: support rtl8157_unload and rtl8157_change_mtu Chih Kai Hsu
2026-09-12 20:19 ` netdev-bot+sashiko
2026-09-15 11:37 ` Chih Kai Hsu [this message]
2026-09-08 7:56 ` [PATCH net-next v3 6/8] r8152: add TGPHY access support Chih Kai Hsu
2026-09-12 20:19 ` netdev-bot+sashiko
2026-09-15 11:52 ` Chih Kai Hsu
2026-09-08 7:56 ` [PATCH net-next v3 7/8] r8152: support rtl_fc_pause_pkt_en() Chih Kai Hsu
2026-09-12 20:19 ` netdev-bot+sashiko
2026-09-15 11:44 ` Chih Kai Hsu
2026-09-08 7:56 ` [PATCH net-next v3 8/8] r8152: support UPS for RTL8157 and RTL8159 Chih Kai Hsu
2026-09-12 20:19 ` netdev-bot+sashiko
2026-09-15 11:45 ` Chih Kai Hsu
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=8bac7d369ad24a85971ccb2ed94635bc@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®