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 CE6EBC021A0 for ; Mon, 17 Feb 2025 08:31:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To: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=v5AnTb28mQKtjEHDL/Wk7VuZHdL8LuplyEfPirr+QDY=; b=jjz/6O9N0OLwg1S5G2QnYMRICD 511iK/NUT8POdOhi41e5f+LKmFGTTOpJI9UYr2TZWSi11rSRCCiu4aNSisMVMOJA5Ty/ndSzDtbve jh2Mpdq0Nzj2yP9fZB2RPzRzxIC7MAAblwQ8ooPzG+qKWUtjgaynnEzz+5pKSrbA28A/5va6O/ZqW +eKii0SQ8VuPrSEv7nkqZP8AAzdNtW7EX1ZkO7MEeW+srjFGGpHqx+itZUOUnDY7NXUUaX2YPRQTD gZB0VNEWWk+VVpGAyR2fc527TgCnHpHPVtE2DfRb1CInKi2InDe6vhq/UcEqqq4mBpR37JX6rmKqN NDigLD7g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tjwWj-00000003lsn-10MP; Mon, 17 Feb 2025 08:30:53 +0000 Received: from relay6-d.mail.gandi.net ([217.70.183.198]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tjwVF-00000003ldP-1UBR for linux-arm-kernel@lists.infradead.org; Mon, 17 Feb 2025 08:29:23 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id E51C0442AA; Mon, 17 Feb 2025 08:29:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1739780956; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v5AnTb28mQKtjEHDL/Wk7VuZHdL8LuplyEfPirr+QDY=; b=LnBzlFkcgZdoEtjFLY3rmc7Fv9NnY81cKg9mYY/HiYt9UxhsWLnGxsV9cIF4Abzd17XhGe 4kneXCqLG+QzaJNapTEBQyXVi3//cC7NdpLsTv0XhY9/D58ZsnH3ydpdOf2L7ccHO7XJ8A wKjo7XpWTprsPoUai+IAO8+AXYJFX2vDlszT6+M+C2Hjp+jxk07z3k+uFp2DJslPVfeZKo a3UI3mIZfkEjWMjNCMu+3dqfBqnc0acxFIPL5CS7+yDfws9QkU2fQGYfs5GFu9Y7Sfivrv 5khQc4Kx7WRi6T55WBGbKgEjBGPRn15o176YQsxsQvxbgJWTtOJraFEVzc5kNA== Date: Mon, 17 Feb 2025 09:29:11 +0100 From: Maxime Chevallier To: "Russell King (Oracle)" Cc: davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, thomas.petazzoni@bootlin.com, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Paolo Abeni , linux-arm-kernel@lists.infradead.org, Christophe Leroy , Herve Codina , Florian Fainelli , Heiner Kallweit , Vladimir Oltean , =?UTF-8?B?S8O2cnk=?= Maincent , Marek =?UTF-8?B?QmVow7pu?= , Oleksij Rempel , =?UTF-8?B?Tmljb2zDsg==?= Veronese , Simon Horman , mwojtas@chromium.org, Antoine Tenart , devicetree@vger.kernel.org, Conor Dooley , Krzysztof Kozlowski , Rob Herring , Romain Gantois , Daniel Golle , Dimitri Fedrau , Sean Anderson Subject: Re: [PATCH net-next v4 05/15] net: phy: Create a phy_port for PHY-driven SFPs Message-ID: <20250217092911.772da5d0@fedora.home> In-Reply-To: References: <20250213101606.1154014-1-maxime.chevallier@bootlin.com> <20250213101606.1154014-6-maxime.chevallier@bootlin.com> Organization: Bootlin X-Mailer: Claws Mail 4.3.0 (GTK 3.24.43; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdehjeeltdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepfffhvfevuffkjghfohfogggtgfesthejredtredtvdenucfhrhhomhepofgrgihimhgvucevhhgvvhgrlhhlihgvrhcuoehmrgigihhmvgdrtghhvghvrghllhhivghrsegsohhothhlihhnrdgtohhmqeenucggtffrrghtthgvrhhnpeegveeltddvveeuhefhvefhlefhkeevfedtgfeiudefffeiledttdfgfeeuhfeukeenucfkphepvdgrtddumegtsgduleemkegugegtmeelfhdttdemsggtvddumeekkeelleemheegtdgtmegvheelvgenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvrgdtudemtggsudelmeekugegtgemlehftddtmegstgdvudemkeekleelmeehgedttgemvgehlegvpdhhvghlohepfhgvughorhgrrdhhohhmvgdpmhgrihhlfhhrohhmpehmrgigihhmvgdrtghhvghvrghllhhivghrsegsohhothhlihhnrdgtohhmpdhnsggprhgtphhtthhopeefuddprhgtphhtthhopehlihhnuhigsegrrhhmlhhinhhugidrohhrghdruhhkpdhrtghpthhtohepuggrvhgvmhesuggrvhgvmhhlohhfthdrnhgvthdprhgtphhtthhopehnvghtuggvvhesvhhgvghrrdhkvghrnhgvlhdro hhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdgrrhhmqdhmshhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepthhhohhmrghsrdhpvghtrgiiiihonhhisegsohhothhlihhnrdgtohhmpdhrtghpthhtoheprghnughrvgifsehluhhnnhdrtghhpdhrtghpthhtohepkhhusggrsehkvghrnhgvlhdrohhrgh X-GND-Sasl: maxime.chevallier@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250217_002921_856326_CABEF876 X-CRM114-Status: GOOD ( 21.95 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hello Russell, On Sat, 15 Feb 2025 18:57:01 +0000 "Russell King (Oracle)" wrote: > On Thu, Feb 13, 2025 at 11:15:53AM +0100, Maxime Chevallier wrote: > > Some PHY devices may be used as media-converters to drive SFP ports (for > > example, to allow using SFP when the SoC can only output RGMII). This is > > already supported to some extend by allowing PHY drivers to registers > > themselves as being SFP upstream. > > > > However, the logic to drive the SFP can actually be split to a per-port > > control logic, allowing support for multi-port PHYs, or PHYs that can > > either drive SFPs or Copper. > > > > To that extent, create a phy_port when registering an SFP bus onto a > > PHY. This port is considered a "serdes" port, in that it can feed data > > to anther entity on the link. The PHY driver needs to specify the > > various PHY_INTERFACE_MODE_XXX that this port supports. > > > > Signed-off-by: Maxime Chevallier > > With this change, using phy_port requires phylink to also be built in > an appropriate manner. Currently, phylink depends on phylib. phy_port > becomes part of phylib. This patch makes phylib depend on phylink, > thereby creating a circular dependency when modular. > > I think a different approach is needed here. That's true. One way to avoid that would be to extract out of phylink/phylib all the functions for linkmode handling that aren't tied to phylink/phylib directly, but are about managing the capabilities of each interface, linkmode, speed, duplex, etc. For phylink, that would be : phylink_merge_link_mode phylink_get_capabilities phylink_cap_from_speed_duplex phylink_limit_mac_speed phylink_caps_to_linkmodes phylink_interface_max_speed phylink_interface_signal_rate phylink_is_empty_linkmode phylink_an_mode_str phylink_set_port_modes For now all these are phylink internal and that makes sense, but if we want phy-driven SFP support, stackable PHYs and so on, we'll need some ways for the PHY to expose its media-side capabilities, and we'd reuse these. These would go into linkmode.c/h for example, and we'd have a shared set of helpers that we can use in phylink, phylib and phy_port. Before I go around and rearrange that, are you OK with this approach ? Maxime