From d5f062cecd0495273d7e18dd9cf1843909d8167a Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 30 Aug 2021 19:24:58 +0200 Subject: [PATCH] core: during reset of ethtool autoneg enable all modes --- src/core/devices/nm-device-ethernet.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/core/devices/nm-device-ethernet.c b/src/core/devices/nm-device-ethernet.c index 62993b6f8d..20f298f960 100644 --- a/src/core/devices/nm-device-ethernet.c +++ b/src/core/devices/nm-device-ethernet.c @@ -943,9 +943,20 @@ link_negotiation_set(NMDevice *device) if (!priv->ethtool_prev_set) { /* remember the values we had before setting it. */ priv->ethtool_prev_autoneg = link_autoneg; - priv->ethtool_prev_speed = link_speed; - priv->ethtool_prev_duplex = link_duplex; - priv->ethtool_prev_set = TRUE; + if (link_autoneg) { + /* with autoneg, we only support advertising one speed/duplex. Likewise + * our nm_platform_ethtool_get_link_settings() can only return the current + * speed/duplex, but not all the modes that we were advertising. + * + * Do the best we can do: remember to re-enable autoneg, but don't restrict + * the mode. */ + priv->ethtool_prev_speed = 0; + priv->ethtool_prev_duplex = NM_PLATFORM_LINK_DUPLEX_UNKNOWN; + } else { + priv->ethtool_prev_speed = link_speed; + priv->ethtool_prev_duplex = link_duplex; + } + priv->ethtool_prev_set = TRUE; } if (!nm_platform_ethtool_set_link_settings(nm_device_get_platform(device),