🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #23411

RE: [PATCH net-next v9 08/12] r8152: split RTL_VER_17 into QFN68 and QFN100 package variants

#23411
From: Chih Kai Hsu
Date: Fri, 27 Nov 2026 08:36
133 lines
19943 bytes
> 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?

No. Both callers return -ENODEV for RTL_VER_UNKNOWN, so a chip with an
unrecognized package, or one whose package register cannot be read, is
no longer bound by r8152. Before this patch, every 0x2020 chip became
RTL_VER_17. I will reword the commit message to say that these devices
are rejected, and that a chip which used to bind can stop binding.

> 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");
> 

Skipping the firmware alone would not be enough. The package also
selects the u2phy backup-restore write in r8157_init() and whether UPS
is enabled. Those are QFN68-only. With an unknown package, the driver
cannot tell which of these apply, and guessing QFN68 would apply the
QFN68-only writes to a part we know nothing about. Both packages used to
share RTL_VER_17, which is the problem this patch fixes, so I would
rather reject a package we do not recognize than keep guessing. I will
put this reasoning in the commit message instead of only mentioning the
firmware.

Since rejecting a device is user-visible, I will also change the
"Unknown package" message from dev_info() to dev_err().

> 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?

Yes, in principle. The read retries three times, but if all three fail
in one call and the next call succeeds, the callers disagree, and a
device could be left in vendor mode without a driver. I think this is
rare and a failed register read at this point suggests the device is
in trouble anyway.

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

Best Regards,
Chih-Kai
---
pw-bot: cr
Technical Details
Message-ID: <077b398494344d22bbab1eeba5e4a028@realtek.com>
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372541-linux-kernel-netdev=dewy.ru
References: <20261126033211.51850-9-nic_swsd@realtek.com> <179575362324.3135.9669497990549921570@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372541-linux-kernel-netdev=dewy.ru
From: hsu.chih.kai@realtek.com (Chih Kai Hsu)
Newsgroups: linux.kernel.netdev
Subject: RE: [PATCH net-next v9 08/12] r8152: split RTL_VER_17 into QFN68 and
 QFN100 package variants
Date: Fri, 27 Nov 2026 08:36:30 +0000
Organization: Usenet Network
Message-ID: <077b398494344d22bbab1eeba5e4a028@realtek.com>
References: <20261126033211.51850-9-nic_swsd@realtek.com>
 <179575362324.3135.9669497990549921570@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
Injection-Info: usenet.network;
	logging-data="684430"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:4DFmSsBT/tD3+UHbU/XCuZf65rM= sha256:QHg1J6NZnIx+TlPwqCK446wQ5rbz9Wyr0810ffjw6K8=
	sha1:sMgtpSYdXMIyryOwRcnN0j3yxtM= sha256:SWbmIs+0ElLQw/XsWzy/IPTgy2fFyO4uny3E2Q4whPY=
Content-Language: zh-TW
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 5EA70125F25; Fri, 27 Nov 2026 11:37:46 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.951
X-Spam-Status: No, score=-1.951 tagged_above=-9999 required=6.31
	tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=realtek.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id eM5PTk8uh16i;
	Fri, 27 Nov 2026 11:37:42 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-372541-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=realtek.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 9A06E125F24; Fri, 27 Nov 2026 11:37:32 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 6015C472A2; Fri, 27 Nov 2026 08:37:21 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=fail;
	t=1795768640;
	b=yHkdvvfB2Ux/g2oU//73QfZc1Vs5Q9Yj8Mz6uCEGamcgPsRWtvNu09Yln4rElzdY93p9
	 DRwMUkIfj0J80Vfb24j+njI0yJ7AvU5l9qq3Yqpsf2DB+Bu1T5NTQ63oDM1OOFA01KsWZ
	 bLmrjPQ9Ozay0VarcZh3rp3JoavVCysq6KMfy+CLeF6VWFh+2r0oZcNql9cBYERm3o/PM
	 5+ZxgpFaLd4r8UuVGbT8CuSB3tn/xESCrHItUzRD2cBIfwSE8cxx0M8/aHtrDmF2J3VuC
	 +Q6Q94wmEaWWs8/V1EO/5JM3T+YdsuubJWfXcMk75KfCff20ibJu/xUug49Df7vA+aA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795768640;
	h=X-Original-To:Received:DMARC-Filter:X-SpamFilter-By:DKIM-Signature:
	 Received:Received:Received:From:To:CC:Subject:Thread-Topic:
	 Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:
	 Content-Language:Content-Type:Content-Transfer-Encoding:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version;
	bh=Gy0V/cr77J3WFNymFExGJAjC5vL+Pn3FFraSnlBZ77s=;
	b=pmM+1RSyE5Epkjl9zOdxaloRwpnj9SohZ5s2vwp0H+IV4fyMiCQp55o6CgnT9+oJI9sQ
	 hDwuTBgQi3WOmJx2MfLRcSCxNvUJ2hEhBPTAQxx9uRDEKydEaH/3QoHaGCYJGsq1dwEDo
	 jDeUNgZ8DWh3s0bGhIjU74HSHLZsLZMK1EEprhV1WxSDfe3KNO9X/L2vvCVxTunjJnRFu
	 6D4JeVpObBg166jcMINBbx/Z4r/atwC42dTUqIBN2/JpBluPgSVqWHNbjMMPrVZwzecpL
	 ZP6Rnf5fpyP6HjtbE6By2cobvPyWKDyBhuoix6MnNVgpuqAqbFUUneZOyKv4PzwE6NA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=realtek.com header.i=@realtek.com header.a=rsa-sha256 header.s=dkim header.b=DUZn+pXA;
	dmarc=pass header.from=realtek.com;
	spf=pass smtp.mailfrom=realtek.com;
	arc=fail smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 2CEC6606A337;
	Fri, 27 Nov 2026 08:37:20 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=realtek.com header.i=@realtek.com header.a=rsa-sha256 header.s=dkim header.b=DUZn+pXA
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=211.75.126.72
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795768639;
	b=KQHsCg4v5+efIOywdCnGV8eCHaOSd+43ydY52zdtVT0Hc/LTK1DtAYyyYzE1SCJhVkRI
	 3CXk9G7klJsSMHNug31eMLYBWAXyR1KVmOay9DLd6/ERMD2Z8axBUlnlNJD+CKqsRA1ZU
	 WaZiQzXcf00FCMkd0vhuRQIyIL3riGQsJo4WjbAW1laAYt/uKfr+QqXoDfOg5IaHynuBk
	 u3qb5A26o1pUubFr0VkDEllCTqmOIdnRiM9mdRXRg2/gZjnFHR19At2dtLV8Ga3LyttC9
	 jOITFNno0S/yOmns50FOKDt4UPsboRvB6oz8Kvc0gfaetiXfWwKA4/cjJCf40eT75bA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795768639;
	h=DMARC-Filter:X-SpamFilter-By:DKIM-Signature:Received:Received:
	 Received:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:
	 References:In-Reply-To:Accept-Language:Content-Language:
	 x-originating-ip:Content-Type:Content-Transfer-Encoding:MIME-Version;
	bh=Gy0V/cr77J3WFNymFExGJAjC5vL+Pn3FFraSnlBZ77s=;
	b=I6XI+2fZ+JKzGYsfXgZuNnU18jIbjlHdLMfGltH/WzhVzXlrAxxHGuo0Puf8f/a/0+sl
	 DFiQLqJIWJ03JJ7AVxMveaTAkKZaxDmcLjzTZlvcAXd3b8vdpzPkbo+DQ6odVu7YOHrNV
	 wspxi+dWCqBgBD3DoH7vKanAhc3ag7tZvNdNmBeFP+ZBRu2Laf0EISDREhaxzCGbO2Cic
	 +ThoA6UocZhwir7ki+y+uvCzAjyAoFI8sAbxJaUwmqjUFZvFOqVycqKnWJtD+bgdNQiS2
	 cRJH7MzrZL+Mbb3tZ/iq/zxwgVTtdPZqgnIjb3D2gKgo6EjZCwSTx7fJbjcvXuLLKhQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=realtek.com;
	spf=pass smtp.mailfrom=realtek.com;
	dkim=pass header.d=realtek.com header.i=@realtek.com header.a=rsa-sha256 header.s=dkim header.b=DUZn+pXA;
	arc=none smtp.remote-ip=211.75.126.72
X-Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7970B606A31C;
	Fri, 27 Nov 2026 08:37:18 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7970B606A31C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realtek.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com
X-SpamFilter-By: ArmorX SpamTrap 5.80 with qID 6AR8aVveD782317, This message is accepted by code: ctloc85258
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=realtek.com; s=dkim;
	t=1795768591; bh=Gy0V/cr77J3WFNymFExGJAjC5vL+Pn3FFraSnlBZ77s=;
	h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To:
	 Content-Type:Content-Transfer-Encoding:MIME-Version;
	b=DUZn+pXAaxjY1N3Ac5bTchvGHHx9RQ+bze06flaZmQExa9t+eA0sqt6jYYtg112Xw
	 31ylaFHgSqpBAvyR2FwSo8DHuE1gYSEuzmT/slnFF5GH3db3ZVZiMR58TbzeGnYZec
	 3dysfTL5kFWko+KzvkT79ceQa6f32iAGB/4CbUx9GNEU0OmEJ/P3T4bB72phTbrUH6
	 FyTXJ016BYNo0IqjqWSs4Zpo4utushOH05UCuQI5URlu2PGyzxc0I8+EvKBP7ork7D
	 Oo8Gc3nsFU5f5vLf6OrxLgKc8DL3xxnjPa+plMfYA9LShwDbOjeo8cRcpCGA3Y8cdr
	 MTqJekwWuDmXg==
X-Received: from mail.realtek.com (rtkexhmbs02.realtek.com.tw[172.21.6.41])
	by rtits2.realtek.com.tw (8.15.2/3.29/5.94) with ESMTPS id 6AR8aVveD782317
	(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL);
	Fri, 27 Nov 2026 16:36:31 +0800
X-Received: from RTKEXHMBS06.realtek.com.tw (10.21.1.56) by
 RTKEXHMBS02.realtek.com.tw (172.21.6.41) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.2.2562.56; Fri, 27 Nov 2026 16:36:30 +0800
X-Received: from RTKEXHMBS06.realtek.com.tw ([fe80::eeeb:c765:ca73:5eef]) by
 RTKEXHMBS06.realtek.com.tw ([fe80::eeeb:c765:ca73:5eef%10]) with mapi id
 15.02.2562.056; Fri, 27 Nov 2026 16:36:30 +0800
X-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>, "mail@birger-koblitz.de"
	<mail@birger-koblitz.de>
X-Thread-Topic: [PATCH net-next v9 08/12] r8152: split RTL_VER_17 into QFN68 and
 QFN100 package variants
X-Thread-Index: AQHdfVa9AZFkbFqW3UyKNdeQ284JO7dAzlCAgADJIdA=
X-In-Reply-To: <179575362324.3135.9669497990549921570@kernel.org>
X-Accept-Language: zh-TW, en-US
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list