summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Golle2024-07-05 18:15:10 +0000
committerDaniel Golle2024-07-05 18:40:28 +0000
commit68c8a4f94cd3cfd654a52cbc8b57c5c9d99640dd (patch)
treeb8328f10bbae108e21d569faa8803d2d98cb8588
parent890929baa8164b4813212fb5e9b8541b7ec61541 (diff)
downloadnetifd-68c8a4f94cd3cfd654a52cbc8b57c5c9d99640dd.tar.gz
system-linux: re-apply ethtool on phy attachment
ethtool settings applied before the interface is in IFF_UP state are going to be lost when phylink is being used. This is the case with many modern NICs as well as when using SFP modules, resulting in the speed, duplex, *pause and autoneg settings not having any effect. Reapply ethtool settings once the PHY is attached. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
-rw-r--r--system-linux.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/system-linux.c b/system-linux.c
index 4463a2a..58c7373 100644
--- a/system-linux.c
+++ b/system-linux.c
@@ -702,6 +702,9 @@ static int system_get_arp_accept(struct device *dev, char *buf, const size_t buf
#endif
static void
+system_set_ethtool_settings(struct device *dev, struct device_settings *s);
+
+static void
system_device_update_state(struct device *dev, unsigned int flags, unsigned int ifindex)
{
if (dev->type == &simple_device_type) {
@@ -711,6 +714,9 @@ system_device_update_state(struct device *dev, unsigned int flags, unsigned int
device_set_present(dev, ifindex > 0);
}
device_set_link(dev, flags & IFF_LOWER_UP ? true : false);
+
+ if ((flags & IFF_UP) && !(flags & IFF_LOWER_UP))
+ system_set_ethtool_settings(dev, &dev->settings);
}
/* Evaluate netlink messages */