aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2021-04-23 22:11:42 +0200
committerAleksander Morgado <aleksander@aleksander.es>2021-04-23 22:29:40 +0200
commite7c1eb8287b724cca1663d58e45ca985cc1dfa15 (patch)
treea38de9eba0d5a6fe5a77a7fe9d78d478e009f892
parent1c6258056eb6933c0f6ba8c064d83e72011e508f (diff)
port-qmi: WDS clients also mux-id specific
In addition to differentiating between IPv4 and IPv6 clients, we also need to explicitly allocate different clients in different bearer objects when in multiplexing.
-rw-r--r--src/mm-bearer-qmi.c26
-rw-r--r--src/mm-port-qmi.c38
-rw-r--r--src/mm-port-qmi.h49
3 files changed, 60 insertions, 53 deletions
diff --git a/src/mm-bearer-qmi.c b/src/mm-bearer-qmi.c
index 12be2ff9..151b20f5 100644
--- a/src/mm-bearer-qmi.c
+++ b/src/mm-bearer-qmi.c
@@ -1323,13 +1323,15 @@ qmi_port_allocate_client_ready (MMPortQmi *qmi,
}
if (ctx->running_ipv4)
- ctx->client_ipv4 = QMI_CLIENT_WDS (mm_port_qmi_get_client (qmi,
- QMI_SERVICE_WDS,
- MM_PORT_QMI_FLAG_WDS_IPV4));
+ 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)));
else
- ctx->client_ipv6 = QMI_CLIENT_WDS (mm_port_qmi_get_client (qmi,
- QMI_SERVICE_WDS,
- MM_PORT_QMI_FLAG_WDS_IPV6));
+ 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)));
/* Keep on */
ctx->step++;
@@ -1621,12 +1623,12 @@ connect_context_step (GTask *task)
client = mm_port_qmi_get_client (ctx->qmi,
QMI_SERVICE_WDS,
- MM_PORT_QMI_FLAG_WDS_IPV4);
+ MM_PORT_QMI_FLAG_WITH_MUX_ID (MM_PORT_QMI_FLAG_WDS_IPV4, ctx->mux_id));
if (!client) {
- mm_obj_dbg (self, "allocating IPv4-specific WDS 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_WDS_IPV4,
+ MM_PORT_QMI_FLAG_WITH_MUX_ID (MM_PORT_QMI_FLAG_WDS_IPV4, ctx->mux_id),
g_task_get_cancellable (task),
(GAsyncReadyCallback)qmi_port_allocate_client_ready,
task);
@@ -1757,12 +1759,12 @@ connect_context_step (GTask *task)
client = mm_port_qmi_get_client (ctx->qmi,
QMI_SERVICE_WDS,
- MM_PORT_QMI_FLAG_WDS_IPV6);
+ MM_PORT_QMI_FLAG_WITH_MUX_ID (MM_PORT_QMI_FLAG_WDS_IPV6, ctx->mux_id));
if (!client) {
- mm_obj_dbg (self, "allocating IPv6-specific WDS 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_WDS_IPV6,
+ MM_PORT_QMI_FLAG_WITH_MUX_ID (MM_PORT_QMI_FLAG_WDS_IPV6, ctx->mux_id),
g_task_get_cancellable (task),
(GAsyncReadyCallback)qmi_port_allocate_client_ready,
task);
diff --git a/src/mm-port-qmi.c b/src/mm-port-qmi.c
index e5a1c214..d6779be9 100644
--- a/src/mm-port-qmi.c
+++ b/src/mm-port-qmi.c
@@ -44,9 +44,9 @@ enum {
static GParamSpec *properties[PROP_LAST];
typedef struct {
- QmiService service;
- QmiClient *client;
- MMPortQmiFlag flag;
+ QmiService service;
+ QmiClient *client;
+ guint flag;
} ServiceInfo;
struct _MMPortQmiPrivate {
@@ -78,10 +78,10 @@ struct _MMPortQmiPrivate {
/*****************************************************************************/
static QmiClient *
-lookup_client (MMPortQmi *self,
- QmiService service,
- MMPortQmiFlag flag,
- gboolean steal)
+lookup_client (MMPortQmi *self,
+ QmiService service,
+ guint flag,
+ gboolean steal)
{
GList *l;
@@ -104,17 +104,17 @@ lookup_client (MMPortQmi *self,
}
QmiClient *
-mm_port_qmi_peek_client (MMPortQmi *self,
- QmiService service,
- MMPortQmiFlag flag)
+mm_port_qmi_peek_client (MMPortQmi *self,
+ QmiService service,
+ guint flag)
{
return lookup_client (self, service, flag, FALSE);
}
QmiClient *
-mm_port_qmi_get_client (MMPortQmi *self,
- QmiService service,
- MMPortQmiFlag flag)
+mm_port_qmi_get_client (MMPortQmi *self,
+ QmiService service,
+ guint flag)
{
QmiClient *client;
@@ -257,12 +257,12 @@ allocate_client_ready (QmiDevice *qmi_device,
}
void
-mm_port_qmi_allocate_client (MMPortQmi *self,
- QmiService service,
- MMPortQmiFlag flag,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+mm_port_qmi_allocate_client (MMPortQmi *self,
+ QmiService service,
+ guint flag,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
AllocateClientContext *ctx;
GTask *task;
diff --git a/src/mm-port-qmi.h b/src/mm-port-qmi.h
index 793e3b1a..dbeff1bd 100644
--- a/src/mm-port-qmi.h
+++ b/src/mm-port-qmi.h
@@ -91,30 +91,35 @@ void mm_port_qmi_set_net_driver (MMPortQmi *self,
typedef enum {
MM_PORT_QMI_FLAG_DEFAULT = 0,
- MM_PORT_QMI_FLAG_WDS_IPV4 = 100,
- MM_PORT_QMI_FLAG_WDS_IPV6 = 101
+ MM_PORT_QMI_FLAG_WDS_IPV4 = 1,
+ MM_PORT_QMI_FLAG_WDS_IPV6 = 2,
} MMPortQmiFlag;
-void mm_port_qmi_allocate_client (MMPortQmi *self,
- QmiService service,
- MMPortQmiFlag flag,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-gboolean mm_port_qmi_allocate_client_finish (MMPortQmi *self,
- GAsyncResult *res,
- GError **error);
-
-void mm_port_qmi_release_client (MMPortQmi *self,
- QmiService service,
- MMPortQmiFlag flag);
-
-QmiClient *mm_port_qmi_peek_client (MMPortQmi *self,
- QmiService service,
- MMPortQmiFlag flag);
-QmiClient *mm_port_qmi_get_client (MMPortQmi *self,
- QmiService service,
- MMPortQmiFlag flag);
+/* 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,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+gboolean mm_port_qmi_allocate_client_finish (MMPortQmi *self,
+ GAsyncResult *res,
+ GError **error);
+
+void mm_port_qmi_release_client (MMPortQmi *self,
+ QmiService service,
+ guint flag);
+
+QmiClient *mm_port_qmi_peek_client (MMPortQmi *self,
+ QmiService service,
+ guint flag);
+QmiClient *mm_port_qmi_get_client (MMPortQmi *self,
+ QmiService service,
+ guint flag);
QmiDevice *mm_port_qmi_peek_device (MMPortQmi *self);