+++ /dev/null
-From 28e8a9b60bf2f7a4888fbe70a344153a2f35a87c Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 17 May 2022 14:05:39 -0400
-Subject: net: usb: r8152: Add in new Devices that are supported for
- Mac-Passthru
-
-From: David Ober <dober6023@gmail.com>
-
-[ Upstream commit f01cdcf891a569dee187a5de0c25cd5766151524 ]
-
-Lenovo Thunderbolt 4 Dock, and other Lenovo USB Docks are using the
-original Realtek USB ethernet Vendor and Product IDs
-If the Network device is Realtek verify that it is on a Lenovo USB hub
-before enabling the passthru feature
-
-This also adds in the device IDs for the Lenovo USB Dongle and one other
-USB-C dock
-
-V2 fix formating of code
-V3 remove Generic define for Device ID 0x8153 and change it to use value
-V4 rearrange defines and case statement to put them in better order
-v5 create helper function to do the testing work as suggested
-
-Signed-off-by: David Ober <dober6023@gmail.com>
-Link: https://lore.kernel.org/r/20220517180539.25839-1-dober6023@gmail.com
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/usb/r8152.c | 33 ++++++++++++++++++++++++++-------
- 1 file changed, 26 insertions(+), 7 deletions(-)
-
-diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
-index ce47a111fe62b..bcfd51373b53c 100644
---- a/drivers/net/usb/r8152.c
-+++ b/drivers/net/usb/r8152.c
-@@ -697,7 +697,9 @@ enum rtl8152_flags {
- #define VENDOR_ID_TPLINK 0x2357
-
- #define DEVICE_ID_THINKPAD_THUNDERBOLT3_DOCK_GEN2 0x3082
-+#define DEVICE_ID_THINKPAD_USB_C_DONGLE 0x720c
- #define DEVICE_ID_THINKPAD_USB_C_DOCK_GEN2 0xa387
-+#define DEVICE_ID_THINKPAD_USB_C_DOCK_GEN3 0x3062
-
- #define MCU_TYPE_PLA 0x0100
- #define MCU_TYPE_USB 0x0000
-@@ -6694,6 +6696,29 @@ static u8 rtl_get_version(struct usb_interface *intf)
- return version;
- }
-
-+static bool rtl8152_supports_lenovo_macpassthru(struct usb_device *udev)
-+{
-+ int parent_vendor_id = le16_to_cpu(udev->parent->descriptor.idVendor);
-+ int product_id = le16_to_cpu(udev->descriptor.idProduct);
-+ int vendor_id = le16_to_cpu(udev->descriptor.idVendor);
-+
-+ if (vendor_id == VENDOR_ID_LENOVO) {
-+ switch (product_id) {
-+ case DEVICE_ID_THINKPAD_THUNDERBOLT3_DOCK_GEN2:
-+ case DEVICE_ID_THINKPAD_USB_C_DOCK_GEN2:
-+ case DEVICE_ID_THINKPAD_USB_C_DOCK_GEN3:
-+ case DEVICE_ID_THINKPAD_USB_C_DONGLE:
-+ return 1;
-+ }
-+ } else if (vendor_id == VENDOR_ID_REALTEK && parent_vendor_id == VENDOR_ID_LENOVO) {
-+ switch (product_id) {
-+ case 0x8153:
-+ return 1;
-+ }
-+ }
-+ return 0;
-+}
-+
- static int rtl8152_probe(struct usb_interface *intf,
- const struct usb_device_id *id)
- {
-@@ -6771,13 +6796,7 @@ static int rtl8152_probe(struct usb_interface *intf,
- netdev->hw_features &= ~NETIF_F_RXCSUM;
- }
-
-- if (le16_to_cpu(udev->descriptor.idVendor) == VENDOR_ID_LENOVO) {
-- switch (le16_to_cpu(udev->descriptor.idProduct)) {
-- case DEVICE_ID_THINKPAD_THUNDERBOLT3_DOCK_GEN2:
-- case DEVICE_ID_THINKPAD_USB_C_DOCK_GEN2:
-- tp->lenovo_macpassthru = 1;
-- }
-- }
-+ tp->lenovo_macpassthru = rtl8152_supports_lenovo_macpassthru(udev);
-
- if (le16_to_cpu(udev->descriptor.bcdDevice) == 0x3011 && udev->serial &&
- (!strcmp(udev->serial, "000001000000") ||
---
-2.43.0
-
+++ /dev/null
-From 6a36f9afdd16e89f3f673ad693020351b96b6bc3 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 24 Aug 2022 21:14:36 +0200
-Subject: r8152: add PID for the Lenovo OneLink+ Dock
-
-From: Jean-Francois Le Fillatre <jflf_kernel@gmx.com>
-
-[ Upstream commit 76d7df9406a1d2faec6eaaa1d835a1dbc1d49cec ]
-
-The Lenovo OneLink+ Dock contains an RTL8153 controller that behaves as
-a broken CDC device by default. Add the custom Lenovo PID to the r8152
-driver to support it properly.
-
-Also, systems compatible with this dock provide a BIOS option to enable
-MAC address passthrough (as per Lenovo document "ThinkPad Docking
-Solutions 2017"). Add the custom PID to the MAC passthrough list too.
-
-Tested on a ThinkPad 13 1st gen with the expected results:
-
-passthrough disabled: Invalid header when reading pass-thru MAC addr
-passthrough enabled: Using pass-thru MAC addr XX:XX:XX:XX:XX:XX
-
-Signed-off-by: Jean-Francois Le Fillatre <jflf_kernel@gmx.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/usb/r8152.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
-index bcfd51373b53c..02bafe49c6c1a 100644
---- a/drivers/net/usb/r8152.c
-+++ b/drivers/net/usb/r8152.c
-@@ -696,6 +696,7 @@ enum rtl8152_flags {
- #define VENDOR_ID_NVIDIA 0x0955
- #define VENDOR_ID_TPLINK 0x2357
-
-+#define DEVICE_ID_THINKPAD_ONELINK_PLUS_DOCK 0x3054
- #define DEVICE_ID_THINKPAD_THUNDERBOLT3_DOCK_GEN2 0x3082
- #define DEVICE_ID_THINKPAD_USB_C_DONGLE 0x720c
- #define DEVICE_ID_THINKPAD_USB_C_DOCK_GEN2 0xa387
-@@ -6704,6 +6705,7 @@ static bool rtl8152_supports_lenovo_macpassthru(struct usb_device *udev)
-
- if (vendor_id == VENDOR_ID_LENOVO) {
- switch (product_id) {
-+ case DEVICE_ID_THINKPAD_ONELINK_PLUS_DOCK:
- case DEVICE_ID_THINKPAD_THUNDERBOLT3_DOCK_GEN2:
- case DEVICE_ID_THINKPAD_USB_C_DOCK_GEN2:
- case DEVICE_ID_THINKPAD_USB_C_DOCK_GEN3:
-@@ -6923,6 +6925,7 @@ static const struct usb_device_id rtl8152_table[] = {
- REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x0927),
- REALTEK_USB_DEVICE(VENDOR_ID_SAMSUNG, 0xa101),
- REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x304f),
-+ REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3054),
- REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3062),
- REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3069),
- REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3082),
---
-2.43.0
-
+++ /dev/null
-From e6b84ca7d14f7686afaebd9ce187f221559be94a Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 6 Jan 2023 17:07:38 +0100
-Subject: r8152: add USB device driver for config selection
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Bjørn Mork <bjorn@mork.no>
-
-[ Upstream commit ec51fbd1b8a2bca2948dede99c14ec63dc57ff6b ]
-
-Subclassing the generic USB device driver to override the
-default configuration selection regardless of matching interface
-drivers.
-
-The r815x family devices expose a vendor specific function which
-the r8152 interface driver wants to handle. This is the preferred
-device mode. Additionally one or more USB class functions are
-usually supported for hosts lacking a vendor specific driver. The
-choice is USB configuration based, with one alternate function per
-configuration.
-
-Example device with both NCM and ECM alternate cfgs:
-
-T: Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 4 Spd=5000 MxCh= 0
-D: Ver= 3.20 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs= 3
-P: Vendor=0bda ProdID=8156 Rev=31.00
-S: Manufacturer=Realtek
-S: Product=USB 10/100/1G/2.5G LAN
-S: SerialNumber=001000001
-C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=256mA
-I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=00 Driver=r8152
-E: Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
-E: Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
-E: Ad=83(I) Atr=03(Int.) MxPS= 2 Ivl=128ms
-C: #Ifs= 2 Cfg#= 2 Atr=a0 MxPwr=256mA
-I: If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0d Prot=00 Driver=
-E: Ad=83(I) Atr=03(Int.) MxPS= 16 Ivl=128ms
-I: If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=01 Driver=
-I: If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=01 Driver=
-E: Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
-E: Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
-C: #Ifs= 2 Cfg#= 3 Atr=a0 MxPwr=256mA
-I: If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=
-E: Ad=83(I) Atr=03(Int.) MxPS= 16 Ivl=128ms
-I: If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=
-I: If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=
-E: Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
-E: Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
-
-A problem with this is that Linux will prefer class functions over
-vendor specific functions. Using the above example, Linux defaults
-to cfg #2, running the device in a sub-optimal NCM mode.
-
-Previously we've attempted to work around the problem by
-blacklisting the devices in the ECM class driver "cdc_ether", and
-matching on the ECM class function in the vendor specific interface
-driver. The latter has been used to switch back to the vendor
-specific configuration when the driver is probed for a class
-function.
-
-This workaround has several issues;
-- class driver blacklists is additional maintanence cruft in an
- unrelated driver
-- class driver blacklists prevents users from optionally running
- the devices in class mode
-- each device needs double match entries in the vendor driver
-- the initial probing as a class function slows down device
- discovery
-
-Now these issues have become even worse with the introduction of
-firmware supporting both NCM and ECM, where NCM ends up as the
-default mode in Linux. To use the same workaround, we now have
-to blacklist the devices in to two different class drivers and
-add yet another match entry to the vendor specific driver.
-
-This patch implements an alternative workaround strategy -
-independent of the interface drivers. It avoids adding a
-blacklist to the cdc_ncm driver and will let us remove the
-existing blacklist from the cdc_ether driver.
-
-As an additional bonus, removing the blacklists allow users to
-select one of the other device modes if wanted.
-
-Signed-off-by: Bjørn Mork <bjorn@mork.no>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/usb/r8152.c | 107 +++++++++++++++++++++++++++++-----------
- 1 file changed, 78 insertions(+), 29 deletions(-)
-
-diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
-index 02bafe49c6c1a..5f212b8752f4d 100644
---- a/drivers/net/usb/r8152.c
-+++ b/drivers/net/usb/r8152.c
-@@ -6733,6 +6733,9 @@ static int rtl8152_probe(struct usb_interface *intf,
- if (version == RTL_VER_UNKNOWN)
- return -ENODEV;
-
-+ if (intf->cur_altsetting->desc.bInterfaceClass != USB_CLASS_VENDOR_SPEC)
-+ return -ENODEV;
-+
- if (!rtl_vendor_mode(intf))
- return -ENODEV;
-
-@@ -6904,39 +6907,31 @@ static void rtl8152_disconnect(struct usb_interface *intf)
- }
- }
-
--#define REALTEK_USB_DEVICE(vend, prod) { \
-- USB_DEVICE_INTERFACE_CLASS(vend, prod, USB_CLASS_VENDOR_SPEC), \
--}, \
--{ \
-- USB_DEVICE_AND_INTERFACE_INFO(vend, prod, USB_CLASS_COMM, \
-- USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), \
--}
--
- /* table of devices that work with this driver */
- static const struct usb_device_id rtl8152_table[] = {
- /* Realtek */
-- REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8050),
-- REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8152),
-- REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8153),
-+ { USB_DEVICE(VENDOR_ID_REALTEK, 0x8050) },
-+ { USB_DEVICE(VENDOR_ID_REALTEK, 0x8152) },
-+ { USB_DEVICE(VENDOR_ID_REALTEK, 0x8153) },
-
- /* Microsoft */
-- REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x07ab),
-- REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x07c6),
-- REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x0927),
-- REALTEK_USB_DEVICE(VENDOR_ID_SAMSUNG, 0xa101),
-- REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x304f),
-- REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3054),
-- REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3062),
-- REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3069),
-- REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3082),
-- REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7205),
-- REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x720c),
-- REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7214),
-- REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x721e),
-- REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0xa387),
-- REALTEK_USB_DEVICE(VENDOR_ID_LINKSYS, 0x0041),
-- REALTEK_USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff),
-- REALTEK_USB_DEVICE(VENDOR_ID_TPLINK, 0x0601),
-+ { USB_DEVICE(VENDOR_ID_MICROSOFT, 0x07ab) },
-+ { USB_DEVICE(VENDOR_ID_MICROSOFT, 0x07c6) },
-+ { USB_DEVICE(VENDOR_ID_MICROSOFT, 0x0927) },
-+ { USB_DEVICE(VENDOR_ID_SAMSUNG, 0xa101) },
-+ { USB_DEVICE(VENDOR_ID_LENOVO, 0x304f) },
-+ { USB_DEVICE(VENDOR_ID_LENOVO, 0x3054) },
-+ { USB_DEVICE(VENDOR_ID_LENOVO, 0x3062) },
-+ { USB_DEVICE(VENDOR_ID_LENOVO, 0x3069) },
-+ { USB_DEVICE(VENDOR_ID_LENOVO, 0x3082) },
-+ { USB_DEVICE(VENDOR_ID_LENOVO, 0x7205) },
-+ { USB_DEVICE(VENDOR_ID_LENOVO, 0x720c) },
-+ { USB_DEVICE(VENDOR_ID_LENOVO, 0x7214) },
-+ { USB_DEVICE(VENDOR_ID_LENOVO, 0x721e) },
-+ { USB_DEVICE(VENDOR_ID_LENOVO, 0xa387) },
-+ { USB_DEVICE(VENDOR_ID_LINKSYS, 0x0041) },
-+ { USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff) },
-+ { USB_DEVICE(VENDOR_ID_TPLINK, 0x0601) },
- {}
- };
-
-@@ -6956,7 +6951,61 @@ static struct usb_driver rtl8152_driver = {
- .disable_hub_initiated_lpm = 1,
- };
-
--module_usb_driver(rtl8152_driver);
-+static int rtl8152_cfgselector_probe(struct usb_device *udev)
-+{
-+ struct usb_host_config *c;
-+ int i, num_configs;
-+
-+ /* The vendor mode is not always config #1, so to find it out. */
-+ c = udev->config;
-+ num_configs = udev->descriptor.bNumConfigurations;
-+ for (i = 0; i < num_configs; (i++, c++)) {
-+ struct usb_interface_descriptor *desc = NULL;
-+
-+ if (!c->desc.bNumInterfaces)
-+ continue;
-+ desc = &c->intf_cache[0]->altsetting->desc;
-+ if (desc->bInterfaceClass == USB_CLASS_VENDOR_SPEC)
-+ break;
-+ }
-+
-+ if (i == num_configs)
-+ return -ENODEV;
-+
-+ if (usb_set_configuration(udev, c->desc.bConfigurationValue)) {
-+ dev_err(&udev->dev, "Failed to set configuration %d\n",
-+ c->desc.bConfigurationValue);
-+ return -ENODEV;
-+ }
-+
-+ return 0;
-+}
-+
-+static struct usb_device_driver rtl8152_cfgselector_driver = {
-+ .name = MODULENAME "-cfgselector",
-+ .probe = rtl8152_cfgselector_probe,
-+ .id_table = rtl8152_table,
-+ .generic_subclass = 1,
-+};
-+
-+static int __init rtl8152_driver_init(void)
-+{
-+ int ret;
-+
-+ ret = usb_register_device_driver(&rtl8152_cfgselector_driver, THIS_MODULE);
-+ if (ret)
-+ return ret;
-+ return usb_register(&rtl8152_driver);
-+}
-+
-+static void __exit rtl8152_driver_exit(void)
-+{
-+ usb_deregister(&rtl8152_driver);
-+ usb_deregister_device_driver(&rtl8152_cfgselector_driver);
-+}
-+
-+module_init(rtl8152_driver_init);
-+module_exit(rtl8152_driver_exit);
-
- MODULE_AUTHOR(DRIVER_AUTHOR);
- MODULE_DESCRIPTION(DRIVER_DESC);
---
-2.43.0
-
+++ /dev/null
-From 0299d1b30eda034d7d78e10303a8556c8d4e297c Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 2 Dec 2023 17:17:12 -0800
-Subject: r8152: add vendor/device ID pair for ASUS USB-C2500
-
-From: Kelly Kane <kelly@hawknetworks.com>
-
-[ Upstream commit 7037d95a047cd89b1f680eed253c6ab586bef1ed ]
-
-The ASUS USB-C2500 is an RTL8156 based 2.5G Ethernet controller.
-
-Add the vendor and product ID values to the driver. This makes Ethernet
-work with the adapter.
-
-Signed-off-by: Kelly Kane <kelly@hawknetworks.com>
-Link: https://lore.kernel.org/r/20231203011712.6314-1-kelly@hawknetworks.com
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/usb/r8152.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
-index 2ed73ae2bea3d..f0b781341e185 100644
---- a/drivers/net/usb/r8152.c
-+++ b/drivers/net/usb/r8152.c
-@@ -696,6 +696,7 @@ enum rtl8152_flags {
- #define VENDOR_ID_NVIDIA 0x0955
- #define VENDOR_ID_TPLINK 0x2357
- #define VENDOR_ID_DLINK 0x2001
-+#define VENDOR_ID_ASUS 0x0b05
-
- #define DEVICE_ID_THINKPAD_ONELINK_PLUS_DOCK 0x3054
- #define DEVICE_ID_THINKPAD_THUNDERBOLT3_DOCK_GEN2 0x3082
-@@ -6934,6 +6935,7 @@ static const struct usb_device_id rtl8152_table[] = {
- { USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff) },
- { USB_DEVICE(VENDOR_ID_TPLINK, 0x0601) },
- { USB_DEVICE(VENDOR_ID_DLINK, 0xb301) },
-+ { USB_DEVICE(VENDOR_ID_ASUS, 0x1976) },
- {}
- };
-
---
-2.43.0
-
+++ /dev/null
-From 6b532e620ea785015abf89d2f0249d3d36cb0c5c Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 26 Aug 2023 01:05:50 +0200
-Subject: r8152: add vendor/device ID pair for D-Link DUB-E250
-
-From: Antonio Napolitano <anton@polit.no>
-
-[ Upstream commit 72f93a3136ee18fd59fa6579f84c07e93424681e ]
-
-The D-Link DUB-E250 is an RTL8156 based 2.5G Ethernet controller.
-
-Add the vendor and product ID values to the driver. This makes Ethernet
-work with the adapter.
-
-Signed-off-by: Antonio Napolitano <anton@polit.no>
-Link: https://lore.kernel.org/r/CV200KJEEUPC.WPKAHXCQJ05I@mercurius
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/usb/r8152.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
-index 5f212b8752f4d..2ed73ae2bea3d 100644
---- a/drivers/net/usb/r8152.c
-+++ b/drivers/net/usb/r8152.c
-@@ -695,6 +695,7 @@ enum rtl8152_flags {
- #define VENDOR_ID_LINKSYS 0x13b1
- #define VENDOR_ID_NVIDIA 0x0955
- #define VENDOR_ID_TPLINK 0x2357
-+#define VENDOR_ID_DLINK 0x2001
-
- #define DEVICE_ID_THINKPAD_ONELINK_PLUS_DOCK 0x3054
- #define DEVICE_ID_THINKPAD_THUNDERBOLT3_DOCK_GEN2 0x3082
-@@ -6932,6 +6933,7 @@ static const struct usb_device_id rtl8152_table[] = {
- { USB_DEVICE(VENDOR_ID_LINKSYS, 0x0041) },
- { USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff) },
- { USB_DEVICE(VENDOR_ID_TPLINK, 0x0601) },
-+ { USB_DEVICE(VENDOR_ID_DLINK, 0xb301) },
- {}
- };
-
---
-2.43.0
-
+++ /dev/null
-From c103c1d2c27716211bcd4d8cb5b9443dcb093490 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 23 Apr 2021 17:44:55 +0800
-Subject: r8152: redefine REALTEK_USB_DEVICE macro
-
-From: Hayes Wang <hayeswang@realtek.com>
-
-[ Upstream commit 55319eeb5bbcd3c73366de92ff224bd62325a68d ]
-
-Redefine REALTEK_USB_DEVICE macro with USB_DEVICE_INTERFACE_CLASS and
-USB_DEVICE_AND_INTERFACE_INFO to simply the code.
-
-Although checkpatch.pl shows the following error, it is more readable.
-
- ERROR: Macros with complex values should be enclosed in parentheses
-
-Signed-off-by: Hayes Wang <hayeswang@realtek.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/usb/r8152.c | 60 +++++++++++++++++++----------------------
- 1 file changed, 27 insertions(+), 33 deletions(-)
-
-diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
-index 170b6ec2dbb3c..7e9335d6e5562 100644
---- a/drivers/net/usb/r8152.c
-+++ b/drivers/net/usb/r8152.c
-@@ -6883,44 +6883,38 @@ static void rtl8152_disconnect(struct usb_interface *intf)
- }
- }
-
--#define REALTEK_USB_DEVICE(vend, prod) \
-- .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
-- USB_DEVICE_ID_MATCH_INT_CLASS, \
-- .idVendor = (vend), \
-- .idProduct = (prod), \
-- .bInterfaceClass = USB_CLASS_VENDOR_SPEC \
-+#define REALTEK_USB_DEVICE(vend, prod) { \
-+ USB_DEVICE_INTERFACE_CLASS(vend, prod, USB_CLASS_VENDOR_SPEC), \
- }, \
- { \
-- .match_flags = USB_DEVICE_ID_MATCH_INT_INFO | \
-- USB_DEVICE_ID_MATCH_DEVICE, \
-- .idVendor = (vend), \
-- .idProduct = (prod), \
-- .bInterfaceClass = USB_CLASS_COMM, \
-- .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, \
-- .bInterfaceProtocol = USB_CDC_PROTO_NONE
-+ USB_DEVICE_AND_INTERFACE_INFO(vend, prod, USB_CLASS_COMM, \
-+ USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), \
-+}
-
- /* table of devices that work with this driver */
- static const struct usb_device_id rtl8152_table[] = {
-- {REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8050)},
-- {REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8152)},
-- {REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8153)},
-- {REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x07ab)},
-- {REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x07c6)},
-- {REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x0927)},
-- {REALTEK_USB_DEVICE(VENDOR_ID_SAMSUNG, 0xa101)},
-- {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x304f)},
-- {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3054)},
-- {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3062)},
-- {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3069)},
-- {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3082)},
-- {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7205)},
-- {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x720c)},
-- {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7214)},
-- {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x721e)},
-- {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0xa387)},
-- {REALTEK_USB_DEVICE(VENDOR_ID_LINKSYS, 0x0041)},
-- {REALTEK_USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff)},
-- {REALTEK_USB_DEVICE(VENDOR_ID_TPLINK, 0x0601)},
-+ /* Realtek */
-+ REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8050),
-+ REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8152),
-+ REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8153),
-+
-+ /* Microsoft */
-+ REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x07ab),
-+ REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x07c6),
-+ REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x0927),
-+ REALTEK_USB_DEVICE(VENDOR_ID_SAMSUNG, 0xa101),
-+ REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x304f),
-+ REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3062),
-+ REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3069),
-+ REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3082),
-+ REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7205),
-+ REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x720c),
-+ REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7214),
-+ REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x721e),
-+ REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0xa387),
-+ REALTEK_USB_DEVICE(VENDOR_ID_LINKSYS, 0x0041),
-+ REALTEK_USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff),
-+ REALTEK_USB_DEVICE(VENDOR_ID_TPLINK, 0x0601),
- {}
- };
-
---
-2.43.0
-
+++ /dev/null
-From 303ec1d99145849a40bd6ce0e3379c5080f4ca3f Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 24 Apr 2021 14:09:03 +0800
-Subject: r8152: remove some bit operations
-
-From: Hayes Wang <hayeswang@realtek.com>
-
-[ Upstream commit 9c68011bd7e477ee8d03824c8cb40eab9c64027d ]
-
-Remove DELL_TB_RX_AGG_BUG and LENOVO_MACPASSTHRU flags of rtl8152_flags.
-They are only set when initializing and wouldn't be change. It is enough
-to record them with variables.
-
-Signed-off-by: Hayes Wang <hayeswang@realtek.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/usb/r8152.c | 14 +++++++-------
- 1 file changed, 7 insertions(+), 7 deletions(-)
-
-diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
-index 7e9335d6e5562..ce47a111fe62b 100644
---- a/drivers/net/usb/r8152.c
-+++ b/drivers/net/usb/r8152.c
-@@ -685,8 +685,6 @@ enum rtl8152_flags {
- PHY_RESET,
- SCHEDULE_TASKLET,
- GREEN_ETHERNET,
-- DELL_TB_RX_AGG_BUG,
-- LENOVO_MACPASSTHRU,
- };
-
- /* Define these values to match your device */
-@@ -860,6 +858,8 @@ struct r8152 {
- u32 rx_copybreak;
- u32 rx_pending;
-
-+ u32 lenovo_macpassthru:1;
-+ u32 dell_tb_rx_agg_bug:1;
- u16 ocp_base;
- u16 speed;
- u16 eee_adv;
-@@ -1432,7 +1432,7 @@ static int vendor_mac_passthru_addr_read(struct r8152 *tp, struct sockaddr *sa)
- acpi_object_type mac_obj_type;
- int mac_strlen;
-
-- if (test_bit(LENOVO_MACPASSTHRU, &tp->flags)) {
-+ if (tp->lenovo_macpassthru) {
- mac_obj_name = "\\MACA";
- mac_obj_type = ACPI_TYPE_STRING;
- mac_strlen = 0x16;
-@@ -2123,7 +2123,7 @@ static int r8152_tx_agg_fill(struct r8152 *tp, struct tx_agg *agg)
-
- remain = agg_buf_sz - (int)(tx_agg_align(tx_data) - agg->head);
-
-- if (test_bit(DELL_TB_RX_AGG_BUG, &tp->flags))
-+ if (tp->dell_tb_rx_agg_bug)
- break;
- }
-
-@@ -5473,7 +5473,7 @@ static void r8153_init(struct r8152 *tp)
- /* rx aggregation */
- ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_USB_CTRL);
- ocp_data &= ~(RX_AGG_DISABLE | RX_ZERO_EN);
-- if (test_bit(DELL_TB_RX_AGG_BUG, &tp->flags))
-+ if (tp->dell_tb_rx_agg_bug)
- ocp_data |= RX_AGG_DISABLE;
-
- ocp_write_word(tp, MCU_TYPE_USB, USB_USB_CTRL, ocp_data);
-@@ -6775,7 +6775,7 @@ static int rtl8152_probe(struct usb_interface *intf,
- switch (le16_to_cpu(udev->descriptor.idProduct)) {
- case DEVICE_ID_THINKPAD_THUNDERBOLT3_DOCK_GEN2:
- case DEVICE_ID_THINKPAD_USB_C_DOCK_GEN2:
-- set_bit(LENOVO_MACPASSTHRU, &tp->flags);
-+ tp->lenovo_macpassthru = 1;
- }
- }
-
-@@ -6783,7 +6783,7 @@ static int rtl8152_probe(struct usb_interface *intf,
- (!strcmp(udev->serial, "000001000000") ||
- !strcmp(udev->serial, "000002000000"))) {
- dev_info(&udev->dev, "Dell TB16 Dock, disable RX aggregation");
-- set_bit(DELL_TB_RX_AGG_BUG, &tp->flags);
-+ tp->dell_tb_rx_agg_bug = 1;
- }
-
- netdev->ethtool_ops = &ops;
---
-2.43.0
-
+++ /dev/null
-From 999a10cbab78406a4fa45870dde04d0e7b7c66c5 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 16 Apr 2021 16:04:37 +0800
-Subject: r8152: search the configuration of vendor mode
-
-From: Hayes Wang <hayeswang@realtek.com>
-
-[ Upstream commit c2198943e33b100ed21dfb636c8fa6baef841e9d ]
-
-The vendor mode is not always at config #1, so it is necessary to
-set the correct configuration number.
-
-Signed-off-by: Hayes Wang <hayeswang@realtek.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/usb/r8152.c | 39 +++++++++++++++++++++++++++++++++++----
- 1 file changed, 35 insertions(+), 4 deletions(-)
-
-diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
-index 0d6f10c9bb139..170b6ec2dbb3c 100644
---- a/drivers/net/usb/r8152.c
-+++ b/drivers/net/usb/r8152.c
-@@ -28,7 +28,7 @@
- #include <crypto/hash.h>
-
- /* Information for net-next */
--#define NETNEXT_VERSION "11"
-+#define NETNEXT_VERSION "12"
-
- /* Information for net */
- #define NET_VERSION "11"
-@@ -5580,6 +5580,39 @@ static void r8153b_init(struct r8152 *tp)
- tp->coalesce = 15000; /* 15 us */
- }
-
-+static bool rtl_vendor_mode(struct usb_interface *intf)
-+{
-+ struct usb_host_interface *alt = intf->cur_altsetting;
-+ struct usb_device *udev;
-+ struct usb_host_config *c;
-+ int i, num_configs;
-+
-+ if (alt->desc.bInterfaceClass == USB_CLASS_VENDOR_SPEC)
-+ return true;
-+
-+ /* The vendor mode is not always config #1, so to find it out. */
-+ udev = interface_to_usbdev(intf);
-+ c = udev->config;
-+ num_configs = udev->descriptor.bNumConfigurations;
-+ for (i = 0; i < num_configs; (i++, c++)) {
-+ struct usb_interface_descriptor *desc = NULL;
-+
-+ if (c->desc.bNumInterfaces > 0)
-+ desc = &c->intf_cache[0]->altsetting->desc;
-+ else
-+ continue;
-+
-+ if (desc->bInterfaceClass == USB_CLASS_VENDOR_SPEC) {
-+ usb_driver_set_configuration(udev, c->desc.bConfigurationValue);
-+ break;
-+ }
-+ }
-+
-+ WARN_ON_ONCE(i == num_configs);
-+
-+ return false;
-+}
-+
- static int rtl8152_pre_reset(struct usb_interface *intf)
- {
- struct r8152 *tp = usb_get_intfdata(intf);
-@@ -6673,10 +6706,8 @@ static int rtl8152_probe(struct usb_interface *intf,
- if (version == RTL_VER_UNKNOWN)
- return -ENODEV;
-
-- if (udev->actconfig->desc.bConfigurationValue != 1) {
-- usb_driver_set_configuration(udev, 1);
-+ if (!rtl_vendor_mode(intf))
- return -ENODEV;
-- }
-
- if (intf->cur_altsetting->desc.bNumEndpoints < 3)
- return -ENODEV;
---
-2.43.0
-
-r8152-search-the-configuration-of-vendor-mode.patch
-r8152-redefine-realtek_usb_device-macro.patch
-r8152-remove-some-bit-operations.patch
-net-usb-r8152-add-in-new-devices-that-are-supported-.patch
-r8152-add-pid-for-the-lenovo-onelink-dock.patch
-r8152-add-usb-device-driver-for-config-selection.patch
-r8152-add-vendor-device-id-pair-for-d-link-dub-e250.patch
-r8152-add-vendor-device-id-pair-for-asus-usb-c2500.patch
netfilter-nf_tables-fix-exist-matching-on-bigendian-.patch
afs-fix-refcount-underflow-from-error-handling-race.patch
hid-lenovo-restrict-detection-of-patched-firmware-on.patch