All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: Oliver Neukum <oneukum@suse.com>,
	netdev@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel@pengutronix.de,
	Jakub Kicinski <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH net-next v1 1/1] usbnet: add devlink support
Date: Fri, 28 Jan 2022 12:23:33 +0100	[thread overview]
Message-ID: <YfPSNSHwTLZBv7me@kroah.com> (raw)
In-Reply-To: <YfPPpkGjL2vcv4oH@pengutronix.de>

On Fri, Jan 28, 2022 at 12:12:38PM +0100, Oleksij Rempel wrote:
> On Thu, Jan 27, 2022 at 02:22:49PM +0100, Greg KH wrote:
> > On Thu, Jan 27, 2022 at 01:31:52PM +0100, Oleksij Rempel wrote:
> > > On Thu, Jan 27, 2022 at 12:13:53PM +0100, Greg KH wrote:
> > > > On Thu, Jan 27, 2022 at 12:07:42PM +0100, Oleksij Rempel wrote:
> > > > > The weakest link of usbnet devices is the USB cable.
> > > > 
> > > > The weakest link of any USB device is the cable, why is this somehow
> > > > special to usbnet devices?
> > > > 
> > > > > Currently there is
> > > > > no way to automatically detect cable related issues except of analyzing
> > > > > kernel log, which would differ depending on the USB host controller.
> > > > > 
> > > > > The Ethernet packet counter could potentially show evidence of some USB
> > > > > related issues, but can be Ethernet related problem as well.
> > > > > 
> > > > > To provide generic way to detect USB issues or HW issues on different
> > > > > levels we need to make use of devlink.
> > > > 
> > > > Please make this generic to all USB devices, usbnet is not special here
> > > > at all.
> > > 
> > > Ok. I'll need some help. What is the best place to attach devlink
> > > registration in the USB subsystem and the places to attach health
> > > reporters?
> > 
> > You tell us, you are the one that thinks this needs to be reported to
> > userspace. What is only being reported in kernel logs that userspace
> > somehow needs to see?  And what will userspace do with that information?
> 
> The user space should get an event in case there is a problem with the
> USB transfers, i.e. the URB status is != 0.

That's pretty brave, lots of things can have a urb status of != 0 in
semi-normal operation, have you tried this?

> The use space then can decide if the USB device needs to be reset, power
> cycled and so on.
> 
> What about calling a to-be-written devlink function that reports the USB
> status if the URB status is not 0:
> 
> diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
> index d0f45600b669..a90134854f32 100644
> --- a/drivers/usb/core/hcd.c
> +++ b/drivers/usb/core/hcd.c
> @@ -1648,6 +1648,8 @@ static void __usb_hcd_giveback_urb(struct urb *urb)
>  	usb_unanchor_urb(urb);
>  	if (likely(status == 0))
>  		usb_led_activity(USB_LED_EVENT_HOST);
> +	else
> +		devlink_report_usb_status(urb, status);

Try it and do lots of transfers, device additions and removals and other
things and let us know what it reports.

thanks,

greg k-h

  reply	other threads:[~2022-01-28 11:23 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-27 11:07 [PATCH net-next v1 1/1] usbnet: add devlink support Oleksij Rempel
2022-01-27 11:13 ` Greg KH
2022-01-27 12:31   ` Oleksij Rempel
2022-01-27 13:22     ` Greg KH
2022-01-28 11:12       ` Oleksij Rempel
2022-01-28 11:23         ` Greg KH [this message]
2022-01-28 11:31           ` Oleksij Rempel
2022-02-02  9:14         ` Oliver Neukum
2022-01-27 17:00   ` Alan Stern
2022-01-28 11:27     ` Oleksij Rempel
2022-01-28 15:33       ` Alan Stern
2022-01-27 11:18 ` Greg KH
2022-01-27 11:19 ` Greg KH
2022-01-27 15:43 ` Andrew Lunn
2022-01-27 16:56   ` Jakub Kicinski
2022-01-27 19:59 ` kernel test robot
2022-01-27 19:59   ` kernel test robot

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=YfPSNSHwTLZBv7me@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=davem@davemloft.net \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=oneukum@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.