From 37785a57e02806f97012f2e4787771605ab6af78 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Tue, 25 Mar 2025 11:53:16 +0100 Subject: [PATCH] platform: use consistent naming for ethtool functions For unknown reasons (wrong copy and paste?) the getter functions had a "link" in the name. Remove it. --- src/core/devices/nm-device.c | 20 +++++++++--------- src/libnm-platform/nm-platform.c | 36 ++++++++++++++------------------ src/libnm-platform/nm-platform.h | 19 +++++++---------- 3 files changed, 34 insertions(+), 41 deletions(-) diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c index e7984c578a..2bb69e9ed3 100644 --- a/src/core/devices/nm-device.c +++ b/src/core/devices/nm-device.c @@ -2746,7 +2746,7 @@ _ethtool_features_set(NMDevice *self, if (nm_setting_ethtool_init_features(s_ethtool, ethtool_state->requested) == 0) return; - features = nm_platform_ethtool_get_link_features(platform, ethtool_state->ifindex); + features = nm_platform_ethtool_get_features(platform, ethtool_state->ifindex); if (!features) { _LOGW(LOGD_DEVICE, "ethtool: failure setting offload features (cannot read features)"); return; @@ -2865,9 +2865,9 @@ _ethtool_coalesce_set(NMDevice *self, continue; if (!has_old) { - if (!nm_platform_ethtool_get_link_coalesce(platform, - ethtool_state->ifindex, - &coalesce_old)) { + if (!nm_platform_ethtool_get_coalesce(platform, + ethtool_state->ifindex, + &coalesce_old)) { _LOGW(LOGD_DEVICE, "ethtool: failure getting coalesce settings (cannot read)"); return; } @@ -2946,7 +2946,7 @@ _ethtool_ring_set(NMDevice *self, nm_assert(g_variant_is_of_type(variant, G_VARIANT_TYPE_UINT32)); if (!has_old) { - if (!nm_platform_ethtool_get_link_ring(platform, ethtool_state->ifindex, &ring_old)) { + if (!nm_platform_ethtool_get_ring(platform, ethtool_state->ifindex, &ring_old)) { _LOGW(LOGD_DEVICE, "ethtool: failure setting ring options (cannot read existing setting)"); return; @@ -3042,9 +3042,9 @@ _ethtool_channels_set(NMDevice *self, nm_assert(g_variant_is_of_type(variant, G_VARIANT_TYPE_UINT32)); if (!has_old) { - if (!nm_platform_ethtool_get_link_channels(platform, - ethtool_state->ifindex, - &channels_old)) { + if (!nm_platform_ethtool_get_channels(platform, + ethtool_state->ifindex, + &channels_old)) { _LOGW(LOGD_DEVICE, "ethtool: failure setting channels options (cannot read existing setting)"); return; @@ -3161,7 +3161,7 @@ _ethtool_pause_set(NMDevice *self, nm_assert(g_variant_is_of_type(variant, G_VARIANT_TYPE_BOOLEAN)); if (!has_old) { - if (!nm_platform_ethtool_get_link_pause(platform, ethtool_state->ifindex, &pause_old)) { + if (!nm_platform_ethtool_get_pause(platform, ethtool_state->ifindex, &pause_old)) { _LOGW(LOGD_DEVICE, "ethtool: failure setting pause options (cannot read " "existing setting)"); @@ -3247,7 +3247,7 @@ _ethtool_eee_set(NMDevice *self, nm_assert(g_variant_is_of_type(variant, G_VARIANT_TYPE_BOOLEAN)); if (!has_old) { - if (!nm_platform_ethtool_get_link_eee(platform, ethtool_state->ifindex, &eee_old)) { + if (!nm_platform_ethtool_get_eee(platform, ethtool_state->ifindex, &eee_old)) { _LOGW(LOGD_DEVICE, "ethtool: failure setting eee options (cannot read " "existing setting)"); diff --git a/src/libnm-platform/nm-platform.c b/src/libnm-platform/nm-platform.c index 160e3c0ade..496bb4f5ee 100644 --- a/src/libnm-platform/nm-platform.c +++ b/src/libnm-platform/nm-platform.c @@ -3595,7 +3595,7 @@ nm_platform_ethtool_get_link_settings(NMPlatform *self, /*****************************************************************************/ NMEthtoolFeatureStates * -nm_platform_ethtool_get_link_features(NMPlatform *self, int ifindex) +nm_platform_ethtool_get_features(NMPlatform *self, int ifindex) { _CHECK_SELF_NETNS(self, klass, netns, NULL); @@ -3640,9 +3640,7 @@ nm_platform_ethtool_set_fec_mode(NMPlatform *self, int ifindex, uint32_t fec_mod } gboolean -nm_platform_ethtool_get_link_coalesce(NMPlatform *self, - int ifindex, - NMEthtoolCoalesceState *coalesce) +nm_platform_ethtool_get_coalesce(NMPlatform *self, int ifindex, NMEthtoolCoalesceState *coalesce) { _CHECK_SELF_NETNS(self, klass, netns, FALSE); @@ -3665,7 +3663,7 @@ nm_platform_ethtool_set_coalesce(NMPlatform *self, } gboolean -nm_platform_ethtool_get_link_ring(NMPlatform *self, int ifindex, NMEthtoolRingState *ring) +nm_platform_ethtool_get_ring(NMPlatform *self, int ifindex, NMEthtoolRingState *ring) { _CHECK_SELF_NETNS(self, klass, netns, FALSE); @@ -3686,9 +3684,7 @@ nm_platform_ethtool_set_ring(NMPlatform *self, int ifindex, const NMEthtoolRingS } gboolean -nm_platform_ethtool_get_link_channels(NMPlatform *self, - int ifindex, - NMEthtoolChannelsState *channels) +nm_platform_ethtool_get_channels(NMPlatform *self, int ifindex, NMEthtoolChannelsState *channels) { _CHECK_SELF_NETNS(self, klass, netns, FALSE); @@ -3711,7 +3707,7 @@ nm_platform_ethtool_set_channels(NMPlatform *self, } gboolean -nm_platform_ethtool_get_link_pause(NMPlatform *self, int ifindex, NMEthtoolPauseState *pause) +nm_platform_ethtool_get_pause(NMPlatform *self, int ifindex, NMEthtoolPauseState *pause) { _CHECK_SELF_NETNS(self, klass, netns, FALSE); @@ -3721,17 +3717,6 @@ nm_platform_ethtool_get_link_pause(NMPlatform *self, int ifindex, NMEthtoolPause return nmp_utils_ethtool_get_pause(ifindex, pause); } -gboolean -nm_platform_ethtool_get_link_eee(NMPlatform *self, int ifindex, NMEthtoolEEEState *eee) -{ - _CHECK_SELF_NETNS(self, klass, netns, FALSE); - - g_return_val_if_fail(ifindex > 0, FALSE); - g_return_val_if_fail(eee, FALSE); - - return nmp_utils_ethtool_get_eee(ifindex, eee); -} - gboolean nm_platform_ethtool_set_pause(NMPlatform *self, int ifindex, const NMEthtoolPauseState *pause) { @@ -3742,6 +3727,17 @@ nm_platform_ethtool_set_pause(NMPlatform *self, int ifindex, const NMEthtoolPaus return nmp_utils_ethtool_set_pause(ifindex, pause); } +gboolean +nm_platform_ethtool_get_eee(NMPlatform *self, int ifindex, NMEthtoolEEEState *eee) +{ + _CHECK_SELF_NETNS(self, klass, netns, FALSE); + + g_return_val_if_fail(ifindex > 0, FALSE); + g_return_val_if_fail(eee, FALSE); + + return nmp_utils_ethtool_get_eee(ifindex, eee); +} + gboolean nm_platform_ethtool_set_eee(NMPlatform *self, int ifindex, const NMEthtoolEEEState *eee) { diff --git a/src/libnm-platform/nm-platform.h b/src/libnm-platform/nm-platform.h index 4c783ac2e9..4ddc224d59 100644 --- a/src/libnm-platform/nm-platform.h +++ b/src/libnm-platform/nm-platform.h @@ -2631,7 +2631,7 @@ gboolean nm_platform_ethtool_get_link_settings(NMPlatform *self, guint32 *out_speed, NMPlatformLinkDuplexType *out_duplex); -NMEthtoolFeatureStates *nm_platform_ethtool_get_link_features(NMPlatform *self, int ifindex); +NMEthtoolFeatureStates *nm_platform_ethtool_get_features(NMPlatform *self, int ifindex); gboolean nm_platform_ethtool_set_features( NMPlatform *self, int ifindex, @@ -2639,22 +2639,20 @@ gboolean nm_platform_ethtool_set_features( const NMOptionBool *requested /* indexed by NMEthtoolID - _NM_ETHTOOL_ID_FEATURE_FIRST */, gboolean do_set /* or reset */); -gboolean nm_platform_ethtool_get_link_coalesce(NMPlatform *self, - int ifindex, - NMEthtoolCoalesceState *coalesce); +gboolean +nm_platform_ethtool_get_coalesce(NMPlatform *self, int ifindex, NMEthtoolCoalesceState *coalesce); gboolean nm_platform_ethtool_set_coalesce(NMPlatform *self, int ifindex, const NMEthtoolCoalesceState *coalesce); -gboolean nm_platform_ethtool_get_link_ring(NMPlatform *self, int ifindex, NMEthtoolRingState *ring); +gboolean nm_platform_ethtool_get_ring(NMPlatform *self, int ifindex, NMEthtoolRingState *ring); gboolean nm_platform_ethtool_set_ring(NMPlatform *self, int ifindex, const NMEthtoolRingState *ring); -gboolean nm_platform_ethtool_get_link_channels(NMPlatform *self, - int ifindex, - NMEthtoolChannelsState *channels); +gboolean +nm_platform_ethtool_get_channels(NMPlatform *self, int ifindex, NMEthtoolChannelsState *channels); gboolean nm_platform_ethtool_set_channels(NMPlatform *self, int ifindex, @@ -2664,10 +2662,9 @@ gboolean nm_platform_ethtool_get_fec_mode(NMPlatform *self, int ifindex, uint32_ gboolean nm_platform_ethtool_set_fec_mode(NMPlatform *self, int ifindex, uint32_t fec_mode); -gboolean -nm_platform_ethtool_get_link_pause(NMPlatform *self, int ifindex, NMEthtoolPauseState *pause); +gboolean nm_platform_ethtool_get_pause(NMPlatform *self, int ifindex, NMEthtoolPauseState *pause); -gboolean nm_platform_ethtool_get_link_eee(NMPlatform *self, int ifindex, NMEthtoolEEEState *eee); +gboolean nm_platform_ethtool_get_eee(NMPlatform *self, int ifindex, NMEthtoolEEEState *eee); gboolean nm_platform_ethtool_set_pause(NMPlatform *self, int ifindex, const NMEthtoolPauseState *pause);