l1sap: fix duplicate RF RESOURCE INDICATION on clock bootstrap
The TTCN-3 test suite (ttcn3-bts-test) expects to receive exactly one RF RESOURCE INDICATION message from each TRX during the bootstrap stage, while waiting for all TRX to come up and be configured by the BSC.
l1sap_interf_meas_report() fires whenever bts->gsm_time.fn % period is 0, where period = intave * 104 (typically 624 frames). Since CLCK.ind with FN=0 satisfies this condition, a report is sent at the very beginning of each clock epoch.
This was not a problem before commit fcfc4e83, because the first CLCK.ind from the transciever was effectively a no-op: with last_fn_timer.fn zero-initialised, the first indication at FN=0 yielded elapsed_fn=0 (not > MAX_FN_SKEW), and the catch-up loop (while fn != last_fn_timer.fn) would not execute either. Downlink scheduling only started on the second CLCK.ind (at FN=102, which is > MAX_FN_SKEW), and 102 % 624 != 0, so no RF RESOURCE INDICATION was triggered.
fcfc4e83 changed the logic so that Downlink scheduling now begins immediately on the first CLCK.ind, via an unconditional call to trx_setup_clock() -> bts_sched_fn(fn). When fake_trx starts its frame counter from FN=0, this immediately triggers l1sap_interf_meas_report() because 0 % 624 == 0. A second report follows ~2.88s later when the periodic timer reaches FN=624, making the bootstrap logic in ttcn3-bts-test unhappy.
Fix by shifting the trigger to (fn + 1) % period == 0, i.e. the report fires at the last frame of each period rather than the first. FN=0 now yields (0+1) % 624 = 1 != 0, suppressing the spurious bootstrap report. The periodic behaviour and report cadence are otherwise unchanged.
Change-Id: I6550178427b08e67c9763f0f37efff5b88960b1f Related: fcfc4e83 ("osmo-bts-trx: fix spurious shutdown on first CLCK.ind from osmo-trx") AI-Assisted: yes (Claude)