diff options
author | Stephan Gerhold <stephan.gerhold@kernkonzept.com> | 2022-08-15 14:07:39 +0200 |
---|---|---|
committer | Stephan Gerhold <stephan.gerhold@kernkonzept.com> | 2022-08-18 18:14:31 +0200 |
commit | 3df2c4f03c2eacc90205a913c234a04d60f24696 (patch) | |
tree | 1eda87e1ef24f8b473af0f24c759bbed615a90ad /src | |
parent | bc1cecbfc40bbac48beaf9bfe20f1403ebdbb959 (diff) |
mm-bearer-qmi: allocate separate WDS client for each endpoint
Multiplexing currently does not work correctly for BAM-DMUX because
ModemManager reuses the same WDS client for all data points. A second
bearer can be created but it effectively disables the first one.
Fix this similar to the existing checks for the mux-id by including the
endpoint type and number in the QMI client flags.
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-bearer-qmi.c | 20 | ||||
-rw-r--r-- | src/mm-port-qmi.h | 5 |
2 files changed, 14 insertions, 11 deletions
diff --git a/src/mm-bearer-qmi.c b/src/mm-bearer-qmi.c index a71d6593..57a30aa5 100644 --- a/src/mm-bearer-qmi.c +++ b/src/mm-bearer-qmi.c @@ -531,6 +531,14 @@ typedef struct { GError *error_ipv6; } ConnectContext; +/* When using the WDS service, we may not only want to have explicit different + * clients for IPv4 or IPv6, but also for different mux ids/endpoints as well, + * so that different bearer objects never attempt to use the same WDS clients. */ +#define MM_BEARER_QMI_PORT_FLAG(flag, ctx) \ + (((ctx->endpoint.interface_number & 0xFF) << 24) | \ + ((ctx->endpoint.type & 0xFF) << 16) | \ + ((ctx->mux_id & 0xFF) << 8) | (flag & 0xFF)) + static void connect_context_free (ConnectContext *ctx) { @@ -1434,12 +1442,12 @@ qmi_port_allocate_client_ready (MMPortQmi *qmi, ctx->client_ipv4 = QMI_CLIENT_WDS (mm_port_qmi_get_client ( qmi, QMI_SERVICE_WDS, - MM_PORT_QMI_FLAG_WITH_MUX_ID (MM_PORT_QMI_FLAG_WDS_IPV4, ctx->mux_id))); + MM_BEARER_QMI_PORT_FLAG (MM_PORT_QMI_FLAG_WDS_IPV4, ctx))); else ctx->client_ipv6 = QMI_CLIENT_WDS (mm_port_qmi_get_client ( qmi, QMI_SERVICE_WDS, - MM_PORT_QMI_FLAG_WITH_MUX_ID (MM_PORT_QMI_FLAG_WDS_IPV6, ctx->mux_id))); + MM_BEARER_QMI_PORT_FLAG (MM_PORT_QMI_FLAG_WDS_IPV6, ctx))); /* Keep on */ ctx->step++; @@ -1803,12 +1811,12 @@ connect_context_step (GTask *task) client = mm_port_qmi_get_client (ctx->qmi, QMI_SERVICE_WDS, - MM_PORT_QMI_FLAG_WITH_MUX_ID (MM_PORT_QMI_FLAG_WDS_IPV4, ctx->mux_id)); + MM_BEARER_QMI_PORT_FLAG (MM_PORT_QMI_FLAG_WDS_IPV4, ctx)); if (!client) { mm_obj_dbg (self, "allocating IPv4-specific WDS client (mux id %u)", ctx->mux_id); mm_port_qmi_allocate_client (ctx->qmi, QMI_SERVICE_WDS, - MM_PORT_QMI_FLAG_WITH_MUX_ID (MM_PORT_QMI_FLAG_WDS_IPV4, ctx->mux_id), + MM_BEARER_QMI_PORT_FLAG (MM_PORT_QMI_FLAG_WDS_IPV4, ctx), g_task_get_cancellable (task), (GAsyncReadyCallback)qmi_port_allocate_client_ready, task); @@ -1939,12 +1947,12 @@ connect_context_step (GTask *task) client = mm_port_qmi_get_client (ctx->qmi, QMI_SERVICE_WDS, - MM_PORT_QMI_FLAG_WITH_MUX_ID (MM_PORT_QMI_FLAG_WDS_IPV6, ctx->mux_id)); + MM_BEARER_QMI_PORT_FLAG (MM_PORT_QMI_FLAG_WDS_IPV6, ctx)); if (!client) { mm_obj_dbg (self, "allocating IPv6-specific WDS client (mux id %u)", ctx->mux_id); mm_port_qmi_allocate_client (ctx->qmi, QMI_SERVICE_WDS, - MM_PORT_QMI_FLAG_WITH_MUX_ID (MM_PORT_QMI_FLAG_WDS_IPV6, ctx->mux_id), + MM_BEARER_QMI_PORT_FLAG (MM_PORT_QMI_FLAG_WDS_IPV6, ctx), g_task_get_cancellable (task), (GAsyncReadyCallback)qmi_port_allocate_client_ready, task); diff --git a/src/mm-port-qmi.h b/src/mm-port-qmi.h index c177925c..7b434cdb 100644 --- a/src/mm-port-qmi.h +++ b/src/mm-port-qmi.h @@ -100,11 +100,6 @@ typedef enum { MM_PORT_QMI_FLAG_WDS_IPV6 = 2, } MMPortQmiFlag; -/* When using the WDS service, we may not only want to have explicit different - * clients for IPv4 or IPv6, but also for different mux ids as well, so that - * different bearer objects never attempt to use the same WDS clients. */ -#define MM_PORT_QMI_FLAG_WITH_MUX_ID(flag, mux_id) ((mux_id << 8) | (flag & 0xFF)) - void mm_port_qmi_allocate_client (MMPortQmi *self, QmiService service, guint flag, |