Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4806849pxk; Wed, 30 Sep 2020 12:10:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwE5HQrHHRZJts+IZyWRq2eNftkt9Tosh/eqdGQ8vsmyVRo4Q9Ysz5QUHa7HqKttixGHK8B X-Received: by 2002:a17:907:444f:: with SMTP id on23mr4276119ejb.392.1601493042119; Wed, 30 Sep 2020 12:10:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601493042; cv=none; d=google.com; s=arc-20160816; b=ypTGXtaqmXaV2pMOUWBScMixWXyKZPMHUl6VRWojGh/p91g1rRPKKtqDR5BZVHrXpr njzJLhVwg0hNiPULjIOS24TZCaRuyFtMkGXYKoHiEb1jTIPDOcyu8IASo8rYozxok9QQ FQt5+ZTn363kX36nyVDdkFF4v8GakMirpZ1LwGqkipGrrUMXJQJrUS6hwICmEUoYZLeh mRMypMzro1C5VzrQhbuBA1rtDOp0YLPKLwCAAeNgL+kE7ZwJUkH8x5IJdxlDuhuIIFzC wjr7esqwzaummEcRvQQ4n3+bNpc4+Xbmd6J/oDgWyYWz6j2R2F57B66SNpsJ/U8bA8ct anng== 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=ZXCSKRDazYo4+hefFWJ2LhdcSMwnKF/HHzSsRCyiS0g=; b=lxXgvD+R+qieZCMJ6XceAI7yu7poBwL48S5ltPpnLH+XBIrzuiOCroj6REaS4LWW1b JX2bMqixjFGRenu0Lw9jnagJB/5BjneVzM1TRIhSJ9LMo8jIim/73IBG3xYn66ItxBdZ IsnLEuRKGwSQN4pfR1qlCdVsxmqSt9+qnLdlIBGYyIbc6Wp8/t3hEq2c/OrJhFQOvBph 5WtxQjuGKD+WLCDPhyhFiJPk0SbqkrEgiVFJHtEB8wSZSh9IwBMYufFr4B23Ro5+KB7E EWB5U6YyyyEY9eyD5Mb/384QZHOE41R0HlfDajdxNM5CRhqt/cccOFQhkjQ3+2ZQ5/pt AcGQ== 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 w13si1928755ejc.261.2020.09.30.12.10.18; Wed, 30 Sep 2020 12:10:42 -0700 (PDT) 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 S1729674AbgI3TJT (ORCPT + 99 others); Wed, 30 Sep 2020 15:09:19 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:36652 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725771AbgI3TJS (ORCPT ); Wed, 30 Sep 2020 15:09:18 -0400 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1kNhTT-00Gwmn-K4; Wed, 30 Sep 2020 21:09:11 +0200 Date: Wed, 30 Sep 2020 21:09:11 +0200 From: Andrew Lunn To: Jisheng Zhang Cc: Heiner Kallweit , Russell King , "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC] net: phy: add shutdown hook to struct phy_driver Message-ID: <20200930190911.GU3996795@lunn.ch> References: <20200930174419.345cc9b4@xhacker.debian> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200930174419.345cc9b4@xhacker.debian> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 30, 2020 at 05:47:43PM +0800, Jisheng Zhang wrote: > Hi, > > A GE phy supports pad isolation which can save power in WOL mode. But once the > isolation is enabled, the MAC can't send/receive pkts to/from the phy because > the phy is "isolated". To make the PHY work normally, I need to move the > enabling isolation to suspend hook, so far so good. But the isolation isn't > enabled in system shutdown case, to support this, I want to add shutdown hook > to net phy_driver, then also enable the isolation in the shutdown hook. Is > there any elegant solution? > Or we can break the assumption: ethernet can still send/receive pkts after > enabling WoL, no? That is not an easy assumption to break. The MAC might be doing WOL, so it needs to be able to receive packets. What you might be able to assume is, if this PHY device has had WOL enabled, it can assume the MAC does not need to send/receive after suspend. The problem is, phy_suspend() will not call into the driver is WOL is enabled, so you have no idea when you can isolate the MAC from the PHY. So adding a shutdown in mdio_driver_register() seems reasonable. But you need to watch out for ordering. Is the MDIO bus driver still running? Andrew