Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp133721rdb; Fri, 5 Jan 2024 05:17:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IGeStbCD115KOE9CzPNqLcjbR2LEiGj9CR+f/PeSQoFBEWSDzrn5IvCA0cy6vJ3qopBc7CW X-Received: by 2002:a50:9e89:0:b0:553:29b0:7ed7 with SMTP id a9-20020a509e89000000b0055329b07ed7mr2507203edf.28.1704460655359; Fri, 05 Jan 2024 05:17:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704460655; cv=none; d=google.com; s=arc-20160816; b=CSpDsjuH/5T9tBTuvAcDSOLe5bpc+Qa2/24r0PmBUMdzaa1RFbGvSfShX3CKnxG8NR QFnpvabUQULF+J047fxUdTkIO13YxLEaEQIWUUi7hBcEeWbtciOkv9ahk+Cxn0UvDG6H tkOKyifHBT6BGEhqp3zuS5Aackd7tj75cmxCdB6KOmZj/4go12pvK0VtI1PQ03O6fpm2 ktgQflZzfc2k7w1ukc5wdzMq/+zHB3SZzVztWvBnaV993jYMAKHTyIPiRSqBXA3oPAk/ a68Hv4UMjIZ+8DabaTZ1YY4Uwl8AHatgpxUxwPLoy6DSR5N9E7HhDTI/pX7gCxEquMTw gTmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=oYkHg1D15kQrScL6uDog31ucMTQ1gHtOMHhxRiO58Dw=; fh=N9ulsK78wa4EskC63McGrAulufPecEQliAWwkNP4nD4=; b=XVcfduqDB9MWUZuEI9Ft++Y1n8XNOeCKA0/tmh9FnRvsTbbNxv4LKjL09IW1RtjzA3 iX9a8B5MvUoIQko82A2x8qMCWqyWLnrugIz4EILXxcief2ZDzqhQr0SCgsKzVS13cKCE QFzt/SfkjhfwcegziK3aczfZh5nPn0QKBgvgS0sBTQ/UTlB8oGfYDn4yqxCmjkzIBHMH t+qFCi4ZJU76s7T742OvJBripABwLjeTr9fXRbu5SB+v+iBjowzzP/5EtfQmZuarCsi4 nZ4aTenaWETISkPWVTjI/9kDeoKeaJBRDMnMXiRrcpraJhCZHImoH5qSswtGUAQMDwKx WUMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=VHzN0NrO; spf=pass (google.com: domain of linux-kernel+bounces-17868-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17868-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id cm2-20020a0564020c8200b005554ae2483bsi624788edb.564.2024.01.05.05.17.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 05:17:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17868-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=VHzN0NrO; spf=pass (google.com: domain of linux-kernel+bounces-17868-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17868-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 054A61F2381D for ; Fri, 5 Jan 2024 13:17:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B554C2D62C; Fri, 5 Jan 2024 13:17:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="VHzN0NrO" X-Original-To: linux-kernel@vger.kernel.org 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 A84AF2D61B; Fri, 5 Jan 2024 13:17:16 +0000 (UTC) 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 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=oYkHg1D15kQrScL6uDog31ucMTQ1gHtOMHhxRiO58Dw=; b=VHzN0NrOusYaSJOab5F/XVEHAy ME9lsChygVo6Tc5hQAtWtSJY3A4paxJCLwtNf1Nmfms1Fl/SsllQS6vVWbEtnJ5zmc+57xlf73Cz4 Y//Yd8HNLB+hMjtinImojOy1QQh1SU6eRF/8TaQnghZV+/RZf8/mNDpTbIU4Bfzc46tE=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1rLk4U-004SGe-Ub; Fri, 05 Jan 2024 14:17:10 +0100 Date: Fri, 5 Jan 2024 14:17:10 +0100 From: Andrew Lunn To: Maxime Chevallier Cc: Jakub Kicinski , davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, 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 Subject: Re: [PATCH net-next v5 07/13] net: ethtool: Introduce a command to list PHYs on an interface Message-ID: <2c955f94-7c95-4f66-b739-f0967ec9c171@lunn.ch> References: <20231221180047.1924733-1-maxime.chevallier@bootlin.com> <20231221180047.1924733-8-maxime.chevallier@bootlin.com> <20240104153401.08ff9809@kernel.org> <20240105104311.03a35622@device-28.home> 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: <20240105104311.03a35622@device-28.home> > > > +int ethnl_phy_dumpit(struct sk_buff *skb, struct netlink_callback *cb) > > > +{ > > > + struct ethnl_phy_dump_ctx *ctx = (void *)cb->ctx; > > > + struct net *net = sock_net(skb->sk); > > > + unsigned long ifindex = 1; > > > > This doesn't look right, if dump gets full you gotta pick up > > when previous call left off. > > I wasn't aware that this was the expected DUMP behaviour. So I should > keep track of the last dev and last phy_index dumped in the dump_ctx I > guess ? I'm not sure how I'm going to test this though, I only have > devices with at most 2 PHYs :( At a guess.... You are supposed to dump until you are out of space in the buffer. You then return what you have, and expect another call so you can continue with the rest. Rather than fill the buffer, just hack the code to only put in a single PHY, and then return with the same condition of a full buffer. Hopefully you should get a second call, and you can then test your logic for picking up from where you left off. Another option might be to add PHY support to netdevsim. Add a debugfs interface to allow you to create arbitrary PHY topologies? You can then even add a test script. Andrew