[PATCH] osmocom-bb[master]: host/trxcon/scheduler: implement sched_clck_reset()

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Feb 22 15:33:12 UTC 2018


Review at  https://gerrit.osmocom.org/6748

host/trxcon/scheduler: implement sched_clck_reset()

It's better to have the clock management API inside a single file.

Change-Id: I92772f3db404e70fdffd530779613196afec61c9
---
M src/host/trxcon/sched_clck.c
M src/host/trxcon/sched_trx.c
M src/host/trxcon/scheduler.h
3 files changed, 16 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/48/6748/1

diff --git a/src/host/trxcon/sched_clck.c b/src/host/trxcon/sched_clck.c
index 9c1edc5..d57d07e 100644
--- a/src/host/trxcon/sched_clck.c
+++ b/src/host/trxcon/sched_clck.c
@@ -198,3 +198,16 @@
 
 	return 0;
 }
+
+void sched_clck_reset(struct trx_sched *sched)
+{
+	/* Reset internal state */
+	sched->state = SCH_CLCK_STATE_WAIT;
+
+	/* Stop clock timer */
+	osmo_timer_del(&sched->clock_timer);
+
+	/* Flush counters */
+	sched->fn_counter_proc = 0;
+	sched->fn_counter_lost = 0;
+}
diff --git a/src/host/trxcon/sched_trx.c b/src/host/trxcon/sched_trx.c
index cc9b1ce..04fc5cf 100644
--- a/src/host/trxcon/sched_trx.c
+++ b/src/host/trxcon/sched_trx.c
@@ -130,7 +130,6 @@
 
 int sched_trx_reset(struct trx_instance *trx)
 {
-	struct trx_sched *sched;
 	int i;
 
 	if (!trx)
@@ -144,16 +143,8 @@
 
 	INIT_LLIST_HEAD(&trx->ts_list);
 
-	/* Obtain a scheduler instance from TRX */
-	sched = &trx->sched;
-
-	/* Reset clock counter */
-	osmo_timer_del(&sched->clock_timer);
-	sched->fn_counter_proc = 0;
-	sched->fn_counter_lost = 0;
-
-	/* Reset internal state */
-	sched->state = SCH_CLCK_STATE_WAIT;
+	/* Stop and reset clock counter */
+	sched_clck_reset(&trx->sched);
 
 	return 0;
 }
diff --git a/src/host/trxcon/scheduler.h b/src/host/trxcon/scheduler.h
index 0783e40..b025d91 100644
--- a/src/host/trxcon/scheduler.h
+++ b/src/host/trxcon/scheduler.h
@@ -35,3 +35,4 @@
 };
 
 int sched_clck_handle(struct trx_sched *sched, uint32_t fn);
+void sched_clck_reset(struct trx_sched *sched);

-- 
To view, visit https://gerrit.osmocom.org/6748
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I92772f3db404e70fdffd530779613196afec61c9
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list