broadband-modem-mbim: track uplink/downlink speeds only via indications
The uplink and downlink speeds will be exclusively tracked via packet service indications, and stored within the MBIM modem object. When the bearer connect result is built, we will include the latest speeds reported, which may have changed upon the operation to connect to the network.
This commit is contained in:
@@ -251,8 +251,6 @@ typedef struct {
|
||||
MMPort *data;
|
||||
MMBearerConnectResult *connect_result;
|
||||
MbimMessage *abort_on_failure;
|
||||
guint64 uplink_speed;
|
||||
guint64 downlink_speed;
|
||||
/* settings to use */
|
||||
gint profile_id;
|
||||
gchar *apn;
|
||||
@@ -362,6 +360,8 @@ ip_configuration_query_ready (MbimDevice *device,
|
||||
g_autofree gchar *ipv6configurationavailable_str = NULL;
|
||||
g_autoptr(MMBearerIpConfig) ipv4_config = NULL;
|
||||
g_autoptr(MMBearerIpConfig) ipv6_config = NULL;
|
||||
guint64 uplink_speed = 0;
|
||||
guint64 downlink_speed = 0;
|
||||
|
||||
/* IPv4 info */
|
||||
|
||||
@@ -626,8 +626,10 @@ ip_configuration_query_ready (MbimDevice *device,
|
||||
if (ctx->profile_id != MM_3GPP_PROFILE_ID_UNKNOWN)
|
||||
mm_bearer_connect_result_set_profile_id (ctx->connect_result, ctx->profile_id);
|
||||
|
||||
mm_bearer_connect_result_set_uplink_speed (ctx->connect_result, ctx->uplink_speed);
|
||||
mm_bearer_connect_result_set_downlink_speed (ctx->connect_result, ctx->downlink_speed);
|
||||
/* Propagate speeds from modem object */
|
||||
mm_broadband_modem_mbim_get_speeds (ctx->modem, &uplink_speed, &downlink_speed);
|
||||
mm_bearer_connect_result_set_uplink_speed (ctx->connect_result, uplink_speed);
|
||||
mm_bearer_connect_result_set_downlink_speed (ctx->connect_result, downlink_speed);
|
||||
}
|
||||
|
||||
if (error) {
|
||||
@@ -1005,10 +1007,6 @@ packet_service_set_ready (MbimDevice *device,
|
||||
}
|
||||
}
|
||||
|
||||
/* store speeds to include in the connection result later on */
|
||||
ctx->uplink_speed = uplink_speed;
|
||||
ctx->downlink_speed = downlink_speed;
|
||||
|
||||
/* Keep on */
|
||||
ctx->step++;
|
||||
connect_context_step (task);
|
||||
|
||||
@@ -155,6 +155,8 @@ struct _MMBroadbandModemMbimPrivate {
|
||||
MbimDataClass highest_available_data_class;
|
||||
MbimRegisterState reg_state;
|
||||
MbimPacketServiceState packet_service_state;
|
||||
guint64 packet_service_uplink_speed;
|
||||
guint64 packet_service_downlink_speed;
|
||||
|
||||
MbimSubscriberReadyState last_ready_state;
|
||||
|
||||
@@ -4742,22 +4744,31 @@ basic_connect_notification_subscriber_ready_status (MMBroadbandModemMbim *self,
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
MMBroadbandModemMbim *self;
|
||||
guint64 uplink_speed;
|
||||
guint64 downlink_speed;
|
||||
} ReportSpeedsContext;
|
||||
/*****************************************************************************/
|
||||
/* Packet service updates */
|
||||
|
||||
void
|
||||
mm_broadband_modem_mbim_get_speeds (MMBroadbandModemMbim *self,
|
||||
guint64 *uplink_speed,
|
||||
guint64 *downlink_speed)
|
||||
{
|
||||
if (uplink_speed)
|
||||
*uplink_speed = self->priv->packet_service_uplink_speed;
|
||||
if (downlink_speed)
|
||||
*downlink_speed = self->priv->packet_service_downlink_speed;
|
||||
}
|
||||
|
||||
static void
|
||||
bearer_list_report_speeds (MMBaseBearer *bearer,
|
||||
gpointer user_data)
|
||||
bearer_list_report_speeds (MMBaseBearer *bearer,
|
||||
MMBroadbandModemMbim *self)
|
||||
{
|
||||
ReportSpeedsContext *ctx = user_data;
|
||||
if (!MM_IS_BEARER_MBIM (bearer))
|
||||
return;
|
||||
|
||||
if (MM_IS_BEARER_MBIM (bearer)) {
|
||||
mm_obj_dbg (ctx->self, "bearer '%s' speeds updated", mm_base_bearer_get_path (bearer));
|
||||
mm_base_bearer_report_speeds (bearer, ctx->uplink_speed, ctx->downlink_speed);
|
||||
}
|
||||
mm_obj_dbg (self, "bearer '%s' speeds updated", mm_base_bearer_get_path (bearer));
|
||||
mm_base_bearer_report_speeds (bearer,
|
||||
self->priv->packet_service_uplink_speed,
|
||||
self->priv->packet_service_downlink_speed);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -4869,19 +4880,15 @@ basic_connect_notification_packet_service (MMBroadbandModemMbim *self,
|
||||
g_strdup (self->priv->current_operator_name));
|
||||
}
|
||||
|
||||
self->priv->packet_service_uplink_speed = uplink_speed;
|
||||
self->priv->packet_service_downlink_speed = downlink_speed;
|
||||
g_object_get (self,
|
||||
MM_IFACE_MODEM_BEARER_LIST, &bearer_list,
|
||||
NULL);
|
||||
if (bearer_list) {
|
||||
ReportSpeedsContext ctx = {
|
||||
.uplink_speed = uplink_speed,
|
||||
.downlink_speed = downlink_speed,
|
||||
};
|
||||
|
||||
if (bearer_list)
|
||||
mm_bearer_list_foreach (bearer_list,
|
||||
(MMBearerListForeachFunc)bearer_list_report_speeds,
|
||||
&ctx);
|
||||
}
|
||||
self);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -66,4 +66,9 @@ MMPortMbim *mm_broadband_modem_mbim_get_port_mbim_for_data (MMBroadbandModemMbi
|
||||
void mm_broadband_modem_mbim_set_unlock_retries (MMBroadbandModemMbim *self,
|
||||
MMModemLock lock_type,
|
||||
guint32 remaining_attempts);
|
||||
|
||||
void mm_broadband_modem_mbim_get_speeds (MMBroadbandModemMbim *self,
|
||||
guint64 *uplink_speed,
|
||||
guint64 *downlink_speed);
|
||||
|
||||
#endif /* MM_BROADBAND_MODEM_MBIM_H */
|
||||
|
||||
Reference in New Issue
Block a user