QMAP multiplexing with ModemManager and MHI

Few weeks ago Aleksander Morgado released a new set of Mobile Broadbad tools: libmbim 1.30.0, libqmi 1.34.0 and ModemManager 1.22. Lot of good stuff there as you can see in the overview of changes: among them, there’s also the support of QMAP multiplexing for MHI-based modems.

QMAP multiplexing

QMAP multiplexing through USB

QMAP support for USB-based modems has been available in ModemManager since version 1.18, both through the qmi_wwan inbox capability (now deprecated) and rmnet.

Before approaching the task for adding support to MHI, I’ve started looking at that feature more deeply, performing tests with different modems and it proved to be working pretty well.

During this process I found a few bugs (Data not passing when using qmi_wwan + rmnet and QMAPv5/v4, Wrong qmap multiplex kernel method if data aggregation protocol is already set once MM starts, Mismatch between modem QMAP dl max aggregation size and qmi_wwan rx urb size), all of them fixed by MR!1043 qmap fixes.

The USB implementation then served as the reference for the implementation related to mhi.

The MHI side…

Adding QMAP multiplexing support for mhi was indeed simpler than I had initially thought.

As a first consideration, differently than USB, there’s a single way on the kernel side for having QMAP and that is rmnet: so the implementation basically consisted of adding the PCIe cases in focused points of the ModemManager code, since most of the implemention for rmnet was already available due to USB and libqmi was already capable of properly managing the rmnet links.

The result was MR!1047 QMAP support for MHI.

The usage is basically the same as when an USB modem is used:

# mmcli -m <modem index> --create-bearer="apn=<apn>,ip-type=<type>,multiplex=requested"
Successfully created new bearer in modem:
        /org/freedesktop/ModemManager1/Bearer/<bearer index>
# mmcli -m <modem index> -b <bearer index> --connect
successfully connected the bearer

Then the network interface can be configured according to the information provided by the bearer, e.g.:

# mmcli -m <modem index> -b <bearer index>

Unfortunately NetworkManager support for multiplexed connections is still missing, see New feature: multiple connections for WWAN devices.

I’m not really a NetworkManager expert, but sooner or later I’ll try to take a look at that…