Whats the purpose of wwan/option pdptype 'IP'?

I have a quectel EC25-AF, trying to connect to AT&T. My
config interface 'wwan'
option device '/dev/cdc-wdm0'
option proto 'qmi'
option ipv6 '0'
option profile '1'
option pdptype 'IP'
option defaultgateway '1'
option metric '50'
option disabled '0'
option auto '0'
option autoconnect '0'
option dhcp '0'
option apn 'broadband'

This does not work, connection not to be established. Digging deeper, I found (after factory reset of modem)
AT+CGDCONT?
+CGDCONT: 1,"IPV4V6","nxtgenphone","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,0
+CGDCONT: 2,"IPV4V6","ims","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,0
+CGDCONT: 3,"IPV4V6","sos","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,1

After changing this to
+CGDCONT: 1,"IP","broadband","0.0.0.0",0,0,0,0
+CGDCONT: 2,"IPV4V6","ims","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,0
+CGDCONT: 3,"IPV4V6","sos","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,1

big success. Connection is established, and stable.
BUT: What is the purpose of option pdptype 'IP' ?
Shouldn't it create a pdptype, like the one I manually created, using AT-cmd ?

When an LTE modem is power on it starts the initial access to the network. During the initial access it uses the default PDP context (APN profile).
Many modems store the default PDP context in CGDCONT=1, some use CGDCONT=0.
If the default PDP context is incorrect the access is denied.

The official uqmi is not verifying the default PDP context, it just try to add a new PDP context with the define APN and PDPtype.

I start wwan explicitly, in /etc/rc.local, using "ifup wwan". After resetting the modem. Then, I guess, the connection (tried) to be established, not earlier.
Obviously, no PDP created/overwritten by uqmi. Although I hoped for it.
Any idea, why not ? I think, PDP-creation using CGDCONT is even standardized.

Most modems are attaching the network directly when you power up your router. Very few are starting in Flight Mode. I prefer to put the modem in Flight Mode, change the APN settings and release the Flight Mode. Then you get a known initial access.

I have sent suggestions upstream to add uqmi commands for modifying the PDP context:

--get-default-profile-number
--get-profile-settings
--create-profile
--modify-profile

No one has commented or approved my suggestions.

Another important line in your configuration is:

option proto 'qmi'

QMI is a completely separate protocol from AT commands and serves as a modern but proprietary replacement. Some new modems do not implement AT commands at all. The same setting can be, in theory, changed both by old-style AT commands and by QMI data.

According to the documentation, indeed, the pdptype option is set correctly in order to get the IPv4-only PDP context. Perhaps it is for the case when there is no profile, but just an ad-hoc attempt to connect? Just guessing, I do not have a QMI device.

I have to use AT-cmd, to properly set up PDP. Would prefere uqmi (or similar), pls advise :slight_smile:

May be, because nobody understood, what you meant :slight_smile: How can I support your suggestions ? It is a shame, to need AT-cmd to overcome deficencies in uqmi.

The patch is available here: https://patchwork.ozlabs.org/project/openwrt/patch/20220905200751.998416-1-henrik@ginstmark.se/

I donĀ“t know the process of accepting patches, maybe @daniel knows?
I suppose someone needs to test and verify it.

Willing to do some real world testing, end of July, because of current task.
Did you try on real modem already ?
I hope, ( "ipv4", QMI_WDS_IP_FAMILY_IPV4 ) causes to be ("IP" in PDP-context) . I am using Quectel EC25-AF, EC25-A and EC25-V.

If you want to test the patch you need to install it on the official uqmi and compile your own version.

I have the APN profile commands included in my customize uqmi.
Source code: https://github.com/mrhaav/openwrt-packages
I have compile for some platforms/versions at: https://github.com/mrhaav/openwrt