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.
This commit is contained in:
Aleksander Morgado
2021-04-23 22:11:42 +02:00
parent 1c6258056e
commit e7c1eb8287
3 changed files with 58 additions and 51 deletions

View File

@@ -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,
ctx->client_ipv4 = QMI_CLIENT_WDS (mm_port_qmi_get_client (
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)));
else
ctx->client_ipv6 = QMI_CLIENT_WDS (mm_port_qmi_get_client (qmi,
ctx->client_ipv6 = QMI_CLIENT_WDS (mm_port_qmi_get_client (
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)));
/* 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);

View File

@@ -46,7 +46,7 @@ static GParamSpec *properties[PROP_LAST];
typedef struct {
QmiService service;
QmiClient *client;
MMPortQmiFlag flag;
guint flag;
} ServiceInfo;
struct _MMPortQmiPrivate {
@@ -80,7 +80,7 @@ struct _MMPortQmiPrivate {
static QmiClient *
lookup_client (MMPortQmi *self,
QmiService service,
MMPortQmiFlag flag,
guint flag,
gboolean steal)
{
GList *l;
@@ -106,7 +106,7 @@ lookup_client (MMPortQmi *self,
QmiClient *
mm_port_qmi_peek_client (MMPortQmi *self,
QmiService service,
MMPortQmiFlag flag)
guint flag)
{
return lookup_client (self, service, flag, FALSE);
}
@@ -114,7 +114,7 @@ mm_port_qmi_peek_client (MMPortQmi *self,
QmiClient *
mm_port_qmi_get_client (MMPortQmi *self,
QmiService service,
MMPortQmiFlag flag)
guint flag)
{
QmiClient *client;
@@ -259,7 +259,7 @@ allocate_client_ready (QmiDevice *qmi_device,
void
mm_port_qmi_allocate_client (MMPortQmi *self,
QmiService service,
MMPortQmiFlag flag,
guint flag,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)

View File

@@ -91,13 +91,18 @@ 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;
/* 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,
MMPortQmiFlag flag,
guint flag,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
@@ -107,14 +112,14 @@ gboolean mm_port_qmi_allocate_client_finish (MMPortQmi *self,
void mm_port_qmi_release_client (MMPortQmi *self,
QmiService service,
MMPortQmiFlag flag);
guint flag);
QmiClient *mm_port_qmi_peek_client (MMPortQmi *self,
QmiService service,
MMPortQmiFlag flag);
guint flag);
QmiClient *mm_port_qmi_get_client (MMPortQmi *self,
QmiService service,
MMPortQmiFlag flag);
guint flag);
QmiDevice *mm_port_qmi_peek_device (MMPortQmi *self);