[MERGED] osmo-bts[master]: Move rach_busy counting above L1SAP

Harald Welte gerrit-no-reply at lists.osmocom.org
Tue Feb 27 18:48:29 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: Move rach_busy counting above L1SAP
......................................................................


Move rach_busy counting above L1SAP

In the past, rach_busy counting was performed below L1SAP, while
reporting was handled above.  This lead to subtle differences between
the BTS models, such as osmo-bts-trx missing to increment rach_busy.

Let's move the rach_busy counting above L1SAP to share more code.

This means we need libosmocore Change-Id
I9439810c3a3ad89ea0302753617b850749af887c for the additional required
parameters in ph_rach_ind_param, as well as libosmocore Change-id
I2b1926a37bde860dcfeb0d613eb55a71271928c5 for osmo-bts-trx to determine
the RACH bit error rate.

Change-Id: I3b989580cb38082e3fd8fc50a11fedda13991092
Closes: OS#3003
---
M src/common/l1sap.c
M src/osmo-bts-litecell15/l1_if.c
M src/osmo-bts-octphy/l1_if.c
M src/osmo-bts-sysmo/l1_if.c
M src/osmo-bts-trx/scheduler_trx.c
5 files changed, 44 insertions(+), 48 deletions(-)

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



diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 2623d84..90f045a 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -1190,7 +1190,23 @@
 	uint8_t acc_delay;
 
 	DEBUGPFN(DL1P, rach_ind->fn, "Rx PH-RA.ind");
+
+	/* check for handover access burst on dedicated channels */
+	if (!L1SAP_IS_CHAN_RACH(rach_ind->chan_nr)) {
+		rate_ctr_inc2(trx->bts->ctrs, BTS_CTR_RACH_HO);
+		return l1sap_handover_rach(trx, l1sap, rach_ind);
+	}
+
 	rate_ctr_inc2(trx->bts->ctrs, BTS_CTR_RACH_RCVD);
+
+	/* increment number of busy RACH slots, if required */
+	if (rach_ind->rssi >= btsb->load.rach.busy_thresh)
+		btsb->load.rach.busy++;
+
+	/* FIXME: RACH filtering due to BER limit */
+
+	/* increment number of RACH slots with valid non-handover RACH burst */
+	btsb->load.rach.access++;
 
 	lc = &trx->ts[0].lchan[CCCH_LCHAN].lapdm_ch;
 
@@ -1204,12 +1220,6 @@
 
 	/* According to 3GPP TS 48.058 § 9.3.17 Access Delay is expressed same way as TA (number of symbols) */
 	set_ms_to_data(get_lchan_by_chan_nr(trx, rach_ind->chan_nr), acc_delay, false);
-
-	/* check for handover rach */
-	if (!L1SAP_IS_CHAN_RACH(rach_ind->chan_nr)) {
-		rate_ctr_inc2(trx->bts->ctrs, BTS_CTR_RACH_HO);
-		return l1sap_handover_rach(trx, l1sap, rach_ind);
-	}
 
 	/* check for packet access */
 	if ((trx == bts->c0 && L1SAP_IS_PACKET_RACH(rach_ind->ra)) ||
diff --git a/src/osmo-bts-litecell15/l1_if.c b/src/osmo-bts-litecell15/l1_if.c
index 9c3b867..1b83fbd 100644
--- a/src/osmo-bts-litecell15/l1_if.c
+++ b/src/osmo-bts-litecell15/l1_if.c
@@ -1002,23 +1002,15 @@
 	uint16_t ra = 0, is_11bit = 0, burst_type = 0, temp = 0;
 	int rc;
 
-	/* increment number of busy RACH slots, if required */
-	if (trx == bts->c0 &&
-	    ra_ind->measParam.fRssi >= btsb->load.rach.busy_thresh)
-		btsb->load.rach.busy++;
-
+	/* FIXME: this should be deprecated/obsoleted as it bypasses rach.busy counting */
 	if (ra_ind->measParam.fLinkQuality < btsb->min_qual_rach) {
 		msgb_free(l1p_msg);
 		return 0;
 	}
 
+	/* the old legacy full-bits acc_delay cannot express negative values */
 	if (ra_ind->measParam.i16BurstTiming > 0)
 		acc_delay = ra_ind->measParam.i16BurstTiming >> 2;
-
-	/* increment number of RACH slots with valid non-handover RACH burst */
-	lchan = l1if_hLayer_to_lchan(trx, (uint32_t)ra_ind->hLayer2);
-	if (trx == bts->c0 && !(lchan && lchan->ho.active == HANDOVER_ENABLED))
-		btsb->load.rach.access++;
 
 	dump_meas_res(LOGL_DEBUG, &ra_ind->measParam);
 	burst_type = ra_ind->burstType;
@@ -1052,6 +1044,9 @@
 	l1sap->u.rach_ind.acc_delay = acc_delay;
 	l1sap->u.rach_ind.fn = fn;
 	l1sap->u.rach_ind.is_11bit = is_11bit; /* no of bits in 11 bit RACH */
+	l1sap->u.rach_ind.rssi = (int8_t) ra_ind->measParam.fRssi;
+	l1sap->u.rach_ind.ber10k = (unsigned int) (ra_ind->measParam.fBer * 10000.0);
+	l1sap->u.rach_ind.acc_delay_256bits = ra_ind->measParam.i16BurstTiming * 64;
 
 	/* mapping of the burst type, the values are specific to
 	 * osmo-bts-litecell15 */
@@ -1074,6 +1069,7 @@
 		break;
 	}
 
+	lchan = l1if_hLayer_to_lchan(trx, (uint32_t)ra_ind->hLayer2);
 	if (!lchan || lchan->ts->pchan == GSM_PCHAN_CCCH ||
 	    lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4 ||
 	    lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4_CBCH)
diff --git a/src/osmo-bts-octphy/l1_if.c b/src/osmo-bts-octphy/l1_if.c
index ddaa9b3..535ac8b 100644
--- a/src/osmo-bts-octphy/l1_if.c
+++ b/src/osmo-bts-octphy/l1_if.c
@@ -1167,30 +1167,17 @@
 	struct gsm_bts_trx *trx = trx_by_l1h(fl1, ra_ind->TrxId.byTrxId);
 	struct gsm_bts *bts = trx->bts;
 	struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
-	struct gsm_lchan *lchan;
 	struct osmo_phsap_prim *l1sap;
-	uint32_t fn;
 	uint8_t ra, acc_delay;
 	int rc;
 
-	/* increment number of busy RACH slots, if required */
-	if (trx == bts->c0 &&
-	    ra_ind->MeasurementInfo.sRSSIDbm >= btsb->load.rach.busy_thresh) {
-		btsb->load.rach.busy++;
-	}
-	/* FIXME: Check min_qual_rach */
-
-	lchan = get_lchan_by_lchid(trx, &ra_ind->LchId);
-	if (trx == bts->c0 && !(lchan && lchan->ho.active == HANDOVER_ENABLED))
-		btsb->load.rach.access++;
-
 	dump_meas_res(LOGL_DEBUG, &ra_ind->MeasurementInfo);
 
-	fn = ra_ind->ulFrameNumber;
 	ra = ra_ind->abyMsg[0];
 
 	if (ra_ind->ulMsgLength != 1) {
-		LOGPFN(DL1C, LOGL_ERROR, fn, "Rx PH-RACH.ind has lenghth %d > 1\n", ra_ind->ulMsgLength);
+		LOGPFN(DL1C, LOGL_ERROR, ra_ind->ulFrameNumber,
+			"Rx PH-RACH.ind has lenghth %d > 1\n", ra_ind->ulMsgLength);
 		msgb_free(l1p_msg);
 		return 0;
 	}
@@ -1209,16 +1196,19 @@
 			l1p_msg);
 	l1sap->u.rach_ind.ra = ra;
 	l1sap->u.rach_ind.acc_delay = acc_delay;
-	l1sap->u.rach_ind.fn = fn;
+	l1sap->u.rach_ind.fn = ra_ind->ulFrameNumber;
 	l1sap->u.rach_ind.is_11bit = 0;
+	l1sap->u.rach_ind.rssi = oct_meas2rssi_dBm(&ra_ind->MeasurementInfo);
+	l1sap->u.rach_ind.ber10k = oct_meas2ber10k(&ra_ind->MeasurementInfo);
+	l1sap->u.rach_ind.acc_delay_256bits = ra_ind->MeasurementInfo.sBurstTiming4x * 64;
 
-	if (!lchan || lchan->ts->pchan == GSM_PCHAN_CCCH ||
-	    lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4 ||
-	    lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4_CBCH)
+	if (ra_ind->LchId.bySubChannelNb == cOCTVC1_GSM_ID_SUB_CHANNEL_NB_ENUM_ALL &&
+	    ra_ind->LchId.bySAPI == cOCTVC1_GSM_SAPI_ENUM_RACH) {
 		l1sap->u.rach_ind.chan_nr = 0x88;
-	else
+	} else {
+		struct gsm_lchan *lchan = get_lchan_by_lchid(trx, &ra_ind->LchId);
 		l1sap->u.rach_ind.chan_nr = gsm_lchan2chan_nr(lchan);
-
+	}
 	l1sap_up(trx, l1sap);
 
 	/* return '1' to indicate l1sap_up has taken msgb ownership */
diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c
index 396d1c2..08f584b 100644
--- a/src/osmo-bts-sysmo/l1_if.c
+++ b/src/osmo-bts-sysmo/l1_if.c
@@ -992,23 +992,15 @@
 	uint16_t ra = 0, is_11bit = 0, burst_type = 0, temp = 0;
 	int rc;
 
-	/* increment number of busy RACH slots, if required */
-	if (trx == bts->c0 &&
-	    ra_ind->measParam.fRssi >= btsb->load.rach.busy_thresh)
-		btsb->load.rach.busy++;
-
+	/* FIXME: this should be deprecated/obsoleted as it bypasses rach.busy counting */
 	if (ra_ind->measParam.fLinkQuality < btsb->min_qual_rach) {
 		msgb_free(l1p_msg);
 		return 0;
 	}
 
+	/* the old legacy full-bits acc_delay cannot express negative values */
 	if (ra_ind->measParam.i16BurstTiming > 0)
 		acc_delay = ra_ind->measParam.i16BurstTiming >> 2;
-
-	/* increment number of RACH slots with valid non-handover RACH burst */
-	lchan = l1if_hLayer_to_lchan(trx, ra_ind->hLayer2);
-	if (trx == bts->c0 && !(lchan && lchan->ho.active == HANDOVER_ENABLED))
-		btsb->load.rach.access++;
 
 	dump_meas_res(LOGL_DEBUG, &ra_ind->measParam);
 	burst_type = ra_ind->burstType;
@@ -1043,6 +1035,9 @@
 	l1sap->u.rach_ind.acc_delay = acc_delay;
 	l1sap->u.rach_ind.fn = fn;
 	l1sap->u.rach_ind.is_11bit = is_11bit;	/* no of bits in 11 bit RACH */
+	l1sap->u.rach_ind.rssi = (int8_t) ra_ind->measParam.fRssi;
+	l1sap->u.rach_ind.ber10k = (unsigned int) (ra_ind->measParam.fBer * 10000.0);
+	l1sap->u.rach_ind.acc_delay_256bits = ra_ind->measParam.i16BurstTiming * 64;
 
 	/*mapping of the burst type, the values are specific to osmo-bts-sysmo*/
 
@@ -1065,6 +1060,7 @@
 		break;
 	}
 
+	lchan = l1if_hLayer_to_lchan(trx, ra_ind->hLayer2);
 	if (!lchan || lchan->ts->pchan == GSM_PCHAN_CCCH ||
 	    lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4 ||
 	    lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4_CBCH)
diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c
index f53e482..43cc30b 100644
--- a/src/osmo-bts-trx/scheduler_trx.c
+++ b/src/osmo-bts-trx/scheduler_trx.c
@@ -718,6 +718,7 @@
 {
 	uint8_t chan_nr;
 	struct osmo_phsap_prim l1sap;
+	int n_errors, n_bits_total;
 	uint8_t ra;
 	int rc;
 
@@ -726,7 +727,7 @@
 	LOGL1S(DL1P, LOGL_DEBUG, l1t, tn, chan, fn, "Received RACH toa=%.2f\n", toa);
 
 	/* decode */
-	rc = gsm0503_rach_decode(&ra, bits + 8 + 41, l1t->trx->bts->bsic);
+	rc = gsm0503_rach_decode_ber(&ra, bits + 8 + 41, l1t->trx->bts->bsic, &n_errors, &n_bits_total);
 	if (rc) {
 		LOGL1S(DL1P, LOGL_DEBUG, l1t, tn, chan, fn, "Received bad AB frame\n");
 		return 0;
@@ -749,6 +750,9 @@
 	/* 11bit RACH is not supported for osmo-trx */
 	l1sap.u.rach_ind.is_11bit = 0;
 	l1sap.u.rach_ind.burst_type = GSM_L1_BURST_TYPE_ACCESS_0;
+	l1sap.u.rach_ind.rssi = rssi;
+	l1sap.u.rach_ind.ber10k = compute_ber10k(n_bits_total, n_errors);
+	l1sap.u.rach_ind.acc_delay_256bits = 256*toa;
 
 	/* forward primitive */
 	l1sap_up(l1t->trx, &l1sap);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3b989580cb38082e3fd8fc50a11fedda13991092
Gerrit-PatchSet: 4
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder


More information about the gerrit-log mailing list