summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2019-04-04 10:22:40 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2019-04-04 15:35:13 +0200
commit8698f512d793db2034745fbff4b5444287b1d48c (patch)
tree4fd383d40603869bcb6f0e7a6fc17f1a628ea7b0
parentdc64745dd8b4a48af132a7ddbecd9ce51dcd86bb (diff)
downloadNetworkManager-8698f512d793db2034745fbff4b5444287b1d48c.tar.gz
platform: assume 'sriov_drivers_autoprobe' is 1 when sysfs file is missing
'sriov_drivers_autoprobe' was added in kernel 4.12. With previous kernel versions NM is currently unable to set any SR-IOV parameter because it tries to read 'sriov_drivers_autoprobe' which doesn't exist, assumes that current value is -1 and tries to change it, failing. When the file doesn't exist, drivers are automatically probed so we can assume the value is 1. In this way NM is able to activate a connection with sriov.autoprobe-drivers=1 (the default) even on older kernel versions. Fixes: 1e41495d9a1b ('platform: sriov: write new values when we can't read old ones') https://bugzilla.redhat.com/show_bug.cgi?id=1695093
-rw-r--r--src/platform/nm-linux-platform.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index 31ef6de4e2..e2f138e8aa 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -6662,6 +6662,14 @@ link_set_sriov_params (NMPlatform *platform,
ifname,
"device/sriov_drivers_autoprobe"),
10, 0, 1, -1);
+
+ if ( current_autoprobe == -1
+ && errno == ENOENT) {
+ /* older kernel versions don't have this sysctl. Assume the value is
+ * "1". */
+ current_autoprobe = 1;
+ }
+
if ( current_num == num_vfs
&& (autoprobe == NM_TERNARY_DEFAULT || current_autoprobe == autoprobe))
return TRUE;