diff options
author | mattprost <matt.prost@ni.com> | 2020-08-31 11:34:51 -0500 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2020-09-01 15:19:30 -0500 |
commit | 3d5d136534bed3e1af50176fc36e26245ab323b9 (patch) | |
tree | 36504c732b7d35e564a4261c9d2e83509b8869bc | |
parent | 97cb396297828f57bba455a275966c58f1abce6e (diff) | |
download | uhd-3d5d136534bed3e1af50176fc36e26245ab323b9.tar.gz uhd-3d5d136534bed3e1af50176fc36e26245ab323b9.tar.bz2 uhd-3d5d136534bed3e1af50176fc36e26245ab323b9.zip |
mpm: Return 10 Gbs link speed on failure
The sysfs call used to determine link speed occasionally will fail and
return -1. In order to mitigate side effects from this behavior, return
10 Gbs link speed instead of 1 Gbs. This mitigates problems that occur
when this issue is seen on 10GbE ports. This approach was elected over
returning -1 to be handled on the host side in order to avoid breaking
mpm compatibility.
Signed-off-by: ettus <matt.prost@ni.com>
-rw-r--r-- | mpm/python/usrp_mpm/sys_utils/net.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mpm/python/usrp_mpm/sys_utils/net.py b/mpm/python/usrp_mpm/sys_utils/net.py index 42eb9de62..a9be7b87d 100644 --- a/mpm/python/usrp_mpm/sys_utils/net.py +++ b/mpm/python/usrp_mpm/sys_utils/net.py @@ -87,6 +87,13 @@ def get_link_speed(ifname): if device.sys_name == ifname][0] speed = net_sysfs.attributes.asint('speed') + # FIXME: This sysfs call occasionally returns -1 as the speed if the connection is at all + # flaky. Returning 10 Gbs rather than 1 Gbs in this case mitigates negative side + # effects in the driver when this occurs on 10GbE ports without breaking mpm + # compatability. + if (speed < 0): + return 10000 + # TODO: 1Gige driver returns a bad value (less than 1000). Remove the conditional once the # driver is fixed return speed if speed >= 10000 else 1000 |