From 3d5d136534bed3e1af50176fc36e26245ab323b9 Mon Sep 17 00:00:00 2001 From: mattprost Date: Mon, 31 Aug 2020 11:34:51 -0500 Subject: 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 --- mpm/python/usrp_mpm/sys_utils/net.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'mpm/python/usrp_mpm/sys_utils') 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 -- cgit v1.2.3