Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2632256pxb; Mon, 31 Jan 2022 00:15:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJyNu50bcxISQtFoB6fJ8DwfZyII7kyQ1RCsytSBCMkQL6fUm70QPwMLKmpSvx7sjzmr2IEq X-Received: by 2002:a17:907:3f17:: with SMTP id hq23mr15959627ejc.544.1643616905357; Mon, 31 Jan 2022 00:15:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643616905; cv=none; d=google.com; s=arc-20160816; b=C4I5Jbh8JvNUvx8fUG/UickwAopyph2Z1Xh44qAcm5eX2HWqgiM6jI4QPs1UPE63xH eKQ9VT32iDIHXPP1v0eZagoqm88r/fc0omP8EhxMOSP4e3hzxQ5/LxYNuzCdc4Is83uQ dMA5/igSyrFrIdTX4UQZr+uWohSod8OqvN3pXAl+rKPun9KrfeE5Am8v6iU1fNoDncQE EplXcjkBsLptlWrLQPuTWtYxWer96zi6oUoaRd8suOdvrUI9XJo5VuK0ZaIdcnBuckTs ADaVXRaAf0rWQoAr51HMdZ+GvHfpONpFlEnPW7hfkV9KJ0263cZDI1vd3Y8FuvB0K4Se TVxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=UIY/jU1VkeBFZIOSfNWAH6MnlrWnIplKHvRWpFHggiI=; b=vi9Q0b84NonIXkmYCPqerxPtDOYZswqA22ou69EDzU2Zqq1EGEArXyqn/CMbIgt5Dl rhL2HpWS5LZRlwqOd9y64jEOHnVqoqHJX3H2F7wvgTE7VNEk2mxG4FQxzcTWncZdUmNl N+fJ8TyIplFgnV0FIUiE3VYrGvFvWRj9t4w+2lC8u/ZUGSzduFlL1Ik2PTy5ZYLL5Ke4 wqoWYzbNU6kF12fItJtfCFpvugcm9XiCFLKEQ6vWM+eXyVAO5UFUT8ny/QYCkKD2ayEn HmmaPriT3voLUybrQoF1Y0BNdQLc4BJQh5RzKuB815EXFG0XeLMd8uaneteVFe+exBs5 zjHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lfWbvoHu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m11si7423665ejn.604.2022.01.31.00.14.41; Mon, 31 Jan 2022 00:15:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lfWbvoHu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231139AbiA1LXk (ORCPT + 99 others); Fri, 28 Jan 2022 06:23:40 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:35418 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230042AbiA1LXj (ORCPT ); Fri, 28 Jan 2022 06:23:39 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A8A6DB8253F; Fri, 28 Jan 2022 11:23:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D57C4C340E0; Fri, 28 Jan 2022 11:23:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643369016; bh=mChaVS62VRMHxG9WuKRILek2xzuVDIFdda4zjzrKGug=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lfWbvoHuVgVw8qF5T7BF7/vfDR862M47wwOioeKxyj0dNh+oKPkWjZi103G8axr4N E0oMhWORR0EynMfo+F4e3sQHT6qdO37gLlFT3DcI9NAKVIXnDlgHlH/rEI6uxPkdca hAwpASLOJ8ujfLF4xzzbsH2KSNYC+I9EyK4rl9DE= Date: Fri, 28 Jan 2022 12:23:33 +0100 From: Greg KH To: Oleksij Rempel Cc: Oliver Neukum , netdev@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Jakub Kicinski , "David S. Miller" Subject: Re: [PATCH net-next v1 1/1] usbnet: add devlink support Message-ID: References: <20220127110742.922752-1-o.rempel@pengutronix.de> <20220127123152.GF9150@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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