This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Review at https://gerrit.osmocom.org/3116
cosmetic: scheduler_trx.c: Add function to get rid of ugly goto path
Change-Id: I9c2e166e6f182f703ccf49aa883c223e377c8421
---
M src/osmo-bts-trx/scheduler_trx.c
1 file changed, 22 insertions(+), 15 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/16/3116/1
diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c
index f46ae1a..26b1705 100644
--- a/src/osmo-bts-trx/scheduler_trx.c
+++ b/src/osmo-bts-trx/scheduler_trx.c
@@ -1585,6 +1585,26 @@
return 0;
}
+/*! reset clock with current fn and schedule it. Called when trx becomes
+ * available or when max clock skew is reached */
+static int trx_setup_clock(struct gsm_bts *bts, struct osmo_trx_clock_state *tcs,
+ struct timespec *tv_now, const struct timespec *interval, uint32_t fn)
+{
+ tcs->last_fn_timer.fn = fn;
+ /* call trx cheduler function for new 'last' FN */
+ trx_sched_fn(bts, tcs->last_fn_timer.fn);
+
+ /* schedule first FN clock timer */
+ timer_ofd_setup(&tcs->fn_timer_ofd, trx_fn_timer_cb, bts);
+ timer_ofd_schedule(&tcs->fn_timer_ofd, NULL, interval);
+
+ tcs->last_fn_timer.tv = *tv_now;
+ tcs->last_clk_ind.tv = *tv_now;
+ tcs->last_clk_ind.fn = fn;
+
+ return 0;
+}
+
/*! called every time we receive a clock indication from TRX */
int trx_sched_clock(struct gsm_bts *bts, uint32_t fn)
{
@@ -1615,20 +1635,7 @@
/* tell BSC */
check_transceiver_availability(bts, 1);
-new_clock:
- tcs->last_fn_timer.fn = fn;
- /* call trx cheduler function for new 'last' FN */
- trx_sched_fn(bts, tcs->last_fn_timer.fn);
-
- /* schedule first FN clock timer */
- timer_ofd_setup(&tcs->fn_timer_ofd, trx_fn_timer_cb, bts);
- timer_ofd_schedule(&tcs->fn_timer_ofd, NULL, &interval);
-
- tcs->last_fn_timer.tv = tv_now;
- tcs->last_clk_ind.tv = tv_now;
- tcs->last_clk_ind.fn = fn;
-
- return 0;
+ return trx_setup_clock(bts, tcs, &tv_now, &interval, fn);
}
/* calculate elapsed time +fn since last timer */
@@ -1663,7 +1670,7 @@
if (elapsed_fn > MAX_FN_SKEW || elapsed_fn < -MAX_FN_SKEW) {
LOGP(DL1C, LOGL_NOTICE, "GSM clock skew: old fn=%u, "
"new fn=%u\n", tcs->last_fn_timer.fn, fn);
- goto new_clock;
+ return trx_setup_clock(bts, tcs, &tv_now, &interval, fn);
}
LOGP(DL1C, LOGL_INFO, "GSM clock jitter: %d us (elapsed_fn=%d)\n",
--
To view, visit https://gerrit.osmocom.org/3116
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9c2e166e6f182f703ccf49aa883c223e377c8421
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>