aboutsummaryrefslogtreecommitdiff
path: root/src/mm-bearer-qmi.c
diff options
context:
space:
mode:
authorStephan Gerhold <stephan.gerhold@kernkonzept.com>2022-08-11 17:53:00 +0200
committerStephan Gerhold <stephan.gerhold@kernkonzept.com>2022-08-18 18:12:49 +0200
commitbc1cecbfc40bbac48beaf9bfe20f1403ebdbb959 (patch)
treed1ad606b69cbc1f8817af6832d8d286be7851daa /src/mm-bearer-qmi.c
parent2b83e274742039432de81f663c34383c238d0314 (diff)
broadband-modem-qmi: choose endpoint number based on data port
At the moment the endpoint type/number is chosen based on the QMI control port. The assumption is that multiplexing is implemented using an additional protocol layer (e.g. QMAP) or that each network interface has its own QMI control port. This is not necessarily the case for BAM-DMUX. To use the built-in multiplexing the WDS client must be bound to the correct data port. This works already for older firmware versions using "Bind Data Port" (SIO port numbers), but not for newer ones using "Bind Mux Data Port" (endpoint type/interface numbers). Make it work for newer firmware versions as well by choosing the endpoint type/number based on the data port similar to the existing implementation for SIO port numbers. Note: The correct endpoint interface number is currently only used for the steps in mm-bearer-qmi. Ideally more refactoring should be done in mm-port-qmi to call WDA Set Data Format for each of the endpoints. In practice it usually works fine without because the data format is set correctly by default.
Diffstat (limited to 'src/mm-bearer-qmi.c')
-rw-r--r--src/mm-bearer-qmi.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/mm-bearer-qmi.c b/src/mm-bearer-qmi.c
index 79433def..a71d6593 100644
--- a/src/mm-bearer-qmi.c
+++ b/src/mm-bearer-qmi.c
@@ -492,8 +492,9 @@ typedef struct {
ConnectStep step;
MMPort *data;
MMPortQmi *qmi;
- QmiSioPort sio_port;
- gboolean sio_port_failed;
+
+ MMQmiDataEndpoint endpoint;
+ gboolean sio_port_failed;
gint profile_id;
MMBearerIpMethod ip_method;
@@ -1820,12 +1821,12 @@ connect_context_step (GTask *task)
case CONNECT_STEP_BIND_DATA_PORT_IPV4:
/* If SIO port given, bind client to it */
- if (!ctx->sio_port_failed && ctx->sio_port != QMI_SIO_PORT_NONE) {
+ if (!ctx->sio_port_failed && ctx->endpoint.sio_port != QMI_SIO_PORT_NONE) {
g_autoptr(QmiMessageWdsBindDataPortInput) input = NULL;
- mm_obj_dbg (self, "binding to data port: %s", qmi_sio_port_get_string (ctx->sio_port));
+ mm_obj_dbg (self, "binding to data port: %s", qmi_sio_port_get_string (ctx->endpoint.sio_port));
input = qmi_message_wds_bind_data_port_input_new ();
- qmi_message_wds_bind_data_port_input_set_data_port (input, ctx->sio_port, NULL);
+ qmi_message_wds_bind_data_port_input_set_data_port (input, ctx->endpoint.sio_port, NULL);
qmi_client_wds_bind_data_port (ctx->client_ipv4,
input,
10,
@@ -1843,8 +1844,8 @@ connect_context_step (GTask *task)
input = qmi_message_wds_bind_mux_data_port_input_new ();
qmi_message_wds_bind_mux_data_port_input_set_endpoint_info (
input,
- mm_port_qmi_get_endpoint_type (ctx->qmi),
- mm_port_qmi_get_endpoint_interface_number (ctx->qmi),
+ ctx->endpoint.type,
+ ctx->endpoint.interface_number,
NULL);
qmi_message_wds_bind_mux_data_port_input_set_mux_id (input, ctx->mux_id, NULL);
@@ -1956,12 +1957,12 @@ connect_context_step (GTask *task)
case CONNECT_STEP_BIND_DATA_PORT_IPV6:
/* If SIO port given, bind client to it */
- if (!ctx->sio_port_failed && ctx->sio_port != QMI_SIO_PORT_NONE) {
+ if (!ctx->sio_port_failed && ctx->endpoint.sio_port != QMI_SIO_PORT_NONE) {
g_autoptr(QmiMessageWdsBindDataPortInput) input = NULL;
- mm_obj_dbg (self, "binding to data port: %s", qmi_sio_port_get_string (ctx->sio_port));
+ mm_obj_dbg (self, "binding to data port: %s", qmi_sio_port_get_string (ctx->endpoint.sio_port));
input = qmi_message_wds_bind_data_port_input_new ();
- qmi_message_wds_bind_data_port_input_set_data_port (input, ctx->sio_port, NULL);
+ qmi_message_wds_bind_data_port_input_set_data_port (input, ctx->endpoint.sio_port, NULL);
qmi_client_wds_bind_data_port (ctx->client_ipv6,
input,
10,
@@ -1979,8 +1980,8 @@ connect_context_step (GTask *task)
input = qmi_message_wds_bind_mux_data_port_input_new ();
qmi_message_wds_bind_mux_data_port_input_set_endpoint_info (
input,
- mm_port_qmi_get_endpoint_type (ctx->qmi),
- mm_port_qmi_get_endpoint_interface_number (ctx->qmi),
+ ctx->endpoint.type,
+ ctx->endpoint.interface_number,
NULL);
qmi_message_wds_bind_mux_data_port_input_set_mux_id (input, ctx->mux_id, NULL);
@@ -2257,7 +2258,6 @@ _connect (MMBaseBearer *_self,
ctx->self = g_object_ref (self);
ctx->modem = g_object_ref (modem);
ctx->mux_id = QMI_DEVICE_MUX_ID_UNBOUND;
- ctx->sio_port = QMI_SIO_PORT_NONE;
ctx->step = CONNECT_STEP_FIRST;
ctx->ip_method = MM_BEARER_IP_METHOD_UNKNOWN;
g_task_set_task_data (task, ctx, (GDestroyNotify)connect_context_free);
@@ -2272,7 +2272,7 @@ _connect (MMBaseBearer *_self,
}
/* Each data port has a single QMI port associated */
- ctx->qmi = mm_broadband_modem_qmi_get_port_qmi_for_data (MM_BROADBAND_MODEM_QMI (modem), ctx->data, &ctx->sio_port, &error);
+ ctx->qmi = mm_broadband_modem_qmi_get_port_qmi_for_data (MM_BROADBAND_MODEM_QMI (modem), ctx->data, &ctx->endpoint, &error);
if (!ctx->qmi) {
g_task_return_error (task, error);
g_object_unref (task);