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 01F3AC27C79 for ; Thu, 20 Jun 2024 03:50:35 +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=JN8Yyr6hltrGEwaFbbPFBck2MIdSHozdx35CMh8gZXE=; b=ldEOI9vq/g46JcwFKgHPnvhTQZ 3d0uy447x/AQaJZtIajKPNkjFqY8557K7xTGyppCGIgepGsECHfqN8o0+1paJhFb7caCVZpBl0+8P 0/yO7WFXkmcB6RWbHehvOcmc6mQDe93V8Mf3q8Zmzd9t8C8NuAMEQPVu8P9eC7boFhAGgD03agzdP TVl5N788ZTtdRtqHe7MIlCKVOVPkWUde6TGZLPOJs6aUMaBH+I/lgNJbsG07I4tOtPLH/LixsL9Vz F6jEDnEore01GwEyF8YJ3reqQ4nq2BPtIoSBE7ZV4uBmzV09//3i/iBTAD6L1tmB3UAdN9bNPiG29 3lbiRviQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sK8ob-00000003Vd9-0nCx; Thu, 20 Jun 2024 03:50:25 +0000 Received: from relay1-d.mail.gandi.net ([2001:4b98:dc4:8::221]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sK8oX-00000003VZY-35Fo for linux-arm-kernel@lists.infradead.org; Thu, 20 Jun 2024 03:50:24 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 340FA240004; Thu, 20 Jun 2024 03:50:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1718855417; 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=JN8Yyr6hltrGEwaFbbPFBck2MIdSHozdx35CMh8gZXE=; b=EekmkNqIk2mPGfzybZt8IeBozFPs//bSNImRlf3ocz83y2WQ+AAx7a6boUN0e2a0Id56rB 2KCwwaM6DSiaRqW5zTFZmfUo9D/zoynEJoreWvcO0V+cQaLjOXVQeI9rXpKvywSUZK3jAh 3Wa/+ZzyHLCdqrxgm4Bv9ZoHwbkYzFOMW7k1nlvmkWaetGxhd6FNZae4khO7tVaeUBaeE2 yJx/5jGXw8r3u7kUWfX0GeRlyrsq34sQ3Lvs2wD4yPWjBcpxj0zysRLG5uVWS6m8TAf37B a+ZF7p+nRf3g5kfrx3QDU9f2mbbkivokaafl/DUUg5rnRDd3etaf5A+Wj96oKg== Date: Thu, 20 Jun 2024 05:50:06 +0200 From: Maxime Chevallier To: Jakub Kicinski Cc: davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Andrew Lunn , Eric Dumazet , Paolo Abeni , Russell King , linux-arm-kernel@lists.infradead.org, Christophe Leroy , Herve Codina , Florian Fainelli , Heiner Kallweit , Vladimir Oltean , =?UTF-8?B?S8O2cnk=?= Maincent , Jesse Brandeburg , Marek =?UTF-8?B?QmVow7pu?= , Piergiorgio Beruto , Oleksij Rempel , =?UTF-8?B?Tmljb2zDsg==?= Veronese , Simon Horman , mwojtas@chromium.org, Nathan Chancellor , Antoine Tenart Subject: Re: [PATCH net-next v13 07/13] net: ethtool: Introduce a command to list PHYs on an interface Message-ID: <20240620055006.57337c52@fedora> In-Reply-To: <20240613181812.27d02c88@kernel.org> References: <20240607071836.911403-1-maxime.chevallier@bootlin.com> <20240607071836.911403-8-maxime.chevallier@bootlin.com> <20240613181812.27d02c88@kernel.org> Organization: Bootlin X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: maxime.chevallier@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_205022_247274_7CBB7BBA X-CRM114-Status: GOOD ( 18.10 ) 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 Jakub, Sorry about the late reply on that one, I'll follow-up with a new version shortly. On Thu, 13 Jun 2024 18:18:12 -0700 Jakub Kicinski wrote: > On Fri, 7 Jun 2024 09:18:20 +0200 Maxime Chevallier wrote: > > + it's parent PHY throug= h an SFP =20 >=20 > its good catch, thanks ! >=20 > > +static int ethnl_phy_parse_request(struct ethnl_req_info *req_base, > > + struct nlattr **tb) > > +{ > > + struct phy_link_topology *topo =3D req_base->dev->link_topo; > > + struct phy_req_info *req_info =3D PHY_REQINFO(req_base); > > + struct phy_device_node *pdn; > > + > > + if (!req_base->phydev) > > + return 0; > > + > > + if (!topo) > > + return 0; > > + > > + pdn =3D xa_load(&topo->phys, req_base->phydev->phyindex); > > + memcpy(&req_info->pdn, pdn, sizeof(*pdn)); =20 >=20 > > + xa_for_each_start(&dev->link_topo->phys, ctx->phy_index, pdn, ctx->ph= y_index) { > > + ehdr =3D ethnl_dump_put(skb, cb, ETHTOOL_MSG_PHY_GET_REPLY); > > + if (!ehdr) { > > + ret =3D -EMSGSIZE; > > + break; > > + } > > + > > + ret =3D ethnl_fill_reply_header(skb, dev, ETHTOOL_A_PHY_HEADER); > > + if (ret < 0) { > > + genlmsg_cancel(skb, ehdr); > > + break; > > + } > > + > > + memcpy(&pri->pdn, pdn, sizeof(*pdn)); =20 >=20 > Why do you copy the pdn each time =F0=9F=A4=94=EF=B8=8F Now that you mention that, I think I don't need to. This dates back from when I was trying to use the ethnl helpers, where I would keep a copy of the pdn in the request context, between the parse / reply_size / fill_reply steps. I then used the same fill_reply in the dump path. Now that the code has moved away from the ethnl scaffolding I can indeed rework that so I can use the actual pdn and not a copy of it. Thanks for pointing it out. > > + return ret; > > +} > > + =20 >=20 > double new line at the end I'll fix that. Thanks, Maxime