device: allow scheduling nm_device_activate_schedule_stage1_prepare() right away

There was only API to schedule the stage on an idle handler.

Sometimes, we are just in the right situation to schedule the stage
right away. It should be possibly to avoid going through the extra hop.

For now, none of the caller makes use of this. So, there isn't any
actual change in behavior. But by adding this possibility, we may do
use in the future.
This commit is contained in:
Thomas Haller 2020-02-28 13:55:40 +01:00
parent 5979972e20
commit 3d78740398
11 changed files with 28 additions and 31 deletions

View file

@ -484,7 +484,7 @@ modem_auth_result (NMModem *modem, GError *error, gpointer user_data)
}
priv->stage1_modem_prepare_state = NM_DEVICE_STAGE_STATE_INIT;
nm_device_activate_schedule_stage1_device_prepare (device);
nm_device_activate_schedule_stage1_device_prepare (device, FALSE);
}
static void
@ -519,7 +519,7 @@ modem_prepare_result (NMModem *modem,
}
priv->stage1_modem_prepare_state = NM_DEVICE_STAGE_STATE_COMPLETED;
nm_device_activate_schedule_stage1_device_prepare (NM_DEVICE (self));
nm_device_activate_schedule_stage1_device_prepare (NM_DEVICE (self), FALSE);
}
static void
@ -719,7 +719,7 @@ mm_modem_added_cb (NMModemManager *manager,
priv = NM_DEVICE_BT_GET_PRIVATE (self);
if (priv->stage1_bt_state == NM_DEVICE_STAGE_STATE_COMPLETED)
nm_device_activate_schedule_stage1_device_prepare (NM_DEVICE (self));
nm_device_activate_schedule_stage1_device_prepare (NM_DEVICE (self), FALSE);
}
/*****************************************************************************/
@ -903,7 +903,7 @@ connect_bz_cb (NMBluezManager *bz_mgr,
}
priv->stage1_bt_state = NM_DEVICE_STAGE_STATE_COMPLETED;
nm_device_activate_schedule_stage1_device_prepare (NM_DEVICE (self));
nm_device_activate_schedule_stage1_device_prepare (NM_DEVICE (self), FALSE);
}
static NMActStageReturn

View file

@ -505,7 +505,7 @@ wired_secrets_cb (NMActRequest *req,
}
supplicant_interface_release (self);
nm_device_activate_schedule_stage1_device_prepare (device);
nm_device_activate_schedule_stage1_device_prepare (device, FALSE);
}
static void
@ -954,7 +954,7 @@ pppoe_reconnect_delay (gpointer user_data)
priv->pppoe_wait_id = 0;
priv->last_pppoe_time = 0;
_LOGI (LOGD_DEVICE, "PPPoE reconnect delay complete, resuming connection...");
nm_device_activate_schedule_stage1_device_prepare (NM_DEVICE (self));
nm_device_activate_schedule_stage1_device_prepare (NM_DEVICE (self), FALSE);
return G_SOURCE_REMOVE;
}

View file

@ -306,7 +306,7 @@ macsec_secrets_cb (NMActRequest *req,
return;
}
nm_device_activate_schedule_stage1_device_prepare (device);
nm_device_activate_schedule_stage1_device_prepare (device, FALSE);
}
static void

View file

@ -71,7 +71,8 @@ gboolean nm_device_hw_addr_reset (NMDevice *device, const char *detail);
void nm_device_set_firmware_missing (NMDevice *self, gboolean missing);
void nm_device_activate_schedule_stage1_device_prepare (NMDevice *device);
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_ip_config_result (NMDevice *device,

View file

@ -1266,7 +1266,7 @@ _secrets_cb (NMActRequest *req,
return;
}
nm_device_activate_schedule_stage1_device_prepare (device);
nm_device_activate_schedule_stage1_device_prepare (device, FALSE);
}
static void

View file

@ -6438,7 +6438,7 @@ master_ready_cb (NMActiveConnection *active,
nm_assert (nm_active_connection_get_master_ready (active));
if (priv->state == NM_DEVICE_STATE_PREPARE)
nm_device_activate_schedule_stage1_device_prepare (self);
nm_device_activate_schedule_stage1_device_prepare (self, FALSE);
}
static void
@ -6586,7 +6586,7 @@ sriov_params_cb (GError *error, gpointer data)
priv->stage1_sriov_state = NM_DEVICE_STAGE_STATE_COMPLETED;
nm_device_activate_schedule_stage1_device_prepare (self);
nm_device_activate_schedule_stage1_device_prepare (self, FALSE);
}
/*
@ -6729,23 +6729,19 @@ activate_stage1_device_prepare (NMDevice *self)
activation_source_invoke_sync (self, activate_stage2_device_config, AF_INET);
}
/*
* nm_device_activate_schedule_stage1_device_prepare
*
* Prepare a device for activation
*
*/
void
nm_device_activate_schedule_stage1_device_prepare (NMDevice *self)
nm_device_activate_schedule_stage1_device_prepare (NMDevice *self,
gboolean do_sync)
{
NMDevicePrivate *priv;
g_return_if_fail (NM_IS_DEVICE (self));
g_return_if_fail (NM_DEVICE_GET_PRIVATE (self)->act_request.obj);
priv = NM_DEVICE_GET_PRIVATE (self);
g_return_if_fail (priv->act_request.obj);
if (!do_sync) {
activation_source_schedule (self, activate_stage1_device_prepare, AF_INET);
return;
}
activation_source_schedule (self, activate_stage1_device_prepare, AF_INET);
activation_source_invoke_sync (self, activate_stage1_device_prepare, AF_INET);
}
static NMActStageReturn
@ -12600,7 +12596,7 @@ _device_activate (NMDevice *self, NMActRequest *req)
act_request_set (self, req);
nm_device_activate_schedule_stage1_device_prepare (self);
nm_device_activate_schedule_stage1_device_prepare (self, FALSE);
}
static void

View file

@ -416,7 +416,7 @@ teamd_dbus_appeared (GDBusConnection *connection,
}
priv->stage1_state = NM_DEVICE_STAGE_STATE_COMPLETED;
nm_device_activate_schedule_stage1_device_prepare (device);
nm_device_activate_schedule_stage1_device_prepare (device, FALSE);
}
static void

View file

@ -256,7 +256,7 @@ companion_notify_cb (NMDeviceWifi *companion, GParamSpec *pspec, gpointer user_d
g_object_get (companion, NM_DEVICE_WIFI_SCANNING, &scanning, NULL);
if (!scanning) {
priv->stage1_waiting = FALSE;
nm_device_activate_schedule_stage1_device_prepare (NM_DEVICE (self));
nm_device_activate_schedule_stage1_device_prepare (NM_DEVICE (self), FALSE);
}
}

View file

@ -523,7 +523,7 @@ peer_add_remove (NMDeviceWifiP2P *self,
if (peer) {
/* A peer for the connection was found, cancel the timeout and go to configure state. */
nm_clear_g_source (&priv->find_peer_timeout_id);
nm_device_activate_schedule_stage1_device_prepare (device);
nm_device_activate_schedule_stage1_device_prepare (device, FALSE);
}
}

View file

@ -1743,7 +1743,7 @@ wifi_secrets_cb (NMActRequest *req,
return;
}
nm_device_activate_schedule_stage1_device_prepare (device);
nm_device_activate_schedule_stage1_device_prepare (device, FALSE);
}
static void
@ -1810,7 +1810,7 @@ supplicant_iface_wps_credentials_cb (NMSupplicantInterface *iface,
}
wifi_secrets_cancel (self);
nm_device_activate_schedule_stage1_device_prepare (NM_DEVICE (self));
nm_device_activate_schedule_stage1_device_prepare (NM_DEVICE (self), FALSE);
}
static gboolean

View file

@ -156,7 +156,7 @@ modem_prepare_result (NMModem *modem,
}
priv->stage1_state = NM_DEVICE_STAGE_STATE_COMPLETED;
nm_device_activate_schedule_stage1_device_prepare (device);
nm_device_activate_schedule_stage1_device_prepare (device, FALSE);
}
static void
@ -191,7 +191,7 @@ modem_auth_result (NMModem *modem, GError *error, gpointer user_data)
}
priv->stage1_state = NM_DEVICE_STAGE_STATE_INIT;
nm_device_activate_schedule_stage1_device_prepare (device);
nm_device_activate_schedule_stage1_device_prepare (device, FALSE);
}
static void