Commit Graph
3981 Commits
Author SHA1 Message Date
Andrew Lassalle ec375bd959 port-qmi: add support for QRTR
Extend mm-port-qmi to accept a QRTR node to work with modems using the
QRTR protocol.
2021-04-14 11:27:27 +02:00
Aleksander Morgado 312f753046 port-qmi: initialize endpoint info for all backends
Connect the signal to initialize endpoint info in the generic object
initialization, also applicable for QRTR ports.
2021-04-14 11:27:27 +02:00
Aleksander Morgado c35bf66678 port-qmi: net ports using IPA driver expect rmnet based multiplexing
When using the IPA driver we cannot blindly use the master network
interface, we must always use RMNET based multiplexing.
2021-04-14 11:27:27 +02:00
Aleksander Morgado bf519fcc1b port-qmi: avoid using QmiDeviceExpectedDataFormat in the port setup
The QmiDeviceExpectedDataFormat is specific to modules exposed by the
qmi_wwan driver, it has nothing to do with other drivers we may find
in the system like bam-dmux or ipa, which don't allow changing the
expected data format.

The port setup logic is now updated to use a new flags bitmask that
specifies which kernel data modes are supported or currently
available.
2021-04-14 11:27:27 +02:00
Aleksander Morgado 768d76e0aa context: allow disabling QRTR on runtime even if support is built 2021-04-14 11:27:27 +02:00
Aleksander Morgado 591d904f5c kernel-device,qrtr: common physdev UID for all QRTR nodes
Add a common physdev UID to all ports in the Qualcomm SoC, so that they
are all bound together to the same modem object.

This change assumes that no external plugged device ever exports a
QRTR node in the QRTR bus (e.g. that no PCI or USB device would ever
do that). This assumption is likely wrong, but given that we're
currently limiting the QRTR support to the Qualcomm SoC plugin, the
assumption is valid for us for now.
2021-04-14 11:27:27 +02:00
Andrew Lassalle 2b126725bf qrtr-bus-watcher: add a class to watch for QRTR nodes
Add a watcher to listen for QRTR add/remove signals.
2021-04-14 11:27:27 +02:00
Andrew Lassalle daf27a9933 kernel-device,qrtr: add MMKernelDeviceQrtr skeleton
Add the skeleton of MMKernelDeviceQrtr and allow building it by the
introduction of with-qrtr.
2021-04-14 11:27:27 +02:00
Andrew Lassalle 5a9460b355 log: enable QRTR logging
Add the 'Qrtr' domain so logging from libqrtr is enabled.
2021-04-14 11:27:27 +02:00
Andrew Lassalle e24346128d filter: add filter for QRTR devices
Add support for devices using the subsystem "qrtr".
2021-04-14 11:27:27 +02:00
Aleksander Morgado 866c1d4ab6 build: look for libqrtr-glib with pkg-config
The WITH_QRTR symbol in config.h will let us know both if libqrtr-glib
is found and if libqmi-glib is compiled with QRTR support (as per the
exposed "qmi_qrtr_supported" variable in pkg-config).
2021-04-14 10:35:06 +02:00
Aleksander Morgado da24b7d450 iface-modem: minor refactor in the unload required logic
No change in the logic, just in how it's setup. E.g. we will load the
max number of retries just once when the logic starts, instead of
checking it on every iteration.

Also some other minor coding style changes included, e.g. adding the
timeout between retries as a defined symbol.
2021-04-14 10:07:28 +02:00
Pavan Holla 19edbd0b53 iface-modem: Increase unlock_required retries
If a SIM is known to exist, for e.g. if it was created during load_sim_slots,
persist a few more times before giving up on the SIM to be ready. There
are modems on which the SIM takes more than 15s to be ready, luckily,
they happen to be QMI modems where the SIM's iccid in load_sim_slots
lets us know that there is a sim.
2021-04-14 07:49:59 +00:00
Aleksander Morgado 3d5a994ca8 kerneldevice: fix segfault when processing event for non-existing port
ModemManager[6954]: <warn>  [1618260091.319919] [br0] invalid sysfs path read for net/br0
    **
    ERROR:kerneldevice/mm-kernel-device-generic.c:235:ptr_array_add_sysfs_attribute_link_basename: assertion failed: (array && sysfs_path && attribute)
    Bail out! ERROR:kerneldevice/mm-kernel-device-generic.c:235:ptr_array_add_sysfs_attribute_link_basename: assertion failed: (array && sysfs_path && attribute)

    Thread 1 "ModemManager" received signal SIGABRT, Aborted.
    (gdb) bt
    #0  0x00007ffff7438ef5 in raise () at /usr/lib/libc.so.6
    #1  0x00007ffff7422862 in abort () at /usr/lib/libc.so.6
    #2  0x00007ffff76c2084 in  () at /usr/lib/libglib-2.0.so.0
    #3  0x00007ffff771d85d in g_assertion_message_expr () at /usr/lib/libglib-2.0.so.0
    #4  0x00005555556a5337 in ptr_array_add_sysfs_attribute_link_basename (array=0x5555557de520, sysfs_path=0x0, attribute=0x555555703bd8 "driver", out_value=0x0)
        at kerneldevice/mm-kernel-device-generic.c:235
    #5  0x00005555556a542b in preload_contents_other (self=0x5555557a6c60) at kerneldevice/mm-kernel-device-generic.c:255
    #6  0x00005555556a6485 in preload_contents (self=0x5555557a6c60) at kerneldevice/mm-kernel-device-generic.c:517
    #7  0x00005555556a7fb6 in check_preload (self=0x5555557a6c60) at kerneldevice/mm-kernel-device-generic.c:980
    #8  0x00005555556a855f in initable_init (initable=0x5555557a6c60, cancellable=0x0, error=0x7fffffffe5c8) at kerneldevice/mm-kernel-device-generic.c:1127
    #9  0x00007ffff78a2f41 in g_initable_new_valist () at /usr/lib/libgio-2.0.so.0
    #10 0x00007ffff78a2ffa in g_initable_new () at /usr/lib/libgio-2.0.so.0
    #11 0x00005555556a8205 in mm_kernel_device_generic_new_with_rules (props=0x5555557a5fa0, rules=0x7fffec001e30, error=0x7fffffffe5c8) at kerneldevice/mm-kernel-device-generic.c:1042
    #12 0x00005555556a827d in mm_kernel_device_generic_new (props=0x5555557a5fa0, error=0x7fffffffe5c8) at kerneldevice/mm-kernel-device-generic.c:1063
    #13 0x00005555555aba9c in handle_kernel_event (self=0x555555793220, properties=0x5555557a5fa0, error=0x7fffffffe5c8) at mm-base-manager.c:414
2021-04-12 23:39:35 +02:00
Pavan Holla b978a7045f shared-qmi: Remove iteration over slots at startup
MM used to iterate over each SIM slot to load IMSI, operator name etc.
However, switching slots at start up caused a few issues in the real
world.
a) Sierra Wireless' AUTO-SIM feature, the hidden SIM slot switching
is actually triggering a full modem reset (because the firmware
detects a new SIM for a different operator, and automatically resets
itself to load the firmware+carrier config associated to that other
operator).
b) The IMSI on slot 2 is reported to be the same as slot 1.
This is solved by adding a 1000ms delay before reading IMSI
on slot 2, after GET_CARD_STATUS indicates the sim is ready. The
delay means a 2s startup penalty when both slots are loaded.
c) 2/5 developers have encountered a fw bug where the modem
incorrectly reports that the SIM on slot 1 has vanished
after the sequence of slot switches. This makes the modem
unusable.
d) If the eSIM daemon changes slots and opens a channel to the eUICC,
MM will detect a hotswap, and break the channel during reprobe.
e) SIMs from a certain large operator in the US take over 20s to be
ready. Thus, switching to such a SIM for just loading IMSI may not be
worth it.

This change does not affect detection of sims in all slots. We still
expose the iccid and presence of all sims. However, properties like
IMSI and operator_name will not be exposed for the inactive slot.
2021-04-12 21:03:57 +00:00
Aleksander Morgado b766ded3ca iface-modem-time: fix invalid read when loading network timezone fails
==226546== Invalid read of size 4
  ==226546==    at 0x5068CB7: g_error_matches (in /usr/lib/libglib-2.0.so.0.6600.7)
  ==226546==    by 0x1BAC86: load_network_timezone_ready (mm-iface-modem-time.c:218)
  ==226546==    by 0x4EA827E: g_simple_async_result_complete (in /usr/lib/libgio-2.0.so.0.6600.7)
  ==226546==    by 0x17AE2C: at_command_ready (mm-base-modem-at.c:538)
  ==226546==    by 0x4EA827E: g_simple_async_result_complete (in /usr/lib/libgio-2.0.so.0.6600.7)
  ==226546==    by 0x24B475: serial_command_ready (mm-port-serial-at.c:378)
  ==226546==    by 0x4EA827E: g_simple_async_result_complete (in /usr/lib/libgio-2.0.so.0.6600.7)
  ==226546==    by 0x244F94: command_context_complete_and_free (mm-port-serial.c:141)
  ==226546==    by 0x246861: port_serial_got_response (mm-port-serial.c:755)
  ==226546==    by 0x246923: port_serial_timed_out (mm-port-serial.c:785)
  ==226546==    by 0x50863C3: ??? (in /usr/lib/libglib-2.0.so.0.6600.7)
  ==226546==    by 0x5085B83: g_main_context_dispatch (in /usr/lib/libglib-2.0.so.0.6600.7)
2021-04-09 00:55:56 +02:00
Aleksander Morgado 83a00a9457 modem-helpers: new helper to lookup range from CGDCONT=? response 2021-04-08 10:04:42 +00:00
Aleksander Morgado 7e0404c6c2 modem-helpers-qmi: match QMI_WDS_AUTHENTICATION_NONE with MM_BEARER_ALLOWED_AUTH_NONE
There is no point in returning UNKNOWN when the WDS auth value is NONE.
2021-04-08 10:04:42 +00:00
Aleksander Morgado e9ee6dfdb8 broadband-modem-qmi: remove unused variables 2021-04-08 10:04:42 +00:00
Aleksander Morgado 1db0f0b66f iface-modem-simple: add multiplex info in connection details logging 2021-04-02 15:05:02 +02:00
Aleksander Morgado c3fdaca4c8 iface-modem-simple: minor renames in logging of connection details 2021-04-02 15:05:02 +02:00
Aleksander Morgado e6a04c0703 iface-modem-3gpp-ussd: use common method to abort invocation if not enabled 2021-04-02 15:05:02 +02:00
Aleksander Morgado 7dfe6198e1 iface-modem: publish helper to abort invocation if state not reached
So that we can use it in other interfaces to abort invocations e.g. if
the modem is not yet enabled.
2021-04-02 15:05:02 +02:00
Aleksander Morgado cc59492caf base-bearer: add autoptr setup for MMBearerConnectResult 2021-04-02 15:05:02 +02:00
Aleksander Morgado 851a708442 modem-helpers: ip family normalization doesn't need log_object 2021-04-01 11:24:42 +02:00
Aleksander Morgado 2c27a7aadc base-bearer: remove default IP family property
There is no point in providing a configurable default IP family in the
bearer object, because we can always assume IPv4 as being the only
default expected.

Simplify the logic and also provide a new method to get the normalize
the IP family, using IPv4 as default always.
2021-03-31 23:46:31 +02:00
Pavan Holla 250c09b73c shared-qmi: Fix crash when a hotswap occurs while loading slots 2021-03-31 15:56:44 +00:00
Aleksander Morgado 7b141a6715 port-serial: remove misleading comments 2021-03-31 13:55:52 +02:00
Aleksander Morgado c456027563 port-serial: the 'FlashOk' property is not really set on construct 2021-03-31 13:55:52 +02:00
Aleksander Morgado 9f7bbf28d2 iface-modem: avoid check for SIM swap if no interface skeleton available 2021-03-24 21:53:45 +01:00
Aleksander Morgado 96d83392a8 iface-modem: avoid lock info update if no interface skeleton available
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/351
2021-03-24 21:53:45 +01:00
Aleksander Morgado d6a724c7b3 broadband-modem: don't warn enabling/disabling USSD failures
USSD is a feature interface, not critical for connection management,
so skip warning on interface enabling/disabling failures.
2021-03-24 11:56:08 +01:00
Andrew Lassalle dbb3825984 kernel-device-helpers: Remove unused variable 2021-03-18 17:10:54 -07:00
Aleksander Morgado ab007a4496 base-modem: plug leaks when organizing ports
The GLists maintained in the logic need to be explicitly freed (just
the lists, not the list contents) if we exit early on error or if we
end up deciding that the specific ports are available but unsupported
by the plugin (e.g. if a plugin that doesn't support net ports finds
net ports in the modem).

  ==225333== 24 bytes in 1 blocks are definitely lost in loss record 2,024 of 5,525
  ==225333==    at 0x483E77F: malloc (vg_replace_malloc.c:307)
  ==225333==    by 0x506C539: g_malloc (in /usr/lib/libglib-2.0.so.0.6600.7)
  ==225333==    by 0x508DC8F: g_slice_alloc (in /usr/lib/libglib-2.0.so.0.6600.7)
  ==225333==    by 0x50636B4: g_list_append (in /usr/lib/libglib-2.0.so.0.6600.7)
  ==225333==    by 0x17E671: mm_base_modem_organize_ports (mm-base-modem.c:1298)
  ==225333==    by 0x1E4409: mm_plugin_create_modem (mm-plugin.c:1094)
  ==225333==    by 0x162C81: mm_device_create_modem (mm-device.c:481)
  ==225333==    by 0x15DE60: device_support_check_ready (mm-base-manager.c:218)
  ==225333==    by 0x4EA8173: ??? (in /usr/lib/libgio-2.0.so.0.6600.7)
  ==225333==    by 0x4EAC6E8: ??? (in /usr/lib/libgio-2.0.so.0.6600.7)
  ==225333==    by 0x16730F: device_context_run_ready (mm-plugin-manager.c:1533)
  ==225333==    by 0x4EA8173: ??? (in /usr/lib/libgio-2.0.so.0.6600.7)
2021-03-18 14:27:34 +01:00
Aleksander Morgado 3e58fbe547 base-bearer: ignore forced disconnections
If using PPP, ModemManager is never in charge of deciding when the
connection is finished, because that would end up making ModemManager
try to use the TTY port while pppd is still using it.

When the modem goes unregistered for some time, we should not force
the disconnection of the bearer object, we still need to wait for pppd
to tell us the modem is disconnected.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/331
2021-03-17 09:19:17 +00:00
Aleksander Morgado 952f416577 bearer-mbim: if no explicit 'multiplex' setting, treat as 'requested' 2021-03-17 09:39:10 +01:00
Aleksander Morgado 8f3df02ba1 broadband-modem-mbim: report up to 256 multiplexed bearers
As defined in the MBIM protocol (session id 0 to 255).
2021-03-17 09:39:10 +01:00
Aleksander Morgado 2d374b1c41 bearer-mbim: implement multiplex support 2021-03-17 09:39:10 +01:00
Aleksander Morgado 32c4b20066 port-mbim: implement new link setup/cleanup methods
These are really wrappers around the MbimDevice methods, only making
sure the MMPortMbim is open before they're used.
2021-03-17 09:39:10 +01:00
Aleksander Morgado e5305498b7 bearer-mbim: session id 0 by default in all non-multiplexed connections
The original logic in the MBIM modem would assume that if we had more
than one network interface in the same modem, we could connect
multiple data interfaces, each one with a different session. That
logic is actually wrong, when using the master (non-multiplexed)
network interface we should always use session id 0, which is the one
holding all non-VLAN-tagged traffic.

So, remove the logic that automatically creates new bearers with a
different session id, as that is really wrong.
2021-03-17 09:39:10 +01:00
Aleksander Morgado 0830f9510c bearer-mbim: refactor and switch to autoptr
Also, keep track of the MMPortMbim instead of the MbimDevice directly,
because the new multiplex support will require operations on the port
as well, not only on the device.
2021-03-17 09:39:10 +01:00
Aleksander Morgado 1fa8ce3f08 broadband-modem-mbim: reset all net ports during initialization
We want to start with the data ports as clean as possible when the
modem is initialized, so we make sure the master interface is down and
that all links found are removed. This ensures a clean restart if
e.g. the daemon crashes for some other reason.
2021-03-17 09:39:10 +01:00
Aleksander Morgado 37d4f5c129 port-mbim: implement port reset logic 2021-03-17 09:36:53 +01:00
Eric Caruso c7b1ee9c94 mm-base-manager: split assertion
This allows us to know which of the subsystem or name for a
removed device is triggering the assertion from just a stack
trace that contains line information.
2021-03-16 11:39:15 -07:00
Aleksander Morgado fdfd4b270a shared-qmi: acquisition order preference TLV always same items
The acquisition order preference TLV must always have the same number
of elements, just the order of the elements should be different.

Also, always prefer the acquisition order preference TLV to the
GSM+WCDMA specific one, which is the same logic the modem applies.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/340
2021-03-15 17:46:49 +01:00
Aleksander Morgado bb5bc9c8c5 shared-qmi: process all feature checks in SSP response together
Loading capabilities is the very first step of the state machines, and
so we can rely on the "NAS Get SSP" method performed there to process
all feature checks of the SSP response.
2021-03-15 17:46:41 +01:00
Aleksander Morgado 65a7624ffd shared-qmi: if getting TP/SSP fails, assume unsupported
Until now we were only considering TP/SSP unsupported if we received
a QMI protocol error (e.g. reporting unknown command).

We now also consider TP/SSP unsupported if the actual request
succeeds, but an error is reported in the response. There is no point
in considering TP/SSP supported if the plain get request without input
TLVs given fails.
2021-03-15 17:21:50 +01:00
Aleksander Morgado 1a5f90f15b shared-qmi: add missing feature check flag initialization to UNKNOWN 2021-03-15 17:21:50 +01:00
Aleksander Morgado 67b64eb7ee shared-qmi: rename feature check variables
We want the "extended_lte_band_preference" with the "nas_ssp" prefix,
as we're going to add more checks for SSP features.
2021-03-15 14:58:54 +01:00
Madhav 830230dccb broadband-modem-qmi: retrieve operator name from plmn_name based on current operator id.
Retrieve operator name from plmn_name based on current operator id.
If service name is available, use service name as operator name.
If not, use the long or short name.
2021-03-14 15:23:55 +01:00