Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1281389rwo; Wed, 2 Aug 2023 11:22:16 -0700 (PDT) X-Google-Smtp-Source: APBJJlGkLKtd09A9ymDIDppcQ4efgWRsgPnnPQOw4zuNWRKv/ppW9XxuBGQyK9JAdHr/Ib/U76TR X-Received: by 2002:a05:6a20:3ca3:b0:13d:ea25:9656 with SMTP id b35-20020a056a203ca300b0013dea259656mr9971110pzj.60.1691000535897; Wed, 02 Aug 2023 11:22:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691000535; cv=none; d=google.com; s=arc-20160816; b=Ez6GNDO498h2hphOij9Sd5ov8L8MQoC48lxr7xu2RqvnC4k/mV+QmDc0GDJxCf6bsP ApHDYum5bq7d80H3P4cn5qRKJw5XAJmA0nLzkm2sFLDHxmiESbYYEB5RowC8tjVUmcrI M5IAVqdKyRSab7lcG6OXOMEKg0jkTWWh//wbk/RWMkeAsDQ0tSm/AdhRUoWvfV9NAqUa sZ21sEV0KUwbIt5Ot4BYId7TX4/yEUC28nRz3V7iMgBbPE+kUf1wenONKKbIp8yeRm5e 3DGHUUJ2+SbxfJDWWlYwVipyd0/dt+ZhElt7SgOZf8gEpxqz6G9NN2CFFUHC1mCY3OEI pMdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:msip_labels:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=vXYtGyeDyghHLi1405pB5TkTgoWtkAh/lozF79fdnVU=; fh=hR2oLAT48I8Oqx6JkA3+mZzOKEYZAA6W+qI1sFj/uwc=; b=EcaEMMl4FiwSkgks8p1VP3ka84IPXM7QEvTEal58NCcrD0dHSRK+C4OVyFXVNXrP+p sznHO7h8OLCeA3BMtT/93lHEfxpArcEHpuD6X0+JK/uC6cFX4+rfVAhUt+kKrZg5G1Oz XJ0kez2cmh6lG3yCIzR215HXuf3iVPqOSJtAXmh0PUDBmeugJNPyZIo92vHbiJX5iKoJ XmxcQ4nbAnlCc6mcXfycw9j0kPKs7JV/UtjCi9n7RDgKbBQOT3B9H/VsydhBvo5GfWvC MRBomk17UCURt9WjqqvAeyb9xuFqrDBHSiac2gA7THFeIqVX/T+auHOHVg7Q+WPL+VMl vRTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hp.com header.s=mimecast20180716 header.b=iLmKC0Yn; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=hp.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fa9-20020a056a002d0900b006870c1ea846si9691939pfb.281.2023.08.02.11.22.02; Wed, 02 Aug 2023 11:22:15 -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; dkim=pass header.i=@hp.com header.s=mimecast20180716 header.b=iLmKC0Yn; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=hp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234595AbjHBO5l (ORCPT + 99 others); Wed, 2 Aug 2023 10:57:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233961AbjHBO5i (ORCPT ); Wed, 2 Aug 2023 10:57:38 -0400 Received: from us-smtp-delivery-162.mimecast.com (us-smtp-delivery-162.mimecast.com [170.10.133.162]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 024EE134 for ; Wed, 2 Aug 2023 07:56:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hp.com; s=mimecast20180716; t=1690988208; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vXYtGyeDyghHLi1405pB5TkTgoWtkAh/lozF79fdnVU=; b=iLmKC0Yn7UP0o1va3FBi+74PBfJwuad8hObo2VGjst6kl3wKaX5cihAdth5VVlHpfE+W/U ffb9ZM9lqoxc2OX9u0zSY9TMV+2ZxhL7Qe0MIdqM0jkaBDKeV+oIXzh8Lgq/XL0GjsUXGb cP2+GBgpO9CFiXhYTDzaXAXbuVXemfA= Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-108-FrEmypWNP5yVjTm8YGTyvA-1; Wed, 02 Aug 2023 10:56:47 -0400 X-MC-Unique: FrEmypWNP5yVjTm8YGTyvA-1 Received: from SJ0PR84MB2088.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:a03:437::8) by DM3PR84MB3468.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:0:44::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.45; Wed, 2 Aug 2023 14:56:43 +0000 Received: from SJ0PR84MB2088.NAMPRD84.PROD.OUTLOOK.COM ([fe80::8cd0:b5a5:f173:60f7]) by SJ0PR84MB2088.NAMPRD84.PROD.OUTLOOK.COM ([fe80::8cd0:b5a5:f173:60f7%6]) with mapi id 15.20.6609.032; Wed, 2 Aug 2023 14:56:43 +0000 From: "Gagniuc, Alexandru" To: Alan Stern CC: "linux-usb@vger.kernel.org" , "netdev@vger.kernel.org" , "davem@davemloft.net" , "edumazet@google.com" , "kuba@kernel.org" , "pabeni@redhat.com" , "hayeswang@realtek.com" , "jflf_kernel@gmx.com" , "bjorn@mork.no" , "svenva@chromium.org" , "linux-kernel@vger.kernel.org" , "Zhang, Eniac" , "stable@vger.kernel.org" Subject: Re: [PATCH v2] r8152: Suspend USB device before shutdown when WoL is enabled Thread-Topic: [PATCH v2] r8152: Suspend USB device before shutdown when WoL is enabled Thread-Index: AQHZumfGWALIKL1Qf0uRlSRmGE3IR6/BawiAgBXCwgU= Date: Wed, 2 Aug 2023 14:56:43 +0000 Message-ID: References: <2c12d7a0-3edb-48b3-abf7-135e1a8838ca@rowland.harvard.edu> <20230719173756.380829-1-alexandru.gagniuc@hp.com> <3c4fd3d8-2b0b-492e-aacc-afafcea98417@rowland.harvard.edu> In-Reply-To: <3c4fd3d8-2b0b-492e-aacc-afafcea98417@rowland.harvard.edu> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SJ0PR84MB2088:EE_|DM3PR84MB3468:EE_ x-ms-office365-filtering-correlation-id: 467dabf2-1995-4d99-c33f-08db9368afac x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0 x-microsoft-antispam-message-info: sE4Qy+wvZmfFfAl4+TAiBGIYfqoJkRaXcOEKjOv+n5n4/9c6SynMSIqEL/ZI7jqvIvUA2APAJloXj9ySLUZUgQiniZkR3EF8USrkT+wQgHE88WM1AWSQ3py8K20zS7pMr3+WL2Hr61I7Sln/3M/m872nmESIbVgzqQkQQT+2q1POkZk8Jpc44DRSE7pZO5DbAwbzsZEoCZzqDd3yY8YGeQt5RBOHWPdG3q9xGGyMTmyFzNOomjyAePmiGmZIrteW9kf9i011RzshK+H0i/dV4dHFXbBVX/aJNZapz8+mpKjDCeLAtoQ47GGj5I3z/SAoB9pH9TvjcwGBas1FRykhewmf90WFiyq9/gcNOqfblxltRezDfZbJq+k3Ym/V/ImxK2zHV4yY5YAKPMX1w15WDErNeuxLBALwAQGCeZYe1nuiHwUY6XC41BCXU3awjBmjfggiiNBdTjv3e4kn2cVgW+13M9nSE3ibhgqRfSJ1W8JAutR9D+rEo7kT3v6Jcsj+/+KTvzLW6Yy0F2xdDHtpk9/31GaUyWKCe7T/swY7WwXOaYGmBHfjqhVVzJx+pKIQ30UUd0LI/psMurY2ZfW1UvUN0zILge0aZ1R/J5Bgvy43JFoCX5m3YrHZ+Qs03YV7 x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR84MB2088.NAMPRD84.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(39860400002)(366004)(136003)(396003)(376002)(451199021)(7416002)(5660300002)(41300700001)(15650500001)(83380400001)(122000001)(82960400001)(38100700002)(316002)(186003)(8676002)(8936002)(6506007)(26005)(38070700005)(4326008)(6916009)(86362001)(66946007)(66476007)(66446008)(64756008)(66556008)(52536014)(76116006)(2906002)(9686003)(91956017)(7696005)(71200400001)(33656002)(478600001)(54906003)(55016003);DIR:OUT;SFP:1102 x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?JQWqMX+VfP/zqeBz9FOeDVXpMjCKzejeD3P2w6LeYEobnwTzDY45S+m6fc?= =?iso-8859-1?Q?Cmu+42s/9jwDegw2+/UdHIwgMA7SftXTuQv2YezEgKQm/aa0OYXwb6Hs+A?= =?iso-8859-1?Q?nkY3G8R0KdTLx+5VArApd/9+FWN0aDEUCYF2/P+33/epExb5CoBbNUbuFI?= =?iso-8859-1?Q?p9nvyDGHMCj40F6CwBQyd5OgZghiQ+r4eBmI0Mh8rGDsy4OJ+pHngcBBsH?= =?iso-8859-1?Q?81+YkV6dGtaXRWeYFcVyjkLnoU9rDtPz1oBNH79/0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4VibYmIgUcmSeADU6yrjTgox7xjPWGfDwHnhRWRCME/YMd?= =?iso-8859-1?Q?koJ450fKIf0cj+XFh8Ea6VNGu0SRvg94cz74KLqsjPERjMQtChgsF4vzpj?= =?iso-8859-1?Q?PxnNHh1oQV4pT7Os5ssRDJ/N30DlM9hDjT7yv+4ReZXs54ih6XcSaq1Tyw?= =?iso-8859-1?Q?CWYnXob1kljAcd5VEbhXlcVzAyb5IMKVEiMKGSOEZxXuEfa/gGe9IuBvDN?= =?iso-8859-1?Q?412vjghjUtukHTUF/CpIi7PJp5xLz8K/4oHVI3L/KGHASpPmR3v2B6jVMF?= =?iso-8859-1?Q?Zl4HL7q4Mqv9nmcws/j4Tul24GDn3Bq/sVD+j/hnYRT9iPb4MFi7hX/ihL?= =?iso-8859-1?Q?yScFt7iX+aMzZDfuDUOr8QnsuPHGFGkwSga32ECF8J+3oo5K4jGcEjbtJf?= =?iso-8859-1?Q?kwAejJ2nLS8vEyn0csmX124f4efFEgRgrZNvxMEvMFINdLY03j/4ym8P9k?= =?iso-8859-1?Q?k3+OMiKEiMF3oQzXiyAaeUvfylhhKMwg+S?= MIME-Version: 1.0 X-OriginatorOrg: hp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SJ0PR84MB2088.NAMPRD84.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 467dabf2-1995-4d99-c33f-08db9368afac X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Aug 2023 14:56:43.6237 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: ca7981a2-785a-463d-b82a-3db87dfc3ce6 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: f4v2qF4lTAx+16/qTPifYz4ZjfvO5rclUf3ZaM7PjGgpnAsOId6HHrCK20olFdS5W6EhDMlWdY20l/Bi7kRNra7/B972SGecnYCrumhcPVQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR84MB3468 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: hp.com Content-Language: en-US Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, PDS_BAD_THREAD_QP_64,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Wed, Jul 19, 2023 at 02:36:25PM -0400, Alan Stern wrote:=0A> On Wed, Jul= 19, 2023 at 05:37:56PM +0000, Alexandru Gagniuc wrote:=0A> > For Wake-on-L= AN to work from S5 (shutdown), the USB link must be put=0A> > in U3 state. = If it is not, and the host "disappears", the chip will=0A> > no longer resp= ond to WoL triggers.=0A> >=20=0A> > To resolve this, add a notifier block a= nd register it as a reboot=0A> > notifier. When WoL is enabled, work throug= h the usb_device struct to=0A> > get to the suspend function. Calling this = function puts the link in=0A> > the correct state for WoL to function.=0A>= =20=0A> How do you know that the link will _remain_ in the correct state?= =0A=0AThe objective is to get to xhci_set_link_state() with the USB_SS_PORT= _LS_U3=0Aargument. This is achieved through usb_port_suspend() in drivers/u= sb/host/hub.c,=0Aand the function is implemented in drivers/usb/host/xhci-h= ub.c.=0A=0AThis is the only path in the kernel that I am aware of for setti= ng the U3 link=0Astate. Given that it is part of the USB subsystem, I am fa= irly confident it will=0Ashow consistent behavior across platforms.=0A=20= =0A> That is, how do you know that the shutdown processing for the USB host= =20=0A> controller won't disable the link entirely, thereby preventing WoL = from=20=0A> working?=0A=0AWe are talking to the USB hub in order to set the= link state. I don't see how=0Aspecifics of the host controller would influ= ence behavior. I do expect a=0Acontroller which advertises S4/S5 in /proc/a= cpi/wakeup to not do anything that=0Awould sabotage this capability. Disabl= ing the link entirely would probalby=0Aviolate that promise.=0A=0AThink of = USB-C docks with a power button showing up as a HID class. The scenario=0Ah= erein would disable the power button. I would take that to be a bug in the = host=0Acontroller driver if the S4/S5 capability is advertised.=0A=0AAlex= =0A=0AP.S. I sincerely apologize for the delay in my reply. The corporate e= mail servers here=0Ahave "difficulties" with plaintext and interleaved rep= lies.=0A