Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp32676713rwd; Fri, 7 Jul 2023 19:16:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlFa5/mDktv1JRNhJXBa+ucywA4U6oEvk2c5XZzcOgu8ciUVOMZHbrFu8ib3gLJLijNAXvuD X-Received: by 2002:a05:620a:294a:b0:767:2b4e:213 with SMTP id n10-20020a05620a294a00b007672b4e0213mr8443989qkp.21.1688782583256; Fri, 07 Jul 2023 19:16:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688782583; cv=none; d=google.com; s=arc-20160816; b=V6W4Pa1guPtP+PE1YOZLnAg0lDRgcbplvDIV0Id8XWEKvvT3EW1OnOEmosogE3bzE1 UW7j4Pd284awxlK+3zsLOyTpGPURd2WeCsRGxpLULVTjrQRhsedbSPBr5UKr6eWAEELu 5oDHSPIsHIwI6+j+uoNI28vMgrJ7qx3WAx9uFcDxkIgX1mqlvYGvSxl3RpsKip9syc2s V1y1UOnwrY2pJSqc/KCkSBzxYz8GY7cd7Ch1qWlSXF6M1tIYzJqxR33YBRJWud5nmsf8 ZCz46ZlzVbeRcAZ112rMCGx3jRIxq0GQ4tvjOFYLR2XRvVvoPoUbqy9pgoz3cRv+3w+t OPrw== 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=grMPzgmRor2eYQMHrur6MQ/PbcPnWwDwUMo5r+HTLsU=; fh=CvRkhzvk/QH74xCBVPz0D39rCsLLTZDrUYnWg+EV2Jg=; b=uEnwG1HyJo/cDQn5QP+ASN7le8DM9JFgyDtOkIoBTqWvMEugOhP/t8B0MUdFs87mdw Fcz867FQMRQfH/3lsFE2kLvCbHYuNbCQgrauPA93vBuR4oCgES+3xIPnCUbF2lvBQiNu 7oUzfd7wsTJYE9Qaa0MegsCxmHK7v18hgKpqbr7OYhCyiD2vf51JF6/YP/KgbRhhABdA PYLcbRvATsi47P4N/tXVbcYrpB5a46a8ZH9INhD7qx/DtzOa0Y0HouZErp8VtLnEGHMp Z+l0WeRBZx704ez+idQQYj2MrabcfgUJYa/bGtuPFeexxmv3BKybR3DWOpwyrsrt1FQt nFhw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j1-20020a634a41000000b0054fdfd26dffsi5134326pgl.337.2023.07.07.19.16.11; Fri, 07 Jul 2023 19:16:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232134AbjGHBvc (ORCPT + 99 others); Fri, 7 Jul 2023 21:51:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229515AbjGHBvb (ORCPT ); Fri, 7 Jul 2023 21:51:31 -0400 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 71F952105 for ; Fri, 7 Jul 2023 18:51:28 -0700 (PDT) Received: (qmail 1232616 invoked by uid 1000); 7 Jul 2023 21:51:27 -0400 Date: Fri, 7 Jul 2023 21:51:27 -0400 From: Alan Stern To: Jakub Kicinski Cc: Alexandru Gagniuc , linux-usb@vger.kernel.org, netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, hayeswang@realtek.com, jflf_kernel@gmx.com, bjorn@mork.no, svenva@chromium.org, linux-kernel@vger.kernel.org, eniac-xw.zhang@hp.com, stable@vger.kernel.org Subject: Re: [PATCH] r8152: Suspend USB device before shutdown when WoL is enabled Message-ID: <2c12d7a0-3edb-48b3-abf7-135e1a8838ca@rowland.harvard.edu> References: <20230706182858.761311-1-alexandru.gagniuc@hp.com> <20230707171225.3cb6e354@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230707171225.3cb6e354@kernel.org> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 07, 2023 at 05:12:25PM -0700, Jakub Kicinski wrote: > On Thu, 6 Jul 2023 18:28:58 +0000 Alexandru Gagniuc wrote: > > For Wake-on-LAN to work from S5 (shutdown), the USB link must be put > > in U3 state. If it is not, and the host "disappears", the chip will > > no longer respond to WoL triggers. > > > > To resolve this, add a notifier block and register it as a reboot > > notifier. When WoL is enabled, work through the usb_device struct to > > get to the suspend function. Calling this function puts the link in > > the correct state for WoL to function. > > Would be good to hear from USB experts on this one, to an outside seems > like something that the bus should be doing, possibly based on some > driver opt-in.. The USB spec does not include any discussion of what things should be done when the system is turned off -- it doesn't even really acknowledge the existence of different system-wide power states. As a result, the USB subsystem never developed any support for power-off callbacks or anything else of the sort. Of course, this kind of thing can always be added. But I don't think there's any way to distinguish (at the USB level) between wakeup from S5-off and wakeup from any other low-power system state. And the PM part of the device model doesn't have multiple types of "enable-wakeup" flags -- either a device is enabled for wakeup or it isn't. Alan Stern