netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>
To: Kai-Heng Feng <kai.heng.feng-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
Cc: davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org,
	hayeswang-Rasf1IRRPZGIwRZHo2/mJg@public.gmane.org,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Mario Limonciello
	<mario.limonciello-8PEkshWhKlo@public.gmane.org>
Subject: Re: [PATCH] r8152: disable rx checksum offload on Dell TB dock
Date: Thu, 23 Nov 2017 08:58:58 +0100	[thread overview]
Message-ID: <20171123075858.GA31473@kroah.com> (raw)
In-Reply-To: <20171123063838.3058-1-kai.heng.feng-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>

On Thu, Nov 23, 2017 at 01:38:38AM -0500, Kai-Heng Feng wrote:
> 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-8PEkshWhKlo@public.gmane.org>
> Signed-off-by: Kai-Heng Feng <kai.heng.feng-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
> ---
>  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);

That's a very scary, and dangerous, cast.  You can not ever be sure that
the hub really is a "root hub" like this.

> +	if (controller->vendor == 0x1b21 && controller->device == 0x1142)
> +		return true;

Why can't you just look at the USB device itself and go off of a quirk
in it?  Something like a version or string or something else?

This sounds like a USB host controller issue, not a USB device issue,
can't we fix the "real" problem here instead of this crazy work-around?
Odds are any device plugged into the hub should have the same issue,
right?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2017-11-23  7:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-23  6:38 [PATCH] r8152: disable rx checksum offload on Dell TB dock Kai-Heng Feng
     [not found] ` <20171123063838.3058-1-kai.heng.feng-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
2017-11-23  7:58   ` Greg KH [this message]
     [not found]     ` <20171123075858.GA31473-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
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
     [not found]                   ` <0A28FAE6-D5BF-465A-8AD9-619E7CC64D6B-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
2017-11-27 15:11                     ` Mario.Limonciello-8PEkshWhKlo
2017-11-24  8:57               ` Kai Heng Feng
2017-11-27 15:13             ` Mario.Limonciello
2017-11-28  9:40               ` Kai Heng Feng

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=20171123075858.GA31473@kroah.com \
    --to=gregkh-hqyy1w1ycw8ekmwlsbkhg0b+6bgklq7r@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=hayeswang-Rasf1IRRPZGIwRZHo2/mJg@public.gmane.org \
    --cc=kai.heng.feng-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mario.limonciello-8PEkshWhKlo@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /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;
as well as URLs for NNTP newsgroup(s).