diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index b05c50de48..2ee478cdcf 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -7254,7 +7254,7 @@ link_supports_sriov (NMPlatform *platform, int ifindex) nm_auto_pop_netns NMPNetns *netns = NULL; nm_auto_close int dirfd = -1; char ifname[IFNAMSIZ]; - int total = -1; + int num = -1; if (!nm_platform_netns_push (platform, &netns)) return FALSE; @@ -7263,13 +7263,13 @@ link_supports_sriov (NMPlatform *platform, int ifindex) if (dirfd < 0) return FALSE; - total = nm_platform_sysctl_get_int32 (platform, - NMP_SYSCTL_PATHID_NETDIR (dirfd, - ifname, - "device/sriov_totalvfs"), - -1); + num = nm_platform_sysctl_get_int32 (platform, + NMP_SYSCTL_PATHID_NETDIR (dirfd, + ifname, + "device/sriov_numvfs"), + -1); - return total > 0; + return num != -1; } static int @@ -7412,15 +7412,7 @@ link_set_sriov_params_async (NMPlatform *platform, ifname, "device/sriov_totalvfs"), 10, 0, G_MAXUINT, 0); - if (errno) { - g_set_error (&error, - NM_UTILS_ERROR, - NM_UTILS_ERROR_UNKNOWN, - "failed reading sriov_totalvfs value: %s", - nm_strerror_native (errno)); - goto out_idle; - } - if (num_vfs > total) { + if (!errno && num_vfs > total) { _LOGW ("link: %d only supports %u VFs (requested %u)", ifindex, total, num_vfs); num_vfs = total; }