[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250224143339.3e9ba797@kmaincent-XPS-13-7390>
Date: Mon, 24 Feb 2025 14:33:39 +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>, Russell King <linux@...linux.org.uk>, 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>, Vladimir Oltean
<vladimir.oltean@....com>, Oleksij Rempel <o.rempel@...gutronix.de>, Simon
Horman <horms@...nel.org>, Romain Gantois <romain.gantois@...tlin.com>
Subject: Re: [PATCH net-next 05/13] net: phy: Use an internal, searchable
storage for the linkmodes
On Sat, 22 Feb 2025 15:27:17 +0100
Maxime Chevallier <maxime.chevallier@...tlin.com> wrote:
Only small typos:
> The canonical definition for all the link modes is in linux/ethtol.h,
ethtool
> which is complemented by the link_mode_params array stored in
> net/ethtool/common.h . That array contains all the metadata about each
> of these modes, including the Speed and Duplex information.
>
> Phylib and phylink needs that information as well for internal
> managmement of the link, which was done by duplicating that information
management
> in locally-stored arrays and lookup functions. This makes it easy for
> developpers adding new modes to forget modifying phylib and phylink
> accordingly.
>
> However, the link_mode_params array in net/ethtool/common.c is fairly
> inefficient to search through, as it isn't sorted in any manner. Phylib
> and phylink perform a lot of lookup operations, mostly to filter modes
> by speed and/or duplex.
>
> We therefore introduce the link_caps private array in phy_caps.c, that
> indexes linkmodes in a more efficient manner. Each element associated a
> tuple <speed, duplex> to a bitfield of all the linkmodes runs at these
> speed/duplex.
>
> We end-up with an array that's fairly short, easily addressable and that
> it optimised for the typical use-cases of phylib/phylink.
>
> That array is initialized at the same time as phylib. As the
> link_mode_params array is part of the net stack, which phylink depends
> on, it should always be accessible from phylib.
The rest looks ok for me.
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
Powered by blists - more mailing lists