aboutsummaryrefslogtreecommitdiff
path: root/src/mm-bearer-mbim.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mm-bearer-mbim.c')
-rw-r--r--src/mm-bearer-mbim.c44
1 files changed, 34 insertions, 10 deletions
diff --git a/src/mm-bearer-mbim.c b/src/mm-bearer-mbim.c
index fc434c78..e956a90d 100644
--- a/src/mm-bearer-mbim.c
+++ b/src/mm-bearer-mbim.c
@@ -1221,10 +1221,19 @@ load_settings_from_bearer (MMBearerMbim *self,
{
MMBearerMultiplexSupport multiplex;
gboolean multiplex_supported = TRUE;
+ guint current_multiplexed_bearers;
+ guint max_multiplexed_bearers;
const gchar *data_port_driver;
+ if (!mm_broadband_modem_get_active_multiplexed_bearers (MM_BROADBAND_MODEM (ctx->modem),
+ &current_multiplexed_bearers,
+ &max_multiplexed_bearers,
+ error))
+ return FALSE;
+
+ /* Check multiplex support in the kernel and the device */
data_port_driver = mm_kernel_device_get_driver (mm_port_peek_kernel_device (ctx->data));
- if (!g_strcmp0 (data_port_driver, "mhi_net"))
+ if (!g_strcmp0 (data_port_driver, "mhi_net") || !max_multiplexed_bearers)
multiplex_supported = FALSE;
/* If no multiplex setting given by the user, assume none */
@@ -1236,17 +1245,32 @@ load_settings_from_bearer (MMBearerMbim *self,
multiplex = MM_BEARER_MULTIPLEX_SUPPORT_NONE;
}
- if (multiplex_supported &&
- (multiplex == MM_BEARER_MULTIPLEX_SUPPORT_REQUESTED ||
- multiplex == MM_BEARER_MULTIPLEX_SUPPORT_REQUIRED)) {
- /* the link prefix hint given must be modem-specific */
- ctx->link_prefix_hint = g_strdup_printf ("mbimmux%u.", mm_base_modem_get_dbus_id (MM_BASE_MODEM (ctx->modem)));
+ /* If multiplex unsupported, either abort or default to none */
+ if (!multiplex_supported) {
+ if (multiplex == MM_BEARER_MULTIPLEX_SUPPORT_REQUIRED) {
+ g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Multiplexing required but not supported");
+ return FALSE;
+ }
+ if (multiplex == MM_BEARER_MULTIPLEX_SUPPORT_REQUESTED) {
+ mm_obj_dbg (self, "Multiplexing unsupported");
+ multiplex = MM_BEARER_MULTIPLEX_SUPPORT_NONE;
+ }
}
- if (!multiplex_supported && multiplex == MM_BEARER_MULTIPLEX_SUPPORT_REQUIRED) {
- g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
- "Multiplexing required but not supported by %s", data_port_driver);
- return FALSE;
+ /* Go on with multiplexing enabled */
+ if (multiplex == MM_BEARER_MULTIPLEX_SUPPORT_REQUESTED ||
+ multiplex == MM_BEARER_MULTIPLEX_SUPPORT_REQUIRED) {
+ g_assert (multiplex_supported);
+
+ if (current_multiplexed_bearers == max_multiplexed_bearers) {
+ g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Maximum number of multiplexed bearers reached");
+ return FALSE;
+ }
+
+ /* the link prefix hint given must be modem-specific */
+ ctx->link_prefix_hint = g_strdup_printf ("mbimmux%u.", mm_base_modem_get_dbus_id (MM_BASE_MODEM (ctx->modem)));
}
/* If profile id is given, we'll load all settings from the stored profile,