linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] r8152: disable rx checksum offload on Dell TB dock
@ 2017-11-23  6:38 Kai-Heng Feng
  2017-11-23  7:58 ` Greg KH
  0 siblings, 1 reply; 12+ messages in thread
From: Kai-Heng Feng @ 2017-11-23  6:38 UTC (permalink / raw)
  To: davem
  Cc: hayeswang, linux-usb, netdev, linux-kernel, Kai-Heng Feng,
	Mario Limonciello

r8153 on Dell TB dock corrupts rx packets.

The root cause is not found yet, but disabling rx checksumming can
workaround the issue. We can use this connection to decide if it's
a Dell TB dock:
Realtek r8153 <-> SMSC hub <-> ASMedia XHCI controller

BugLink: https://bugs.launchpad.net/bugs/1729674
Cc: Mario Limonciello <mario.limonciello@dell.com>
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 drivers/net/usb/r8152.c | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index d51d9abf7986..58b80b5e7803 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -27,6 +27,8 @@
 #include <linux/usb/cdc.h>
 #include <linux/suspend.h>
 #include <linux/acpi.h>
+#include <linux/pci.h>
+#include <linux/usb/hcd.h>
 
 /* Information for net-next */
 #define NETNEXT_VERSION		"09"
@@ -5135,6 +5137,35 @@ static u8 rtl_get_version(struct usb_interface *intf)
 	return version;
 }
 
+/* Ethernet on Dell TB 15/16 dock is connected this way:
+ * Realtek r8153 <-> SMSC hub <-> ASMedia XHCI controller
+ * We use this connection to make sure r8153 is on the Dell TB dock.
+ */
+static bool check_dell_tb_dock(struct usb_device *udev)
+{
+	struct usb_device *hub = udev->parent;
+	struct usb_device *root_hub;
+	struct pci_dev *controller;
+
+	if (!hub)
+		return false;
+
+	if (!(le16_to_cpu(hub->descriptor.idVendor) == 0x0424 &&
+	      le16_to_cpu(hub->descriptor.idProduct) == 0x5537))
+		return false;
+
+	root_hub = hub->parent;
+	if (!root_hub || root_hub->parent)
+		return false;
+
+	controller = to_pci_dev(bus_to_hcd(root_hub->bus)->self.controller);
+
+	if (controller->vendor == 0x1b21 && controller->device == 0x1142)
+		return true;
+
+	return false;
+}
+
 static int rtl8152_probe(struct usb_interface *intf,
 			 const struct usb_device_id *id)
 {
@@ -5202,7 +5233,7 @@ static int rtl8152_probe(struct usb_interface *intf,
 				NETIF_F_HIGHDMA | NETIF_F_FRAGLIST |
 				NETIF_F_IPV6_CSUM | NETIF_F_TSO6;
 
-	if (tp->version == RTL_VER_01) {
+	if (tp->version == RTL_VER_01 || check_dell_tb_dock(udev)) {
 		netdev->features &= ~NETIF_F_RXCSUM;
 		netdev->hw_features &= ~NETIF_F_RXCSUM;
 	}
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-11-28  9:40 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-23  6:38 [PATCH] r8152: disable rx checksum offload on Dell TB dock Kai-Heng Feng
2017-11-23  7:58 ` Greg KH
2017-11-23  8:53   ` Kai Heng Feng
2017-11-23  9:24     ` Greg KH
2017-11-24  3:44       ` Kai Heng Feng
2017-11-24  8:28         ` Greg KH
2017-11-24  8:29           ` Greg KH
2017-11-24  8:59             ` Kai Heng Feng
2017-11-27 15:11               ` Mario.Limonciello
2017-11-24  8:57           ` Kai Heng Feng
2017-11-27 15:13         ` Mario.Limonciello
2017-11-28  9:40           ` Kai Heng Feng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).