diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2021-07-22 13:18:57 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2021-08-09 12:22:26 +0000 |
commit | 4a07ab39f14d3879c9168e5d7da3b8a0a32bfb61 (patch) | |
tree | 0d6985cc77548eb0a4990dec0bac3ea85fc0fb45 /src | |
parent | 04dba846c9659f7066d44acd6ecddbe76b2fc880 (diff) |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-broadband-modem-qmi.c | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c index 1dd3295b..9d508216 100644 --- a/src/mm-broadband-modem-qmi.c +++ b/src/mm-broadband-modem-qmi.c @@ -360,24 +360,35 @@ static MMBearerList * modem_create_bearer_list (MMIfaceModem *self) { MMPortQmi *port; - guint n; - guint n_multiplexed; - - /* 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); - - /* The maximum number of multiplexed links is retrieved from the - * MMPortQmi */ + 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"); - 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); + 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 */ + 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 */ |