fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/42850?usp=email )


Change subject: osmo-bts-trx: reset BTS GSM time on clock (re)start
......................................................................

osmo-bts-trx: reset BTS GSM time on clock (re)start

trx_sched_clock_started() is called when the transceiver is powered
on, e.g. after an A-bis link re-establishment, which in ttcn3-bts-test
happens once per testcase.  The transceiver restarts its TDMA frame
number from ~0, but we only reset the per-TRX clock state (tcs),
leaving bts->gsm_time.fn at the previous epoch's value.

As a result the first (low) FN reported by the transceiver is mistaken
for a huge backwards jump, e.g.:

  l1sap.c:628 Invalid condition detected: Frame difference is 102-10386=2705364 
> 1!

Reset bts->gsm_time to FN 0 here so each clock epoch starts clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Change-Id: Id8da126e460d3846a3be5bdb271553457fdd0590
---
M src/osmo-bts-trx/scheduler_trx.c
1 file changed, 6 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/50/42850/1

diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c
index 770a54b..d791eaf 100644
--- a/src/osmo-bts-trx/scheduler_trx.c
+++ b/src/osmo-bts-trx/scheduler_trx.c
@@ -491,6 +491,12 @@
        osmo_fd_close(&tcs->fn_timer_ofd);
        memset(tcs, 0, sizeof(*tcs));
        tcs->fn_timer_ofd.fd = -1;
+       /* This is a fresh clock epoch: the transceiver was (re)powered on, 
e.g. due to
+        * A-bis link (re-)establishment, and (re)starts its TDMA frame number 
from 0.
+        * Reset our notion of GSM time accordingly, so that the first CLCK.ind 
reported
+        * by the transceiver is not mistaken for a huge backwards jump against 
a stale
+        * frame number left over from the previous epoch. */
+       gsm_fn2gsmtime(&bts->gsm_time, 0);
        /* Set up timeout to shutdown BTS if no clock ind is received in a few
         * seconds. Upon clock ind receival, fn_timer_ofd will be reused and
         * timeout won't trigger.

--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/42850?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Id8da126e460d3846a3be5bdb271553457fdd0590
Gerrit-Change-Number: 42850
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>

Reply via email to