QMI interface fails to start

After 12-13 hours of running the 4G (QMI proto) interface, it just dies and fails to come back up, this is the output I see in logread:

Sat Feb 18 11:41:29 2023 daemon.notice netifd: 4G (3372): Stopping network 4G
Sat Feb 18 11:41:29 2023 daemon.notice netifd: 4G (3372): Command failed: ubus call network.interface notify_proto { "action": 0, "link-up": false, "keep": false, "interface": "4G" } (Permission denied)
Sat Feb 18 11:41:29 2023 daemon.notice netifd: Interface '4G' is now down
Sat Feb 18 11:41:29 2023 daemon.notice netifd: Interface '4G' is setting up now
Sat Feb 18 11:41:29 2023 daemon.notice netifd: 4G (3387): Waiting for SIM initialization

But after a system restart, it works fine again

Sat Feb 18 11:42:32 2023 daemon.notice netifd: Interface '4G' is setting up now
Sat Feb 18 11:42:32 2023 daemon.notice netifd: 4G (2947): Waiting for SIM initialization
Sat Feb 18 11:42:33 2023 daemon.notice netifd: 4G (2947): Failed to parse message data
Sat Feb 18 11:42:33 2023 daemon.notice netifd: 4G (2947): PIN verification is disabled
Sat Feb 18 11:42:33 2023 daemon.notice netifd: 4G (2947): Device does not support 802.3 mode. Informing driver of raw-ip only for wwan0 ..
Sat Feb 18 11:42:34 2023 daemon.notice netifd: 4G (2947): Waiting for network registration
Sat Feb 18 11:42:35 2023 daemon.notice netifd: 4G (2947): Starting network 4G
Sat Feb 18 11:42:37 2023 daemon.notice netifd: 4G (2947): Setting up wwan0
Sat Feb 18 11:42:37 2023 daemon.notice netifd: Interface '4G' is now up
Sat Feb 18 11:42:37 2023 daemon.notice netifd: Interface '4G_4' is enabled
Sat Feb 18 11:42:37 2023 daemon.notice netifd: Interface '4G_4' has link connectivity
Sat Feb 18 11:42:37 2023 daemon.notice netifd: Interface '4G_4' is setting up now
Sat Feb 18 11:42:37 2023 daemon.notice netifd: 4G_4 (5625): udhcpc: started, v1.36.0
Sat Feb 18 11:42:37 2023 daemon.notice netifd: 4G_4 (5625): udhcpc: broadcasting discover
Sat Feb 18 11:42:37 2023 daemon.notice netifd: 4G_4 (5625): udhcpc: broadcasting select for 10.94.135.100, server 10.94.135.101
Sat Feb 18 11:42:38 2023 daemon.notice netifd: 4G_4 (5625): udhcpc: lease of 10.94.135.100 obtained from 10.94.135.101, lease time 7200
Sat Feb 18 11:42:38 2023 daemon.notice netifd: Interface '4G_4' is now up

My interface config in /etc/config/network:

config interface '4G'
        option proto 'qmi'
        option auth 'none'
        option pdptype 'ipv4v6'
        option device '/dev/cdc-wdm0'
        option metric '50'
        list dns '2606:4700:4700::1001'
        list dns '1.1.1.1'
        option peerdns '0'

From logread after boot

Any pointers about what could be going wrong would be super helpful and thanks in advance!

Hi
It is quite normal for your cellular internet provider to regularly disconnect your service.
My disconnect every 24 hour.
You need some kind of daemon to check your connectivity.
I have a customized version of uqmi with a daemon that checks the connectivity ever 30s, https://github.com/mrhaav/openwrt-packages. If your modem is disconnected, the daemon re-connects it.
Which OpenWrt version and what hardware do you use?

That makes sense, I'm using a quectel EC25-E module with the latest openwrt snapshot on a banana pi r3.

Is there a uqmi command I can manually run to make this work just for testing? I've just been trying ifup 4G but it just gives me this output with logread:

Sun Feb 19 23:00:46 2023 daemon.notice netifd: 4G (14928): Stopping network 4G
Sun Feb 19 23:00:46 2023 daemon.notice netifd: 4G (14928): Command failed: ubus call network.interface notify_proto { "action": 0, "link-up": false, "keep": false, "interface": "4G" } (Permission denied)
Sun Feb 19 23:00:46 2023 daemon.notice netifd: Interface '4G' is now down
Sun Feb 19 23:00:46 2023 daemon.notice netifd: Interface '4G' is setting up now
Sun Feb 19 23:00:46 2023 daemon.notice netifd: 4G (14941): Waiting for SIM initialization

But if I restart the device it establishes a connection again.

EDIT:

I passed the AT command AT+CFUN=1,1 to /dev/ttyUSB3 which is the serial interface and it seems to work again

see TL-MR6400 V4 - QMI Not working - #14 by AndrewZ