broadband-modem-qmi: fix max bearers computation in IPA based setups

In IPA based setups, there are only multiplexed bearers supported,
there is no way to not enable multiplexing.

We change the logic that computes the maximum number of multiplexed
and non-multiplexed bearers, so that we check which are the current
kernel data modes before computing them.
This commit is contained in:
Aleksander Morgado
2021-07-22 13:18:57 +02:00
parent 04dba846c9
commit 4a07ab39f1

View File

@@ -360,25 +360,36 @@ static MMBearerList *
modem_create_bearer_list (MMIfaceModem *self)
{
MMPortQmi *port;
guint n;
guint n_multiplexed;
guint n = 0;
guint n_multiplexed = 0;
port = mm_broadband_modem_qmi_peek_port_qmi (MM_BROADBAND_MODEM_QMI (self));
if (!port) {
/* this should not happen, just fallback to defaults */
mm_obj_warn (self, "no port to query maximum number of supported network links");
} else {
MMPortQmiKernelDataMode kernel_data_modes;
kernel_data_modes = mm_port_qmi_get_kernel_data_modes (port);
/* There are setups, like IPA, where there is ONLY multiplexing expected
* and supported. In those cases, there isn't any expected non-multiplexed
* bearer */
if (kernel_data_modes & (QMI_WDA_LINK_LAYER_PROTOCOL_RAW_IP | MM_PORT_QMI_KERNEL_DATA_MODE_802_3)) {
/* The maximum number of available/connected modems is guessed from
* the size of the data ports list. */
n = g_list_length (mm_base_modem_peek_data_ports (MM_BASE_MODEM (self)));
mm_obj_dbg (self, "allowed up to %u active bearers", n);
}
if (kernel_data_modes & (MM_PORT_QMI_KERNEL_DATA_MODE_MUX_RMNET | MM_PORT_QMI_KERNEL_DATA_MODE_MUX_QMIWWAN)) {
/* The maximum number of multiplexed links is retrieved from the
* MMPortQmi */
port = mm_broadband_modem_qmi_peek_port_qmi (MM_BROADBAND_MODEM_QMI (self));
if (!port) {
mm_obj_warn (self, "no port to query maximum number of supported network links");
n_multiplexed = 0;
} else {
n_multiplexed = mm_port_qmi_get_max_multiplexed_links (port);
mm_obj_dbg (self, "allowed up to %u active multiplexed bearers", n_multiplexed);
}
}
/* by default, no multiplexing support */
return mm_bearer_list_new (n, n_multiplexed);