summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-09-10 16:47:42 +0200
committerChristian Poessinger <christian@poessinger.com>2021-09-10 16:49:53 +0200
commite2b7e1766cc22c5cd718a5001be6336bdca92eec (patch)
tree63af551f9e315c72dd1dc3142b47ab9822765caf
parent07840977834816b69fa3b366817d90f44b5dc7a7 (diff)
downloadvyos-1x-e2b7e1766cc22c5cd718a5001be6336bdca92eec.tar.gz
vyos-1x-e2b7e1766cc22c5cd718a5001be6336bdca92eec.zip
ethernet: T3802: not all NICs support reading speed/duplex settings in all states
Turns out an AX88179 USB 3.0 NIC does not support reading back the speed and duplex settings in every operating state. While the NIC is beeing initialized, reading the speed setting will return: $ cat /sys/class/net/eth6/speed cat: /sys/class/net/eth6/speed: Invalid argument Thus if this happens, we simply tell the system that the current NIC speed matches the requested speed and nothing is changed at this point in time.
-rw-r--r--python/vyos/ifconfig/ethernet.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/python/vyos/ifconfig/ethernet.py b/python/vyos/ifconfig/ethernet.py
index 50e865203..d06b0a842 100644
--- a/python/vyos/ifconfig/ethernet.py
+++ b/python/vyos/ifconfig/ethernet.py
@@ -143,9 +143,12 @@ class EthernetIf(Interface):
# bail out early as nothing is to change
return
else:
- # read in current speed and duplex settings
- cur_speed = read_file(f'/sys/class/net/{ifname}/speed')
- cur_duplex = read_file(f'/sys/class/net/{ifname}/duplex')
+ # XXX: read in current speed and duplex settings
+ # There are some "nice" NICs like AX88179 which do not support
+ # reading the speed thus we simply fallback to the supplied speed
+ # to not cause any change here and raise an exception.
+ cur_speed = read_file(f'/sys/class/net/{ifname}/speed', speed)
+ cur_duplex = read_file(f'/sys/class/net/{ifname}/duplex', duplex)
if (cur_speed == speed) and (cur_duplex == duplex):
# bail out early as nothing is to change
return