HOWTO: using QMAP multiplexing with libqmi

Wolfgang Tolkien w at tolkien.email
Tue Jul 24 21:48:22 UTC 2018


Newer Qualcomm chipsets only have a single 'wwan0' interface and require the use of Qualcomm's 'QMAP' multiplexing protocol to establish multiple simultaneous connections. Aside from an app note by Sierra Wireless that explains how to do this using their API, there seems to be very little information available. Here is the app note:

https://source.sierrawireless.com/resources/airprime/application_notes_and_code_samples/airprime---multiple-pdn-support-on-newer-sierra-wireless-modules/

Here is how to do this with libqmi / qmi_wwan:

* Tested on a Sierra EM7565 using the latest firmware - this will NOT work on earlier firmware, so get the latest here: https://source.sierrawireless.com/resources/airprime/minicard/75xx/airprime-em_mc75xx-approved-fw-packages/
* Tested with kernel 4.14. Amazingly, the qmi_wwan driver already had QMAP support for a long time.
* Switch your EM7565 to QMAP mode using the 'AT!NETNUM" command as explained in the app note above. Sierra states that the EM7565 supports a maximum of 8 mux'ed interfaces, but they do their internal testing with 4 interfaces. So we will stick with that below.

After the modem powers up and you see the 'wwan0' interface, issue the following commands to setup the qmi_wwan driver for qmap:


# enable raw ip encapsulation
echo 1 > /sys/class/net/wwan0/qmi/raw_ip

# using fixed number of interfaces (4) and fixed mux ids [1-4]
echo 1 > /sys/class/net/wwan0/qmi/add_mux
echo 2 > /sys/class/net/wwan0/qmi/add_mux
echo 3 > /sys/class/net/wwan0/qmi/add_mux
echo 4 > /sys/class/net/wwan0/qmi/add_mux

# startup MTU is 0, set to 1500 instead
ip link set qmimux0 mtu 1500
ip link set qmimux1 mtu 1500
ip link set qmimux2 mtu 1500
ip link set qmimux3 mtu 1500

Now we have 4 'qmimux[1-4]' interfaces ready to be used for simultaneous connections. For each connection do the following:


# bring up the link layer. For some reason it seems important to do this before starting with QMI traffic.
ip link set wwan0 up
ip link set qmimux0 up

# get WDS and WDA client ids and don't release them. 
qmicli -p -d /dev/cdc-wdm0 --client-no-release-cid --wds-noop
qmicli -p -d /dev/cdc-wdm0 --client-no-release-cid --wda-noop

# client ids shall henceforth be referred to as $wds_cid and $wda_cid. 

# set the data format as 'qmap' - note that the 'ep-iface-number' is modem-specific and is '8' for the EM7565
qmicli -p -d /dev/cdc-wdm0 --wda-set-data-format="link-layer-protocol=raw-ip,ul-protocol=qmap,dl-protocol=qmap,dl-max-datagrams=32,dl-datagram-max-size=32768,ep-type=hsusb,ep-iface-number=8" --client-cid=$wda_cid --client-no-release-cid

# set mux ID to '1', which is the ID that has been chosen for the qmimux0 interface above
qmicli -p -d /dev/cdc-wdm0 --wds-bind-mux-data-port="mux-id=1,ep-iface-number=8" --client-cid=$wds_cid --client-no-release-cid

# start network using the same WDS client id:
qmicli -p -d /dev/cdc-wdm0 --wds-start-network="apn=whatever" --client-cid=$wds_cid --client-no-release-cid

# setup the qmimux0 interface using DHCP or by getting IP settings via wds-get-current-settings and applying them manually (I only tried the latter)

Repeat for other qmimuxX interfaces

Cheers,
Wolfgang





​​


More information about the libqmi-devel mailing list