[PATCH] osmo-bts[master]: l1sap: Fix expired rach slot counting

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

dexter gerrit-no-reply at lists.osmocom.org
Wed Jan 11 15:09:08 UTC 2017


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

l1sap: Fix expired rach slot counting

The counting of the expired rach slots in l1sap.c is not correctly
implemented. This commit fixes the implementation. The expired
rach slots are now conted correctly according to the configured
channel combination. If a CCCH and SDCCH are combined, only the
frames related to rach slots are counted.

Change-Id: I87f40f5f160a4f6750c4f3d06997fc4f24049303
---
M src/common/l1sap.c
1 file changed, 49 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/73/1573/1

diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 968237f..cf7b085 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -354,15 +354,26 @@
 
 /* time information received from bts model */
 static int l1sap_info_time_ind(struct gsm_bts *bts,
-	struct osmo_phsap_prim *l1sap,
-	struct info_time_ind_param *info_time_ind)
+			       struct osmo_phsap_prim *l1sap,
+			       struct info_time_ind_param *info_time_ind)
 {
 	struct gsm_bts_trx *trx;
 	struct gsm_bts_role_bts *btsb = bts->role;
-
-	int frames_expired = info_time_ind->fn - btsb->gsm_time.fn;
+	unsigned int blockno;
+	struct gsm48_system_information_type_3 *si3;
+	uint8_t ccch_conf;
+	uint8_t ccch_mult;
+	int frames_expired;
+	int rach_frames_expired = 0;
 
 	DEBUGP(DL1P, "MPH_INFO time ind %u\n", info_time_ind->fn);
+
+	/* Calculate and check frame difference */
+	frames_expired = info_time_ind->fn - btsb->gsm_time.fn;
+	if (frames_expired > 1) {
+		LOGP(DL1P, LOGL_ERROR,
+		     "Invalid condition detected: Frame difference is > 1!\n");
+	}
 
 	/* Update our data structures with the current GSM time */
 	gsm_fn2gsmtime(&btsb->gsm_time, info_time_ind->fn);
@@ -373,21 +384,45 @@
 	/* check if the measurement period of some lchan has ended
 	 * and pre-compute the respective measurement */
 	llist_for_each_entry(trx, &bts->trx_list, list)
-		trx_meas_check_compute(trx, info_time_ind->fn - 1);
+	    trx_meas_check_compute(trx, info_time_ind->fn - 1);
 
 	/* increment number of RACH slots that have passed by since the
-	 * last time indication */
-	if (trx == bts->c0) {
-		unsigned int num_rach_per_frame;
-		/* 27 / 51 taken from TS 05.01 Figure 3 */
-		if (bts->c0->ts[0].pchan == GSM_PCHAN_CCCH_SDCCH4)
-			num_rach_per_frame = 27;
-		else
-			num_rach_per_frame = 51;
+	 * last time indication, See also 3GPP TS 05.02 Clause 7 Table 5 of 9 */
+	blockno = info_time_ind->fn % 51;
+	si3 = GSM_BTS_SI(bts, SYSINFO_TYPE_3);
+	ccch_conf = si3->control_channel_desc.ccch_conf;
 
-		btsb->load.rach.total += frames_expired * num_rach_per_frame;
+	if (ccch_conf == RSL_BCCH_CCCH_CONF_1_C) {
+		/* It is possible to combine a CCCH with an SDCCH4, in this
+		 * case the CCCH will have to share the available frames with
+		 * the other channel, this results in a limited number of
+		 * available rach slots */
+		if (blockno == 4 || blockno == 5
+		    || (blockno >= 15 && blockno <= 36) || blockno == 45
+		    || blockno == 46)
+			rach_frames_expired = frames_expired;
+	} else {
+		/* It is possible to have multiple CCCH channels on
+		 * different physical channels (large cells), this
+		 * also multiplies the available/expired RACH channels.
+		 * See also TS 04.08, Chapter 10.5.2.11, table 10.29 */
+		if (ccch_conf == RSL_BCCH_CCCH_CONF_2_NC)
+			ccch_mult = 2;
+		if (ccch_conf == RSL_BCCH_CCCH_CONF_3_NC)
+			ccch_mult = 3;
+		if (ccch_conf == RSL_BCCH_CCCH_CONF_4_NC)
+			ccch_mult = 4;
+		else
+			ccch_mult = 1;
+
+		rach_frames_expired = frames_expired * ccch_mult;
 	}
 
+	/* Each Frame has room for 4 RACH requests, since RACH
+	 * requests are short enough to fit into a single radio
+	 * burst, so we need to multiply the final result by 4 */
+	btsb->load.rach.total += rach_frames_expired * 4;
+
 	return 0;
 }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I87f40f5f160a4f6750c4f3d06997fc4f24049303
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>



More information about the gerrit-log mailing list