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

host/trxcon/l1ctl.c: do nothing if CCCH mode matches

When the L1CTL_CCCH_MODE_REQ is received, we don't need to
reconfigure anything if the current mode matches requested.

Change-Id: Ib8a511e4edd7210b1806f47e83f316be00a8cbb1
---
M src/host/trxcon/l1ctl.c
1 file changed, 14 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/68/6768/1

diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c
index ee03ad6..ec774d7 100644
--- a/src/host/trxcon/l1ctl.c
+++ b/src/host/trxcon/l1ctl.c
@@ -413,6 +413,7 @@
 static int l1ctl_rx_ccch_mode_req(struct l1ctl_link *l1l, struct msgb *msg)
 {
        struct l1ctl_ccch_mode_req *req;
+       struct trx_ts *ts;
        int mode, rc = 0;
 
        req = (struct l1ctl_ccch_mode_req *) msg->l1h;
@@ -427,10 +428,21 @@
                req->ccch_mode == CCCH_MODE_COMBINED ?
                        "combined" : "not combined");
 
-       /* Reconfigure TS0 */
+       /* Make sure that TS0 is allocated and configured */
+       ts = l1l->trx->ts_list[0];
+       if (ts == NULL || ts->mf_layout == NULL) {
+               LOGP(DL1C, LOGL_ERROR, "TS0 is not configured");
+               rc = -EINVAL;
+               goto exit;
+       }
+
+       /* Choose corresponding channel combination */
        mode = req->ccch_mode == CCCH_MODE_COMBINED ?
                GSM_PCHAN_CCCH_SDCCH4 : GSM_PCHAN_CCCH;
-       rc = sched_trx_configure_ts(l1l->trx, 0, mode);
+
+       /* Do nothing if the current mode matches required */
+       if (ts->mf_layout->chan_config != mode)
+               rc = sched_trx_configure_ts(l1l->trx, 0, mode);
 
        /* Confirm reconfiguration */
        if (!rc)

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

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

Reply via email to