From patchwork Wed Mar 5 14:19:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Chevallier X-Patchwork-Id: 14002895 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 BF027C282DE for ; Wed, 5 Mar 2025 15:34:00 +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: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=YY4Pp+CzXGStQ9eEENpuYpVt2ERsOCjh5tfjvgZMmCk=; b=3LlixqfRe1FoicReb6tlUQj06X SV3WG79kJ80i2ym0SS6QjNJTGbfnDnM9XSwwU0sVRHrlv1UizaP/T7cIk6uZZsrkzkSf6ZQ2zSOqP fXMIiRlBOT7XqQaJ57w8yDMKJk2HOUqItcs12O7SUlu/0ClsxxYY92h5zRwe6wSBI+i7+gUwazm5e jhWQD+bi4Ei9qQmeN587wzecYmOQX5m1nZMHvFRIDTTFwD51IOwkXXyJOJlIiTya1zUdnmzBh8iM/ IFUEd9n0fdtJYV82fC3MkL3hli9PKEsVYccU0uBWPIfSnH1VLGGAYyQ9p0Of6SPUUuznGRvJmGFVX wsiu2Npw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tpqkg-00000008Wv8-2dTn; Wed, 05 Mar 2025 15:33:42 +0000 Received: from relay2-d.mail.gandi.net ([217.70.183.194]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tppb8-00000008KGE-3xgD for linux-arm-kernel@lists.infradead.org; Wed, 05 Mar 2025 14:19:48 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 48B3B44113; Wed, 5 Mar 2025 14:19:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1741184382; 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=YY4Pp+CzXGStQ9eEENpuYpVt2ERsOCjh5tfjvgZMmCk=; b=S7w4FCBdwNrZeSsprQWO8JntEcQMcq0RLJjZLZf5MSJhvF7zYCuP5/sqYWfqWQXBjyhU+v 78OpFEnsC5hD2uIqed0xkZKSHC6KNPdtlaRsbfu1ElwAPtjdkiG3kzHFJ4pyKRamZqpQKB FW18ZJhYra6vlFB4yNFmt8vCLSrJRTv7lc86bTZdF2ygxCBnDUC1+3ODmzAMe/hrAn1k8A EQqFvAjkzon8tWFnFbHXnfGYSg0Ec3iz1CLd3EsV3j36aUjkQfFr/edHkW+zL/CtH6Z/Yd PdTW4ElgGQRmRGgvGJHBJlkDhKx3HCHIhjNQJlnVnEvFJ+Yn9ddwef6esQup4Q== From: Maxime Chevallier To: davem@davemloft.net, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Paolo Abeni , 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 , Russell King , Vladimir Oltean , =?utf-8?q?K=C3=B6ry_Maincent?= , Oleksij Rempel , Simon Horman , Romain Gantois , Piergiorgio Beruto Subject: [PATCH net-next 0/7] net: ethtool: Introduce ethnl dump helpers Date: Wed, 5 Mar 2025 15:19:30 +0100 Message-ID: <20250305141938.319282-1-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.48.1 MIME-Version: 1.0 X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddutdehtdegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffoggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhmvgcuvehhvghvrghllhhivghruceomhgrgihimhgvrdgthhgvvhgrlhhlihgvrhessghoohhtlhhinhdrtghomheqnecuggftrfgrthhtvghrnhepgeeiueduleekjeeigeeffeelgfehvedufeejueevgeekgfdtjedtteekffffheejnecuffhomhgrihhnpehgihhthhhusgdrtghomhenucfkphepvdgrtddumegtsgduleemkegugegtmeelfhdttdemsggtvddumeekkeelleemheegtdgtmegvheelvgenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvrgdtudemtggsudelmeekugegtgemlehftddtmegstgdvudemkeekleelmeehgedttgemvgehlegvpdhhvghlohepfhgvughorhgrrdhhohhmvgdpmhgrihhlfhhrohhmpehmrgigihhmvgdrtghhvghvrghllhhivghrsegsohhothhlihhnrdgtohhmpdhnsggprhgtphhtthhopedvuddprhgtphhtthhopegurghvvghmsegurghvvghmlhhofhhtrdhnvghtpdhrtghpthhtoheprghnughrvgifsehluhhnnhdrtghhpdhrtghpthhtohepkhhusggrsehkvghrnhgvl hdrohhrghdprhgtphhtthhopegvughumhgriigvthesghhoohhglhgvrdgtohhmpdhrtghpthhtohepphgrsggvnhhisehrvgguhhgrthdrtghomhdprhgtphhtthhopehhkhgrlhhlfigvihhtudesghhmrghilhdrtghomhdprhgtphhtthhopehmrgigihhmvgdrtghhvghvrghllhhivghrsegsohhothhlihhnrdgtohhmpdhrtghpthhtohepnhgvthguvghvsehvghgvrhdrkhgvrhhnvghlrdhorhhg X-GND-Sasl: maxime.chevallier@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250305_061947_113721_4720BA7D X-CRM114-Status: GOOD ( 14.99 ) 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 Hi everyone, This series adds some scaffolding into ethnl to ease the support of DUMP operations. As of today when using ethnl's default ops, the DUMP requests will simply perform a GET for each netdev. That hits limitations for commands that may return multiple messages for a single netdev, such as : - RSS (listing contexts) - All PHY-specific commands (PLCA, PSE-PD, phy) - tsinfo (one item for the netdev + one per phy) Commands that need a non-default DUMP support have to re-implement ->dumpit() themselves, which prevents using most of ethnl's internal circuitry. This series therefore introduces a better support for dump operations in ethnl. The patches 1 and 2 introduce the support for filtered DUMPs, where an ifindex/ifname can be passed in the request header for the DUMP operation. This is for when we want to dump everything a netdev supports, but without doing so for every single netdev. ethtool's "--show-phys ethX" option for example performs a filtered dump. Patch 3 introduces 3 new ethnl ops : ->dump_start() to initialize a dump context ->dump_one_dev(), that can be implemented per-command to dump everything on a given netdev ->dump_done() to release the context The default behaviour for dumps remains the same, calling the whole ->doit() path for each netdev. Patch 4 introduces a set of ->dump_start(), ->dump_one_dev() and ->dump_done() callback implementations that can simply be plugged into the existing commands that list objects per-phy, making the phy-targeting command behaviour more coherent. Patch 5 uses that new set of helpers to rewrite the phy.c support, which now uses the regulat ethnl_ops instead of fully custom genl ops. This one is the hardest to review, sorry about that, I couldn't really manage to incrementally rework that file :( Patches 6 and 7 are where the new dump infra shines, adding per-netdev per-phy dump support for PLCA and PSE-PD. We could also consider converting tsinfo/tsconfig, rss and tunnels to these new ->dump_***() operations as well, but that's out of this series' scope. I've tested that series with some netdevsim PHY patches that I plan to submit (they can be found here [1]), with the refcount tracker for net/netns enabled to make sure the lock usage is somewhat coherent. Thanks, Maxime [1]: https://github.com/minimaxwell/linux/tree/mc/netdevsim-phy Maxime Chevallier (7): net: ethtool: netlink: Allow per-netdevice DUMP operations net: ethtool: netlink: Rename ethnl_default_dump_one net: ethtool: netlink: Introduce command-specific dump_one_dev net: ethtool: netlink: Introduce per-phy DUMP helpers net: ethtool: phy: Convert the PHY_GET command to generic phy dump net: ethtool: plca: Use per-PHY DUMP operations net: ethtool: pse-pd: Use per-PHY DUMP operations net/ethtool/netlink.c | 161 ++++++++++++++------ net/ethtool/netlink.h | 46 +++++- net/ethtool/phy.c | 335 ++++++++++++------------------------------ net/ethtool/plca.c | 12 ++ net/ethtool/pse-pd.c | 6 + 5 files changed, 277 insertions(+), 283 deletions(-)