From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) (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 B69692940D; Fri, 7 Mar 2025 17:36:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.195 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741368980; cv=none; b=NTDsgQStlP3d00VinWBk6ibrqsmc7XQMLMdru9LharY129RdnBSrZE27OdYAv0Ck//2ZXjy8GmfdRuOrwsRw3ZKV3gSZ3dfA3yCeMzgbhurPKp5M9wjuIlCf3e/7vRLzSNojGjQxjSNDyE8opaVirFw+wz5V/Ix542QA9+HBIg0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741368980; c=relaxed/simple; bh=dYUxZlwkWdCCw+HQ3oAIc3NOJWT6b38NeCp5TmdAr2s=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=LJ/oMqx7nISHO/SOxpY2KFf5/F6VFZjMMlw8Td8YqcG1Ne7+f8dTJXonpBH4n17xEKK/QcsDEHj4mijutoM5JddrW6baISf49dJLPmWP7pAjBcyYXTlCmpIk10DrakkqlKg/Q9rda7BvxtceHFr2l3QFndy9lk1UqrhGk/mpSeA= 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=Ssn6KFrF; arc=none smtp.client-ip=217.70.183.195 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="Ssn6KFrF" Received: by mail.gandi.net (Postfix) with ESMTPSA id EF96A20454; Fri, 7 Mar 2025 17:36:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1741368975; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=2oZe26dvDe/cy6uqiDDi7SugxDmjZD7H4aAqZ/7Y2Hc=; b=Ssn6KFrFfRMZzePX67dy3aXffwYP4D3uAJ1HeBMO+J7EStK4SBShX6Mbj7s9WY3J2do2Ln VPI7oVU7i0m6uPeDrQVDbpXC7/NF7jGIlABQdygPSgauWNEPq9UOVg9rZY/rvmc0+5mzvz jNJYTdjZj2KWpHbwNWntvDvcM1alY2o5DJ6HIa+QthbsCci/3iBO6leNlzJLFfxlCazeAl oME0VAWpxxfKCKVGIbPINSMT2bxDJlxQANyGFZmaH9zzNLE+RA/hIpY9VkA/13axLCPxM0 V3euu8zdUNf2Tv3jSfxkmW84regVY/35TAN32wlUZJW+xRAvvmKsuPbQmL8RQw== 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, linux-arm-kernel@lists.infradead.org, Christophe Leroy , Herve Codina , Florian Fainelli , Vladimir Oltean , =?UTF-8?q?K=C3=B6ry=20Maincent?= , Oleksij Rempel , Simon Horman , Romain Gantois Subject: [PATCH net-next v5 00/13] net: phy: Rework linkmodes handling in a dedicated file Date: Fri, 7 Mar 2025 18:35:57 +0100 Message-ID: <20250307173611.129125-1-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.48.1 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduudduvdekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffoggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhmvgcuvehhvghvrghllhhivghruceomhgrgihimhgvrdgthhgvvhgrlhhlihgvrhessghoohhtlhhinhdrtghomheqnecuggftrfgrthhtvghrnhepjefhleeihefgffeiffdtffeivdehfeetheekudekgfetffetveffueeujeeitdevnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucfkphepvdgrtddumegtsgduleemkegugegtmeelfhdttdemsggtvddumeekkeelleemheegtdgtmegvheelvgenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvrgdtudemtggsudelmeekugegtgemlehftddtmegstgdvudemkeekleelmeehgedttgemvgehlegvpdhhvghlohepfhgvughorhgrrdhhohhmvgdpmhgrihhlfhhrohhmpehmrgigihhmvgdrtghhvghvrghllhhivghrsegsohhothhlihhnrdgtohhmpdhnsggprhgtphhtthhopedvtddprhgtphhtthhopegurghvvghmsegurghvvghmlhhofhhtrdhnvghtpdhrtghpthhtoheprghnughrvgifsehluhhnnhdrtghhpdhrtghpthhtohepkhhusggrsehkvghrnhgvl hdrohhrghdprhgtphhtthhopegvughumhgriigvthesghhoohhglhgvrdgtohhmpdhrtghpthhtohepphgrsggvnhhisehrvgguhhgrthdrtghomhdprhgtphhtthhopehlihhnuhigsegrrhhmlhhinhhugidrohhrghdruhhkpdhrtghpthhtohephhhkrghllhifvghithdusehgmhgrihhlrdgtohhmpdhrtghpthhtohepmhgrgihimhgvrdgthhgvvhgrlhhlihgvrhessghoohhtlhhinhdrtghomh X-GND-Sasl: maxime.chevallier@bootlin.com Hello everyone, This is V5 of the phy_caps series. In a nutshell, this series reworks the way we maintain the list of speed/duplex capablities for each linkmode so that we no longer have multiple definition of these associations. That will help making sure that when people add new linkmodes in include/uapi/linux/ethtool.h, they don't have to update phylib and phylink as well, making the process more straightforward and less error-prone. It also generalises the phy_caps interface to be able to lookup linkmodes from phy_interface_t, which is needed for the multi-port work I've been working on for a while. This V5 addresse Russell's and Paolo's reviews, namely : - Error out when encountering an unknown SPEED_XXX setting It prints an error and fails to initialize phylib. I've tested by introducing a dummy 1.6T speed, I guess it's only a matter of time before that actually happens :) - Deal more gracefully with the fixed-link settings, keeping some level of compatibility with what we had before by making sure we report a single BaseT mode like before. V1 : https://lore.kernel.org/netdev/20250222142727.894124-1-maxime.chevallier@bootlin.com/ V2 : https://lore.kernel.org/netdev/20250226100929.1646454-1-maxime.chevallier@bootlin.com/ V3 : https://lore.kernel.org/netdev/20250228145540.2209551-1-maxime.chevallier@bootlin.com/ V4 : https://lore.kernel.org/netdev/20250303090321.805785-1-maxime.chevallier@bootlin.com/ Maxime Chevallier (13): net: ethtool: Export the link_mode_params definitions net: phy: Use an internal, searchable storage for the linkmodes net: phy: phy_caps: Move phy_speeds to phy_caps net: phy: phy_caps: Move __set_linkmode_max_speed to phy_caps net: phy: phy_caps: Introduce phy_caps_valid net: phy: phy_caps: Implement link_capabilities lookup by linkmode net: phy: phy_caps: Allow looking-up link caps based on speed and duplex net: phy: phy_device: Use link_capabilities lookup for PHY aneg config net: phylink: Use phy_caps_lookup for fixed-link configuration net: phy: drop phy_settings and the associated lookup helpers net: phylink: Add a mapping between MAC_CAPS and LINK_CAPS net: phylink: Convert capabilities to linkmodes using phy_caps net: phylink: Use phy_caps to get an interface's capabilities and modes drivers/net/phy/Makefile | 2 +- drivers/net/phy/phy-caps.h | 63 ++++++ drivers/net/phy/phy-core.c | 253 ++---------------------- drivers/net/phy/phy.c | 37 +--- drivers/net/phy/phy_caps.c | 359 +++++++++++++++++++++++++++++++++++ drivers/net/phy/phy_device.c | 16 +- drivers/net/phy/phylink.c | 355 ++++++++++------------------------ include/linux/ethtool.h | 8 + include/linux/phy.h | 15 -- net/ethtool/common.c | 1 + net/ethtool/common.h | 7 - 11 files changed, 571 insertions(+), 545 deletions(-) create mode 100644 drivers/net/phy/phy-caps.h create mode 100644 drivers/net/phy/phy_caps.c -- 2.48.1