[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231123144045.57574132@device.home>
Date: Thu, 23 Nov 2023 14:40:45 +0100
From: Maxime Chevallier <maxime.chevallier@...tlin.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: davem@...emloft.net, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, thomas.petazzoni@...tlin.com,
Jakub Kicinski <kuba@...nel.org>,
Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>,
Russell King <linux@...linux.org.uk>,
linux-arm-kernel@...ts.infradead.org,
Christophe Leroy <christophe.leroy@...roup.eu>,
Herve Codina <herve.codina@...tlin.com>,
Florian Fainelli <f.fainelli@...il.com>,
Heiner Kallweit <hkallweit1@...il.com>,
Vladimir Oltean <vladimir.oltean@....com>,
Köry Maincent <kory.maincent@...tlin.com>,
Jesse Brandeburg <jesse.brandeburg@...el.com>
Subject: Re: [RFC PATCH net-next v2 06/10] net: ethtool: Introduce a command
to list PHYs on an interface
On Tue, 21 Nov 2023 02:40:27 +0100
Andrew Lunn <andrew@...n.ch> 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
Powered by blists - more mailing lists