port-qmi: allow setting initial mux-id value when using rmnet multiplexing

Qualcomm suggests to use mux id values >= 0x81: though this does not
seem a strict mandatory rule, there are scenarios in which the usage of
a specifix mux id is required otherwise various kind of issues could
happen (e.g. call failure, limited throughput...).

A new ID_MM_INITIAL_QMAP_MUX_ID udev tag allows setting the first initial
mux id value to be used when creating the multiplexed data connection.

Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
This commit is contained in:
Daniele Palmas
2025-11-24 23:50:03 -06:00
committed by Dan Williams
parent 0f19f10958
commit d2de8ff226
3 changed files with 61 additions and 17 deletions
@@ -229,6 +229,7 @@ ID_MM_TTY_BAUDRATE
ID_MM_TTY_FLOW_CONTROL ID_MM_TTY_FLOW_CONTROL
ID_MM_REQUIRED ID_MM_REQUIRED
ID_MM_MAX_MULTIPLEXED_LINKS ID_MM_MAX_MULTIPLEXED_LINKS
ID_MM_INITIAL_QMAP_MUX_ID
<SUBSECTION Deprecated> <SUBSECTION Deprecated>
ID_MM_TTY_BLACKLIST ID_MM_TTY_BLACKLIST
ID_MM_TTY_MANUAL_SCAN_ONLY ID_MM_TTY_MANUAL_SCAN_ONLY
+14
View File
@@ -323,6 +323,20 @@
*/ */
#define ID_MM_TTY_AT_PROBE_TRIES "ID_MM_TTY_AT_PROBE_TRIES" #define ID_MM_TTY_AT_PROBE_TRIES "ID_MM_TTY_AT_PROBE_TRIES"
/**
* ID_MM_INITIAL_QMAP_MUX_ID:
*
* This is a device-specific tag that allows users to specify the initial value
* of the QMAP multiplexed id to be used.
*
* An integer value greater or equal than 1 and smaller than 255.
*
* This setting does nothing if the modem doesn't support multiplexing.
*
* Since: 1.26
*/
#define ID_MM_INITIAL_QMAP_MUX_ID "ID_MM_INITIAL_QMAP_MUX_ID"
/* /*
* The following symbols are deprecated. We don't add them to -compat * The following symbols are deprecated. We don't add them to -compat
* because this -tags file is not really part of the installed API. * because this -tags file is not really part of the installed API.
+46 -17
View File
@@ -60,6 +60,7 @@ struct _MMPortQmiPrivate {
gchar *net_driver; gchar *net_driver;
gchar *net_sysfs_path; gchar *net_sysfs_path;
guint net_preallocated_links_requested; guint net_preallocated_links_requested;
guint net_initial_mux_id;
#if defined WITH_QRTR #if defined WITH_QRTR
QrtrNode *node; QrtrNode *node;
#endif #endif
@@ -563,14 +564,24 @@ initialize_preallocated_links_next (GTask *task)
return; return;
} }
qmi_device_add_link_with_flags (self->priv->qmi_device, if (self->priv->net_initial_mux_id)
ctx->preallocated_links->len + 1, qmi_device_add_link_with_flags_and_initial_mux_id (self->priv->qmi_device,
mm_kernel_device_get_name (mm_port_peek_kernel_device (ctx->data)), self->priv->net_initial_mux_id + ctx->preallocated_links->len,
ctx->link_prefix_hint, mm_kernel_device_get_name (mm_port_peek_kernel_device (ctx->data)),
ctx->flags, ctx->link_prefix_hint,
NULL, ctx->flags,
(GAsyncReadyCallback) device_add_link_preallocated_ready, NULL,
task); (GAsyncReadyCallback) device_add_link_preallocated_ready,
task);
else
qmi_device_add_link_with_flags (self->priv->qmi_device,
ctx->preallocated_links->len + 1,
mm_kernel_device_get_name (mm_port_peek_kernel_device (ctx->data)),
ctx->link_prefix_hint,
ctx->flags,
NULL,
(GAsyncReadyCallback) device_add_link_preallocated_ready,
task);
} }
static void static void
@@ -635,12 +646,17 @@ device_add_link_ready (QmiDevice *device,
GAsyncResult *res, GAsyncResult *res,
GTask *task) GTask *task)
{ {
MMPortQmi *self;
SetupLinkContext *ctx; SetupLinkContext *ctx;
GError *error = NULL; GError *error = NULL;
self = g_task_get_source_object (task);
ctx = g_task_get_task_data (task); ctx = g_task_get_task_data (task);
ctx->link_name = qmi_device_add_link_with_flags_finish (device, res, &ctx->mux_id, &error); if (self->priv->net_initial_mux_id)
ctx->link_name = qmi_device_add_link_with_flags_and_initial_mux_id_finish (device, res, &ctx->mux_id, &error);
else
ctx->link_name = qmi_device_add_link_with_flags_finish (device, res, &ctx->mux_id, &error);
if (!ctx->link_name) { if (!ctx->link_name) {
g_prefix_error (&error, "failed to add link for device: "); g_prefix_error (&error, "failed to add link for device: ");
g_task_return_error (task, error); g_task_return_error (task, error);
@@ -810,14 +826,24 @@ mm_port_qmi_setup_link (MMPortQmi *self,
/* No preallocated links required and using rmnet, just try to add link in the QmiDevice */ /* No preallocated links required and using rmnet, just try to add link in the QmiDevice */
if (self->priv->kernel_data_modes & MM_PORT_QMI_KERNEL_DATA_MODE_MUX_RMNET) { if (self->priv->kernel_data_modes & MM_PORT_QMI_KERNEL_DATA_MODE_MUX_RMNET) {
qmi_device_add_link_with_flags (self->priv->qmi_device, if (self->priv->net_initial_mux_id)
QMI_DEVICE_MUX_ID_AUTOMATIC, qmi_device_add_link_with_flags_and_initial_mux_id (self->priv->qmi_device,
mm_kernel_device_get_name (mm_port_peek_kernel_device (data)), self->priv->net_initial_mux_id,
link_prefix_hint, mm_kernel_device_get_name (mm_port_peek_kernel_device (data)),
get_rmnet_device_add_link_flags (self), link_prefix_hint,
NULL, get_rmnet_device_add_link_flags (self),
(GAsyncReadyCallback) device_add_link_ready, NULL,
task); (GAsyncReadyCallback) device_add_link_ready,
task);
else
qmi_device_add_link_with_flags (self->priv->qmi_device,
QMI_DEVICE_MUX_ID_AUTOMATIC,
mm_kernel_device_get_name (mm_port_peek_kernel_device (data)),
link_prefix_hint,
get_rmnet_device_add_link_flags (self),
NULL,
(GAsyncReadyCallback) device_add_link_ready,
task);
return; return;
} }
@@ -2723,6 +2749,9 @@ mm_port_qmi_set_net_details (MMPortQmi *self,
g_assert (!self->priv->net_preallocated_links_requested); g_assert (!self->priv->net_preallocated_links_requested);
self->priv->net_preallocated_links_requested = mm_kernel_device_get_global_property_as_int (first_net_dev, "ID_MM_QMI_PREALLOCATED_LINKS"); self->priv->net_preallocated_links_requested = mm_kernel_device_get_global_property_as_int (first_net_dev, "ID_MM_QMI_PREALLOCATED_LINKS");
g_assert (!self->priv->net_initial_mux_id);
self->priv->net_initial_mux_id = mm_kernel_device_get_global_property_as_int (first_net_dev, "ID_MM_INITIAL_QMAP_MUX_ID");
initialize_endpoint_info (self); initialize_endpoint_info (self);
} }