lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250325143411.241053ec@kmaincent-XPS-13-7390>
Date: Tue, 25 Mar 2025 14:34:11 +0100
From: Kory Maincent <kory.maincent@...tlin.com>
To: Maxime Chevallier <maxime.chevallier@...tlin.com>
Cc: davem@...emloft.net, Andrew Lunn <andrew@...n.ch>, Jakub Kicinski
 <kuba@...nel.org>, Eric Dumazet <edumazet@...gle.com>, Paolo Abeni
 <pabeni@...hat.com>, Heiner Kallweit <hkallweit1@...il.com>,
 netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
 thomas.petazzoni@...tlin.com, linux-arm-kernel@...ts.infradead.org,
 Christophe Leroy <christophe.leroy@...roup.eu>, Herve Codina
 <herve.codina@...tlin.com>, Florian Fainelli <f.fainelli@...il.com>,
 Russell King <linux@...linux.org.uk>, Vladimir Oltean
 <vladimir.oltean@....com>, Oleksij Rempel <o.rempel@...gutronix.de>, Simon
 Horman <horms@...nel.org>, Romain Gantois <romain.gantois@...tlin.com>,
 Piergiorgio Beruto <piergiorgio.beruto@...il.com>
Subject: Re: [PATCH net-next v4 5/8] net: ethtool: netlink: Introduce
 per-phy DUMP helpers

On Mon, 24 Mar 2025 11:40:07 +0100
Maxime Chevallier <maxime.chevallier@...tlin.com> wrote:

> As there are multiple ethnl commands that report messages based on
> phy_device information, let's introduce a set of ethnl generic dump
> helpers to allow DUMP support for each PHY on a given netdev.
> 
> This logic iterates over the phy_link_topology of each netdev (or a
> single netdev for filtered DUMP), and call ethnl_default_dump_one() with
> the req_info populated with ifindex + phyindex.
> 
> This allows re-using all the existing infra for phy-targetting commands
> that already use ethnl generic helpers.
> 
> Signed-off-by: Maxime Chevallier <maxime.chevallier@...tlin.com>
> ---
> V4 : No changes
> 
>  net/ethtool/netlink.c | 78 +++++++++++++++++++++++++++++++++++++++++++
>  net/ethtool/netlink.h |  6 ++++
>  2 files changed, 84 insertions(+)
> 
> diff --git a/net/ethtool/netlink.c b/net/ethtool/netlink.c
> index 0345bffa0678..171290eaf406 100644
> --- a/net/ethtool/netlink.c
> +++ b/net/ethtool/netlink.c
> @@ -560,6 +560,84 @@ static int ethnl_default_dump_one(struct sk_buff *skb,
>  	return ret;
>  }
>  
> +/* Specific context for phy-targeting command DUMP operatins. We keep in
> context
> + * the latest phy_index we dumped, in case of an interrupted DUMP.
> + */
> +struct ethnl_dump_ctx_perphy {
> +	unsigned long phy_index;
> +};
> +
> +/**
> + * ethnl_dump_start_perphy() - Initialise a dump for PHY cmds
> + * @ctx: Generic ethnl dump context whose cmd_ctx will be initialized
> + *
> + * Initializes a dump context for ethnl commands that may return
> + * one message per PHY on a single netdev.
> + *
> + * Returns: 0 for success, a negative value for errors.

Minimal nitpick. In the kernel doc Return does not take a s.

> +/**
> + * ethnl_dump_one_dev_perphy() - Dump all PHY-related messages for one netdev
> + * @skb: skb containing the DUMP result
> + * @ctx: Dump context. Will be kept across the DUMP operation.
> + * @info: Genl receive info
> + *
> + * Some commands are related to PHY devices attached to netdevs. As there
> may be
> + * multiple PHYs, this DUMP handler will populate the reply with one message
> per
> + * PHY on a single netdev.
> + *
> + * Returns: 0 for success or when nothing to do, a negative value otherwise.

Same.

Reviewed-by: Kory Maincent <kory.maincent@...tlin.com>

Thank you!
-- 
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ