diff mbox series

[LEDE-DEV] uqmi: fix raw-ip mode for newer lte modems

Message ID 1511797001-8211-1-git-send-email-koen.vandeputte@ncentric.com
State Superseded
Headers show
Series [LEDE-DEV] uqmi: fix raw-ip mode for newer lte modems | expand

Commit Message

Koen Vandeputte Nov. 27, 2017, 3:36 p.m. UTC
Some newer LTE modems, like the MC7455 or EC25-E do not support
"802.3" mode, and will stay in "raw-ip" regardless of the mode being
set.

In this case, the driver must be informed that it should handle all
packets in raw mode. [1]

This commit fixes connectivity issues for these devices.

Before:

[ Node 5 ] udhcpc -i wwan0
udhcpc: started, v1.27.2
udhcpc: sending discover
udhcpc: sending discover
udhcpc: sending discover

After:

[ Node 5 ] udhcpc -i wwan0
udhcpc: started, v1.27.2
udhcpc: sending discover
udhcpc: sending select for 100.66.245.226
udhcpc: lease of 100.66.245.226 obtained, lease time 7200
udhcpc: ifconfig wwan0 100.66.245.226 netmask 255.255.255.252 broadcast
+
udhcpc: setting default routers: 100.66.245.225

[1] https://lists.freedesktop.org/archives/libqmi-
devel/2017-January/002064.html

Tested on cns3xxx using a Sierra Wireless MC7455 LTE-A

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
---
 package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Bjørn Mork Nov. 27, 2017, 4:53 p.m. UTC | #1
Koen Vandeputte <koen.vandeputte@ncentric.com> writes:

> @@ -99,6 +99,13 @@ proto_qmi_setup() {
>  
>  	uqmi -s -d "$device" --set-data-format 802.3
>  	uqmi -s -d "$device" --wda-set-data-format 802.3
> +	dataformat="$(uqmi -s -d "$device" --wda-get-data-format)"
> +
> +	if [ "$dataformat" = '"raw-ip"' ]; then
> +		echo "Device detected which does not support 802.3 mode. Informing driver of raw-ip only for $ifname .."
> +		echo "Y" > /sys/class/net/$ifname/qmi/raw_ip
> +	fi


It might be good to test for existence here since this attribute was
added as late as Linux v4.5?  Maybe provide some helpful warning in case
it doesn't exist and the modem refuses to run in 802.3 mode?


Bjørn
Koen Vandeputte Nov. 27, 2017, 5:07 p.m. UTC | #2
On 2017-11-27 17:53, Bjørn Mork wrote:
> Koen Vandeputte <koen.vandeputte@ncentric.com> writes:
>
>> @@ -99,6 +99,13 @@ proto_qmi_setup() {
>>   
>>   	uqmi -s -d "$device" --set-data-format 802.3
>>   	uqmi -s -d "$device" --wda-set-data-format 802.3
>> +	dataformat="$(uqmi -s -d "$device" --wda-get-data-format)"
>> +
>> +	if [ "$dataformat" = '"raw-ip"' ]; then
>> +		echo "Device detected which does not support 802.3 mode. Informing driver of raw-ip only for $ifname .."
>> +		echo "Y" > /sys/class/net/$ifname/qmi/raw_ip
>> +	fi
>
> It might be good to test for existence here since this attribute was
> added as late as Linux v4.5?  Maybe provide some helpful warning in case
> it doesn't exist and the modem refuses to run in 802.3 mode?
>
>
> Bjørn
This sounds fair. :)
I'll send a V2 adding the test.



As you are the author of the fixing patch upstream:

Would you also force this attribute to "No" in case it exists and format 
is detected as 802.3?


Psuedo:

if (raw-ip && file_exists)
{
     set "y"
}
else if (802.3 && file_exists)
{
     set "n"
}



Thanks,

Koen
Bjørn Mork Nov. 27, 2017, 5:15 p.m. UTC | #3
Koen Vandeputte <koen.vandeputte@ncentric.com> writes:

> On 2017-11-27 17:53, Bjørn Mork wrote:
>> Koen Vandeputte <koen.vandeputte@ncentric.com> writes:
>>
>>> @@ -99,6 +99,13 @@ proto_qmi_setup() {
>>>     	uqmi -s -d "$device" --set-data-format 802.3
>>>   	uqmi -s -d "$device" --wda-set-data-format 802.3
>>> +	dataformat="$(uqmi -s -d "$device" --wda-get-data-format)"
>>> +
>>> +	if [ "$dataformat" = '"raw-ip"' ]; then
>>> +		echo "Device detected which does not support 802.3 mode. Informing driver of raw-ip only for $ifname .."
>>> +		echo "Y" > /sys/class/net/$ifname/qmi/raw_ip
>>> +	fi
>>
>> It might be good to test for existence here since this attribute was
>> added as late as Linux v4.5?  Maybe provide some helpful warning in case
>> it doesn't exist and the modem refuses to run in 802.3 mode?
>>
>>
>> Bjørn
> This sounds fair. :)
> I'll send a V2 adding the test.
>
>
>
> As you are the author of the fixing patch upstream:
>
> Would you also force this attribute to "No" in case it exists and
> format is detected as 802.3?

I don't have any strong opinion.  The driver defaults to N and will
alwyas do that for backwards userspace compatibility, so you can depend
on that.  But if you want to be 100% sure that something else didn't
mess with this, then you could of course force it to N.  Not sure what
"something else" would be, though.  Probably the admin, and admins
should be allowed to shoot themselves in the foot :-)



Bjørn
diff mbox series

Patch

diff --git a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
index 9c953ea..31441e0 100755
--- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
+++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
@@ -27,7 +27,7 @@  proto_qmi_init_config() {
 
 proto_qmi_setup() {
 	local interface="$1"
-
+	local dataformat
 	local device apn auth username password pincode delay modes pdptype profile dhcpv6 autoconnect plmn $PROTO_DEFAULT_OPTIONS
 	local cid_4 pdh_4 cid_6 pdh_6
 	local ip_6 ip_prefix_length gateway_6 dns1_6 dns2_6
@@ -99,6 +99,13 @@  proto_qmi_setup() {
 
 	uqmi -s -d "$device" --set-data-format 802.3
 	uqmi -s -d "$device" --wda-set-data-format 802.3
+	dataformat="$(uqmi -s -d "$device" --wda-get-data-format)"
+
+	if [ "$dataformat" = '"raw-ip"' ]; then
+		echo "Device detected which does not support 802.3 mode. Informing driver of raw-ip only for $ifname .."
+		echo "Y" > /sys/class/net/$ifname/qmi/raw_ip
+	fi
+
 	uqmi -s -d "$device" --sync
 
 	echo "Waiting for network registration"