Kernel module cdc_mbim
There are two basic ways to establish a connection via mobile broadband modems:
- Using a serial port (and AT protocol) with the Point-to-Point Protocol (PPP) as data link layer (layer 2) communications protocol (requires ppp_generic module);
- Using an emulated ethernet adapter over the QMI or MBMI protocol (requires cdc_mbim [qmi_wwan for Qualcomm based devices]).
A PPP session over a serial port has lower datarates in comparison to
e.g. LTE (which is only possible over emulated ethernet).
In the Alpine wiki there are steps for the ppp method described, so I
was trying to find a way for the second method.
For my basic understanding I figured out the following:
First the USB device has to be in modem mode. For the switch from zero
mode into modem mode there is usb-modeswitch.
When it’s about how to “speak” to the modem, there are (apart from the AT standard mentioned above) two modem control protocols to mention: QMI (Qualcomm Modem Interface) for Qualcomm based modems and MBIM (Mobile Broadband Interface Model). MBIM is supposed to be a new standard USB device model by the USB Implementers Forum. This model has also a new MBIM protocol.
This is where it comes to the cdc_mbim kernel modul, which is in upstream Linux since 3.8. Without this module it’s not possible to use (non-Qualcomm) mobile broadband dongles with an emulated ethernet adapter (and without ppp). To support the MBIM protocol there is libmbim, which package is currently in the Alpine community repo.
There is a good writing about this topic here:
https://sigquit.wordpress.com/2013/02/06/an-introduction-to-libmbim/
For Qualcomm based modems there is libqmi, which is also in the
community repo. Speaking of libqmi, actually qmi_wann could be also
considered to be enabled:
https://sigquit.wordpress.com/2014/06/11/qmiwwan-or-gobinet/
Basic working method: The USB interface gets split into an MBMI- or QMI-capable /dev/cdc-wdmX port (cdc_wdm modul) AND a network device - emulated ethernet adapter - created by qmi_wann (the modules usbnet and usb_wann are also relevant in this context).
/dev/cdc-wdm0 is for the management of the interface. For the use of the device emulated by qmi_wann there are ofono, uqemi and libqmi (in case of Qualcomm based modems). Otherwise there is libmbim.
It’s interesting to mention that for mobile broadband connections network-manager uses ModemManager, which is using libqmi or libmbim. Therefore for mobile broadband connections neither network-manager, nor ModemManager are required as either ppp or libmbim/libqmi provide the necessary tools for establishing a connection. Instead of network-manager there is also Connman.
While the ModemManager has its cli tool (mmcli), there is also mbimcli, which is the command line utility for libmbim (similar with qmicli and libqmi).
It’s possible to use an mbimcli command to establish a connection. There is also mbim-network, which uses mbimcli to establish a connection simply by the command: mbim-network /dev/cdc-wdm0 start (same with qmi-network).
For more info on this topic there is a pdf called: FOSDEM2013 - Mobile
broadband modem control protocols.pdf (easy to find)
And this is a great how-to:
http://trac.gateworks.com/wiki/wireless/modem
(from redmine: issue id 8855, created on 2018-05-01, closed on 2019-05-03)
- Changesets:
- Revision 7d1defbd by Natanael Copa on 2018-05-07T12:25:40Z:
main/linux-vanilla: misc config changes
- build xgene net drivers as modules (aarch64)
- enable cbc_mbim (x86/x86_64) fixes #8855