disable ccflags-y += -DCONFIG_MHI_NETDEV_MBIM in pcie_mhi/Makefile

root@OpenWrt:~# insmod pcie_mhi.ko 

root@OpenWrt:~# dmesg | grep mhi
[  138.483252] mhi_init Quectel_Linux_PCIE_MHI_Driver_V1.3.0.6
[  138.492350] mhi_pci_probe pci_dev->name = 0000:01:00.0, domain=0, bus=1, slot=0, vendor=17CB, device=0306
[  138.497564] mhi_q 0000:01:00.0: BAR 0: assigned [mem 0x20300000-0x20300fff 64bit]
[  138.506952] mhi_q 0000:01:00.0: enabling device (0140 -> 0142)
[  138.514562] [I][mhi_init_pci_dev] msi_required = 5, msi_allocated = 5, msi_irq = 63
[  138.514581] [I][mhi_power_up] dev_state:RESET
[  138.514587] [I][mhi_async_power_up] Requested to power on
[  138.514728] [I][mhi_alloc_coherent] size = 114688, dma_handle = 72160000
[  138.514734] [I][mhi_init_dev_ctxt] mhi_ctxt->ctrl_seg = c221f000
[  138.515030] [I][mhi_async_power_up] dev_state:RESET ee:AMSS
[  138.515056] [I][mhi_pm_st_worker] Transition to state:READY
[  138.515067] [I][mhi_pm_st_worker] INVALID_EE -> AMSS
[  138.515073] [I][mhi_ready_state_transition] Waiting to enter READY state
[  138.515210] [I][mhi_async_power_up] Power on setup success
[  138.515227] [I][mhi_pci_probe] Return successful
[  138.589013] [I][mhi_ready_state_transition] Device in READY State
[  138.589029] [I][mhi_intvec_threaded_handlr] device ee:AMSS dev_state:READY, pm_state:POR
[  138.589038] [I][mhi_intvec_threaded_handlr] device ee:AMSS dev_state:READY, INVALID_EE
[  138.589041] [I][mhi_tryset_pm_state] Transition to pm state from:POR to:POR
[  138.589046] [I][mhi_init_mmio] Initializing MMIO
[  138.589050] [I][mhi_init_mmio] CHDBOFF:0x300
[  138.589060] [I][mhi_init_mmio] ERDBOFF:0x700
[  138.589065] [I][mhi_init_mmio] Programming all MMIO values.
[  138.706124] [I][mhi_dump_tre] carl_ev evt_state_change mhistate=2
[  138.706132] [I][mhi_process_ctrl_ev_ring] MHI state change event to state:M0
[  138.706140] [I][mhi_pm_m0_transition] Entered With State:READY PM_STATE:POR
[  138.706146] [I][mhi_tryset_pm_state] Transition to pm state from:POR to:M0
[  138.708699] [I][mhi_dump_tre] carl_ev evt_ee_state execenv=2
[  138.708706] [I][mhi_process_ctrl_ev_ring] MHI EE received event:AMSS
[  138.708726] [I][mhi_pm_st_worker] Transition to state:MISSION MODE
[  138.708736] [I][mhi_pm_st_worker] INVALID_EE -> AMSS
[  138.708742] [I][mhi_pm_mission_mode_transition] Processing Mission Mode Transition
[  138.708758] [I][mhi_init_timesync] No timesync capability found
[  138.708764] [I][mhi_pm_mission_mode_transition] Adding new devices
[  138.709785] [I][mhi_dtr_probe] Enter for DTR control channel
[  138.709794] [I][__mhi_prepare_channel] Entered: preparing channel:18
[  138.715378] [I][mhi_dump_tre] carl_ev evt_cmd_comp code=1
[  138.715397] [I][__mhi_prepare_channel] Chan:18 successfully moved to start state
[  138.715403] [I][__mhi_prepare_channel] Entered: preparing channel:19
[  138.720201] [I][mhi_dump_tre] carl_ev evt_cmd_comp code=1
[  138.720218] [I][__mhi_prepare_channel] Chan:19 successfully moved to start state
[  138.720236] [I][mhi_dtr_probe] Exit with ret:0
[  138.720590] [I][mhi_netdev_enable_iface] Prepare the channels for transfer
[  138.720630] [I][__mhi_prepare_channel] Entered: preparing channel:100
[  138.757230] [I][mhi_dump_tre] carl_ev evt_cmd_comp code=1
[  138.757253] [I][__mhi_prepare_channel] Chan:100 successfully moved to start state
[  138.757259] [I][__mhi_prepare_channel] Entered: preparing channel:101
[  138.774352] [I][mhi_dump_tre] carl_ev evt_cmd_comp code=1
[  138.774370] [I][__mhi_prepare_channel] Chan:101 successfully moved to start state
[  138.778137] [I][mhi_netdev_enable_iface] Exited.
[  138.779018] rmnet_vnd_register_device(rmnet_mhi0.1)=0
[  138.782283] net rmnet_mhi0 rmnet_mhi0.1: NSS context created
[  138.800865] [I][mhi_pm_mission_mode_transition] Exit with ret:0

root@OpenWrt:~# ./quectel-CM &
root@OpenWrt:~# [04-02_04:12:16:477] Quectel_QConnectManager_Linux_V1.6.0.5
[04-02_04:12:16:477] Find /sys/bus/usb/devices/4-1 idVendor=0x2c7c idProduct=0x800, bus=0x004, dev=0x002
[04-02_04:12:16:478] network interface '' or qmidev '' is not exist
[04-02_04:12:16:478] netcard driver = pcie_mhi, driver version = V1.3.0.6
[04-02_04:12:16:479] qmap_mode = 1, qmap_version = 9, qmap_size = 16384, muxid = 0x81, qmap_netcard = rmnet_mhi0.1
[04-02_04:12:16:479] Modem works in QMI mode
[04-02_04:12:16:505] cdc_wdm_fd = 7
[04-02_04:12:17:506] QmiThreadSendQMITimeout pthread_cond_timeout_np timeout
[04-02_04:12:18:516] Get clientWDS = 19
[04-02_04:12:18:520] Get clientDMS = 1
[04-02_04:12:18:524] Get clientNAS = 3
[04-02_04:12:18:527] Get clientUIM = 1
[04-02_04:12:18:531] Get clientWDA = 1
[04-02_04:12:18:535] requestBaseBandVersion RM500QGLAAR03A01M4G_BETA_20200107F  1  [Dec 30 2019 17:00:00]
[04-02_04:12:18:539] qmap_settings.rx_urb_size = 16384
[04-02_04:12:18:539] qmap_settings.ul_data_aggregation_max_datagrams  = 16
[04-02_04:12:18:539] qmap_settings.ul_data_aggregation_max_size       = 8192
[04-02_04:12:18:539] qmap_settings.dl_minimum_padding                 = 0
[04-02_04:12:18:550] requestSetLoopBackState(loopback_state=1, replication_factor=14)
[04-02_04:12:18:557] requestGetSIMStatus SIMStatus: SIM_ABSENT
[04-02_04:12:18:560] requestGetProfile[1] ///0
[04-02_04:12:18:563] requestRegistrationState2 MCC: 0, MNC: 0, PS: Detached, DataCap: UNKNOW
[04-02_04:12:18:565] requestQueryDataCall IPv4ConnectionStatus: DISCONNECTED
[04-02_04:12:18:566] ifconfig rmnet_mhi0.1 down
[04-02_04:12:18:571] ifconfig rmnet_mhi0.1 0.0.0.0
ifconfig: SIOCSIFFLAGS: Network is down
[04-02_04:12:18:575] SetLoopBackInd: loopback_state=1, replication_factor=14
[04-02_04:12:18:591] requestSetupDataCall WdsConnectionIPv4Handle: 0xe40182a0
[04-02_04:12:18:601] ifconfig rmnet_mhi0 up
[04-02_04:12:18:607] ifconfig rmnet_mhi0.1 up
[04-02_04:12:18:613] you are use OpenWrt?
[04-02_04:12:18:614] should not calling udhcpc manually?
[04-02_04:12:18:614] should modify /etc/config/network as below?
[04-02_04:12:18:614] config interface wan
[04-02_04:12:18:614] 	option ifname	rmnet_mhi0.1
[04-02_04:12:18:614] 	option proto	dhcp
[04-02_04:12:18:614] should use "/sbin/ifstaus wan" to check rmnet_mhi0.1 's status?
[04-02_04:12:18:614] busybox udhcpc -f -n -q -t 5 -i rmnet_mhi0.1
udhcpc: started, v1.28.3
udhcpc: sending discover
udhcpc: sending select for 192.168.48.171
udhcpc: lease of 192.168.48.171 obtained, lease time 7200
[04-02_04:12:18:809] udhcpc: ifconfig rmnet_mhi0.1 192.168.48.171 netmask 255.255.255.248 broadcast +
[04-02_04:12:18:819] udhcpc: setting default routers: 192.168.48.172

root@OpenWrt:~# ifconfig rmnet_mhi0
rmnet_mhi0 Link encap:Ethernet  HWaddr 02:50:F4:00:00:00  
          inet6 addr: fe80::50:f4ff:fe00:0/64 Scope:Link
          UP RUNNING NOARP  MTU:1500  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:608 (608.0 B)  TX bytes:672 (672.0 B)

root@OpenWrt:~# ifconfig rmnet_mhi0.1
rmnet_mhi0.1 Link encap:UNSPEC  HWaddr 02-50-F4-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:192.168.48.171  Mask:255.255.255.248
          inet6 addr: fe80::50:f4ff:fe00:0/64 Scope:Link
          UP RUNNING NOARP  MTU:1500  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:592 (592.0 B)  TX bytes:656 (656.0 B)

# adjust CPU load balancing
root@OpenWrt:~# echo 2 > /sys/class/net/rmnet_mhi0/queues/rx-0/rps_cpus 
root@OpenWrt:~# echo 4 > /sys/class/net/rmnet_mhi0.1/queues/rx-0/rps_cpus 
root@OpenWrt:~# echo 2000 > /proc/sys/net/core/netdev_max_backlog 
root@OpenWrt:~# cat /sys/class/net/rmnet_mhi0/queues/rx-0/rps_cpus
2
root@OpenWrt:~# cat /sys/class/net/rmnet_mhi0.1/queues/rx-0/rps_cpus
4
root@OpenWrt:~# cat /proc/sys/net/core/netdev_max_backlog
2000