diff options
Diffstat (limited to 'src/devices/nm-device-ethernet.c')
| -rw-r--r-- | src/devices/nm-device-ethernet.c | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c index 6c5e33e4..87d16dbe 100644 --- a/src/devices/nm-device-ethernet.c +++ b/src/devices/nm-device-ethernet.c @@ -753,13 +753,6 @@ supplicant_interface_init (NMDeviceEthernet *self) return TRUE; } -NM_UTILS_LOOKUP_STR_DEFINE_STATIC (link_duplex_to_string, NMPlatformLinkDuplexType, - NM_UTILS_LOOKUP_DEFAULT_WARN (NULL), - NM_UTILS_LOOKUP_STR_ITEM (NM_PLATFORM_LINK_DUPLEX_UNKNOWN, "unknown"), - NM_UTILS_LOOKUP_STR_ITEM (NM_PLATFORM_LINK_DUPLEX_FULL, "full"), - NM_UTILS_LOOKUP_STR_ITEM (NM_PLATFORM_LINK_DUPLEX_HALF, "half"), -); - static NMPlatformLinkDuplexType link_duplex_to_platform (const char *duplex) { @@ -787,13 +780,11 @@ link_negotiation_set (NMDevice *device) s_wired = (NMSettingWired *) nm_device_get_applied_setting (device, NM_TYPE_SETTING_WIRED); if (s_wired) { autoneg = nm_setting_wired_get_auto_negotiate (s_wired); - if (!autoneg) { - speed = nm_setting_wired_get_speed (s_wired); - duplex = link_duplex_to_platform (nm_setting_wired_get_duplex (s_wired)); - if (!speed && !duplex) { - _LOGD (LOGD_DEVICE, "set-link: ignore link negotiation"); - return; - } + speed = nm_setting_wired_get_speed (s_wired); + duplex = link_duplex_to_platform (nm_setting_wired_get_duplex (s_wired)); + if (!autoneg && !speed && !duplex) { + _LOGD (LOGD_DEVICE, "set-link: ignore link negotiation"); + return; } } @@ -804,20 +795,23 @@ link_negotiation_set (NMDevice *device) } /* If link negotiation setting are already in place do nothing and return with success */ - if ( (!!autoneg == !!link_autoneg) - && (!speed || (speed == link_speed)) - && (!duplex || (duplex == link_duplex))) { + if ( !!autoneg == !!link_autoneg + && speed == link_speed + && duplex == link_duplex) { _LOGD (LOGD_DEVICE, "set-link: link negotiation is already configured"); return; } - if (autoneg) - _LOGD (LOGD_DEVICE, "set-link: configure autonegotiation"); + if (autoneg && !speed && !duplex) + _LOGD (LOGD_DEVICE, "set-link: configure auto-negotiation"); else { - _LOGD (LOGD_DEVICE, "set-link: configure static negotiation (%u Mbit%s - %s duplex%s)", + _LOGD (LOGD_DEVICE, "set-link: configure %snegotiation (%u Mbit%s - %s duplex%s)", + autoneg ? "auto-" : "static ", speed ?: link_speed, speed ? "" : "*", - duplex ? link_duplex_to_string (duplex) : link_duplex_to_string (link_duplex), + duplex + ? nm_platform_link_duplex_type_to_string (duplex) + : nm_platform_link_duplex_type_to_string (link_duplex), duplex ? "" : "*"); } |