merge: branch 'fix_sriov'
sriov: only valid sriov capacity when enabled https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2051
This commit is contained in:
@@ -9507,6 +9507,7 @@ check_connection_compatible(NMDevice *self,
|
||||
NMSettingMatch *s_match;
|
||||
const GSList *specs;
|
||||
gboolean has_match = FALSE;
|
||||
NMSettingSriov *s_sriov = NULL;
|
||||
|
||||
klass = NM_DEVICE_GET_CLASS(self);
|
||||
if (klass->connection_type_check_compatible) {
|
||||
@@ -9524,12 +9525,14 @@ check_connection_compatible(NMDevice *self,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!nm_device_has_capability(self, NM_DEVICE_CAP_SRIOV)
|
||||
&& nm_connection_get_setting(connection, NM_TYPE_SETTING_SRIOV)) {
|
||||
nm_utils_error_set_literal(error,
|
||||
NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
|
||||
"device does not support SR-IOV");
|
||||
return FALSE;
|
||||
if (!nm_device_has_capability(self, NM_DEVICE_CAP_SRIOV)) {
|
||||
s_sriov = (NMSettingSriov *) nm_connection_get_setting(connection, NM_TYPE_SETTING_SRIOV);
|
||||
if (s_sriov && nm_setting_sriov_get_total_vfs(s_sriov)) {
|
||||
nm_utils_error_set_literal(error,
|
||||
NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
|
||||
"device does not support SR-IOV");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
conn_iface = nm_manager_get_connection_iface(NM_MANAGER_GET, connection, NULL, NULL, &local);
|
||||
@@ -10140,7 +10143,7 @@ activate_stage1_device_prepare(NMDevice *self)
|
||||
s_sriov = nm_device_get_applied_setting(self, NM_TYPE_SETTING_SRIOV);
|
||||
}
|
||||
|
||||
if (s_sriov) {
|
||||
if (s_sriov && nm_device_has_capability(self, NM_DEVICE_CAP_SRIOV)) {
|
||||
nm_auto_freev NMPlatformVF **plat_vfs = NULL;
|
||||
gs_free_error GError *error = NULL;
|
||||
NMSriovVF *vf;
|
||||
@@ -10148,8 +10151,6 @@ activate_stage1_device_prepare(NMDevice *self)
|
||||
guint num;
|
||||
guint i;
|
||||
|
||||
nm_assert(nm_device_has_capability(self, NM_DEVICE_CAP_SRIOV));
|
||||
|
||||
autoprobe = nm_setting_sriov_get_autoprobe_drivers(s_sriov);
|
||||
if (autoprobe == NM_TERNARY_DEFAULT) {
|
||||
autoprobe = nm_config_data_get_connection_default_int64(
|
||||
|
Reference in New Issue
Block a user