Netdev List
 help / color / mirror / Atom feed
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 v9 08/12] r8152: split RTL_VER_17 into QFN68 and QFN100 package variants
Date: Fri, 27 Nov 2026 04:27:03 +0000	[thread overview]
Message-ID: <179575362324.3135.9669497990549921570@kernel.org> (raw)
In-Reply-To: <20261126033211.51850-9-nic_swsd@realtek.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 1

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] Before this patch, chip ID 0x2020 always mapped to RTL_VER_17
  and r8152 drove it.
- [Low] The commit message says QFN100 "uses a different firmware image
  from QFN68" and gives "guessing a package could load the wrong…

--

r8152: split RTL_VER_17 into QFN68 and QFN100 package variants

This patch splits RTL_VER_17 into RTL_VER_17_QFN68 and RTL_VER_17_QFN100.
The package is detected by reading the new PLA_PKG_DET register from
__rtl_get_hw_ver(). QFN100 parts now load rtl_nic/rtl8159-2.fw instead of
rtl8159-1.fw, and r8157_init() gains a QFN68-only u2phy backup restore
write.

> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
> index 3e16d0f832bc3..151acb0f58da6 100644
> --- a/drivers/net/usb/r8152.c
> +++ b/drivers/net/usb/r8152.c

[ ... ]

> @@ -10223,9 +10253,12 @@ static int rtl_fw_init(struct r8152 *tp)
>  	case RTL_VER_16:
>  		rtl_fw->fw_name		= FIRMWARE_8157_1;
>  		break;
> -	case RTL_VER_17:
> +	case RTL_VER_17_QFN68:
>  		rtl_fw->fw_name		= FIRMWARE_8159_1;
>  		break;
> +	case RTL_VER_17_QFN100:
> +		rtl_fw->fw_name		= FIRMWARE_8159_2;
> +		break;
>  	default:
>  		break;
>  	}

[Severity: Low]

The commit message says:

  QFN100 uses a different firmware image from QFN68, so rtl_fw_init()
  selects rtl8159-2.fw for it and keeps rtl8159-1.fw for QFN68.

It also explains rejecting unknown packages with "guessing a package could
load the wrong firmware".

Before this patch, every 0x2020 chip got rtl_nic/rtl8159-1.fw, QFN100 parts
included. If that image was wrong for QFN100, is this a fix to the original
RTL8159 support? Other fixes in this series carry a tag like:

  Fixes: ad2a55b63b41 ("r8152: Add support for the RTL8159 chip")

Should this patch carry one too?

Is rtl_nic/rtl8159-2.fw already in linux-firmware?
rtl8152_request_firmware() does not fail when the file is missing:

result:
	if (rc) {
		rtl_fw->fw = ERR_PTR(rc);

		dev_warn(&tp->intf->dev,
			 "unable to load firmware patch %s (%ld)\n",
			 rtl_fw->fw_name, rc);
	}

If the new file is not published yet, QFN100 users would go from loading
rtl8159-1.fw to running with no firmware patch at all. Only a warning would
show the change.

Could the commit message say whether this is a fix or a feature, and where
the new firmware can be found?

[ ... ]

> @@ -10318,7 +10382,20 @@ static u8 __rtl_get_hw_ver(struct usb_device *udev)
>  		version = RTL_VER_16;
>  		break;
>  	case 0x2020:
> -		version = RTL_VER_17;
> +		ret = __rtl_get_pkg_det(udev, &pkg_det);
> +		if (ret < 0) {
> +			version = RTL_VER_UNKNOWN;
> +			dev_err(&udev->dev, "Failed to read package: %d\n",
> +				ret);
> +		} else 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);
> +		}
>  		break;
>  	default:
>  		version = RTL_VER_UNKNOWN;

[Severity: Medium]

Before this patch, chip ID 0x2020 always mapped to RTL_VER_17. Now it maps
to RTL_VER_UNKNOWN in two cases:

  - __rtl_get_pkg_det() fails (three failed control reads, a short read,
    or -ENOMEM).
  - The masked value is not 0x1e, 0x1c, 0x18 or 0x1a. That covers 12 of
    the 16 values PKG_MASK allows.

The commit message calls this a fallback. Do the callers treat it as one?
Both of them reject the device:

rtl8152_cfgselector_choose_configuration()
	if (__rtl_get_hw_ver(udev) == RTL_VER_UNKNOWN)
		return -ENODEV;

rtl8152_probe()
	version = rtl8152_get_version(intf);
	if (version == RTL_VER_UNKNOWN)
		return -ENODEV;

In those cases a previously supported RTL8159 is never switched to vendor
mode, and r8152 never drives it. The unknown-package case is logged only
at dev_info. Should the commit message say that a chip which used to bind
to r8152 can now stop binding?

The stated reason is to avoid loading the wrong firmware. Is refusing the
whole device needed for that? rtl8152_request_firmware() already skips
loading when no firmware name is set:

	if (rtl_fw->fw || !rtl_fw->fw_name) {
		dev_info(&tp->intf->dev, "skip request firmware\n");

Also, each caller reads PLA_PKG_DET again on its own: the cfgselector,
rtl8152_probe(), and r8153_ecm_probe() through rtl8152_get_version(). If
one read fails transiently, the callers can get different answers. Could
the cfgselector then switch the device to vendor mode, only for
rtl8152_probe() to reject it?

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

  reply	other threads:[~2026-11-27  4:27 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  3:31 [PATCH net-next v9 00/12] r8152: refactor and extend RTL8157/8159 support Chih Kai Hsu
2026-11-26  3:32 ` [PATCH net-next v9 01/12] r8152: fix RTL8156/RTL8156B/RTL8157/RTL8159 up and down settings Chih Kai Hsu
2026-11-27  4:26   ` netdev-bot+sashiko
2026-11-26  3:32 ` [PATCH net-next v9 02/12] r8152: add rtl8157_unload() for RTL8157 and RTL8159 Chih Kai Hsu
2026-11-27  4:27   ` netdev-bot+sashiko
2026-11-26  3:32 ` [PATCH net-next v9 03/12] r8152: add rtl8157_change_mtu() " Chih Kai Hsu
2026-11-26  3:32 ` [PATCH net-next v9 04/12] r8152: fix flow control for RTL8156/RTL8156B/RTL8157/RTL8159 Chih Kai Hsu
2026-11-26  3:32 ` [PATCH net-next v9 05/12] r8152: split r8156_init by generation and factor out wait_autoload_done Chih Kai Hsu
2026-11-26  3:32 ` [PATCH net-next v9 06/12] r8152: add new init writes for RTL8156/8156B/8157/8159 Chih Kai Hsu
2026-11-26  3:32 ` [PATCH net-next v9 07/12] r8152: accept PLA and USB firmware blocks for RTL8157 and RTL8159 Chih Kai Hsu
2026-11-26  3:32 ` [PATCH net-next v9 08/12] r8152: split RTL_VER_17 into QFN68 and QFN100 package variants Chih Kai Hsu
2026-11-27  4:27   ` netdev-bot+sashiko [this message]
2026-11-26  3:32 ` [PATCH net-next v9 09/12] r8152: split rtl8156_enable/up/down into per-generation functions Chih Kai Hsu
2026-11-26  3:32 ` [PATCH net-next v9 10/12] r8152: split r8157_hw_phy_cfg into RTL8157 and RTL8159 variants Chih Kai Hsu
2026-11-27  4:27   ` netdev-bot+sashiko
2026-11-26  3:32 ` [PATCH net-next v9 11/12] r8152: add TGPHY register access for RTL8157 and RTL8159 Chih Kai Hsu
2026-11-27  4:27   ` netdev-bot+sashiko
2026-11-26  3:32 ` [PATCH net-next v9 12/12] r8152: enable UPS for RTL8157 and RTL8159 QFN68 Chih Kai Hsu
2026-11-27  4:27   ` netdev-bot+sashiko
2026-11-26  3:38 ` [PATCH net-next v9 00/12] 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=179575362324.3135.9669497990549921570@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