Re: [PATCH ethtool-next v2 3/3] ethtool: Introduce a command to list PHYs

Michal Kubecek
2024-09-01T22:07:58Z

[-- Attachment #1: Type: text/plain, Size: 1386 bytes --]

On Wed, Aug 28, 2024 at 05:25:10PM +0200, Maxime Chevallier wrote:
> It is now possible to list all Ethernet PHYs that are present behind a
> given interface, since the following linux commit :
> 63d5eaf35ac3 ("net: ethtool: Introduce a command to list PHYs on an interface")
>
> This command relies on the netlink DUMP command to list them, by allowing to
> pass an interface name/id as a parameter in the DUMP request to only
> list PHYs on one interface.
>
> Therefore, we introduce a new helper function to prepare a interface-filtered
> dump request (the filter can be empty, to perform an unfiltered dump),
> and then uses it to implement PHY enumeration through the --show-phys
> command.
>
> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
> ---
[...]
> diff --git a/netlink/extapi.h b/netlink/extapi.h
> index c882295..fd99610 100644
> --- a/netlink/extapi.h
> +++ b/netlink/extapi.h
> @@ -56,6 +56,7 @@ int nl_set_mm(struct cmd_context *ctx);
> int nl_gpse(struct cmd_context *ctx);
> int nl_spse(struct cmd_context *ctx);
> int nl_flash_module_fw(struct cmd_context *ctx);
> +int nl_get_phy(struct cmd_context *ctx);
>
> void nl_monitor_usage(void);
>

Please add also a fallback to !ETHTOOL_ENABLE_NETLINK branch, similar
to other netlink handlers, so that a build with --disable-netlink does
not fail.

Michal

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]