PCIe MBIM modem not creating a wwan netdev
I have a router board with a Quectel RM520N-GL 5G module that speaks either USB or PCIe. In USB mode, I have
CONFIG_USB_USBNET=y
CONFIG_USB_NET_CDC_MBIM=y
and everything works: I get a /dev/wwan0mbim to bring up the modem and a wwan0 netdev to use with the negotiated config.
If I switch the modem to PCIe MHI mode and compile in
CONFIG_MHI_BUS=y
CONFIG_MHI_BUS_PCI_GENERIC=y
CONFIG_WWAN=y
CONFIG_MHI_WWAN_CTRL=y
CONFIG_MHI_WWAN_MBIM=y
the modem is recognised as one of the models listed in drivers/bus/mhi/host/pci_generic.c. dmesg reports
mhi-pci-generic 0000:01:00.0: MHI PCI device found: qcom-sdx65m mhi-pci-generic 0000:01:00.0: BAR 0 [mem 0x20000000-0x20000fff 64bit]: assigned mhi-pci-generic 0000:01:00.0: enabling device (0000 -> 0002)
mhi mhi0: Requested to power ON
mhi mhi0: Power on setup success
wwan wwan0: port wwan0qcdm0 attached
wwan wwan0: port wwan0mbim0 attached
wwan wwan0: port wwan0qmi0 attached
and this gives me character devices /dev/wwan0mbim0, /dev/wwan0qcdm0 and /dev/wwan0qmi0... but no corresponding wwan0 network interface.
I can successfully bring up the modem over mbim exactly as in the USB case:
# mbim /dev/wwan0mbim0 open # mbim /dev/wwan0mbim0 subscriber ready-state initialized sim-icc-id 8xxxxxxxxxxxxxxxxxxx subscriber-id 23xxxxxxxxxxxx telephone-number +447xxxxxxxxx # mbim /dev/wwan0mbim0 connect ipv4:internet session-id 0 activation-state activated ip-type ipv4 # mbim /dev/wwan0mbim0 config address 10.248.62.56/28 gateway 10.248.62.57 dns 192.168.253.31 dns 192.168.253.31 mtu 1500 #
but I have no netdev to configure the negotiated address on:
# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq master br0 state DOWN mode DEFAULT group default qlen 1000
link/ether 94:83:c4:a6:cf:d7 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br0 state UP mode DEFAULT group default qlen 1000
link/ether 94:83:c4:a6:cf:d8 brd ff:ff:ff:ff:ff:ff
4: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether 94:83:c4:a6:cf:d9 brd ff:ff:ff:ff:ff:ff
5: wlan1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether 94:83:c4:a6:cf:d7 brd ff:ff:ff:ff:ff:ff
6: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 94:83:c4:a6:cf:d7 brd ff:ff:ff:ff:ff:ff(If I add CONFIG_MHI_NET=y, I get 'raw' links like
2: mhi_swip0: <POINTOPOINT,NOARP> mtu 16384 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/[519]
3: mhi_hwip0: <POINTOPOINT,NOARP> mtu 16384 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/[519]but no wwan0 link. Configuring the address on a raw link doesn't work.)
I added a printk to mhi_mbim_probe() of drivers/net/wwan/mhi_wwan_mbim.c and this never fires, which might explain why no netdev is created? The same thing happens on linux 6.10.2 and the head of Linus' tree at the time I write this. I also reproduced on an older 6.9.12 kernel.
Is this a bug (with my modem?) or there something more than the above I need to enable for the network device to be created as well as the character devices, as in the USB case?
For what it's worth, my complete 'make savedefconfig' is
https://github.com/arachsys-hosts/gl-x3000/blob/master/config/linux.cfg
Best wishes,
Chris.
Quoted 3 lines · Chris Webb
Is this a bug (with my modem?) or there something more than the above I need to enable for the network device to be created as well as the character devices, as in the USB case?
This turns out to be a missing PCI ID for the variant of the RM520M-GL modem I have. Doing the following got the channels labelled correctly so the mhi_wwan_mbim driver bound to IP_HW0_MBIM:
drivers/bus/mhi/host/pci_generic.c +3 -0
@@ -620,6 +620,9 @@ static const struct pci_device_id mhi_pci_id_table[] = { .driver_data = (kernel_ulong_t) &mhi_telit_fn980_hw_v1_info }, { PCI_DEVICE(PCI_VENDOR_ID_QCOM, 0x0306), .driver_data = (kernel_ulong_t) &mhi_qcom_sdx55_info }, +/* RM520N-GL variant with Qualcomm vendor and subvendor ID */ + { PCI_DEVICE_SUB(PCI_VENDOR_ID_QCOM, 0x0308, PCI_VENDOR_ID_QCOM, 0x5201), + .driver_data = (kernel_ulong_t) &mhi_quectel_rm5xx_info },/* Telit FN990 */ { PCI_DEVICE_SUB(PCI_VENDOR_ID_QCOM, 0x0308, 0x1c5d, 0x2010), .driver_data = (kernel_ulong_t) &mhi_telit_fn990_info },
I wonder if there's an exhaustive list somewhere of the PCI ids used on these Quectel cards, that might enable me to submit a sensible patch rather than just an ad hoc fix-up for one combination I've found in the wild...
I do note quite a bit of
[ 388.122202] sequence number glitch prev=94 curr=0 [ 402.513709] sequence number glitch prev=12 curr=0 [ 408.708148] sequence number glitch prev=3 curr=0 [ 416.915221] sequence number glitch prev=11 curr=0 [ 423.032992] sequence number glitch prev=5 curr=0 [ 442.724830] sequence number glitch prev=4 curr=0 [ 455.594228] sequence number glitch prev=9 curr=0 [ 463.810701] sequence number glitch prev=3 curr=0 [ 468.970895] sequence number glitch prev=6 curr=0
but assume this is likely to be some kind of modem bug? Interestingly, the equivalent warning in drivers/net/usb/cdc_ncm.c never fires when the modem is in USB mode.
Best wishes,
Chris.