<div dir="ltr">Hi Aleksander,<div><br></div><div>Thank you for all the explanations. I wasn't aware the initial EPS bearer needs to be configured separately. Your guesses about the empty APN were right, I can see:</div><div><br># qmicli -d /dev/cdc-wdm0 -p --wds-get-lte-attach-pdn-list<br>Attach PDN list retrieved:<br>      Current list: '1'<br>     Pending list: n/a<br><br># qmicli -d /dev/cdc-wdm0 -p --wds-get-profile-list=3gpp<br>Profile list retrieved:<br>        [1] 3gpp - <br>           APN: ''<br>               PDP type: 'ipv4-or-ipv6'<br>              PDP context number: '1'<br>               Username: ''<br>          Password: ''<br>          Auth: 'none'<br>          No roaming: 'no'<br>              APN disabled: 'no'<br><br></div><div>Setting the initial EPS bearer works, I'm going to observe how it impacts our connectivity, thank you!<br># mmcli -m 0 --3gpp-set-initial-eps-bearer-settings="apn=de1.super,ip-type=ipv4"<br>Successfully set initial EPS bearer properties<br><br># mmcli -m a -K | grep "modem.3gpp.eps.initial-bearer.settings"<br>modem.3gpp.eps.initial-bearer.settings.apn      : de1.super<br>modem.3gpp.eps.initial-bearer.settings.ip-type  : ipv4<br>modem.3gpp.eps.initial-bearer.settings.user     : --<br>modem.3gpp.eps.initial-bearer.settings.password : --<br></div><div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">Kind regards,</span><br style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">Filip</span></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 9, 2024 at 11:02 AM Aleksander Morgado <<a href="mailto:aleksandermj@chromium.org">aleksandermj@chromium.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hey!<br>
<br>
><br>
> First of all I wanted to say thanks for developing and supporting a great piece of software.<br>
><br>
<br>
Thanks to you for using it!<br>
<br>
> We have a few thousand devices running ModemManager 1.18.6 and Quectel EC21 modem. Our service provider Twilio/Kore keeps reporting that on some devices we have 2 simultaneous data sessions with different APNs: "super" and "de1.super".<br>
><br>
> We use ModemManager's API to find the modem, enable it, then wait for auto-register done by the modem FW, and finally create a bearer with "de1.super" APN and connect. Operations are run over QMI protocol.<br>
><br>
<br>
Ok, so if I'm reading this right, you do NOT explicitly configure the<br>
attach APN settings, you only provide the data APN settings. The<br>
attach APN settings are provided by the modem itself.<br>
<br>
> We have autoselect disabled, so I'd expect to always use European APN "de1.super", instead of US "super" which is the default.<br>
> mmcli -m 0 --command='AT+QMBNCFG="AutoSel"' response: '+QMBNCFG: "AutoSel",0<br>
<br>
I don't know what AutoSel does in these modems, can you elaborate?<br>
<br>
> We have made an experiment to show PDP contexts on the devices with AT+CGDCONT?, and noticed an interesting thing:<br>
> On most of them, it only shows 1 PDP context:<br>
> PdpContext { ctx_id: 1, pdp_type: IpV4V6, pdp_addr: \"0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0\", apn: \"\", data_comp: Off, head_comp: Off, ipv4_addr_alloc: NasSignaling, request_type: ContextEstablishmentOrNon3GppAccessNetworkHandover }<br>
><br>
> However, on 1 of the 200 devices, we see 2 PDP contexts:<br>
> PdpContext { ctx_id: 2, pdp_type: Ip, pdp_addr: \"0.0.0.0\", apn: \"de1.super\", data_comp: Off, head_comp: Off, ipv4_addr_alloc: NasSignaling, request_type: ContextEstablishmentOrNon3GppAccessNetworkHandover }<br>
><br>
> PdpContext { ctx_id: 1, pdp_type: IpV4V6, pdp_addr: \"0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0\", apn: \"\", data_comp: Off, head_comp: Off, ipv4_addr_alloc: NasSignaling, request_type: ContextEstablishmentOrNon3GppAccessNetworkHandover }<br>
><br>
> However, even on device with just 1 PDP context received from AT command<br>
> # mmcli -m 0 --command='AT+CGDCONT?'<br>
> response: '+CGDCONT: 1,"IPV4V6","","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,0'<br>
><br>
> AT commands are run ~10 minutes after modem setup and connection is done with ModemManager.<br>
> ModemManager always reports 2 bearers, I understand the 1st bearer is LTE default EPS bearer, while the 2nd one is the actual data session bearer:<br>
><br>
<br>
Yes.<br>
<br>
> # mmcli -b 0<br>
>   -------------------------<br>
>   General    |        path: /org/freedesktop/ModemManager1/Bearer/0<br>
>              |        type: default-attach<br>
>   -------------------------<br>
>   Status     |   connected: yes<br>
>              |   suspended: no<br>
>              | multiplexed: no<br>
>              |  ip timeout: 20<br>
>   -------------------------<br>
>   Properties |         apn: super<br>
>              |     ip type: ipv4<br>
><br>
> # mmcli -b 3<br>
>   ------------------------------------<br>
>   General            |           path: /org/freedesktop/ModemManager1/Bearer/3<br>
>                      |           type: default<br>
>   ------------------------------------<br>
>   Status             |      connected: yes<br>
>                      |      suspended: no<br>
>                      |    multiplexed: no<br>
>                      |      interface: wwan0<br>
>                      |     ip timeout: 20<br>
>   ------------------------------------<br>
>   Properties         |            apn: de1.super<br>
>                      |        roaming: allowed<br>
>                      |        ip type: ipv4<br>
>   ------------------------------------<br>
>   IPv4 configuration |         method: static<br>
>                      |        address: 100.79.145.117<br>
>                      |         prefix: 30<br>
>                      |        gateway: 100.79.145.118<br>
>                      |            dns: 8.8.4.4, 8.8.8.8<br>
>                      |            mtu: 1360<br>
>   ------------------------------------<br>
>   Statistics         |       duration: 3810<br>
>                      |       bytes rx: 513071<br>
>                      |       bytes tx: 296673<br>
>                      |       attempts: 1<br>
>                      | total-duration: 3810<br>
>                      | total-bytes rx: 513071<br>
>                      | total-bytes tx: 296673<br>
><br>
<br>
In the above output, your initial EPS default bearer that is brought<br>
up during attach is using the "super" APN. I don't think this is what<br>
you want, based on the previous comments? Not sure.<br>
<br>
> I have some questions:<br>
> 1. When using QMI, is it reliable to check modem state with AT commands? I don't care about immediate / race conditions, but I'd like to know that if I run some AT command e.g. 1 hour after it was set up by ModemManager with QMI it will tell me the accurate modem state.<br>
><br>
<br>
Yes. As long as you don't modify state of the modem with the AT<br>
commands, i.e. only use commands to read the state, you can safely run<br>
them and they will give you the latest up to date info.<br>
<br>
> 2. Why do some devices have only 1 PDP context with empty APN, while others have 2 PDP contexts with the right APN in context 2?<br>
> We'd like to make sure all devices use European APN as it positively impacts the latency and download speed.<br>
><br>
<br>
I assume the modem is reporting the PDP context in CID 1 with empty<br>
APN because the attach APN settings have an empty APN. You can confirm<br>
this running the following:<br>
<br>
$ sudo qmicli -d /dev/cdc-wdm0 -p --wds-get-lte-attach-pdn-list<br>
// will likely return that profile 1 is the one used for attach<br>
<br>
$ sudo qmicli -d /dev/cdc-wdm0 -p --wds-get-profile-list=3gpp<br>
// and check contents of the profile 1<br>
<br>
If you see a blank APN there, it means you're telling the network you<br>
don't want any specific APN, and the network should assign one to you.<br>
If this is the case, looking at the output above, it could be the<br>
network assigning to you the "super" APN that you don't want.<br>
<br>
You can manually configure the attach APN settings to be the same as<br>
the data APN settings with an explicit mmcli operation:<br>
$ sudo mmcli -m a<br>
--3gpp-set-initial-eps-bearer-settings="apn=de1.super,ip-type=ipv4"<br>
<br>
If this is the problem, you should try to ensure those settings are in<br>
place before creating the data APN. E.g. you can first check that the<br>
settings are the expected ones in the mmcli output, and if they<br>
aren't, you set them.<br>
<br>
$ mmcli -m a -K | grep "modem.3gpp.eps.initial-bearer.settings"<br>
modem.3gpp.eps.initial-bearer.settings.apn      : --<br>
modem.3gpp.eps.initial-bearer.settings.ip-type  : --<br>
modem.3gpp.eps.initial-bearer.settings.user     : --<br>
modem.3gpp.eps.initial-bearer.settings.password : --<br>
<br>
-- <br>
Aleksander<br>
</blockquote></div>