Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1412229pxb; Fri, 22 Jan 2021 15:28:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJzxn4+POfOMT1q4h84NugMloQCCn3xm6Gej12hIyILid4hO8J7w/2mGzwJXjULq37J/JBwt X-Received: by 2002:a05:6402:1398:: with SMTP id b24mr185105edv.108.1611358088759; Fri, 22 Jan 2021 15:28:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611358088; cv=none; d=google.com; s=arc-20160816; b=WA2NjbcF/0CyuxKfJRSr2ROLyPeyk7rAi/zEYSqiMYdhmpbqOS+aG43uGzzCbU4TGc zkoHPFfW9/m4MZV35WB4lsr+1BDhqZojzloTAsLU6yLcA14Aoc9lVCr89y8gU5+BHwag QYQYsD7r8e5DdPrASzfmI/tHv8voUghLn0ZTpdtGnPjPX4GR56otgq8X5lGZzLjuhxGj WFWqoNyMk3maK9/bCCgH8/sB1l6qQUuood40/WfKxEQtslIQmoYTu87Y06Pg2Z84wboL +B8BsxYL7jgQNAV4kBm0HP47WiMyoxPoL7LhSYAlQoYxP/xk8yjkCiwiWxa/KXENZhjF /+YA== 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=8dbIU+VgTOUuzXw9A0rVrThP97JLYp/759nsqv/527E=; b=oCXkdy5IO/Oq4cZ2mlR8R+2DhnmN5Xj69SX19rJI7PoWgCZnOMY8aO3YgskMZq5ND1 2V49EeqgrW8uIiVI75l1JlIshGGi+rur2R9sGKRrk04W33/gU+oOvi7/PAMkA8zym7DE xyX34dfcvXPX+jng4+SFJ3qqMkcO8W2W5aQLL49LzLDihtaUZ9v3/KByv4cCW9/n8snD 8GKSx2ohPLqn1OuGycOZTGedK7rhiYOcKarh1EeJXBwep1dKvQpw+7XG16xi9StedjUw JH66M8qTbQ4P67O0mt3ARLFh8fDwEG60ohC+oeuNnzTC1UqjREoSg2lMtI6rvwoWVBUe eE3w== 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 c1si2162184eds.18.2021.01.22.15.27.45; Fri, 22 Jan 2021 15:28:08 -0800 (PST) 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 S1728163AbhAVXYY (ORCPT + 99 others); Fri, 22 Jan 2021 18:24:24 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:55426 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728151AbhAVXYP (ORCPT ); Fri, 22 Jan 2021 18:24:15 -0500 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1l35m1-002A7o-C0; Sat, 23 Jan 2021 00:23:25 +0100 Date: Sat, 23 Jan 2021 00:23:25 +0100 From: Andrew Lunn To: Sergej Bauer Cc: netdev@vger.kernel.org, f.fainelli@gmail.com, "David S. Miller" , Jakub Kicinski , Bryan Whitehead , UNGLinuxDriver@microchip.com, Simon Horman , Mark Einon , Madalin Bucur , Arnd Bergmann , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] lan743x: add virtual PHY for PHY-less devices Message-ID: References: <20210122214247.6536-1-sbauer@blackbox.su> <21783568.4JFRnjC3Rk@metabook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <21783568.4JFRnjC3Rk@metabook> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > > @@ -1000,8 +1005,10 @@ static void lan743x_phy_close(struct > > > lan743x_adapter *adapter)> > > > struct net_device *netdev = adapter->netdev; > > > > > > phy_stop(netdev->phydev); > > > > > > - phy_disconnect(netdev->phydev); > > > - netdev->phydev = NULL; > > > + if (phy_is_pseudo_fixed_link(netdev->phydev)) > > > + lan743x_virtual_phy_disconnect(netdev->phydev); > > > + else > > > + phy_disconnect(netdev->phydev); > > > > phy_disconnect() should work. You might want to call There are drivers which call phy_disconnect() on a fixed_link. e.g. https://elixir.bootlin.com/linux/v5.11-rc4/source/drivers/net/usb/lan78xx.c#L3555. It could be your missing call to fixed_phy_unregister() is leaving behind bad state. > It was to make ethtool show full set of supported speeds and MII only in > supported ports (without TP and the no any ports in the bare card). But fixed link does not support the full set of speed. It is fixed. It supports only one speed it is configured with. And by setting it wrongly, you are going to allow the user to do odd things, like use ethtool force the link speed to a speed which is not actually supported. Andrew