diff options
author | Maxime Chevallier <maxime.chevallier@bootlin.com> | 2025-03-07 18:35:59 +0100 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2025-03-18 09:03:11 +0100 |
commit | d8c838a57ce25c746c9882ffa427d8bb3f22b526 (patch) | |
tree | 8b359d4d6ca3bc854824e213ad004447bdb49bdc /drivers/dma-buf/dma-buf.c | |
parent | 79f88a584e35133359c394506b351a60230cf37b (diff) |
net: phy: Use an internal, searchable storage for the linkmodes
The canonical definition for all the link modes is in linux/ethtool.h,
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
management of the link, which was done by duplicating that information
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.
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Link: https://patch.msgid.link/20250307173611.129125-3-maxime.chevallier@bootlin.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'drivers/dma-buf/dma-buf.c')
0 files changed, 0 insertions, 0 deletions