From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752448AbdK1OKP (ORCPT ); Tue, 28 Nov 2017 09:10:15 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:33710 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751402AbdK1OKN (ORCPT ); Tue, 28 Nov 2017 09:10:13 -0500 Date: Tue, 28 Nov 2017 15:10:01 +0100 From: Antoine Tenart To: Andrew Lunn Cc: Antoine Tenart , rmk@armlinux.org.uk, f.fainelli@gmail.com, davem@davemloft.net, Yan Markman , gregory.clement@free-electrons.com, thomas.petazzoni@free-electrons.com, miquel.raynal@free-electrons.com, nadavh@marvell.com, mw@semihalf.com, stefanc@marvell.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net] net: phylink: fix link state on phy-connect Message-ID: <20171128141001.GA4127@kwain> References: <20171128132932.27196-1-antoine.tenart@free-electrons.com> <20171128135610.GD20797@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20171128135610.GD20797@lunn.ch> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andrew, On Tue, Nov 28, 2017 at 02:56:10PM +0100, Andrew Lunn wrote: > > + /* On _disconnect, the phy state machine and phylink resolve > > + * are stopped before executing full gracefull down/reset state. > > + * The further _connect starts with incorrect init state. Let's set > > + * init values here. > > + */ > > + pl->phy_state.link = false; > > + pl->link_config.pause = MLO_PAUSE_AN; > > + pl->link_config.speed = SPEED_UNKNOWN; > > + pl->link_config.duplex = DUPLEX_UNKNOWN; > > Looks sensible. My only comment would be, maybe it makes sense to > reduce the duplication by adding a little helper which is called here, > and in phylink_create()? Yes, it could be better to have a little helper to reset the link config and state values and avoid duplication. I'll wait for more comments before sending a v2 though. Maybe Russell will have good suggestions to do this the good way. Thanks! Antoine -- Antoine Ténart, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com