Change in osmocom-bb[master]: trxcon/l1ctl.c: properly handle indicated CCCH mode

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
Wed Oct 3 08:37:12 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/11179 )

Change subject: trxcon/l1ctl.c: properly handle indicated CCCH mode
......................................................................

trxcon/l1ctl.c: properly handle indicated CCCH mode

The 'ccch_mode' enum from 'l1ctl_proto.h' to be extended in the
near future in order to reflect persistence of CBCH. Thus it
should be handled in a switch statement.

Change-Id: I75e3b8deac1da296efb178e65ff6992b5c407b80
---
M src/host/trxcon/l1ctl.c
1 file changed, 29 insertions(+), 12 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c
index a8a1289..f7f48af 100644
--- a/src/host/trxcon/l1ctl.c
+++ b/src/host/trxcon/l1ctl.c
@@ -256,6 +256,25 @@
 	return l1ctl_link_send(l1l, msg);
 }
 
+static enum gsm_phys_chan_config l1ctl_ccch_mode2pchan_config(enum ccch_mode mode)
+{
+	switch (mode) {
+	/* TODO: distinguish extended BCCH */
+	case CCCH_MODE_NON_COMBINED:
+	case CCCH_MODE_NONE:
+		return GSM_PCHAN_CCCH;
+
+	/* TODO: distinguish CBCH */
+	case CCCH_MODE_COMBINED:
+		return GSM_PCHAN_CCCH_SDCCH4;
+
+	default:
+		LOGP(DL1C, LOGL_NOTICE, "Undandled CCCH mode (%u), "
+			"assuming non-combined configuration\n", mode);
+		return GSM_PCHAN_CCCH;
+	}
+}
+
 /* FBSB expire timer */
 static void fbsb_timer_cb(void *data)
 {
@@ -292,6 +311,7 @@
 
 static int l1ctl_rx_fbsb_req(struct l1ctl_link *l1l, struct msgb *msg)
 {
+	enum gsm_phys_chan_config ch_config;
 	struct l1ctl_fbsb_req *fbsb;
 	uint16_t band_arfcn;
 	uint16_t timeout;
@@ -305,6 +325,7 @@
 		goto exit;
 	}
 
+	ch_config = l1ctl_ccch_mode2pchan_config(fbsb->ccch_mode);
 	band_arfcn = ntohs(fbsb->band_arfcn);
 	timeout = ntohs(fbsb->timeout);
 
@@ -316,10 +337,7 @@
 	sched_trx_reset(l1l->trx, 1);
 
 	/* Configure a single timeslot */
-	if (fbsb->ccch_mode == CCCH_MODE_COMBINED)
-		sched_trx_configure_ts(l1l->trx, 0, GSM_PCHAN_CCCH_SDCCH4);
-	else
-		sched_trx_configure_ts(l1l->trx, 0, GSM_PCHAN_CCCH);
+	sched_trx_configure_ts(l1l->trx, 0, ch_config);
 
 	/* Ask SCH handler to send L1CTL_FBSB_CONF */
 	l1l->fbsb_conf_sent = 0;
@@ -434,9 +452,10 @@
 
 static int l1ctl_rx_ccch_mode_req(struct l1ctl_link *l1l, struct msgb *msg)
 {
+	enum gsm_phys_chan_config ch_config;
 	struct l1ctl_ccch_mode_req *req;
 	struct trx_ts *ts;
-	int mode, rc = 0;
+	int rc = 0;
 
 	req = (struct l1ctl_ccch_mode_req *) msg->l1h;
 	if (msgb_l1len(msg) < sizeof(*req)) {
@@ -446,9 +465,8 @@
 		goto exit;
 	}
 
-	LOGP(DL1C, LOGL_NOTICE, "Received CCCH mode request (%s)\n",
-		req->ccch_mode == CCCH_MODE_COMBINED ?
-			"combined" : "not combined");
+	LOGP(DL1C, LOGL_NOTICE, "Received CCCH mode request (%u)\n",
+		req->ccch_mode); /* TODO: add value-string for ccch_mode */
 
 	/* Make sure that TS0 is allocated and configured */
 	ts = l1l->trx->ts_list[0];
@@ -459,12 +477,11 @@
 	}
 
 	/* Choose corresponding channel combination */
-	mode = req->ccch_mode == CCCH_MODE_COMBINED ?
-		GSM_PCHAN_CCCH_SDCCH4 : GSM_PCHAN_CCCH;
+	ch_config = l1ctl_ccch_mode2pchan_config(req->ccch_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);
+	if (ts->mf_layout->chan_config != ch_config)
+		rc = sched_trx_configure_ts(l1l->trx, 0, ch_config);
 
 	/* Confirm reconfiguration */
 	if (!rc)

-- 
To view, visit https://gerrit.osmocom.org/11179
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I75e3b8deac1da296efb178e65ff6992b5c407b80
Gerrit-Change-Number: 11179
Gerrit-PatchSet: 2
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181003/07544911/attachment.htm>


More information about the gerrit-log mailing list