From: netdev-bot+sashiko@kernel.org
To: hsu.chih.kai@realtek.com
Cc: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org,
nic_swsd@realtek.com, linux-kernel@vger.kernel.org,
linux-usb@vger.kernel.org, edumazet@google.com, bjorn@mork.no,
pabeni@redhat.com, andrew+netdev@lunn.ch, mail@birger-koblitz.de
Subject: Re: [PATCH net-next v8 07/11] r8152: split RTL_VER_17 into QFN68 and QFN100 package variants
Date: Sat, 14 Nov 2026 09:28:36 +0000 [thread overview]
Message-ID: <179464851600.2199510.15487366405068056998@kernel.org> (raw)
In-Reply-To: <20261110032416.16968-8-nic_swsd@realtek.com>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] In drivers/net/usb/r8152.c, __rtl_get_hw_ver() no longer maps
chip ID 0x2020 (RTL8159) straight to a supported version.
--
r8152: split RTL_VER_17 into QFN68 and QFN100 package variants
This commit splits RTL_VER_17 into RTL_VER_17_QFN68 and RTL_VER_17_QFN100.
When the chip ID is 0x2020, a new helper, __rtl_get_pkg_det(), reads the
PLA_PKG_DET register to detect the package, and unrecognised values fall
back to RTL_VER_UNKNOWN. r8157_init() also gains a QFN68-only u2phy backup
restore write.
> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
> index a1c2e1e08b161..b6f252722a5eb 100644
> --- a/drivers/net/usb/r8152.c
> +++ b/drivers/net/usb/r8152.c
[ ... ]
> @@ -10227,9 +10254,38 @@ static int rtl_fw_init(struct r8152 *tp)
> return 0;
> }
>
> +static u32 __rtl_get_pkg_det(struct usb_device *udev)
> +{
> + u32 pkg_det = 0;
> + __le32 *tmp;
> + int ret, i;
> +
> + tmp = kmalloc_obj(*tmp);
> + if (!tmp)
> + return 0;
> +
> + for (i = 0, ret = 0; i < 3 && ret != 4; i++)
> + ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
> + RTL8152_REQ_GET_REGS, RTL8152_REQT_READ,
> + PLA_PKG_DET, MCU_TYPE_PLA, tmp,
> + sizeof(*tmp), USB_CTRL_GET_TIMEOUT);
> +
> + if (ret == sizeof(*tmp)) {
> + if (i != 1)
> + dev_warn(&udev->dev,
> + "Needed %d retries to read package\n", i - 1);
> +
> + pkg_det = __le32_to_cpu(*tmp) & PKG_MASK;
> + }
> +
> + kfree(tmp);
> + return pkg_det;
> +}
> +
[ ... ]
> @@ -10312,7 +10368,16 @@ static u8 __rtl_get_hw_ver(struct usb_device *udev)
> version = RTL_VER_16;
> break;
> case 0x2020:
> - version = RTL_VER_17;
> + pkg_det = __rtl_get_pkg_det(udev);
> + if (pkg_det == 0x1e || pkg_det == 0x1c) {
> + version = RTL_VER_17_QFN68;
> + } else if (pkg_det == 0x18 || pkg_det == 0x1a) {
> + version = RTL_VER_17_QFN100;
> + } else {
> + version = RTL_VER_UNKNOWN;
> + dev_info(&udev->dev, "Unknown package 0x%04x\n",
> + pkg_det);
> + }
[Severity: Low]
If the PLA_PKG_DET read fails, does a 0x2020 chip that was handled as
RTL_VER_17 before this patch now become RTL_VER_UNKNOWN?
__rtl_get_pkg_det() returns 0 in three cases: kmalloc_obj() fails, all
three usb_control_msg() attempts fail, or the reply is short. A 0 here
takes the else branch. The log then says "Unknown package 0x0000" instead
of reporting a read error.
With RTL_VER_UNKNOWN, rtl8152_cfgselector_choose_configuration() returns
early and never selects the vendor configuration:
if (__rtl_get_hw_ver(udev) == RTL_VER_UNKNOWN)
return -ENODEV;
rtl8153_ecm_probe() then binds the device, because rtl8152_get_version()
now returns 0.
The read might also succeed in the cfgselector and fail later in
rtl8152_probe(). In that case the device is already in vendor mode and no
driver binds to it.
Apart from the QFN68-only 0xb99c write, RTL_VER_17_QFN100 behaves exactly
like the old RTL_VER_17. Could a read failure fall back to QFN100? Or could
it at least be reported separately from an unrecognised package value?
The commit message describes the RTL_VER_UNKNOWN fallback only for
unrecognised package values, not for I/O or allocation failures.
> break;
> default:
> version = RTL_VER_UNKNOWN;
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261110032416.16968-1-nic_swsd%40realtek.com
next prev parent reply other threads:[~2026-11-14 9:28 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 3:24 [PATCH net-next v8 00/11] r8152: refactor and extend RTL8157/8159 support Chih Kai Hsu
2026-11-10 3:24 ` [PATCH net-next v8 01/11] r8152: fix RTL8156/RTL8156B/RTL8157/RTL8159 up and down settings Chih Kai Hsu
2026-11-14 9:28 ` netdev-bot+sashiko
2026-11-10 3:24 ` [PATCH net-next v8 02/11] r8152: add rtl8157_unload() for RTL8157 and RTL8159 Chih Kai Hsu
2026-11-14 9:28 ` netdev-bot+sashiko
2026-11-10 3:24 ` [PATCH net-next v8 03/11] r8152: add rtl8157_change_mtu() " Chih Kai Hsu
2026-11-14 9:28 ` netdev-bot+sashiko
2026-11-10 3:24 ` [PATCH net-next v8 04/11] r8152: fix flow control for RTL8156/RTL8156B/RTL8157/RTL8159 Chih Kai Hsu
2026-11-14 9:28 ` netdev-bot+sashiko
2026-11-10 3:24 ` [PATCH net-next v8 05/11] r8152: split r8156_init by generation and factor out wait_autoload_done Chih Kai Hsu
2026-11-10 3:24 ` [PATCH net-next v8 06/11] r8152: add new init writes for RTL8156/8156B/8157/8159 Chih Kai Hsu
2026-11-14 9:28 ` netdev-bot+sashiko
2026-11-10 3:24 ` [PATCH net-next v8 07/11] r8152: split RTL_VER_17 into QFN68 and QFN100 package variants Chih Kai Hsu
2026-11-14 9:28 ` netdev-bot+sashiko [this message]
2026-11-10 3:24 ` [PATCH net-next v8 08/11] r8152: split rtl8156_enable/up/down into per-generation functions Chih Kai Hsu
2026-11-10 3:24 ` [PATCH net-next v8 09/11] r8152: split r8157_hw_phy_cfg into RTL8157 and RTL8159 variants Chih Kai Hsu
2026-11-14 9:28 ` netdev-bot+sashiko
2026-11-10 3:24 ` [PATCH net-next v8 10/11] r8152: add TGPHY register access for RTL8157 and RTL8159 Chih Kai Hsu
2026-11-14 9:28 ` netdev-bot+sashiko
2026-11-10 3:24 ` [PATCH net-next v8 11/11] r8152: enable UPS for RTL8157 and RTL8159 QFN68 Chih Kai Hsu
2026-11-14 9:28 ` netdev-bot+sashiko
2026-11-10 5:04 ` [PATCH net-next v8 00/11] 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=179464851600.2199510.15487366405068056998@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=bjorn@mork.no \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hsu.chih.kai@realtek.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mail@birger-koblitz.de \
--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®