From nobody Mon Feb 9 10:25:49 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (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 A0F2437418C; Wed, 28 Jan 2026 20:46:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769633166; cv=none; b=oc8Yi/TXQg6QRlpFPooXG8Mma640HoAUYpJxQ/a6zHNFefP7BXC48k28TPnbcgsGNUrX/WC0GoNflYvAkdfgPYVc6mPvmjZp61SbaBZARhc914OrE0P2HGXJb+cUuiVvsJ3gmHHrSngj0ELCvU+H8k7Iq5NTDFAwFkifVUAHbRc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769633166; c=relaxed/simple; bh=o4C5JoFvdaKbDLz0PCFiqU8VJ+VNFNhbpi6kQWKE2GY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U+/VubI0xO5arpvIBuia2DyQiFrKSgFteIpQN03hGet7bVOjgzeDZo08pRza6Rxms38QiCWTR6EeC120ZNvgimfTQr15RpMJFIHiG7BJgQ9TMwLjE+y5tk1Gmx2HXqedQSbE9Ip1iRs+676cXstcvHHzO9gdpec8EXT9Lq5YvVE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=HYRrmarU; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="HYRrmarU" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id E73F8C211F3; Wed, 28 Jan 2026 20:46:05 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 459786071F; Wed, 28 Jan 2026 20:46:03 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id E230B119A883B; Wed, 28 Jan 2026 21:45:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1769633161; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=3JyNXaJPV1JN+oROG8njfZR+nQrPMM6HIkQN7k5HMQU=; b=HYRrmarU+OgZ6f0inEoXwi2pfcJ/hEV7tSLtx4zX+Rxhrauetw2jv3MJIiaLZKMfoqEqTg HhxFxX/02Xhy5sS8CufT93LnF9YYoMJXy7it4LQDmWvPnJRmCz/es5+UelLK6nW6DM5y3J YAfylolx7iiK39zoBk9xnteJEujp02JYmydnBv6KoOt4KeK7oaDt3Ov3i8RwSVNydXAXlv QJIRC9nB/kkAAFjggyZvEpvnY0cht7eVNusOBAkYXq+MDJkPSLcNZk+aMJt6TZkgdO8wuI Jj4KF5MYQmp5Oz6AqwDRZjlOlJiN5yWe899hG55Ry7Z3ieNZySswQwLsl9VTwA== From: Maxime Chevallier To: davem@davemloft.net, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Paolo Abeni , Russell King , Heiner Kallweit Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Christophe Leroy , Herve Codina , Florian Fainelli , Vladimir Oltean , =?UTF-8?q?K=C3=B6ry=20Maincent?= , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Oleksij Rempel , =?UTF-8?q?Nicol=C3=B2=20Veronese?= , Simon Horman , mwojtas@chromium.org, Romain Gantois , Daniel Golle , Dimitri Fedrau Subject: [PATCH net-next v2 10/12] net: phy: phy_link_topology: Add a helper to retrieve ports Date: Wed, 28 Jan 2026 21:45:23 +0100 Message-ID: <20260128204526.170927-11-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20260128204526.170927-1-maxime.chevallier@bootlin.com> References: <20260128204526.170927-1-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-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" In order to allow netlink access to phy_ports, let's add a helper to retrieve them. When handling a port coming from phy_link_topology, the caller must hold rtnl until it's done with it. Signed-off-by: Maxime Chevallier --- include/linux/phy_link_topology.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/linux/phy_link_topology.h b/include/linux/phy_link_top= ology.h index 66bceff72b19..b05858086e42 100644 --- a/include/linux/phy_link_topology.h +++ b/include/linux/phy_link_topology.h @@ -66,6 +66,17 @@ phy_link_topo_get_phy(struct net_device *dev, u32 phyind= ex) return NULL; } =20 +static inline struct phy_port * +phy_link_topo_get_port(struct net_device *dev, u32 port_id) +{ + struct phy_link_topology *topo =3D dev->link_topo; + + if (!topo) + return NULL; + + return xa_load(&topo->ports, port_id); +} + #else static inline int phy_link_topo_add_phy(struct net_device *dev, struct phy_device *phy, @@ -95,6 +106,12 @@ phy_link_topo_get_phy(struct net_device *dev, u32 phyin= dex) { return NULL; } + +static inline struct phy_port * +phy_link_topo_get_port(struct net_device *dev, u32 port_id) +{ + return NULL; +} #endif =20 #endif /* __PHY_LINK_TOPOLOGY_H */ --=20 2.49.0