Change in osmo-bsc[master]: osmo_bsc_main.c: verify the physical channel mapping at startup

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

laforge gerrit-no-reply at lists.osmocom.org
Tue Nov 5 02:06:00 UTC 2019


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/15932 )

Change subject: osmo_bsc_main.c: verify the physical channel mapping at startup
......................................................................

osmo_bsc_main.c: verify the physical channel mapping at startup

As per 3GPP TS 45.002, section 3.3.2.3, and table 3 of clause 7,
the following limitations apply mapping of CCCH/BCCH channels:

  - TS0/C0 shall be configured as CCCH/BCCH (optionally combined);
  - combined CCCH (CCCH+SDCCH4) can only be used on TS0;
  - additional CCCHs can be on TS2, TS4, and TS6;
  - additional CCCHs are not allowed if TS0 is combined.

Let's make sure that OsmoBSC is properly configured before starring.

Change-Id: I758ef80f7884ba35cdf59d671ee30222ffb9d68b
---
M include/osmocom/bsc/gsm_data.h
M src/osmo-bsc/gsm_data.c
M src/osmo-bsc/osmo_bsc_main.c
3 files changed, 63 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index ca9d294..23aacd6 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -1749,4 +1749,6 @@
 
 int bts_count_free_ts(struct gsm_bts *bts, enum gsm_phys_chan_config pchan);
 
+bool trx_has_valid_pchan_config(const struct gsm_bts_trx *trx);
+
 #endif /* _GSM_DATA_H */
diff --git a/src/osmo-bsc/gsm_data.c b/src/osmo-bsc/gsm_data.c
index 88981c0..e7fe065 100644
--- a/src/osmo-bsc/gsm_data.c
+++ b/src/osmo-bsc/gsm_data.c
@@ -1693,3 +1693,54 @@
 	OSMO_VALUE_STRING(FOR_VTY),
 	{}
 };
+
+bool trx_has_valid_pchan_config(const struct gsm_bts_trx *trx)
+{
+	bool combined = false;
+	bool result = true;
+	unsigned int i;
+
+	/* Iterate over all timeslots */
+	for (i = 0; i < 8; i++) {
+		const struct gsm_bts_trx_ts *ts = &trx->ts[i];
+
+		switch (ts->pchan_from_config) {
+		case GSM_PCHAN_CCCH_SDCCH4_CBCH:
+		case GSM_PCHAN_CCCH_SDCCH4:
+			/* CCCH+SDCCH4 can only be configured on TS0 */
+			if (i > 0) {
+				LOGP(DNM, LOGL_ERROR, "Combined CCCH is not allowed "
+						      "on TS%u > 0\n", i);
+				result = false;
+			}
+			if (i == 0)
+				combined = true;
+			/* fall-through */
+		case GSM_PCHAN_CCCH:
+			/* 3GPP TS 45.002, Table 3, CCCH: TS (0, 2, 4, 6) */
+			if (i % 2 != 0) {
+				LOGP(DNM, LOGL_ERROR, "%s is not allowed on odd TS%u\n",
+				     gsm_pchan_name(ts->pchan_from_config), i);
+				result = false;
+			}
+
+			/* There can be no more CCCHs if TS0/C0 is combined */
+			if (i > 0 && combined) {
+				LOGP(DNM, LOGL_ERROR, "%s is not allowed on TS%u, "
+				     "because TS0 is using combined channel configuration\n",
+				     gsm_pchan_name(ts->pchan_from_config), i);
+				result = false;
+			}
+			break;
+
+		default:
+			/* CCCH on TS0 is mandatory for C0 */
+			if (trx->bts->c0 == trx && i == 0) {
+				LOGP(DNM, LOGL_ERROR, "TS0 on C0 must be CCCH/BCCH\n");
+				result = false;
+			}
+		}
+	}
+
+	return result;
+}
diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index dacd61a..3acdf30 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -401,6 +401,7 @@
 
 static int bootstrap_bts(struct gsm_bts *bts)
 {
+	struct gsm_bts_trx *trx;
 	int i, n;
 
 	if (!bts->model)
@@ -447,6 +448,15 @@
 		return -EINVAL;
 	}
 
+	/* Verify the physical channel mapping */
+	llist_for_each_entry(trx, &bts->trx_list, list) {
+		if (!trx_has_valid_pchan_config(trx)) {
+			LOGP(DNM, LOGL_ERROR, "TRX %u has invalid timeslot "
+					      "configuration\n", trx->nr);
+			return -EINVAL;
+		}
+	}
+
 	/* Control Channel Description is set from vty/config */
 
 	/* Set ccch config by looking at ts config */

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/15932
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I758ef80f7884ba35cdf59d671ee30222ffb9d68b
Gerrit-Change-Number: 15932
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191105/95cc6ade/attachment.htm>


More information about the gerrit-log mailing list