From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BBA08C3F2CD for ; Sat, 29 Feb 2020 15:42:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7DFC224699 for ; Sat, 29 Feb 2020 15:42:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="fmhVz6uX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727143AbgB2PmW (ORCPT ); Sat, 29 Feb 2020 10:42:22 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:39784 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727070AbgB2PmW (ORCPT ); Sat, 29 Feb 2020 10:42:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=iZuw/pvRa7xameAMNnCGHbBoA0L0pl49ZDm5F8xaDjo=; b=fmhVz6uXY8xH99U9QwoBuOyPSG aOzmNe7uqF4suFclvezByPARh7B0XmKu4GPbn1pH06kWV1JIN4ffo1H6wWP4iptFJ+WERqjkk470K IFhphvsgZekx8JUPcc1ugL/D+tP4uNu60NfDFl93DRYn5SZrvZaF+Se0skUB5pelJ12c=; Received: from andrew by vps0.lunn.ch with local (Exim 4.93) (envelope-from ) id 1j84Fr-0001nx-CT; Sat, 29 Feb 2020 16:42:15 +0100 Date: Sat, 29 Feb 2020 16:42:15 +0100 From: Andrew Lunn To: Russell King Cc: Florian Fainelli , Vivien Didelot , "David S. Miller" , Jakub Kicinski , Ioana Ciornei , Vladimir Oltean , netdev@vger.kernel.org Subject: Re: [PATCH net] net: dsa: fix phylink_start()/phylink_stop() calls Message-ID: <20200229154215.GD6305@lunn.ch> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org > -int dsa_port_enable(struct dsa_port *dp, struct phy_device *phy) > +int dsa_port_enable_locked(struct dsa_port *dp, struct phy_device *phy) > { > struct dsa_switch *ds = dp->ds; > int port = dp->index; > int err; > > + if (dp->pl) > + phylink_start(dp->pl); > + > if (ds->ops->port_enable) { > err = ds->ops->port_enable(ds, port, phy); > if (err) > @@ -81,7 +84,18 @@ int dsa_port_enable(struct dsa_port *dp, struct phy_device *phy) > return 0; > } Hi Russell I'm wondering about the order here. You are starting phylink before the port is actually enabled in the hardware. Could phylink_start() result in synchronous calls into the MAC to configure the port? If the port is disabled, maybe that configuration will not stick? The current code in dsa_slave_open() first enables the port, then calls phylink_start(). So maybe we should keep the ordering the same? > +void dsa_port_disable_locked(struct dsa_port *dp) > { > struct dsa_switch *ds = dp->ds; > int port = dp->index; > @@ -91,6 +105,16 @@ void dsa_port_disable(struct dsa_port *dp) > > if (ds->ops->port_disable) > ds->ops->port_disable(ds, port); > + > + if (dp->pl) > + phylink_stop(dp->pl); > +} The current code first stops phylink, then disables the port... Apart from this ordering issue, the code looks good. Thanks Andrew