MBIM connection through pcie

Dear support,
I’m using an RM500Q module connected via pcie interface to my host (arm64 architecture).
QMI connection works okay, no issues.
But in MBIM mode, it seems no packet can be received on the linux netdev, please see logs below:

/tmp # dmesg
[ 108.983562] usb 6-1: new SuperSpeed Gen 1 USB device number 2 using xhci-hcd
[ 109.168904] usb 6-1: Enable of device-initiated U1 failed.
[ 109.232894] usb 6-1: Enable of device-initiated U2 failed.
[ 109.264884] option 6-1:1.0: GSM modem (1-port) converter detected
[ 109.271145] usb 6-1: GSM modem (1-port) converter now attached to ttyUSB0
[ 109.278138] option 6-1:1.1: GSM modem (1-port) converter detected
[ 109.284372] usb 6-1: GSM modem (1-port) converter now attached to ttyUSB1
[ 109.291269] option 6-1:1.2: GSM modem (1-port) converter detected
[ 109.297433] usb 6-1: GSM modem (1-port) converter now attached to ttyUSB2
[ 109.304329] option 6-1:1.3: GSM modem (1-port) converter detected
[ 109.310499] usb 6-1: GSM modem (1-port) converter now attached to ttyUSB3
[ 130.423070] mhi_init Quectel_Linux_PCIE_MHI_Driver_V1.3.1
[ 145.405456] pci 0001:01:00.0: [17cb:0306] type 00 class 0xff0000
[ 145.411567] pci 0001:01:00.0: reg 0x10: [mem 0x00000000-0x00000fff 64bit]
[ 145.418394] pci 0001:01:00.0: reg 0x18: [mem 0x00000000-0x00000fff 64bit]
[ 145.425507] pci 0001:01:00.0: PME# supported from D0 D3hot D3cold
[ 145.431761] pci 0001:01:00.0: 2.000 Gb/s available PCIe bandwidth, limited by 2.5 GT/s x1 link at 0001:00:00.0 (capable of 31.506 Gb/s with 16 GT/s x2 link)
[ 145.445789] OF: /soc/pcie@3600000: no msi-map translation for rid 0x100 on (null)
[ 145.466009] pcieport 0001:00:00.0: BAR 14: assigned [mem 0x5040100000-0x50401fffff]
[ 145.473696] pci 0001:01:00.0: BAR 0: assigned [mem 0x5040100000-0x5040100fff 64bit]
[ 145.481379] pci 0001:01:00.0: BAR 2: assigned [mem 0x5040101000-0x5040101fff 64bit]
[ 145.489133] mhi_pci_probe pci_dev->name = 0001:01:00.0, domain=1, bus=1, slot=0, vendor=17CB, device=0306
[ 145.498813] [I][mhi_arch_set_bus_request] Setting bus request to index 1
[ 145.498818] mhi_q 0001:01:00.0: BAR 0: assigned [mem 0x5040100000-0x5040100fff 64bit]
[ 145.506685] mhi_q 0001:01:00.0: enabling device (0000 → 0002)
[ 145.512662] [I][mhi_init_pci_dev] msi_required = 5, msi_allocated = 1, msi_irq = 89
[ 145.512680] [I][mhi_power_up] dev_state:RESET
[ 145.512682] [I][mhi_async_power_up] Requested to power on
[ 145.512820] [I][mhi_alloc_coherent] size = 114688, dma_handle = e7c60000
[ 145.512823] [I][mhi_init_dev_ctxt] mhi_ctxt->ctrl_seg = 000000002e6c45d7
[ 145.512985] [I][mhi_async_power_up] dev_state:RESET ee:AMSS
[ 145.512993] [I][mhi_pm_st_worker] Transition to state:READY
[ 145.513005] [I][mhi_pm_st_worker] INVALID_EE → AMSS
[ 145.513007] [I][mhi_ready_state_transition] Waiting to enter READY state
[ 145.513045] [I][mhi_async_power_up] Power on setup success
[ 145.513051] [I][mhi_pci_probe] Return successful
[ 145.558630] [I][mhi_intvec_threaded_handlr] device ee:AMSS dev_state:READY, pm_state:POR
[ 145.558635] [I][mhi_intvec_threaded_handlr] device ee:AMSS dev_state:READY, INVALID_EE
[ 148.755463] [I][mhi_ready_state_transition] Device in READY State
[ 148.755468] [I][mhi_tryset_pm_state] Transition to pm state from:POR to:POR
[ 148.755472] [I][mhi_init_mmio] Initializing MMIO
[ 148.755480] [I][mhi_init_mmio] CHDBOFF:0x300
[ 148.755489] [I][mhi_init_mmio] ERDBOFF:0x700
[ 148.755492] [I][mhi_init_mmio] Programming all MMIO values.
[ 148.865152] [I][mhi_dump_tre] carl_ev evt_state_change mhistate=2
[ 148.865157] [I][mhi_process_ctrl_ev_ring] MHI state change event to state:M0
[ 148.865162] [I][mhi_pm_m0_transition] Entered With State:READY PM_STATE:POR
[ 148.865166] [I][mhi_tryset_pm_state] Transition to pm state from:POR to:M0
[ 148.869564] [I][mhi_dump_tre] carl_ev evt_ee_state execenv=2
[ 148.869568] [I][mhi_process_ctrl_ev_ring] MHI EE received event:AMSS
[ 148.869581] [I][mhi_pm_st_worker] Transition to state:MISSION MODE
[ 148.869593] [I][mhi_pm_st_worker] INVALID_EE → AMSS
[ 148.869597] [I][mhi_pm_mission_mode_transition] Processing Mission Mode Transition
[ 148.869614] [I][mhi_init_timesync] No timesync capability found
[ 148.869617] [I][mhi_pm_mission_mode_transition] Adding new devices
[ 148.870776] [I][mhi_dtr_probe] Enter for DTR control channel
[ 148.870781] [I][__mhi_prepare_channel] Entered: preparing channel:18
[ 148.879523] [I][mhi_dump_tre] carl_ev evt_cmd_comp code=1, type=33
[ 148.879536] [I][__mhi_prepare_channel] Chan:18 successfully moved to start state
[ 148.879539] [I][__mhi_prepare_channel] Entered: preparing channel:19
[ 148.888368] [I][mhi_dump_tre] carl_ev evt_cmd_comp code=1, type=33
[ 148.888382] [I][__mhi_prepare_channel] Chan:19 successfully moved to start state
[ 148.888432] [I][mhi_dtr_probe] Exit with ret:0
[ 148.888797] [I][mhi_netdev_enable_iface] Prepare the channels for transfer
[ 148.895689] [I][__mhi_prepare_channel] Entered: preparing channel:100
[ 148.908510] [I][mhi_dump_tre] carl_ev evt_cmd_comp code=1, type=33
[ 148.908523] [I][__mhi_prepare_channel] Chan:100 successfully moved to start state
[ 148.908527] [I][__mhi_prepare_channel] Entered: preparing channel:101
[ 148.921968] [I][mhi_dump_tre] carl_ev evt_cmd_comp code=1, type=33
[ 148.921982] [I][__mhi_prepare_channel] Chan:101 successfully moved to start state
[ 148.924397] [I][mhi_netdev_enable_iface] Exited.
[ 148.929548] rmnet_vnd_register_device(rmnet_mhi0.1)=0
[ 148.934618] [I][mhi_pm_mission_mode_transition] Exit with ret:0

/tmp # ls /dev/mhi_*
/dev/mhi_BHI /dev/mhi_DUN /dev/mhi_MBIM
/dev/mhi_DIAG /dev/mhi_LOOPBACK

/tmp # microcom /dev/mhi_DUN
ati
Quectel
RM500Q-GL
Revision: RM500QGLABR11A05M4G

OK
AT+QCFG=“data_interface”
+QCFG: “data_interface”,1,1

OK

AT+QCFG=“pcie_mbim”
+QCFG: “pcie_mbim”,0

OK

(Please note I’ve tried with pcie_mbim=1 as well)

It seems the modem can bring up the context, see below:

/tmp # ./quectel-CM &
/tmp # [01-01_00:08:57:122] QConnectManager_Linux_V1.6.1
[01-01_00:08:57:123] Find /sys/bus/usb/devices/6-1 idVendor=0x2c7c idProduct=0x800, bus=0x006, dev=0x002
[01-01_00:08:57:123] network interface ‘’ or qmidev ‘’ is not exist
[01-01_00:08:57:123] netcard driver = pcie_mhi, driver version = V1.3.1
[01-01_00:08:57:123] mbim_qmap_mode = 1, vlan_id = 0x01, qmap_netcard = rmnet_mhi0.1
[01-01_00:08:57:123] Modem works in MBIM mode
[01-01_00:08:57:149] cdc_wdm_fd = 7
[01-01_00:08:57:149] mbim_open_device()
[01-01_00:08:57:714] mbim_device_caps_query()
[01-01_00:08:57:726] DeviceId: 863305040409020
[01-01_00:08:57:726] FirmwareInfo: RM500QGLABR11A05M4G
[01-01_00:08:57:726] HardwareInfo: RM500Q-GL
[01-01_00:08:57:726] mbim_device_services_query()
[01-01_00:08:57:733] mbim_set_radio_state( 1 )
[01-01_00:08:57:736] HwRadioState: 1, SwRadioState: 1
[01-01_00:08:57:736] mbim_subscriber_status_query()
[01-01_00:08:57:755] SubscriberId: 222882455476262
[01-01_00:08:57:755] SimIccId: 8939880845033062625F
[01-01_00:08:57:755] SubscriberReadyState NotInitialized → Initialized
[01-01_00:08:57:755] mbim_register_state_query()
[01-01_00:08:57:760] RegisterState Unknown → Home
[01-01_00:08:57:760] mbim_packet_service_query()
[01-01_00:08:57:765] PacketServiceState Unknown → Attached
[01-01_00:08:57:765] CurrentDataClass = LTE
[01-01_00:08:57:765] mbim_query_connect(sessionID=0)
[01-01_00:08:57:768] ActivationState Unknown → Deactivated
[01-01_00:08:57:768] ifconfig rmnet_mhi0 down
[01-01_00:08:57:771] ifconfig rmnet_mhi0.1 0.0.0.0
ifconfig: SIOCSIFFLAGS: Network is down
[01-01_00:08:57:774] ifconfig rmnet_mhi0.1 down
[01-01_00:08:57:777] mbim_set_connect(onoff=1, sessionID=0)
[01-01_00:08:58:133] ActivationState Deactivated → Activated
[01-01_00:08:58:[ 538.194781] net rmnet_mhi0: link_state 0x0 → 0x1
133] mbim_ip_config(sessionID=0)[ 538.201725] [I][mhi_netdev_open] Opened net dev interface

[01-01_00:08:58:137] < SessionId = 0
[01-01_00:08:58:137] < IPv4ConfigurationAvailable = 0xb
[01-01_00:08:58:137] < IPv6ConfigurationAvailable = 0x0
[01-01_00:08:58:137] < IPv4AddressCount = 0x1
[01-01_00:08:58:137] < IPv4AddressOffset = 0x3c
[01-01_00:08:58:137] < IPv6AddressCount = 0x0
[01-01_00:08:58:137] < IPv6AddressOffset = 0x0
[01-01_00:08:58:137] < IPv4 = 10.10.71.152/28
[01-01_00:08:58:137] < gw = 10.10.71.153
[01-01_00:08:58:137] < dns1 = 0.0.0.0
[01-01_00:08:58:137] < ipv4 mtu = 1500
[01-01_00:08:58:145] ifconfig rmnet_mhi0 up
[01-01_00:08:58:154] ifconfig rmnet_mhi0.1 up
[01-01_00:08:58:156] ip -4 address flush dev rmnet_mhi0.1
[01-01_00:08:58:158] ip -4 address add 10.10.71.152/28 dev rmnet_mhi0.1
[01-01_00:08:58:159] ip -4 route add default via 10.10.71.153 dev rmnet_mhi0.1

/tmp #
/tmp #
/tmp #
/tmp # ifconfig
eth1 Link encap:Ethernet HWaddr C8:77:65:00:00:01
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::ca77:65ff:fe00:1/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:268 errors:0 dropped:0 overruns:0 frame:0
TX packets:73 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:213406 (208.4 KiB) TX bytes:8035 (7.8 KiB)
Memory:1ae4000-1ae4fff

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:358 (358.0 B) TX bytes:358 (358.0 B)

rmnet_mhi0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet6 addr: fe80::ece1:2284:c4c1:1b67/64 Scope:Link
UP RUNNING NOARP MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

rmnet_mhi0.1 Link encap:Ethernet HWaddr 02:50:F4:00:00:00
inet addr:10.10.71.152 Mask:255.255.255.240
inet6 addr: fe80::50:f4ff:fe00:0/64 Scope:Link
UP RUNNING NOARP MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

/tmp # route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.10.71.153 0.0.0.0 UG 0 0 0 rmnet_mhi0.1
10.10.71.144 0.0.0.0 255.255.255.240 U 0 0 0 rmnet_mhi0.1
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1

But no packets are received from the network (neither I know if packets are tranmitted to the mobile network side too):

/tmp # ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
^C
— 8.8.8.8 ping statistics —
3 packets transmitted, 0 packets received, 100% packet loss
/tmp #
/tmp #
/tmp #
/tmp # ifconfig rmnet_mhi0.1
rmnet_mhi0.1 Link encap:Ethernet HWaddr 02:50:F4:00:00:00
inet addr:10.10.71.152 Mask:255.255.255.240
inet6 addr: fe80::50:f4ff:fe00:0/64 Scope:Link
UP RUNNING NOARP MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:294 (294.0 B)

It seems something related to communication between the host/modem, can you please help?

Thanks
Tommaso

Seems everything is fine…

If you would like to use mibim mode, you should set:

AT+QCFG=“usbnet”,2

And reboot the 5G module and then try the quectel-CM.

Okay, I thought usbnet was related to usb only.
Do I have to set
at+qcfg=“pcie_mbim”,1

too?

BTW, I’ve tried all the 4 combinations (usbnet=0/2 and pcie_mbim=0/1), rebooting the modem after each one.
Unfortunately still no packets received. Is the modem fw okay to be used in MBIM?

Thanks
Tommaso

It‘s MBIM mode allready.