From 99cb791813e416c62010a629939b36a4fc31548d Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 28 Feb 2020 13:55:40 +0100 Subject: device: allow scheduling nm_device_activate_schedule_stage2_device_config() right away We usually want to schedule stage2 when we just completed with the previous stage (or, if we are currently in stage2, and want to re-enter it). In those cases, the conditions are often right to just proceed right away. No need to schedule the stage on an idle handler. Allow to invoke stage2 right away. --- src/devices/nm-device-private.h | 3 ++- src/devices/nm-device.c | 20 +++++++++----------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/devices/nm-device-private.h b/src/devices/nm-device-private.h index dc8a33f98e..8d539026e7 100644 --- a/src/devices/nm-device-private.h +++ b/src/devices/nm-device-private.h @@ -73,7 +73,8 @@ void nm_device_set_firmware_missing (NMDevice *self, gboolean missing); void nm_device_activate_schedule_stage1_device_prepare (NMDevice *device, gboolean do_sync); -void nm_device_activate_schedule_stage2_device_config (NMDevice *device); +void nm_device_activate_schedule_stage2_device_config (NMDevice *device, + gboolean do_sync); void nm_device_activate_schedule_ip_config_result (NMDevice *device, int addr_family, diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index e712d5813b..63cffc6235 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -691,8 +691,6 @@ static void (*const activate_stage4_ip_config_timeout_x[2]) (NMDevice *self) = { static void sriov_op_cb (GError *error, gpointer user_data); -static void activate_stage2_device_config (NMDevice *self); - static void activate_stage5_ip_config_result_4 (NMDevice *self); static void activate_stage5_ip_config_result_6 (NMDevice *self); @@ -6726,7 +6724,7 @@ activate_stage1_device_prepare (NMDevice *self) if (master) master_ready (self, active); - activation_source_invoke_sync (self, activate_stage2_device_config, AF_INET); + nm_device_activate_schedule_stage2_device_config (self, TRUE); } void @@ -7105,18 +7103,18 @@ activate_stage2_device_config (NMDevice *self) nm_device_activate_schedule_stage3_ip_config_start (self); } -/* - * nm_device_activate_schedule_stage2_device_config - * - * Schedule setup of the hardware device - * - */ void -nm_device_activate_schedule_stage2_device_config (NMDevice *self) +nm_device_activate_schedule_stage2_device_config (NMDevice *self, + gboolean do_sync) { g_return_if_fail (NM_IS_DEVICE (self)); - activation_source_schedule (self, activate_stage2_device_config, AF_INET); + if (!do_sync) { + activation_source_schedule (self, activate_stage2_device_config, AF_INET); + return; + } + + activation_source_invoke_sync (self, activate_stage2_device_config, AF_INET); } void -- cgit v1.2.1