How to setup EM7565 on linux - qmi?

I’ve fumbled through getting this modem on, present in the system, and registered on a cell network.
Now I have no clue how to get wwan0 an IP. I’ve followed the few guides on here and else where and dhclient or the likes just times out on discovery or just immediately exits and the interface still doesn’t have an IP.

I might have broken something, as I originally wanted to use ECM mode and an ethernet bridge to give a router behind it the IP from the cellular ISP. I’ve given up on that as I have no idea what I’m doing, so I’ve gone back to trying to get raw_ip on qmi working.

# mmcli -m 0
  ----------------------------------
  General  |                   path: /org/freedesktop/ModemManager1/Modem/0
           |              device id: xxxxxxxxx
  ----------------------------------
  Hardware |           manufacturer: Sierra Wireless, Incorporated
           |                  model: EM7565
           |      firmware revision: SWI9X50C_01.14.22.00 ba8ef1 jenkins 2022/11/11 09:59:48
           |         carrier config: default
           |           h/w revision: 1.5
           |              supported: gsm-umts, lte
           |                current: gsm-umts, lte
           |           equipment id: xxxxxxxxxx
  ----------------------------------
  System   |                 device: /sys/devices/pci0000:00/0000:00:15.0/usb2/2-6
           |                drivers: qmi_wwan, qcserial
           |                 plugin: sierra
           |           primary port: cdc-wdm0
           |                  ports: cdc-wdm0 (qmi), ttyUSB0 (qcdm), ttyUSB1 (gps), 
           |                         ttyUSB2 (at), wwan0 (net)
  ----------------------------------
  Numbers  |                    own: 1xxxxxxxxxx
  ----------------------------------
  Status   |                   lock: sim-pin2
           |         unlock retries: sim-pin (3), sim-puk (10), sim-pin2 (3), sim-puk2 (10)
           |                  state: registered
           |            power state: on
           |            access tech: lte
           |         signal quality: 75% (recent)
  ----------------------------------
  Modes    |              supported: allowed: 3g; preferred: none
           |                         allowed: 4g; preferred: none
           |                         allowed: 3g, 4g; preferred: 4g
           |                         allowed: 3g, 4g; preferred: 3g
           |                current: allowed: 3g, 4g; preferred: 4g
  ----------------------------------
  Bands    |              supported: utran-1, utran-4, utran-6, utran-5, utran-8, utran-9, 
           |                         utran-2, eutran-1, eutran-2, eutran-3, eutran-4, eutran-5, eutran-7, 
           |                         eutran-8, eutran-9, eutran-12, eutran-13, eutran-18, eutran-19, 
           |                         eutran-20, eutran-26, eutran-28, eutran-29, eutran-30, eutran-32, 
           |                         eutran-41, eutran-46, eutran-66, utran-19
           |                current: utran-1, utran-4, utran-6, utran-5, utran-8, utran-9, 
           |                         utran-2, eutran-1, eutran-2, eutran-3, eutran-4, eutran-5, eutran-7, 
           |                         eutran-8, eutran-9, eutran-12, eutran-13, eutran-18, eutran-19, 
           |                         eutran-20, eutran-26, eutran-28, eutran-29, eutran-30, eutran-32, 
           |                         eutran-41, eutran-46, eutran-66, utran-19
  ----------------------------------
  IP       |              supported: ipv4, ipv6, ipv4v6
  ----------------------------------
  3GPP     |                   imei: xxxxxxxxxx
           |          enabled locks: fixed-dialing
           |            operator id: 310410
           |          operator name: AT&T
           |           registration: home
           |   packet service state: attached
  ----------------------------------
  3GPP EPS |   ue mode of operation: csps-2
           |    initial bearer path: /org/freedesktop/ModemManager1/Bearer/0
           |     initial bearer apn: nxtgenphone
           | initial bearer ip type: ipv4v6
  ----------------------------------
  SIM      |       primary sim path: /org/freedesktop/ModemManager1/SIM/0
           |         sim slot paths: slot 1: /org/freedesktop/ModemManager1/SIM/0 (active)
           |                         slot 2: none

So after all the problems, I started over with qmicli.

# qmicli -p -d /dev/cdc-wdm0 --dms-get-operating-mode
[/dev/cdc-wdm0] Operating mode retrieved:
        Mode: 'online'
        HW restricted: 'no'
# ip link set wwan0 down
# echo 'Y' | sudo tee /sys/class/net/wwan0/qmi/raw_ip
Y
# ip link set wwan0 up
# qmicli -p -d /dev/cdc-wdm0 --wda-get-data-format
[/dev/cdc-wdm0] Successfully got data format
                   QoS flow header: no
               Link layer protocol: 'raw-ip'
  Uplink data aggregation protocol: 'disabled'
Downlink data aggregation protocol: 'disabled'
                     NDP signature: '0'
Downlink data aggregation max datagrams: '0'
Downlink data aggregation max size: '0'
# qmicli -p -d /dev/cdc-wdm0 --device-open-net='net-raw-ip|net-no-qos-header' --wds-start-network="apn='nxtgenphone',ip-type=4" --client-no-release-cid
error: couldn't open the QmiDevice: Transaction timed out
# ip link show wwan0
6: wwan0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN mode DEFAULT group default qlen 1000
    link/none
# qmicli -p -d /dev/cdc-wdm0 --nas-get-signal-strength 
[/dev/cdc-wdm0] Successfully got signal strength
Current:
        Network 'lte': '-68 dBm'
RSSI:
        Network 'lte': '-68 dBm'
ECIO:
        Network 'lte': '-2.5 dBm'
IO: '-106 dBm'
SINR (8): '9.0 dB'
RSRQ:
        Network 'lte': '-12 dB'
SNR:
        Network 'lte': '13.6 dB'
RSRP:
        Network 'lte': '-99 dBm'

I thought maybe ModemManager was messing something up, so I rebooted with it disabled.
Got a little further than before, but no luck getting an IP.

# ip link set wwx02360d4c2e4c up
# qmicli -d /dev/cdc-wdm0 --device-open-net='net-raw-ip|net-no-qos-header' --wds-start-network="apn='nxtgenphone',ip-type=4" --client-no-release-cid
[/dev/cdc-wdm0] Network started
        Packet data handle: '4251282640'
[/dev/cdc-wdm0] Client ID not released:
        Service: 'wds'
            CID: '18'
# udhcpc -q -f -i wwx02360d4c2e4c
udhcpc: started, v1.35.0
udhcpc: broadcasting discover
udhcpc: broadcasting discover
udhcpc: broadcasting discover

Just stuck on discover.

What am I doing wrong here?
I would really appreciate someones help getting up to speed on this.

Also I saw theres a /sys/class/net/wwx02360d4c2e4c/qmi/pass_through for qmi. Does this mean I can give the ISP IP to a device behind this modem? I can’t find anything online about a pass_through mode

You can see here on using mbpl

No, that’s for passthrough to another driver. It is intended for Qualcomms virtual rmnet driver, which is transport agnostic. qmi_wwan can serve as the USB transport for that driver by using tha “passthrough” feature.

Yes, that’s a real problem. This is seriously underdocumented, and I have to google the recipe every time I want to test it. Should probably have pushed back harder. But who am I do deny Qualcomm from adding support for their own chips :wink:

There are some hint on the usage in the commit message adding this feature:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/net/usb/qmi_wwan.c?id=59e139cf0b32a7a08ef20453927ecd57db086d8e

Daniele added some basic usage instructions later:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/Documentation/ABI/testing/sysfs-class-net-qmi?id=bd1af6b5fffd36c12997bd48d61d39dc5796fa7b

But this still doesn’t explain how it all is supposed to work… I gues it’s not intended for manual use, but for user space tools like ModemManager.

Anyway, it doesn’t help you with the IP pass through you want. The answer to that is routing. You have one wwan interface and an ethernet interface and configure default routing in both directions in such a way that anything entering he ethernet port goes out the wwan port and vice versa. And there you hace an “ethernet bridge”. (which it of course never will be since the cellular tunnel is IP only).

The tools for this is “ip route” and “ip rule”. And then you may want to add proxy arp, or some other way to fake a gateway address for the ethernet side of the “bridge”. And probably also a local DHCP server for the ethernet side, so that you can easily forward the wwan IP config to the client behind it.