platform: make states of NMEthtoolCoalesceState indexed by ethtool_id

System Internals / NetworkManager - Thomas Haller [redhat.com] - 22 May 2020 13:58 EDT

We already have NMEthtoolID to handle coalesce options in a way that is convenient programmatically. That is, we can iterate over all valid coalesce options (it's just an integer) and use that in a more generic way.

If NMEthtoolCoalesceState names all fields explicitly, we need explicit code that names each coalesce option. Especially since NMEthtoolCoalesceState is an internal and intermediate data structure, this is cumbersome and unnecessary.

Thereby it also fixes the issue that nm_platform_ethtool_init_coalesce() has a NMPlatform argument without actually needing it. nm_platform_ethtool_init_coalesce() does not operate on a NMPlatform instance, and should not have the appearance of being a method of NMPlatform.

1f4b19093 platform: make states of NMEthtoolCoalesceState indexed by ethtool_id
shared/nm-libnm-core-intern/nm-ethtool-utils.h | 2 +
src/devices/nm-device.c | 6 +-
src/platform/nm-platform-utils.c | 100 +++++++++++++------------
src/platform/nm-platform-utils.h | 23 +-----
src/platform/nm-platform.c | 80 --------------------
src/platform/nm-platform.h | 5 --
6 files changed, 56 insertions(+), 160 deletions(-)

Upstream: cgit.freedesktop.org


  • Share