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 2511FC624B4 for ; Thu, 23 Nov 2023 13:41:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=vp19hNXp0oPoLY6j+cAw3usFCRmxdWA+TxsnS9L9RUw=; b=rc1c+eZKbF8Kr0 4D8HWyR5FUP/+ziLwqnkqZv7C4jzeQ05Ei6pQ/2OUN/Qe5vuTkbBz31xQbbQc+B2skw0FrQb7mJp1 /aCbu0I4Vu9PAk19Iw1dTurJXRikkE+VjccyGQ+h/7HXfZS/HoDCJUA7BMd5sCbcAJfniH8i93UwP n9oQ6f8w3mYlVR/VVdLlSFUDTm5Pk0eqeqpQxF4WNv9m9sMjk71zaG9PacLg0GQtdti1QaV1qc7BH wZACqAKRCpusgmA7yOBcVed/sJ2gUN+Hkh5ZVHU4lxaTNg0oJyTcBsNtFJr/5Qii2b5UC85N1ke25 ZbwMmVROSsLW5Tb6f4PA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r69wu-004uwC-29; Thu, 23 Nov 2023 13:40:56 +0000 Received: from relay8-d.mail.gandi.net ([2001:4b98:dc4:8::228]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r69wr-004uvh-18 for linux-arm-kernel@lists.infradead.org; Thu, 23 Nov 2023 13:40:55 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id A03BB1BF210; Thu, 23 Nov 2023 13:40:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1700746849; 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=aNsWgng4IthX8Dyj2PdimJwFQSUwFngI8Cl8W1jSZbY=; b=XLzvxMc3JyA80XZ7DzFZE1c/zFyrU9gpu/UfROvpF+Y+didEbBGxAASiVYnFOhD4SJ4ioJ oI4+F4Q+dITEq9ItZgKaeUgagzezayOpdaQHHwA6CswlCjApW5djMeUSGuQyDD56RuejtM FWUQufdGb4K+DfcvnvulPNrwWy+BXIRar+/uz4T+nB38Jnqu8PW7QGCOD41Ur/WoEThVs3 /vzwN/rs0Hi4P/R+t0cxm6AkaNKkIM9GxqO4Zc5+ISUPe/453+DF8ljyHJfCHq6V8IOceT LIMkt4PSQy/Qgemzx7pOVlPO8Qum4RmdYFqeOWjG4zfm6o+3/Ux9h6urN/7JfQ== Date: Thu, 23 Nov 2023 14:40:45 +0100 From: Maxime Chevallier To: Andrew Lunn Cc: davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Jakub Kicinski , 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 Subject: Re: [RFC PATCH net-next v2 06/10] net: ethtool: Introduce a command to list PHYs on an interface Message-ID: <20231123144045.57574132@device.home> In-Reply-To: <97c04999-c3fe-421e-a8eb-642aff647536@lunn.ch> References: <20231117162323.626979-1-maxime.chevallier@bootlin.com> <20231117162323.626979-7-maxime.chevallier@bootlin.com> <97c04999-c3fe-421e-a8eb-642aff647536@lunn.ch> Organization: Bootlin X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-redhat-linux-gnu) MIME-Version: 1.0 X-GND-Sasl: maxime.chevallier@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231123_054053_533341_8B66C057 X-CRM114-Status: GOOD ( 14.42 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 21 Nov 2023 02:40:27 +0100 Andrew Lunn wrote: > > +ethnl_phy_reply_size(const struct ethnl_req_info *req_base, > > + struct netlink_ext_ack *extack) > > +{ > > + struct phy_device_node *pdn; > > + struct phy_device *phydev; > > + struct link_topology *lt; > > + unsigned long index; > > + size_t size; > > + > > + lt = &req_base->dev->link_topo; > > + > > + size = nla_total_size(0); > > + > > + xa_for_each(<->phys, index, pdn) { > > + phydev = pdn->phy; > > + > > + /* ETHTOOL_A_PHY_INDEX */ > > + size += nla_total_size(sizeof(u32)); > > + > > + /* ETHTOOL_A_DRVNAME */ > > + size += nla_total_size(strlen(phydev->drv->name)); > > + > > + /* ETHTOOL_A_NAME */ > > + size += nla_total_size(strlen(dev_name(&phydev->mdio.dev))); > > + > > + /* ETHTOOL_A_PHY_UPSTREAM_TYPE */ > > + size += nla_total_size(sizeof(u8)); > > + > > + /* ETHTOOL_A_PHY_ID */ > > + size += nla_total_size(sizeof(u32)); > > + > > + if (phy_on_sfp(phydev)) { > > + /* ETHTOOL_A_PHY_UPSTREAM_SFP_NAME */ > > + if (sfp_get_name(pdn->parent_sfp_bus)) > > + size += nla_total_size(strlen(sfp_get_name(pdn->parent_sfp_bus))); > > Have you tried a modular build? Now that you mention it, no. I did try with CONFIG_SFP disabled, but not as a module, I'll add it to my test suite. > > sfp_get_name() could be in a module, and then you will get linker > errors. It is all a bit messy calling into phylib from ethtool :-( > > This might actually be the only function you need? If so, its small > enough you can move it into a header as a static inline function. It's the only one indeed, so as add it as a header function then. Thanks, Maxime > Andrew _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel