<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Hi Bjørn,</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">thanks for this reply, it's full of information!</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Carlo</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 20 September 2016 at 11:16, Bjørn Mork <span dir="ltr"><<a href="mailto:bjorn@mork.no" target="_blank">bjorn@mork.no</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Carlo Lobrano <<a href="mailto:c.lobrano@gmail.com">c.lobrano@gmail.com</a>> writes:<br>
<br>
> Initially I'd like to investigate this topic without considering the<br>
> protocol (AT, MBIM, QMI), and only the modem's capabilities, although this<br>
> note from the above mentioned discussion is really appealing<br>
><br>
> MBIM modems can multiplex IP sessions over a single data port.<br>
><br>
><br>
> and as Dan said, QMI should not support this with a single data port.<br>
<br>
</span>QMI should already work fine I think. The driver creates a cdc-wdm<br>
device and a NET port per QMI function, and modems with more than one<br>
function will therefore have more than one data port available.<br>
<br>
The driver ignores the non-functional third QMI port on the Sierra<br>
modems with this problem, so I believe there is no need for MM or<br>
anything else to be aware of that issue.<br>
<span class=""><br>
> Also this note caught my attention<br>
><br>
> There's an issue here; the port needs to be a NET port, because that<br>
>> is what the Bearer should export in the interface. This is, if you<br>
>> have 2 bearers, they should both expose "wwan0", and not<br>
>> "/dev/cdc-wdm...". NetworkManager needs to know which is the NET port<br>
>> where the IP config<br>
>> is to be applied.<br>
><br>
><br>
> does this mean that the required changes will touch other actors (like<br>
> NetworkManager and/or the driver)?<br>
<br>
</span>I don't think so. NetworkManager only needs the NET port and address<br>
info. The driver already supports creating additional NET ports<br>
representing the multiplexed MBIM IP sessions, mapping them to VLAN<br>
interfaces on top of the single default port. The driver API is<br>
documented here:<br>
<a href="https://www.kernel.org/doc/Documentation/networking/cdc_mbim.txt" rel="noreferrer" target="_blank">https://www.kernel.org/doc/<wbr>Documentation/networking/cdc_<wbr>mbim.txt</a><br>
<br>
So you can set up multiple MBIM IP sessions manually using the "ip" and<br>
"mbimcli" tools today. What's missing is the part that creates and<br>
deletes the NET ports as needed, and mapping these to bearers and MBIM<br>
session IDs in ModemManager.<br>
<br>
I guess an example of how to create multiple sessions can help explain<br>
how the existing driver and libmbim support works:<br>
<br>
<br>
1) this modem supports up to 8 sessions:<br>
<br>
<br>
# mbimcli -p -d /dev/cdc-wdm0 --query-device-caps<br>
[/dev/cdc-wdm0] Device capabilities retrieved:<br>
Device type: 'remote'<br>
Cellular class: 'gsm'<br>
Voice class: 'no-voice'<br>
Sim class: 'removable'<br>
Data class: 'umts, hsdpa, hsupa, lte'<br>
SMS caps: 'pdu-receive, pdu-send'<br>
Ctrl caps: 'reg-manual'<br>
Max sessions: '8'<br>
Custom data class: 'unknown'<br>
Device ID: xxx<br>
Firmware info: 'SWI9X30C_02.20.03.00'<br>
Hardware info: 'EM7455'<br>
<br>
<br>
2) the NET interface created by the driver is named wwan0. We create<br>
three new interfaces on top of it, representing MBIM session IDs 0,1<br>
and 2:<br>
<br>
<br>
# ip link add link wwan0 name wwan0.0 type vlan id 4094<br>
# ip link add link wwan0 name wwan0.1 type vlan id 1<br>
# ip link add link wwan0 name wwan0.2 type vlan id 2<br>
<br>
3) and bring up the main interface and make sure we're attached to the network<br>
<br>
# ip link set wwan0 up<br>
<br>
# mbimcli -p -d /dev/cdc-wdm0 --attach-packet-service<br>
[/dev/cdc-wdm0] Successfully attached to packet service<br>
<br>
[/dev/cdc-wdm0] Packet service status:<br>
Network error: 'unknown'<br>
Packet service state: 'attached'<br>
Available data classes: 'lte'<br>
Uplink speed: '50000000 bps'<br>
Downlink speed: '300000000 bps'<br>
<br>
<br>
4) then we connect three different sessions to different APNs, one IPv6<br>
only, one NATed IPv4 and one IPv4 with a public IP address:<br>
<br>
<br>
# mbimcli -p -d /dev/cdc-wdm0 --connect=session-id=0,apn=ims<br>
[/dev/cdc-wdm0] Successfully connected<br>
<br>
[/dev/cdc-wdm0] Connection status:<br>
Session ID: '0'<br>
Activation state: 'activated'<br>
Voice call state: 'none'<br>
IP type: 'ipv6'<br>
Context type: 'internet'<br>
Network error: 'unknown'<br>
<br>
[/dev/cdc-wdm0] IPv4 configuration available: 'none'<br>
<br>
[/dev/cdc-wdm0] IPv6 configuration available: 'address, gateway, mtu'<br>
IP [0]: '2a02:2121:105:fd6d:8887:f6a8:<wbr>c14b:1dc2/64'<br>
Gateway: '2a02:2121:105:fd6d:31df:2343:<wbr>a046:245'<br>
MTU: '1500'<br>
<br>
# mbimcli -p -d /dev/cdc-wdm0 --connect=session-id=1,apn=<wbr>telenor.smart<br>
[/dev/cdc-wdm0] Successfully connected<br>
<br>
[/dev/cdc-wdm0] Connection status:<br>
Session ID: '1'<br>
Activation state: 'activated'<br>
Voice call state: 'none'<br>
IP type: 'ipv4'<br>
Context type: 'internet'<br>
Network error: 'unknown'<br>
<br>
[/dev/cdc-wdm0] IPv4 configuration available: 'address, gateway, dns, mtu'<br>
IP [0]: '<a href="http://10.130.163.117/30" rel="noreferrer" target="_blank">10.130.163.117/30</a>'<br>
Gateway: '10.130.163.118'<br>
DNS [0]: '193.213.112.4'<br>
DNS [1]: '130.67.15.198'<br>
MTU: '1500'<br>
<br>
[/dev/cdc-wdm0] IPv6 configuration available: 'none'<br>
<br>
# mbimcli -p -d /dev/cdc-wdm0 --connect=session-id=2,apn=<wbr>telenor<br>
[/dev/cdc-wdm0] Successfully connected<br>
<br>
[/dev/cdc-wdm0] Connection status:<br>
Session ID: '2'<br>
Activation state: 'activated'<br>
Voice call state: 'none'<br>
IP type: 'ipv4'<br>
Context type: 'internet'<br>
Network error: 'unknown'<br>
<br>
[/dev/cdc-wdm0] IPv4 configuration available: 'address, gateway, dns, mtu'<br>
IP [0]: '<a href="http://46.156.97.6/30" rel="noreferrer" target="_blank">46.156.97.6/30</a>'<br>
Gateway: '46.156.97.5'<br>
DNS [0]: '193.213.112.4'<br>
DNS [1]: '130.67.15.198'<br>
MTU: '1500'<br>
<br>
[/dev/cdc-wdm0] IPv6 configuration available: 'none'<br>
<br>
<br>
5) and configure the addressing (except IPv6 addresses which are<br>
autoconfigured using SLAAC as long as the interface is up when<br>
connecting):<br>
<br>
# ip addr add <a href="http://10.130.163.117/32" rel="noreferrer" target="_blank">10.130.163.117/32</a> dev wwan0.1<br>
# ip addr add <a href="http://46.156.97.6/32" rel="noreferrer" target="_blank">46.156.97.6/32</a> dev wwan0.2<br>
<br>
<br>
The MBIM related NET ports now look like this:<br>
<br>
# ip addr show|tail -22<br>
10: wwan0: <BROADCAST,MULTICAST,NOARP,UP,<wbr>LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000<br>
link/ether 9e:81:5f:2f:36:bf brd ff:ff:ff:ff:ff:ff<br>
inet6 fe80::9c81:5fff:fe2f:36bf/64 scope link<br>
valid_lft forever preferred_lft forever<br>
11: wwan0.0@wwan0: <BROADCAST,MULTICAST,NOARP,UP,<wbr>LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000<br>
link/ether 9e:81:5f:2f:36:bf brd ff:ff:ff:ff:ff:ff<br>
inet6 2a02:2121:105:fd6d:9c81:5fff:<wbr>fe2f:36bf/64 scope global mngtmpaddr dynamic<br>
valid_lft forever preferred_lft forever<br>
inet6 fe80::9c81:5fff:fe2f:36bf/64 scope link<br>
valid_lft forever preferred_lft forever<br>
12: wwan0.1@wwan0: <BROADCAST,MULTICAST,NOARP,UP,<wbr>LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000<br>
link/ether 9e:81:5f:2f:36:bf brd ff:ff:ff:ff:ff:ff<br>
inet <a href="http://10.130.163.117/32" rel="noreferrer" target="_blank">10.130.163.117/32</a> scope global wwan0.1<br>
valid_lft forever preferred_lft forever<br>
inet6 fe80::9c81:5fff:fe2f:36bf/64 scope link<br>
valid_lft forever preferred_lft forever<br>
13: wwan0.2@wwan0: <BROADCAST,MULTICAST,NOARP,UP,<wbr>LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000<br>
link/ether 9e:81:5f:2f:36:bf brd ff:ff:ff:ff:ff:ff<br>
inet <a href="http://46.156.97.6/32" rel="noreferrer" target="_blank">46.156.97.6/32</a> scope global wwan0.2<br>
valid_lft forever preferred_lft forever<br>
inet6 fe80::9c81:5fff:fe2f:36bf/64 scope link<br>
valid_lft forever preferred_lft forever<br>
<br>
<br>
<br>
<br>
6) I don't know how to best demonstrate that this works, but using a<br>
"get public IP" service is one way:<br>
<br>
$ host <a href="http://api.ipify.org" rel="noreferrer" target="_blank">api.ipify.org</a><br>
<a href="http://api.ipify.org" rel="noreferrer" target="_blank">api.ipify.org</a> is an alias for <a href="http://api.ipify.org.herokudns.com" rel="noreferrer" target="_blank">api.ipify.org.herokudns.com</a>.<br>
<a href="http://api.ipify.org.herokudns.com" rel="noreferrer" target="_blank">api.ipify.org.herokudns.com</a> has address 54.221.194.87<br>
<br>
# ip route add 54.221.194.87 dev wwan0.1<br>
$ curl '<a href="https://api.ipify.org?format=json" rel="noreferrer" target="_blank">https://api.ipify.org?format=<wbr>json</a>'<br>
{"ip":"2.150.42.73"}<br>
<br>
# ip route del 54.221.194.87 dev wwan0.1<br>
# ip route add 54.221.194.87 dev wwan0.2<br>
$ curl '<a href="https://api.ipify.org?format=json" rel="noreferrer" target="_blank">https://api.ipify.org?format=<wbr>json</a>'<br>
{"ip":"46.156.97.6"}r<br>
<br>
<br>
I can unfortunately not demonstrate this for session 0, since I have no<br>
idea which addresses are reachable there. It's not the Internet, but an<br>
IMS VPN (as you might have guessed from the APN). As you can see above,<br>
it doesn't even have name servers. But I currently have a shortage of<br>
valid APNs for testing :-(<br>
<br>
Note that it wasn't strictly necessary to create a new NET interface for<br>
session 0. We could have used the top level interface instead, as we<br>
currently do in ModemManager. But creating the VLAN is more consistent,<br>
and allows you to set the MTU independently for all sessions.<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
Bjørn<br>
</font></span></blockquote></div><br></div>