From mboxrd@z Thu Jan 1 00:00:00 1970 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 EC52C3EFD34; Wed, 20 May 2026 16:54:23 +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=1779296065; cv=none; b=CsNv7qs/1KGG4S+U0hPUUw2VWvSaiutwgRbtidM6UXl0vTBcoMlCqnh1JPr51PqN8ksOyCGIPbpgPa3STGxqZ6CQYJ+Nt42A4cucwQgzQTZiTkjMFuwAU+bNXhvPqM0hx9qGbSa++a/+9AHtNGdhT04AzvUg0U8TuR/T3X9F230= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779296065; c=relaxed/simple; bh=ixckk90Vg8fZaqA4QlHyyWVrl0b6H3lCzSkzEaECSlM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WuqlxITgxsk2k32edNiIxcXK5BpZA2OUioDhpEvdecweGvottorO3mdGXUdhTaMkxM9iewOE5TMPrP3WjxNqd4myvU5BRS1tb82jzByntA44CG6rh3VFfAde77o9Dp07Nq7dvXdpP82/5zlfBGST4P1/Ioc3AhTtfkh5HVQqLeA= 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=ECHfVLpR; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="ECHfVLpR" 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=6Qj1CxIF4Evt4pS9q2l1ij6TzpWOuNV9UzxyE3LIEZg=; b=ECHfVLpRcSBUIbAQQRv9UxWsV5 YoiV0Xgo4JhNxrBE7PcRrU2de/DfaoyLRmpSKEjAwFeZ2IMtUnW1Kh+9IIiHD/UQq8W6hXLpPBrQj 1a52Vay9Mw9Evv8iTA+jP+8ZSQRqbhJVJiMGkKNwwaeyoDlbOJ7JR0PVEWXfQtlVa7nY=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1wPkBN-003s82-RB; Wed, 20 May 2026 18:54:09 +0200 Date: Wed, 20 May 2026 18:54:09 +0200 From: Andrew Lunn To: Maxime Chevallier Cc: davem@davemloft.net, Jakub Kicinski , Eric Dumazet , Paolo Abeni , Russell King , Heiner Kallweit , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Christophe Leroy , Herve Codina , Florian Fainelli , Vladimir Oltean , =?iso-8859-1?Q?K=F6ry?= Maincent , Marek =?iso-8859-1?Q?Beh=FAn?= , Oleksij Rempel , =?iso-8859-1?Q?Nicol=F2?= Veronese , Simon Horman , mwojtas@chromium.org, Romain Gantois , Daniel Golle , Dimitri Fedrau , Frank Wunderlich Subject: Re: [PATCH net-next v10 6/9] net: phy: phy_port: Store information about a MII port's vacant state Message-ID: <9ff206d7-2214-4f80-96b2-b03db2ab8982@lunn.ch> References: <20260513130521.1064094-1-maxime.chevallier@bootlin.com> <20260513130521.1064094-7-maxime.chevallier@bootlin.com> <97cd33a0-ee74-4f64-b11a-bb5b88bce79a@lunn.ch> 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: > I've given this a go, and now I remember why it's that way. In a nutshell, > if something fails during .module_insert() (e.g. module isn't compatible > with the MII modes ont the cage), then .module_remove() isn't called, so we > can't track module presence unless we add that in the sfp code itself. I did wounder about that, it is a pretty typically pattern. > > However a better way to deal with this whole situation may just be to store > the presence information in the module's port itself, as the parent port id > : > phy_port.id = 1 > / phy_port.id = 2; > / / phy_port.upstream_port = 1 > +------+ +----------+ +------------+ > | MAC | --- | SFP Cage | --- | SFP module | > +------+ +----------+ +------------+ > > So, we lose one piece of information, that is "is there an SFP module > present, even if the module doesn't work". It's now indirectly present > as "there's another port that references the SFP cage port, hence it's > not empty". That is reasonable. Andrew