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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 13D0FC67861 for ; Sat, 6 Apr 2024 15:51:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CgbhKDEnF+KjO7gz2lw3N6Zodx0W+N1sG4DFeGwJ53c=; b=0cPCQpUpifXSvh yYzv8qQ9MIE+1LHyKn+g43CfWqe2E3kn2YgmP5lsjdIIxcHAEip+A2KxEeQFe9D6qBkvPlAR1yIPD gYJibMQJ5pxlzMe9DYJMymZSfTRl384+SxiIe9z8JlPEKymjRgBvgiFXm30aiIRu9wIxbjpWJO7MF qRFXHQZjNyVowfdsFGceU32gg61cdi8rA0Giq6HXybE0qdUIOMk3ujSSOblnBi/qHu3epfrwNhdql MDvUm9BmwaSuIGRqfqC7hDTfmt1P82jTrTeZ77j80NQMgYl85Wu0hKu3Af95q6XHoqe2I8EQocTEj ip3GWwa1IqD5/8k7tZkg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rt8KE-0000000AZJQ-3wOJ; Sat, 06 Apr 2024 15:51:26 +0000 Received: from vps0.lunn.ch ([156.67.10.101]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rt8KC-0000000AZIg-4ASg for linux-arm-kernel@lists.infradead.org; Sat, 06 Apr 2024 15:51:26 +0000 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=Eq+WYVe7ZG4D7uYVbOzuAjHgqNe69MUAj/3ZLYiacM0=; b=04ff6QxFGP+O57ChfgcHW3uZbO obGU9F50Oxw3CTxg7vb4GrGMfdCVexgtBoJOSO9sgvqihy+gz+r4aCJxv8rUzRrKZlSR14uvnn4q3 kCv/ByhY6HWGoufYbwjjkAIXYIGmJk7VIAADlfO54zQaXzWv91tjI6gj/23lGHfk58n4=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1rt8Jv-00CNRN-K5; Sat, 06 Apr 2024 17:51:07 +0200 Date: Sat, 6 Apr 2024 17:51:07 +0200 From: Andrew Lunn To: Maxime Chevallier Cc: davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Jakub Kicinski , Eric Dumazet , Paolo Abeni , Russell King , linux-arm-kernel@lists.infradead.org, Christophe Leroy , Herve Codina , Florian Fainelli , Heiner Kallweit , Vladimir Oltean , =?iso-8859-1?Q?K=F6ry?= Maincent , Jesse Brandeburg , Jonathan Corbet , Marek =?iso-8859-1?Q?Beh=FAn?= , Piergiorgio Beruto , Oleksij Rempel , =?iso-8859-1?Q?Nicol=F2?= Veronese , Simon Horman , mwojtas@chromium.org Subject: Re: [PATCH net-next v11 01/13] net: phy: Introduce ethernet link topology representation Message-ID: References: <20240404093004.2552221-1-maxime.chevallier@bootlin.com> <20240404093004.2552221-2-maxime.chevallier@bootlin.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240404093004.2552221-2-maxime.chevallier@bootlin.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240406_085125_059709_2292839D X-CRM114-Status: GOOD ( 17.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Apr 04, 2024 at 11:29:51AM +0200, Maxime Chevallier wrote: > Link topologies containing multiple network PHYs attached to the same > net_device can be found when using a PHY as a media converter for use > with an SFP connector, on which an SFP transceiver containing a PHY can > be used. > > With the current model, the transceiver's PHY can't be used for > operations such as cable testing, timestamping, macsec offload, etc. > > The reason being that most of the logic for these configuration, coming > from either ethtool netlink or ioctls tend to use netdev->phydev, which > in multi-phy systems will reference the PHY closest to the MAC. > > Introduce a numbering scheme allowing to enumerate PHY devices that > belong to any netdev, which can in turn allow userspace to take more > precise decisions with regard to each PHY's configuration. > > The numbering is maintained per-netdev, in a phy_device_list. > The numbering works similarly to a netdevice's ifindex, with > identifiers that are only recycled once INT_MAX has been reached. > > This prevents races that could occur between PHY listing and SFP > transceiver removal/insertion. > > The identifiers are assigned at phy_attach time, as the numbering > depends on the netdevice the phy is attached to. The PHY index can be > re-used for PHYs that are persistent. > > Signed-off-by: Maxime Chevallier Reviewed-by: Andrew Lunn Andrew _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 13F7F2B9CE; Sat, 6 Apr 2024 15:51:16 +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=1712418679; cv=none; b=Z5AZhF19gtiMG9IN+4dmQH9WYJUwVdOPLo+azQ772g2K3NcNfIKaWEbSFhCu25P2oGr32ovBJmqFRz++5u5aTbnY4tenG5J+X8JfmAokkN47XOgvZ2kTnPafOOD1udSCguPD7xU5TiNiMKlIrYh7ItxfeejtUE9zd5iZ4CDBIf4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712418679; c=relaxed/simple; bh=lp6fIx2QGzzZL15VJHwAUgYmgUhpH59peCuTj/YVL8E=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PF8j3zfJoQn0c786XqKHiAnoD1zrUwVzhKhYjuES3wI6HXgwboWx6Cqu3OD5v0esGTwYKwEY0Ds3b3yvmV03q6/dH51NjMfcRE7lu1xsSRJptVBWW84aWrLL/qJqVJ/eDdjZa0KOIui4ZbKa7aXRBliDk5mPG90yR3o86oLOVu0= 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=04ff6QxF; 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="04ff6QxF" 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=Eq+WYVe7ZG4D7uYVbOzuAjHgqNe69MUAj/3ZLYiacM0=; b=04ff6QxFGP+O57ChfgcHW3uZbO obGU9F50Oxw3CTxg7vb4GrGMfdCVexgtBoJOSO9sgvqihy+gz+r4aCJxv8rUzRrKZlSR14uvnn4q3 kCv/ByhY6HWGoufYbwjjkAIXYIGmJk7VIAADlfO54zQaXzWv91tjI6gj/23lGHfk58n4=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1rt8Jv-00CNRN-K5; Sat, 06 Apr 2024 17:51:07 +0200 Date: Sat, 6 Apr 2024 17:51:07 +0200 From: Andrew Lunn To: Maxime Chevallier Cc: davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Jakub Kicinski , Eric Dumazet , Paolo Abeni , Russell King , linux-arm-kernel@lists.infradead.org, Christophe Leroy , Herve Codina , Florian Fainelli , Heiner Kallweit , Vladimir Oltean , =?iso-8859-1?Q?K=F6ry?= Maincent , Jesse Brandeburg , Jonathan Corbet , Marek =?iso-8859-1?Q?Beh=FAn?= , Piergiorgio Beruto , Oleksij Rempel , =?iso-8859-1?Q?Nicol=F2?= Veronese , Simon Horman , mwojtas@chromium.org Subject: Re: [PATCH net-next v11 01/13] net: phy: Introduce ethernet link topology representation Message-ID: References: <20240404093004.2552221-1-maxime.chevallier@bootlin.com> <20240404093004.2552221-2-maxime.chevallier@bootlin.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: <20240404093004.2552221-2-maxime.chevallier@bootlin.com> On Thu, Apr 04, 2024 at 11:29:51AM +0200, Maxime Chevallier wrote: > Link topologies containing multiple network PHYs attached to the same > net_device can be found when using a PHY as a media converter for use > with an SFP connector, on which an SFP transceiver containing a PHY can > be used. > > With the current model, the transceiver's PHY can't be used for > operations such as cable testing, timestamping, macsec offload, etc. > > The reason being that most of the logic for these configuration, coming > from either ethtool netlink or ioctls tend to use netdev->phydev, which > in multi-phy systems will reference the PHY closest to the MAC. > > Introduce a numbering scheme allowing to enumerate PHY devices that > belong to any netdev, which can in turn allow userspace to take more > precise decisions with regard to each PHY's configuration. > > The numbering is maintained per-netdev, in a phy_device_list. > The numbering works similarly to a netdevice's ifindex, with > identifiers that are only recycled once INT_MAX has been reached. > > This prevents races that could occur between PHY listing and SFP > transceiver removal/insertion. > > The identifiers are assigned at phy_attach time, as the numbering > depends on the netdevice the phy is attached to. The PHY index can be > re-used for PHYs that are persistent. > > Signed-off-by: Maxime Chevallier Reviewed-by: Andrew Lunn Andrew