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

host/trxcon/scheduler: optionally reset clock counter

Change-Id: I4565620fc0c5f64133c2674d2c972fc34245cf32
---
M src/host/trxcon/l1ctl.c
M src/host/trxcon/sched_trx.c
M src/host/trxcon/sched_trx.h
M src/host/trxcon/trxcon.c
4 files changed, 13 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/49/6749/1

diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c
index 436d043..7810763 100644
--- a/src/host/trxcon/l1ctl.c
+++ b/src/host/trxcon/l1ctl.c
@@ -287,8 +287,8 @@
                gsm_band_name(gsm_arfcn2band(band_arfcn)),
                band_arfcn &~ ARFCN_FLAG_MASK);
 
-       /* Reset L1 */
-       sched_trx_reset(l1l->trx);
+       /* Reset scheduler and clock counter */
+       sched_trx_reset(l1l->trx, 1);
 
        /* Configure a single timeslot */
        if (fbsb->ccch_mode == CCCH_MODE_COMBINED)
@@ -371,7 +371,7 @@
 
                /* Fall through */
        case L1CTL_RES_T_SCHED:
-               sched_trx_reset(l1l->trx);
+               sched_trx_reset(l1l->trx, 1);
                break;
        default:
                LOGP(DL1C, LOGL_ERROR, "Unknown L1CTL_RESET_REQ type\n");
@@ -560,7 +560,7 @@
 static int l1ctl_rx_dm_rel_req(struct l1ctl_link *l1l, struct msgb *msg)
 {
        /* Reset scheduler */
-       sched_trx_reset(l1l->trx);
+       sched_trx_reset(l1l->trx, 0);
 
        msgb_free(msg);
        return 0;
diff --git a/src/host/trxcon/sched_trx.c b/src/host/trxcon/sched_trx.c
index 04fc5cf..94a8e68 100644
--- a/src/host/trxcon/sched_trx.c
+++ b/src/host/trxcon/sched_trx.c
@@ -128,14 +128,15 @@
        return 0;
 }
 
-int sched_trx_reset(struct trx_instance *trx)
+int sched_trx_reset(struct trx_instance *trx, int reset_clock)
 {
        int i;
 
        if (!trx)
                return -EINVAL;
 
-       LOGP(DSCH, LOGL_NOTICE, "Reset scheduler\n");
+       LOGP(DSCH, LOGL_NOTICE, "Reset scheduler %s\n",
+               reset_clock ? "and clock counter" : "");
 
        /* Free all potentially allocated timeslots */
        for (i = 0; i < TRX_TS_COUNT; i++)
@@ -143,8 +144,9 @@
 
        INIT_LLIST_HEAD(&trx->ts_list);
 
-       /* Stop and reset clock counter */
-       sched_clck_reset(&trx->sched);
+       /* Stop and reset clock counter if required */
+       if (reset_clock)
+               sched_clck_reset(&trx->sched);
 
        return 0;
 }
diff --git a/src/host/trxcon/sched_trx.h b/src/host/trxcon/sched_trx.h
index cab290b..ff3d254 100644
--- a/src/host/trxcon/sched_trx.h
+++ b/src/host/trxcon/sched_trx.h
@@ -248,7 +248,7 @@
 
 /* Scheduler management functions */
 int sched_trx_init(struct trx_instance *trx);
-int sched_trx_reset(struct trx_instance *trx);
+int sched_trx_reset(struct trx_instance *trx, int reset_clock);
 int sched_trx_shutdown(struct trx_instance *trx);
 
 /* Timeslot management functions */
diff --git a/src/host/trxcon/trxcon.c b/src/host/trxcon/trxcon.c
index 82371bd..4a571b9 100644
--- a/src/host/trxcon/trxcon.c
+++ b/src/host/trxcon/trxcon.c
@@ -89,8 +89,8 @@
                osmo_fsm_inst_state_chg(trxcon_fsm, TRXCON_STATE_IDLE, 0, 0);
 
                if (app_data.trx->fsm->state != TRX_STATE_OFFLINE) {
-                       /* Reset scheduler */
-                       sched_trx_reset(app_data.trx);
+                       /* Reset scheduler and clock counter */
+                       sched_trx_reset(app_data.trx, 1);
 
                        /* TODO: implement trx_if_reset() */
                        trx_if_cmd_poweroff(app_data.trx);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4565620fc0c5f64133c2674d2c972fc34245cf32
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <lafo...@gnumonks.org>

Reply via email to