Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp440935lqs; Thu, 13 Jun 2024 15:02:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUEnXWdvfJySJM9Qt/bSYraBmCoXNmKiZEFyGK4QtIe1q+GMifmBF4MWb89ZnRqF09ime6YJ7Cm1K6zwcu7wC9Gehuulp+hIzy4+p2piw== X-Google-Smtp-Source: AGHT+IG0vJGgTwuQmBe0ujwFLO0XGz55MWg+0hW7Pv8yzT7nyJ7rDQ5WLNKaHXb1bA2jOLks4qn2 X-Received: by 2002:a17:90a:ca14:b0:2bd:92e7:c305 with SMTP id 98e67ed59e1d1-2c4db34ce07mr1115466a91.21.1718316154312; Thu, 13 Jun 2024 15:02:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718316154; cv=pass; d=google.com; s=arc-20160816; b=exLuaB6EfGLjwIf6bDdmMs/vJH86OPOiLgfKPFzo8FUIPxLHyz73FdamG3iInBanxp Hlyk8c8mXEMjBMsfkwJ8vCnWd99Sn09JthKkJ4dTIsPmSb6QbMHo3GQSKYL2E4gABVK6 v2F0izCAHU/fAXQ3nILOpj8ZkKvh6NLFiIDinjsqfpmZuFH4fZ2aSocACFUgW+qW+Rcl gLdL3C27Nt6ooO+tC4qd9dWuBn1Is+6g2Qi0I9QJWSkiy6+bex5RDRcptzzFMOm/Dwgm 5h0UnFZQNG8kq6NPVueoL4SJpD2MKpIqNsKdFKovhKMHTPMdpmpqjG9taqE6pj0KfDhl eccA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=j7zmwo2RU6Du49DJYBT9DPZ+SSoMA3yEsZqcq2HtOms=; fh=W1R7QLwRf1oj7G7T9e1v6uvRctF22WHW4TCMEZnmY+Y=; b=TWtbuscYAKEnADVHH/jQJADpw9FyiWF1Ftg/srMUFmyHengA1CyX489cMDGP+/FtxU XfQNZf8nVRo+0aRq0eAG6ErrO0Ay9zGwbbh5e/PjH8aRuteCmQRbKa5Q2xCFWpKxI+Qc CCRYNuH5jYSs6d4NzLjQMR+d4ag33KxGEu+JrwnqX9CeC2m80aeKzN3Km8UTFTv3rLY5 tk+4Ez/RMekbRKKseod+A5jo25iNSjlL763UlbsgSViHCgZllKIaLx1en6kkb3st2reN Csdhg+3mnShWAFsxDTMb7a5gH1rc7MZg3MX6gMzeJxYzQwMd6cHK0bHuaYpbhFhIa6sz TOAA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=z1ZtUrKD; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-214045-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214045-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c4a75f3fb1si4573673a91.64.2024.06.13.15.02.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 15:02:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-214045-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=z1ZtUrKD; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-214045-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214045-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id EAD77285A9B for ; Thu, 13 Jun 2024 22:02:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7BB7714B06A; Thu, 13 Jun 2024 22:02:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="z1ZtUrKD" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D5F11369A1; Thu, 13 Jun 2024 22:02:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718316143; cv=none; b=lhP5jvm0kx3XUIAZCY7e//En64kI+Sz7sjZ4+h98R9c7J46Ip0iMP/fALPyBCZkaKl6hKDaKHHE+HQ/t7ERot4lVgSKFZxKxQQ+HGV7fOSZ6Uw4bxwEtrPYQy5dr2WH1k590GUXWS5IIhWuOEVSmQH8ykxQ9sVE5sgiMbxsHb7g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718316143; c=relaxed/simple; bh=mvhZ7fg02QLWDHOt4fSSAy0v3cjUxDyrkpKSDETExpo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=mM8XwRZXDmueFCxP+mM/08wexPQ5XvcTW7W+hMX5V0Hh8dYenVwfuqkOBk7c/ABSTGDp/TqC6urSZRiIzGylkL5RdHf8RIC7+8tqu1U+5p7QyXR5lXjAcBG3o7+Ca5C93z+qHk/sIeYe9wOugYGhzcbaMm47RSqHjJufey05m/I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=z1ZtUrKD; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=j7zmwo2RU6Du49DJYBT9DPZ+SSoMA3yEsZqcq2HtOms=; b=z1ZtUrKDjEIC/fl/3dnk+8K7Rd AtuWAhrv9Bk+AZ53kimQy5z3UvwmTX9axysgmJptRQfYtmdCBlAAEHJErHPi8dBeEIFYHSO217/JZ ZJtcGWQBE5Eg2jSmQKkISAjoDzd10sL+MD88UPZSquC0NoPrt869YJvnhZHdUapbb8mA=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1sHsWK-0000bs-Ce; Fri, 14 Jun 2024 00:02:12 +0200 Date: Fri, 14 Jun 2024 00:02:12 +0200 From: Andrew Lunn To: Paul Geurts Cc: wei.fang@nxp.com, shenwei.wang@nxp.com, xiaoning.wang@nxp.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, imx@lists.linux.dev, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] fec_main: Register net device before initializing the MDIO bus Message-ID: <51faeed2-6a6b-439b-80e6-8cf2b5ce401a@lunn.ch> References: <20240613144112.349707-1-paul.geurts@prodrive-technologies.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240613144112.349707-1-paul.geurts@prodrive-technologies.com> On Thu, Jun 13, 2024 at 04:41:11PM +0200, Paul Geurts wrote: > Registration of the FEC MDIO bus triggers a probe of all devices > connected to that bus. DSA based Ethernet switch devices connect to the > uplink Ethernet port during probe. When a DSA based, MDIO controlled > Ethernet switch is connected to FEC, it cannot connect the uplink port, > as the FEC MDIO port is registered before the net device is being > registered. This causes an unnecessary defer of the Ethernet switch > driver probe. > > Register the net device before initializing and registering the MDIO > bus. The problem with this is, as soon as you call register_netdev(), the device is alive and sending packets. It can be sending packets even before register_netdev() returns, e.g. in the case of NFS root. So fec_enet_open() gets called, and tried to find its PHY. But the MDIO bus is not registered yet.... So yes, DSA ends up doing an EPROBE_DEFER cycle. Not much we can do about that. We can try to keep the DSA probe functions as cheap as possible, and put all the expensive stuff in setup(), which will only be called once we have all the needed resources. Andrew --- pw-bot: cr