Skip to content

WIP: Update ModemManager to latest release / switch to upstreamed RPMSG patches

Minecrell requested to merge msm8916-mainline/pmaports:mm-rpmsg-upstream into master

When I worked with @aleksander0m on upstreaming the RPMSG patch for ModemManager (for the modem in MSM8916/MSM8974 based devices, see !1607 (merged)) we decided that it is cleaner to let the bam-dmux driver operate in Raw-IP mode rather than Ethernet mode (which is partially broken). There were also several other changes made that require minor changes in the bam-dmux driver.

Because of that, the upstreamed patch now depends on some changes in the bam-dmux driver (and vice-versa) so we need to upgrade ModemManager and the kernels together.

This MR drops the old RPMSG patches, switches to the latest Git version of ModemManager and does some related changes:

  • The kernel changes for linux-postmarketos-qcom-msm8916 are available at https://github.com/msm8916-mainline/linux/pull/177 (should be built with envkernel, see https://wiki.postmarketos.org/wiki/MSM8916_Mainlining#Build_Kernel).
  • The kernel changes for linux-postmarketos-qcom-msm8974 are included here (not sure what is preferred for testing that kernel).
  • I had to fork libqmi from Alpine to update it to the latest Git version.
  • The upstream ModemManager patch automatically switches the modem to Raw-IP mode. The same change is required for oFono, so I've created a simple patch that does that.
  • (FIXME: I've temporarily removed all other MM patches, the ones not upstream yet need to be added back if necessary...)

TODO

  • Test oFono on linux-postmarketos-qcom-msm8916
  • Test ModemManager on linux-postmarketos-qcom-msm8916
  • Test oFono or ModemManager on linux-postmarketos-qcom-msm8974 (@z3ntu, @JuniorJPDJ, ?)
  • Coordinate with @dylanvanassche to add back relevant patches that were not upstreamed yet, and coordinate with !1931 (merged)
  • Test oFono/ModemManager on PinePhone to ensure no regressions?

Testing

There are two major changes that could cause regressions on MSM8916/MSM8974:

  1. Switch to Raw-IP mode instead of Ethernet mode, changes in oFono/MM
  2. Close BAM-DMUX channel when setting network interface down
    • This seems cleaner to me, but the downstream kernel does not do this with a comment
      /* do not close rmnet port once up,  this causes remote side to hang if tried to open again */
      I cannot reproduce this (maybe it was fixed long ago), but it could cause problems.

Therefore, I'm looking for help with testing with the following instructions (especially on MSM8974 devices!):

  1. Check if interface is in Raw-IP mode now. ip link should look like:
    3: rmnet0: <POINTOPOINT,NOARP> mtu 1500 qdisc noop state DOWN qlen 1000
        link/[519] 
    4: rmnet1: <POINTOPOINT,NOARP> mtu 1500 qdisc noop state DOWN qlen 1000
        link/[519] 
    5: rmnet2: <POINTOPOINT,NOARP> mtu 1500 qdisc noop state DOWN qlen 1000
        link/[519] 
    6: rmnet3: <POINTOPOINT,NOARP> mtu 1500 qdisc noop state DOWN qlen 1000
        link/[519] 
    7: rmnet4: <POINTOPOINT,NOARP> mtu 1500 qdisc noop state DOWN qlen 1000
        link/[519] 
    8: rmnet5: <POINTOPOINT,NOARP> mtu 1500 qdisc noop state DOWN qlen 1000
        link/[519] 
    9: rmnet6: <POINTOPOINT,NOARP> mtu 1500 qdisc noop state DOWN qlen 1000
        link/[519] 
    10: rmnet7: <POINTOPOINT,NOARP> mtu 1500 qdisc noop state DOWN qlen 1000
        link/[519] 
    11: rmnet_usb0: <POINTOPOINT,NOARP> mtu 1500 qdisc noop state DOWN qlen 1000
        link/[519] 
    Note the link/[519] instead of link/ether, which means the interface is in Raw-IP mode.

  2. Check if mobile data still works with ModemManager/oFono.
    • You can checkout this PR and build the updated packages locally, or download the updated packages from the artifacts of the GitLab CI. (Click Pipelines then the Download button close to the CI run...)
    • It should work through the UI interfaces in Phosh/Plasma Mobile, but I usually test from command line like explained in https://gist.github.com/Minecrell/4cc2bfb9fcae18e294386b0a213907d1

  3. Check if bringing network interface down/up works without problems.
    • Try disconnecting/reconnecting: nmcli c down modem, nmcli c up modem
    • Try manually managing network interface and check that Internet still works after setting it down and back up, e.g.
      $ nmcli c down modem
      $ sudo mmcli -m 0 --simple-connect="apn=<apn>"
      $ sudo ip link set rmnet0 up
      $ sudo udhcpc -i rmnet0
        # Should get an IP here
      $ ping <some-IP> # e.g. 8.8.8.8
        # Make sure this works
      $ sudo ip link set rmnet0 down
      $ sudo ip link set rmnet0 up
      $ sudo udhcpc -i rmnet0
      $ ping <some-IP> # e.g. 8.8.8.8
        # Make sure this works
Edited by Minecrell

Merge request reports