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,
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);

View File

@@ -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;

View File

@@ -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);
/* 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_release_client (MMPortQmi *self,
QmiService service,
MMPortQmiFlag flag);
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);
QmiClient *mm_port_qmi_peek_client (MMPortQmi *self,
QmiService service,
MMPortQmiFlag flag);
QmiClient *mm_port_qmi_get_client (MMPortQmi *self,
QmiService service,
MMPortQmiFlag flag);
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);