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 BE283C2BD09 for ; Wed, 3 Jul 2024 14:54:59 +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:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=GJQEvoz0wIDeZIENvMBRDSvSZb0uYILKO4p51jsjWXc=; b=c+3gfMtg9zQ1yQKQ5oip5a7zDg Xb5VS/CSrmZ52brunRRTDxYtVxPaOrxMH/oCB1TEDDI4FJjw4ra1LXGigGrhDFFgbPOTL4H+TL7xC xH9tIlLgehgzB600miL683SEPLOqVsOtkVOiJhzvQ1TtPGlHlrVvhvHBRvCT0LId0NOr286JTf/GI oqLEK+4LrzkRQ/4uMAn0RgmXK853qd433HtSnfhWjqk24asQfcZE1TclaV66du+boQjHxywwnL9UV r3li4ZzX+ByClHhPbES3KPyTCfedzu4yTHDtR0hj2QEHBNSxugkm9i8eC5vC0fo4nQFXPnfmIAqEl dpk8qYkg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP1Nf-0000000AY5V-3Esx; Wed, 03 Jul 2024 14:54:47 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP1NT-0000000AXlO-3fOU for linux-arm-kernel@lists.infradead.org; Wed, 03 Jul 2024 14:54:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=GJQEvoz0wIDeZIENvMBRDSvSZb0uYILKO4p51jsjWXc=; b=wNFCYmoNy49f91CpMZqn4/Iq1L KPLRCCAc3T61tv7x98xHEt73VD10OoEeAz/OADbqdIBgmLSCisoT/x0g4rwlJ2yTinMIW4sWg4McX 7yPiHZWXr4wSWbyyKFsYPCSEaHlbv1ADF6sXlyJuKGsmRNQjsP7NEZStkLQZKPyduho3PWhOWINdc s5I/O1CUgzZgTZ5G4S4I4p0rtN3sLCeZVO+qYelKXUwCucRMAzqaeBEf+VLNT223H+5dIq1mArn2M rZ/nkoUeGzLHVwBEnRYSjjzQ64S6/TiuoILQo1YXS+1AQ+G1ZD3qS6AqpcL+e60LxqLDDCDj9L9OR sFxc4Tkw==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:50572) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sP1LC-0005hs-1a; Wed, 03 Jul 2024 15:52:14 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1sP1LA-00030B-8H; Wed, 03 Jul 2024 15:52:12 +0100 Date: Wed, 3 Jul 2024 15:52:12 +0100 From: "Russell King (Oracle)" To: Maxime Chevallier Cc: davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Paolo Abeni , 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 , Marek =?iso-8859-1?Q?Beh=FAn?= , Piergiorgio Beruto , Oleksij Rempel , =?iso-8859-1?Q?Nicol=F2?= Veronese , Simon Horman , mwojtas@chromium.org, Nathan Chancellor , Antoine Tenart , Marc Kleine-Budde , Dan Carpenter Subject: Re: [PATCH net-next v15 07/14] net: ethtool: Introduce a command to list PHYs on an interface Message-ID: References: <20240703140806.271938-1-maxime.chevallier@bootlin.com> <20240703140806.271938-8-maxime.chevallier@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240703140806.271938-8-maxime.chevallier@bootlin.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240703_075435_934583_9D81BE72 X-CRM114-Status: GOOD ( 13.57 ) 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 On Wed, Jul 03, 2024 at 04:07:57PM +0200, Maxime Chevallier wrote: > +static int > +ethnl_phy_fill_reply(const struct ethnl_req_info *req_base, struct sk_buff *skb) > +{ > + struct phy_req_info *req_info = PHY_REQINFO(req_base); > + struct phy_device_node *pdn = req_info->pdn; > + struct phy_device *phydev = pdn->phy; > + enum phy_upstream ptype; > + > + ptype = pdn->upstream_type; > + > + if (nla_put_u32(skb, ETHTOOL_A_PHY_INDEX, phydev->phyindex) || > + nla_put_string(skb, ETHTOOL_A_PHY_NAME, dev_name(&phydev->mdio.dev)) || > + nla_put_u32(skb, ETHTOOL_A_PHY_UPSTREAM_TYPE, ptype) || > + nla_put_u32(skb, ETHTOOL_A_PHY_ID, phydev->phy_id)) > + return -EMSGSIZE; I'm really not sure that it is a good idea to export phydev->phy_id through this API. Clause 45-only PHYs don't have a phy_id, they have a whole bunch of IDs (actually, two per MMD - a device ID and a package ID. I think the package ID is supposed to be the same for all MMDs, but in practice it isn't. For example, 88x3310 uses: MMD devid pkgid 1 002b09aa 002b09aa 3 002b09aa 002b09aa 4 01410daa 01410daa 7 002b09aa 002b09aa So, if we want to report the ID of the PHY, then really we need to report the clause 22 ID, and at least all the devids of each MMD in a clause 45 PHY. Alternatively, we may decide it isn't worth the effort of reporting any of these IDs. However, reporting just the clause 22 ID would be a design error IMHO. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!