Skip to content

omamobile-modem-sit 0.3.45: mobile data back at once after a wake with no Wi-Fi, and a reconnect that comes back IPv6 only tried again - #837

Open
W4HO-ham wants to merge 3 commits into
derekross:mainfrom
W4HO-ham:sit-data-route-alone
Open

W4HO-ham wants to merge 3 commits into
derekross:mainfrom
W4HO-ham:sit-data-route-alone

Conversation

@W4HO-ham

Copy link
Copy Markdown
Contributor

Two fixes from tonight's modem-up sleep runs on my Pixel 9a (#758, under #809), both in the data path after a wake.

Mobile data back at once after a wake when nothing else leads out. omamobile-sit-data takes the cellular default route away at logind's sleep announcement and, after the wake, waits for Wi-Fi or for RETURN_GRACE (10 s), which #750 added so traffic doesn't leak over the bearer while Wi-Fi reconnects. With Wi-Fi off, though, that means no mobile data for the first 10 s of every wake: in 155 wakes with WIFI=off the series' ping 5 s after the wake got only its last echo back every time. Awake, with the link idle, the same ping got 3 of 3. And on the 99th wake, the wake was at 23:04:22.33 and "The cellular default route is back as the only way out" at 23:04:32.64. The wait now applies only when something else led out before the sleep. That is read from the previous check (last), before NetworkManager reacts to the same signal, so Wi-Fi going down for the sleep doesn't count. A sleep during the wait keeps what was known before it. With Wi-Fi connected, nothing changes.

A reconnect that comes back IPv6 only is released and tried again. In one boot the network dropped the internet bearer (the internet bearer (CID 1) is gone from the list), and #817's reconnect ran 3 s later as designed. It asked for IPv4v6, as at start-up, but this time the network granted PDP type 2 (start-up had got 3). omamobile-sit-data then failed at every restart with "An active IPv4 internet bearer is required", and mobile data stayed down until a reboot. A reconnect asking for IPv4 that gets IPv6 only now releases the bearer (data_call.deactivate) and counts as a failed try, so it is retried on the existing backoff (15 s, doubling).

Tests: test_data_network.py has three new SleepHold cases (back at once when alone; Wi-Fi before the sleep still waits; a sleep during the wait keeps what was known), and test_data_call_change.py has one for the IPv6-only reconnect, which is released, retried, and on IPv4v6 starts the route service. packages/omamobile-modem-sit/test/all passes.

On the palmtop, with this package (push1-g716f6d8ef355, WIFI=off, modem-sleep-series.sh 10 120, the boot ended in systemctl reboot): 10 requests, 9 entered, 1 refused by the link's notifier. After every wake: ping 3 of 3 and DNS answered, where 155 wakes before the change got 1 of 3. The network didn't drop the bearer in that run, so the IPv6-only path is tested only by the unit test so far.

@derekross

Copy link
Copy Markdown
Owner

Thank you, both of these come straight out of your night's runs, and the numbers make the case: one echo of three after 155 wakes, three of three after the change. I read the route change through main(): with Wi-Fi connected last is False and nothing changes, and with the bearer alone the route is back within half a second of the wake. The four new tests pass here with the rest of the two files.

Two things before it merges:

  1. Please bound the IPv6-only release. On a network that only ever grants IPv6 for this APN, every try now sets the bearer up and releases it again: 15 s doubling to 5 minutes, then every 30 minutes for the rest of the boot, and each try holds sitd's loop for up to a couple of minutes, during which an incoming call is presented late. Before, such a drop ended in one reconnect and a bearer that stayed. Either stop releasing after a few IPv6-only grants in a row (keep the bearer and say so once), or release only when this boot's first setup had IPv4. A test where activate grants type 2 every time and the releases are counted would pin it.
  2. A run on my Pixel 7 Pro, which I'll do. It sleeps with the modem up by default now, so this is its data path too. The wait you're removing was put in because traffic sent right at a wake brought answers that ended the next sleeps early, and with Wi-Fi off that is now every wake, including the short ones the shell puts straight back to sleep. Your series can't show what that costs (its own ping runs at each wake, and the two sets of runs were on different kernels), so I'll compare an idle half hour with Wi-Fi off on 0.3.43 and 0.3.44: wakes, refused sleeps, data after each wake.

One note for that run and for #759: while a default route through the USB gadget stays configured, others is never empty and last is never True, so the new branch isn't taken. I'll print the default routes first.

Small things: in the half second after the route returns last is None, so a sleep announced right then waits the 10 s once more; keeping the previous answer would close that. And if the release itself fails, the next try logs "listed again; no setup needed" for a bearer that is still IPv6 only; a line saying so would save someone a puzzle.

W4HO-ham added a commit to W4HO-ham/omarchy-mobile that referenced this pull request Nov 18, 2026
…se that failed is done first, and the route's wait knows the bearer was alone across a wake

From the review of derekross#837.

A reconnect that comes back IPv6 only is released and tried again three times in a row at most (IPV6_ONLY_RELEASES). The next such bearer is kept as the network gave it, with one line saying so, and so are the ones after it, until a setup brings IPv4 again. On a network that only ever grants IPv6 for the APN, every try used to set the bearer up and release it for the rest of the boot, holding sitd's loop each time.

If that release itself fails, the bearer stays listed with its IPv6-only record and the next try said "listed again; no setup needed". sitd now remembers that a release is owed, says the bearer is still listed IPv6 only, and releases it before the setup. A bearer nobody meant to release (the network's grant at start-up, or one kept after the bound) is still left alone when the modem lists it again.

The route service kept "was cellular the only way out" in the variable it also resets to print the path again, so in the half second between the route's return and the next check a sleep waited RETURN_GRACE once more. The answer now lives in SleepHold (seen), which takes it only from checks made while the route is its own business.

Tested: test_data_call_change.py gains four cases (activate granting IPv6 only every time: three releases and no more over later drops, one "keeping" line; IPv4 again starts the count afresh; a failed release is done before the next setup; an IPv6-only bearer listed again is left alone) and test_data_network.py two for the hold. test/all passes. Not run on a phone yet.
@W4HO-ham

Copy link
Copy Markdown
Contributor Author

Done, in 9c2190b.

  1. The IPv6-only release is bounded. Three in a row (IPV6_ONLY_RELEASES), then the bearer is kept as the network gave it, with one line saying so, and so are the ones after it until a setup brings IPv4 again. The count runs across drops, so a network that only ever grants IPv6 for the APN costs three releases in a boot, not three per drop. The test you asked for is test_ipv6_only_releases_are_bounded: activate grants type 2 every time, through the first drop and five later ones, and the releases stop at three.
  2. A release that fails. sitd now remembers that one is owed, says "still listed IPv6 only (its release did not go through)" at the next try and releases before the setup. A bearer nobody meant to release (IPv6 only from start-up, or kept after the bound) is still left alone when the modem lists it again. There is a test for each.
  3. last being None for half a second. The answer now lives in SleepHold (seen), which takes it only from checks made while the route is its own business, so a sleep announced right after the route's return still knows the bearer was alone. Two tests.

Unit tests only so far: this commit has not run on a phone. My palmtop gets it with its next modem start.

On the gadget's default route: in my runs the log said "as the only way out" after each wake, so my palmtop had no default route through the gadget then. I haven't looked at why.

W4HO-ham added a commit to W4HO-ham/omarchy-mobile that referenced this pull request Nov 18, 2026
…ell to works (opt-in), with the runs on the published branch

The cell's old condition was a fix for the third no-wake and a series from the published kernel as it is. Kernel derekross#247 is merged, and on derek/omamobile at 26867fc4e (derekross#224, derekross#232, derekross#247, derekross#258) 300 of 300 sleeps with a 60 s alarm woke with the modem off on the night of 2026-11-17: 296 on the alarm and 4 within seconds on the touchscreen's interrupt with nobody at the palmtop. On 2026-11-16, 86 of 86 sleeps entered with the modem up woke, each ended by the modem within 29 s, so none of those reached its alarm.

From the review of derekross#846: the word is "works (opt-in)", since auto-sleep ships off on the 9a (omamobile-device-tegu doesn't install /usr/share/omamobile/auto-sleep-default); the cell says again that a new sleep test runs attended first and that the modem's inhibitor stays, the owner's palmtop under derekross#809 excepted; and it cites merged notes, not derekross#758's comments.

MODEM-PLAN gains the 2026-11-16 section: the runs on the test kernel and on the published branch under derekross#809's terms, the route finding that became derekross#837, and the palmtop hanging awake twice at a power-up of the modem's link (once between the sleeps of a series, once in everyday use with Wi-Fi connected), with the NV check after each. The Modem cell names those hangs. SLEEP-PLAN's S1 table gains a row for the 86 modem-up sleeps and one for the night's 300, and its status line is brought up to date.
@derekross

Copy link
Copy Markdown
Owner

Thank you, that was quick, and it is what I asked for. The bound reads right: three releases in a row, then the bearer stays as the network gave it, and the count runs across drops, so a network that only ever grants IPv6 costs three releases in a boot. test_ipv6_only_releases_are_bounded pins it the way I hoped. Moving the "was the bearer alone" answer into SleepHold is cleaner than what I suggested, and the owed release with its own log line closes the puzzle. The 55 tests of the two files pass here and CI is green on 9c2190b.

What's left before it merges:

  1. My Pixel 7 Pro run, still mine: an idle half hour with Wi-Fi off on 0.3.43 and on this, wakes, refused sleeps and data after each wake, with the default routes printed first.
  2. Your next modem-up series on this head. The 89 sleeps were on the first commit, and the route logic changed in the second, so please post the result from 9c2190b (or later) here when the palmtop has run it.
  3. The version. omamobile-modem-sit 0.3.44: an IMS bearer the network ended no longer blocks the internet bearer's reconnect #881 (den-kloot's fix for an IMS record that blocks the reconnect) also says 0.3.44 and touches the same function. It is small and ready, so I'll merge it first; please rebase onto main after that and take 0.3.45. The only conflict is at the top of the try in reconnect(); keep both sides like this, and both sets of tests pass on the result (I ran them):
            items = data_call.entries(self.client.request(0x0602, timeout=10))
            listed = next((i for i in items if i[2] == cid), None)
            unreleased = False

Two small things, as you see fit:

  • Once the bound is reached and mobile data was on, sitd still starts omamobile-sit-data on a bearer it knows is IPv6 only; the service then fails and restarts every 10 s for the rest of the boot. Main does the same today, so it isn't new, but the start could be skipped there.
  • If a release fails and the modem then drops the bearer by itself, ipv6_release_owed stays set; a kept bearer that is later listed again then gets one release it wasn't owed. Clearing the flag when the bearer is no longer listed would close that.

…h no Wi-Fi, and a reconnect that comes back IPv6 only tried again

On the 9a with Wi-Fi off, the cellular default route came back 10 s after every wake (the grace that waits for Wi-Fi), so a ping 5 s after each of 155 wakes got only its last echo. The grace now applies only when something else led out before the sleep.

In the same night's runs the network dropped the internet bearer once and sitd's reconnect asked for IPv4v6 but got IPv6 only, which omamobile-sit-data can't use, so mobile data stayed down. Such a bearer is now released and counts as a failed try, retried with the usual backoff.
…se that failed is done first, and the route's wait knows the bearer was alone across a wake

From the review of derekross#837.

A reconnect that comes back IPv6 only is released and tried again three times in a row at most (IPV6_ONLY_RELEASES). The next such bearer is kept as the network gave it, with one line saying so, and so are the ones after it, until a setup brings IPv4 again. On a network that only ever grants IPv6 for the APN, every try used to set the bearer up and release it for the rest of the boot, holding sitd's loop each time.

If that release itself fails, the bearer stays listed with its IPv6-only record and the next try said "listed again; no setup needed". sitd now remembers that a release is owed, says the bearer is still listed IPv6 only, and releases it before the setup. A bearer nobody meant to release (the network's grant at start-up, or one kept after the bound) is still left alone when the modem lists it again.

The route service kept "was cellular the only way out" in the variable it also resets to print the path again, so in the half second between the route's return and the next check a sleep waited RETURN_GRACE once more. The answer now lives in SleepHold (seen), which takes it only from checks made while the route is its own business.

Tested: test_data_call_change.py gains four cases (activate granting IPv6 only every time: three releases and no more over later drops, one "keeping" line; IPv4 again starts the count afresh; a failed release is done before the next setup; an IPv6-only bearer listed again is left alone) and test_data_network.py two for the hold. test/all passes. Not run on a phone yet.
…, and a release owed ends with the bearer

From the review of derekross#837. Once the bound is reached and an IPv6-only bearer is kept, sitd no longer starts omamobile-sit-data on it: the route service needs IPv4, and started there it failed and was started again every 10 s for the rest of the boot. Mobile data stays wanted, so the next bearer that comes with IPv4 starts it. And a release owed from a try that failed is cleared when the modem no longer lists the bearer, so a kept bearer listed later isn't released for it.

Tested: test_data_call_change.py (the bounded case now checks the route isn't started on the kept bearer and is started when IPv4 comes back; a new case drops the bearer after a failed release and checks nothing more is released) and test/all.
@W4HO-ham
W4HO-ham force-pushed the sit-data-route-alone branch from 9c2190b to 6592bc4 Compare November 18, 2026 17:38
@W4HO-ham

Copy link
Copy Markdown
Contributor Author

Rebased onto main after #881, now 0.3.45 (the version file and the three commit subjects). The conflict at the top of the try in reconnect() is resolved as you wrote it, keeping both sides.

Both small points are in a third commit (6592bc4):

  • Once the bound is reached and an IPv6-only bearer is kept, sitd no longer starts omamobile-sit-data on it. It logs "Mobile data not started on an IPv6-only bearer: the route needs IPv4" instead. Mobile data stays wanted, so the next bearer with IPv4 starts the route.
  • ipv6_release_owed is cleared when the modem no longer lists the bearer, so a kept bearer listed later isn't released for an old failed try.

test_data_call_change.py covers both: the bounded case now checks the route isn't started on the kept bearer and is started when IPv4 comes back, and a new case drops the bearer after a failed release and checks nothing more is released. The package's test/all (302 tests), tests/all and tools/pr-check origin/main pass.

The modem-up series on this head is next. My palmtop is on a modem-off sleep series for the auto-sleep question until late today, so the modem-up run follows that, with the result here.

@W4HO-ham W4HO-ham changed the title omamobile-modem-sit 0.3.44: mobile data back at once after a wake with no Wi-Fi, and a reconnect that comes back IPv6 only tried again omamobile-modem-sit 0.3.45: mobile data back at once after a wake with no Wi-Fi, and a reconnect that comes back IPv6 only tried again Nov 18, 2026
@W4HO-ham

Copy link
Copy Markdown
Contributor Author

The modem-up series on this head (6592bc4), on my palmtop today, under #809's terms:

  • What ran: kernel 7.3.0-rc6-omamobile-push1-g26867fc4e826 (the published branch at 26867fc4e, build tools: accept the NixOS binfmt name in the ARM builder #15, the one the 11-16 series ran on, so not a new kernel), omamobile-modem-sit 0.3.45-1 built from this branch, omamobile-modem 0.1.27-1, omamobile-device-tegu 0.2.21-1, the modem started by its boot unit after a clean reboot; device/tegu/bringup/modem-sleep-series.sh as on main, WIFI=off, 20 requests of 60 s, on the charger (14:05 to 14:25).
  • Result: 20 of 20 requests entered a sleep and all 20 woke, each ended by the modem (cp2ap_wakeup) after 3 to 46 s, so none reached its alarm. 20 s after every wake: CP ONLINE, sitd active, no failed poll, no new UFS or oops line. 5 s after every wake, data over rmnet0 with Wi-Fi off: 3 of 3 pings and the DNS lookup, 20 of 20; at the end, 5 of 5 pings.
  • sitd's data-call lines: 58 "Data-call list changed" lines over the run, the internet bearer (CID 1, IPv4v6) going between dormant and active around the sleeps (active 1 and active 2) and the IMS bearer (CID 2) staying up. The network didn't drop the internet bearer in these 20 minutes, so neither the reconnect nor the IPv6-only path had anything to do in this run; nothing was released and no route was refused.
  • The end: systemctl reboot, with the modem's boot unit masked first for the kernel change that follows, as the AGENTS.md entry asks.

W4HO-ham added a commit to W4HO-ham/omarchy-mobile that referenced this pull request Nov 18, 2026
omamobile-modem-sit is 0.3.46 here, after main's 0.3.44 and derekross#837's 0.3.45; the audio defaults keep this branch's tegu_route and tegu_aec beside main's control follow_screen.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants