Re: [PATCH net-next v5 07/13] net: ethtool: Introduce a command to list PHYs on an interface

From: Jakub Kicinski
Date: Fri Jan 05 2024 - 10:39:57 EST


On Fri, 5 Jan 2024 10:43:11 +0100 Maxime Chevallier wrote:
> > > +static int ethnl_phy_parse_request(struct ethnl_req_info *req_base,
> > > + struct nlattr **tb)
> > > +{
> > > + struct phy_link_topology *topo = &req_base->dev->link_topo;
> > > + struct phy_req_info *req_info = PHY_REQINFO(req_base);
> > > + struct phy_device_node *pdn;
> > > +
> > > + if (!req_base->phydev)
> > > + return 0;
> >
> > The PHY INDEX should probably be a required attr, with
> > GENL_REQ_ATTR_CHECK()? Without phydev being specified
> > what's the point?
>
> We can still have a phydev without passing a PHY INDEX, this would
> report information on the netdev->phydev device, that can be helpful
> for users to know which PHY is targeted by commands such as "ethtool
> --cable-test eth0" when no PHY index is passed

But req_base->phydev will be netdev->phydev if user didn't specify
the index. Are you saying this is for commands which can operate
on netdevs as well as on PHYs (e.g. "integrated NICs" which don't
user phylib?)