aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2021-02-25 15:42:35 +0100
committerAleksander Morgado <aleksander@aleksander.es>2021-03-10 10:59:22 +0100
commit05b9ab7c25bf252e43037ed0ea002b0aed6f051b (patch)
tree996bf3a13e114298d450ce10136a6838d9f00006
parent35e20a48c8b16ae744c4ca3082f70e8aa674c2f4 (diff)
api,modem: new 'MaxActiveMultiplexedBearers' property
In addition to the amount of bearers a user may connect without multiplexing enabled (the default until now), we now also expose the maximum number of bearers a user may connect after enabling multiplexing over one single network interface (if supported). The method responsible for creating the MMBearerList is now also subclassable, so that implementations supporting multiplexing can provide their own version with their own thresholds.
-rw-r--r--docs/reference/libmm-glib/libmm-glib-sections.txt3
-rw-r--r--introspection/org.freedesktop.ModemManager1.Modem.xml20
-rw-r--r--libmm-glib/mm-modem.c32
-rw-r--r--libmm-glib/mm-modem.h3
-rw-r--r--src/mm-bearer-list.c27
-rw-r--r--src/mm-bearer-list.h13
-rw-r--r--src/mm-broadband-modem.c18
-rw-r--r--src/mm-iface-modem.c33
-rw-r--r--src/mm-iface-modem.h5
9 files changed, 119 insertions, 35 deletions
diff --git a/docs/reference/libmm-glib/libmm-glib-sections.txt b/docs/reference/libmm-glib/libmm-glib-sections.txt
index 92d25bc8..c9d9b0fd 100644
--- a/docs/reference/libmm-glib/libmm-glib-sections.txt
+++ b/docs/reference/libmm-glib/libmm-glib-sections.txt
@@ -162,6 +162,7 @@ mm_modem_peek_unlock_retries
mm_modem_get_unlock_retries
mm_modem_get_max_bearers
mm_modem_get_max_active_bearers
+mm_modem_get_max_active_multiplexed_bearers
mm_modem_get_bearer_paths
mm_modem_dup_bearer_paths
mm_modem_get_own_numbers
@@ -2105,6 +2106,7 @@ mm_gdbus_modem_dup_equipment_identifier
mm_gdbus_modem_get_manufacturer
mm_gdbus_modem_dup_manufacturer
mm_gdbus_modem_get_max_active_bearers
+mm_gdbus_modem_get_max_active_multiplexed_bearers
mm_gdbus_modem_get_max_bearers
mm_gdbus_modem_get_model
mm_gdbus_modem_dup_model
@@ -2193,6 +2195,7 @@ mm_gdbus_modem_set_drivers
mm_gdbus_modem_set_equipment_identifier
mm_gdbus_modem_set_manufacturer
mm_gdbus_modem_set_max_active_bearers
+mm_gdbus_modem_set_max_active_multiplexed_bearers
mm_gdbus_modem_set_max_bearers
mm_gdbus_modem_set_model
mm_gdbus_modem_set_own_numbers
diff --git a/introspection/org.freedesktop.ModemManager1.Modem.xml b/introspection/org.freedesktop.ModemManager1.Modem.xml
index d75f86fc..6accaf29 100644
--- a/introspection/org.freedesktop.ModemManager1.Modem.xml
+++ b/introspection/org.freedesktop.ModemManager1.Modem.xml
@@ -351,15 +351,29 @@
The maximum number of active
<link linkend="MM-BEARER-TYPE-DEFAULT:CAPS"><constant>MM_BEARER_TYPE_DEFAULT</constant></link>
- bearers that may be explicitly enabled by the user.
+ bearers that may be explicitly enabled by the user without multiplexing support.
POTS and CDMA2000-only devices support one active bearer, while GSM/UMTS
- and LTE-capable devices (including LTE/CDMA devices) typically support
- at least two active bearers.
+ and LTE/5GNR capable devices (including 3GPP+3GPP3 multimode devices) may support
+ one or more active bearers, depending on the amount of physical ports exposed
+ by the device.
-->
<property name="MaxActiveBearers" type="u" access="read" />
<!--
+ MaxActiveMultiplexedBearers:
+
+ The maximum number of active
+ <link linkend="MM-BEARER-TYPE-DEFAULT:CAPS"><constant>MM_BEARER_TYPE_DEFAULT</constant></link>
+ bearers that may be explicitly enabled by the user with multiplexing support
+ on one single network interface.
+
+ If the modem doesn't support multiplexing of data sessiones, a value of 0 will
+ be reported.
+ -->
+ <property name="MaxActiveMultiplexedBearers" type="u" access="read" />
+
+ <!--
Manufacturer:
The equipment manufacturer, as reported by the modem.
diff --git a/libmm-glib/mm-modem.c b/libmm-glib/mm-modem.c
index e3b29bb5..02e322dd 100644
--- a/libmm-glib/mm-modem.c
+++ b/libmm-glib/mm-modem.c
@@ -436,13 +436,15 @@ mm_modem_get_max_bearers (MMModem *self)
* mm_modem_get_max_active_bearers:
* @self: a #MMModem.
*
- * Gets the maximum number of active packet data bearers this #MMModem supports.
+ * Gets the maximum number of active packet data bearers this #MMModem supports
+ * without enabling multiplexing support.
*
* POTS and CDMA2000-only devices support one active bearer, while GSM/UMTS
- * and LTE-capable devices (including LTE/CDMA devices) typically support
- * at least two active bearers.
+ * and LTE/5GNR capable devices (including 3GPP+3GPP3 multimode devices) may support
+ * one or more active bearers, depending on the amount of physical ports exposed
+ * by the device.
*
- * Returns: the maximum number of defined packet data bearers.
+ * Returns: the maximum number of active packet data bearers.
*
* Since: 1.0
*/
@@ -457,6 +459,28 @@ mm_modem_get_max_active_bearers (MMModem *self)
/*****************************************************************************/
/**
+ * mm_modem_get_max_active_multiplexed_bearers:
+ * @self: a #MMModem.
+ *
+ * Gets the maximum number of active packet data bearers this #MMModem supports
+ * after enabling multiplexing support on one single network interface.
+ *
+ * Returns: the maximum number of active packet data bearers, or 0 if
+ * multiplexing is not supported.
+ *
+ * Since: 1.18
+ */
+guint
+mm_modem_get_max_active_multiplexed_bearers (MMModem *self)
+{
+ g_return_val_if_fail (MM_IS_MODEM (self), 0);
+
+ return mm_gdbus_modem_get_max_active_multiplexed_bearers (MM_GDBUS_MODEM (self));
+}
+
+/*****************************************************************************/
+
+/**
* mm_modem_get_bearer_paths:
* @self: A #MMModem.
*
diff --git a/libmm-glib/mm-modem.h b/libmm-glib/mm-modem.h
index 589ddafa..ee1f7879 100644
--- a/libmm-glib/mm-modem.h
+++ b/libmm-glib/mm-modem.h
@@ -94,7 +94,8 @@ G_DEPRECATED
guint mm_modem_get_max_bearers (MMModem *self);
#endif /* MM_DISABLE_DEPRECATED */
-guint mm_modem_get_max_active_bearers (MMModem *self);
+guint mm_modem_get_max_active_bearers (MMModem *self);
+guint mm_modem_get_max_active_multiplexed_bearers (MMModem *self);
const gchar * const *mm_modem_get_bearer_paths (MMModem *self);
gchar **mm_modem_dup_bearer_paths (MMModem *self);
diff --git a/src/mm-bearer-list.c b/src/mm-bearer-list.c
index 8bf6ae05..b0694588 100644
--- a/src/mm-bearer-list.c
+++ b/src/mm-bearer-list.c
@@ -35,6 +35,7 @@ enum {
PROP_0,
PROP_NUM_BEARERS,
PROP_MAX_ACTIVE_BEARERS,
+ PROP_MAX_ACTIVE_MULTIPLEXED_BEARERS,
PROP_LAST
};
@@ -45,6 +46,7 @@ struct _MMBearerListPrivate {
GList *bearers;
/* Max number of active bearers */
guint max_active_bearers;
+ guint max_active_multiplexed_bearers;
};
/*****************************************************************************/
@@ -55,6 +57,12 @@ mm_bearer_list_get_max_active (MMBearerList *self)
return self->priv->max_active_bearers;
}
+guint
+mm_bearer_list_get_max_active_multiplexed (MMBearerList *self)
+{
+ return self->priv->max_active_multiplexed_bearers;
+}
+
gboolean
mm_bearer_list_add_bearer (MMBearerList *self,
MMBaseBearer *bearer,
@@ -238,11 +246,13 @@ mm_bearer_list_disconnect_all_bearers (MMBearerList *self,
/*****************************************************************************/
MMBearerList *
-mm_bearer_list_new (guint max_active_bearers)
+mm_bearer_list_new (guint max_active_bearers,
+ guint max_active_multiplexed_bearers)
{
/* Create the object */
return g_object_new (MM_TYPE_BEARER_LIST,
MM_BEARER_LIST_MAX_ACTIVE_BEARERS, max_active_bearers,
+ MM_BEARER_LIST_MAX_ACTIVE_MULTIPLEXED_BEARERS, max_active_multiplexed_bearers,
NULL);
}
@@ -261,6 +271,9 @@ set_property (GObject *object,
case PROP_MAX_ACTIVE_BEARERS:
self->priv->max_active_bearers = g_value_get_uint (value);
break;
+ case PROP_MAX_ACTIVE_MULTIPLEXED_BEARERS:
+ self->priv->max_active_multiplexed_bearers = g_value_get_uint (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -282,6 +295,9 @@ get_property (GObject *object,
case PROP_MAX_ACTIVE_BEARERS:
g_value_set_uint (value, self->priv->max_active_bearers);
break;
+ case PROP_MAX_ACTIVE_MULTIPLEXED_BEARERS:
+ g_value_set_uint (value, self->priv->max_active_multiplexed_bearers);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -342,4 +358,13 @@ mm_bearer_list_class_init (MMBearerListClass *klass)
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property (object_class, PROP_MAX_ACTIVE_BEARERS, properties[PROP_MAX_ACTIVE_BEARERS]);
+ properties[PROP_MAX_ACTIVE_MULTIPLEXED_BEARERS] =
+ g_param_spec_uint (MM_BEARER_LIST_MAX_ACTIVE_MULTIPLEXED_BEARERS,
+ "Max active multiplexed bearers",
+ "Maximum number of active multiplexed bearers the list can handle",
+ 1,
+ G_MAXUINT,
+ 1,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
+ g_object_class_install_property (object_class, PROP_MAX_ACTIVE_MULTIPLEXED_BEARERS, properties[PROP_MAX_ACTIVE_MULTIPLEXED_BEARERS]);
}
diff --git a/src/mm-bearer-list.h b/src/mm-bearer-list.h
index 1d8db726..72fe24ff 100644
--- a/src/mm-bearer-list.h
+++ b/src/mm-bearer-list.h
@@ -30,8 +30,9 @@
#define MM_IS_BEARER_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_BEARER_LIST))
#define MM_BEARER_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_BEARER_LIST, MMBearerListClass))
-#define MM_BEARER_LIST_NUM_BEARERS "num-bearers"
-#define MM_BEARER_LIST_MAX_ACTIVE_BEARERS "max-active-bearers"
+#define MM_BEARER_LIST_NUM_BEARERS "num-bearers"
+#define MM_BEARER_LIST_MAX_ACTIVE_BEARERS "max-active-bearers"
+#define MM_BEARER_LIST_MAX_ACTIVE_MULTIPLEXED_BEARERS "max-active-multiplexed-bearers"
typedef struct _MMBearerList MMBearerList;
typedef struct _MMBearerListClass MMBearerListClass;
@@ -49,10 +50,12 @@ struct _MMBearerListClass {
GType mm_bearer_list_get_type (void);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MMBearerList, g_object_unref)
-MMBearerList *mm_bearer_list_new (guint max_active_bearers);
+MMBearerList *mm_bearer_list_new (guint max_active_bearers,
+ guint max_active_multiplexed_bearers);
-GStrv mm_bearer_list_get_paths (MMBearerList *self);
-guint mm_bearer_list_get_max_active (MMBearerList *self);
+GStrv mm_bearer_list_get_paths (MMBearerList *self);
+guint mm_bearer_list_get_max_active (MMBearerList *self);
+guint mm_bearer_list_get_max_active_multiplexed (MMBearerList *self);
gboolean mm_bearer_list_add_bearer (MMBearerList *self,
MMBaseBearer *bearer,
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
index 66320c63..bcd56faa 100644
--- a/src/mm-broadband-modem.c
+++ b/src/mm-broadband-modem.c
@@ -418,6 +418,23 @@ modem_create_bearer (MMIfaceModem *self,
}
/*****************************************************************************/
+/* Create Bearer List (Modem interface) */
+
+static MMBearerList *
+modem_create_bearer_list (MMIfaceModem *self)
+{
+ guint n;
+
+ /* The maximum number of available/connected modems is guessed from
+ * the size of the data ports list. */
+ n = g_list_length (mm_base_modem_peek_data_ports (MM_BASE_MODEM (self)));
+ mm_obj_dbg (self, "allowed up to %u active bearers", n);
+
+ /* by default, no multiplexing support */
+ return mm_bearer_list_new (n, 0);
+}
+
+/*****************************************************************************/
/* Create SIM (Modem interface) */
static MMBaseSim *
@@ -12425,6 +12442,7 @@ iface_modem_init (MMIfaceModem *iface)
iface->load_power_state_finish = modem_load_power_state_finish;
iface->load_supported_ip_families = modem_load_supported_ip_families;
iface->load_supported_ip_families_finish = modem_load_supported_ip_families_finish;
+ iface->create_bearer_list = modem_create_bearer_list;
/* Enabling steps */
iface->modem_power_up = modem_power_up;
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
index 5ac3da9c..20580d8f 100644
--- a/src/mm-iface-modem.c
+++ b/src/mm-iface-modem.c
@@ -5083,47 +5083,38 @@ interface_initialization_step (GTask *task)
/* fall-through */
case INITIALIZATION_STEP_BEARERS: {
- MMBearerList *list = NULL;
+ g_autoptr(MMBearerList) list = NULL;
/* Bearers setup is meant to be loaded only once during the whole
- * lifetime of the modem. The list may have been created by the object
- * implementing the interface; if so use it. */
+ * lifetime of the modem, so check if it exists; and if it doesn't,
+ * create it right away. */
g_object_get (self,
MM_IFACE_MODEM_BEARER_LIST, &list,
NULL);
if (!list) {
- guint n;
-
- /* The maximum number of available/connected modems is guessed from
- * the size of the data ports list. */
- n = g_list_length (mm_base_modem_peek_data_ports (MM_BASE_MODEM (self)));
- mm_obj_dbg (self, "allowed up to %u active bearers", n);
-
- /* Create new default list */
- list = mm_bearer_list_new (n);
+ list = MM_IFACE_MODEM_GET_INTERFACE (self)->create_bearer_list (self);
g_signal_connect (list,
"notify::" MM_BEARER_LIST_NUM_BEARERS,
G_CALLBACK (bearer_list_updated),
self);
- g_object_set (self,
- MM_IFACE_MODEM_BEARER_LIST, list,
- NULL);
- }
- if (mm_gdbus_modem_get_max_active_bearers (ctx->skeleton) == 0)
mm_gdbus_modem_set_max_active_bearers (
ctx->skeleton,
mm_bearer_list_get_max_active (list));
+ mm_gdbus_modem_set_max_active_multiplexed_bearers (
+ ctx->skeleton,
+ mm_bearer_list_get_max_active_multiplexed (list));
- /* MaxBearers set equal to MaxActiveBearers */
- if (mm_gdbus_modem_get_max_bearers (ctx->skeleton) == 0)
+ /* MaxBearers set equal to MaxActiveBearers */
mm_gdbus_modem_set_max_bearers (
ctx->skeleton,
mm_gdbus_modem_get_max_active_bearers (ctx->skeleton));
- g_object_unref (list);
-
+ g_object_set (self,
+ MM_IFACE_MODEM_BEARER_LIST, list,
+ NULL);
+ }
ctx->step++;
} /* fall-through */
diff --git a/src/mm-iface-modem.h b/src/mm-iface-modem.h
index 66d43ac0..c649a49f 100644
--- a/src/mm-iface-modem.h
+++ b/src/mm-iface-modem.h
@@ -26,6 +26,7 @@
#include "mm-port-serial-at.h"
#include "mm-base-bearer.h"
#include "mm-base-sim.h"
+#include "mm-bearer-list.h"
#define MM_TYPE_IFACE_MODEM (mm_iface_modem_get_type ())
#define MM_IFACE_MODEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_IFACE_MODEM, MMIfaceModem))
@@ -372,6 +373,10 @@ struct _MMIfaceModem {
MMBaseBearer * (*create_bearer_finish) (MMIfaceModem *self,
GAsyncResult *res,
GError **error);
+
+ /* Create new bearer list object */
+ MMBearerList * (* create_bearer_list) (MMIfaceModem *self);
+
/* Setup SIM hot swap */
void (*setup_sim_hot_swap) (MMIfaceModem *self,
GAsyncReadyCallback callback,