Re: [RFC PATCH net-next 4/7] net: ethtool: add a netlink command to list PHYs

From: Andrew Lunn
Date: Tue Sep 12 2023 - 12:29:49 EST


> +static int phy_list_fill_reply(struct sk_buff *skb,
> + const struct ethnl_req_info *req_base,
> + const struct ethnl_reply_data *reply_base)
> +{
> + const struct phy_list_reply_data *data = PHY_LIST_REPDATA(reply_base);
> +
> + if (nla_put_u8(skb, ETHTOOL_A_PHY_LIST_COUNT, data->n_phys))
> + return -EMSGSIZE;
> +
> + if (!data->n_phys)
> + return 0;
> +
> + if (nla_put(skb, ETHTOOL_A_PHY_LIST_INDEX, sizeof(u32) * data->n_phys,
> + data->phy_indices))
> + return -EMSGSIZE;
> +

Can we add additional information here to allow mapping to what is
under /sys ? A PHY has an struct device, so has a name. So maybe that
can be included?

Andrew