Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2646031pxb; Mon, 31 Jan 2022 00:45:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJwCxpNDPccgJxyiC2C3Ozb4ohC8E2B6hHZInhRFGm0pJycBYZY8SvpE8lFnohCAAMEO5MSg X-Received: by 2002:a17:907:7f8f:: with SMTP id qk15mr11456110ejc.287.1643618708575; Mon, 31 Jan 2022 00:45:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643618708; cv=none; d=google.com; s=arc-20160816; b=LtCj32ptw/niBSggS3HxU0Uc2aG4UllbB8dNHZEedW2jKI7yZQeg9x2ajvpQi9PyrP KR2aXWTR0h9hACz1nbHrj8P5vKaSAQZ66BNET109+V6+SCsUIWhrHUpgvoHVkApjx/Mt mN6n4Z+HpUCCFgPDG8ZNTY0cO+u3ZVt7WWWbMywC0ngH5aFJcUEvdt6ZMxK9z/pQ13Nu igonkiYrkvYWHGuHA0OiFZCdsMA5WsA9RUIvpb4rNE9YT84MZGYxC5MV7uLpX63Zqyga kcFGcSAHj/w6GPKXjDPCXhQCFJVlv3WRmN+7/2JQHn9IO19GFbMCwN18vCZCY/uWcSgY Pojw== 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; bh=fOJQI/w0ckUJFxabFOKrVCMef2EFXRbfC8JZPtB3kaQ=; b=wszBklZZgz8Xqth8SXipzYeMMQst6U59odfRIM7X86YSJcwj/SVpFOulI1fbkJQ6v9 xVB5xSwcRaIA5E9hqvZLwb126eI0dBtQw2KVken7znUkPZcRxV9MA0ixEJHXLfUAdgcp s3ojNjyFe6QEOEbk5sjUKscEe7mbq3z0cbvVa1QYnEz8mH5EQztXNFZzYquhhJwIhO0U pNxuIB33K3232mQFWGgn0WD9g0Uq0/emUlpqzSlQKHI5gTavzJ8NTZ63VYyo7TQFzF+j U9a8B9m/y+Dy0gGzqlgU7jpH/rkReonDhB5sK4KQHoRS9jbp5RXqa3rUzujjrBXgvT7+ WpIA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s20si7253703edy.515.2022.01.31.00.44.43; Mon, 31 Jan 2022 00:45:08 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235867AbiA1LbO (ORCPT + 99 others); Fri, 28 Jan 2022 06:31:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235774AbiA1LbN (ORCPT ); Fri, 28 Jan 2022 06:31:13 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AC68C061714 for ; Fri, 28 Jan 2022 03:31:13 -0800 (PST) Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nDPTB-0003hG-H3; Fri, 28 Jan 2022 12:31:09 +0100 Received: from ore by dude.hi.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1nDPTA-00Cldy-Hw; Fri, 28 Jan 2022 12:31:08 +0100 Date: Fri, 28 Jan 2022 12:31:08 +0100 From: Oleksij Rempel To: Greg KH Cc: linux-usb@vger.kernel.org, netdev@vger.kernel.org, Oliver Neukum , 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=utf-8 Content-Disposition: inline In-Reply-To: X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 12:28:20 up 92 days, 17:55, 123 users, load average: 2.68, 5.84, 7.25 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 28, 2022 at 12:23:33PM +0100, Greg KH wrote: > 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. Ok :) I'll need make some other tasks next week, will respond ASAP as i'll continue on this task. Regards, Oleksij -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |