Change in osmo-bts[master]: bts-trx: Try decoding received UL bursts when SACCH frame detected as...

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

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Tue Oct 23 17:51:26 UTC 2018


Pau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/11446


Change subject: bts-trx: Try decoding received UL bursts when SACCH frame detected as lost
......................................................................

bts-trx: Try decoding received UL bursts when SACCH frame detected as lost

This way if for instance only 1 out of 3 bursts was lost, reported ul
mesuarement is more similar to expected values.

Related: OS#3665
Change-Id: I910277df181df5082b234c1c97a75eebdffc2cb5
---
M src/osmo-bts-trx/scheduler_trx.c
1 file changed, 61 insertions(+), 41 deletions(-)



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

diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c
index fa3aed2..332a41d 100644
--- a/src/osmo-bts-trx/scheduler_trx.c
+++ b/src/osmo-bts-trx/scheduler_trx.c
@@ -65,6 +65,61 @@
 		return 10000 * n_errors / n_bits_total;
 }
 
+static void reset_ul_bursts(struct l1sched_chan_state *chan_state, uint32_t first_fn)
+{
+	if (chan_state->ul_bursts)
+		memset(chan_state->ul_bursts, 0, 464);
+	chan_state->ul_mask = 0x0;
+	chan_state->ul_first_fn = first_fn;
+	chan_state->rssi_sum = 0;
+	chan_state->rssi_num = 0;
+	chan_state->toa256_sum = 0;
+	chan_state->toa_num = 0;
+}
+
+static int _submit_ph_data_ind_with_ul_meas_res(struct l1sched_trx *l1t, uint8_t tn,
+				uint32_t fn, enum trx_chan_type chan,
+				struct l1sched_chan_state *chan_state)
+{
+	uint8_t l2[GSM_MACBLOCK_LEN], l2_len;
+	int n_errors, n_bits_total;
+	uint16_t ber10k;
+	float rssi;
+	int16_t toa256;
+	int rc;
+	struct l1sched_ts *l1ts = l1sched_trx_get_ts(l1t, tn);
+
+	/* empty mask -> empty buffer, no need to decode buffer (buffer may not even be allocated) */
+	if (chan_state->ul_mask == 0x0) {
+		l1if_process_meas_res(l1t->trx, tn, fn, trx_chan_desc[chan].chan_nr | tn,
+				      456, 456, -110, 0);
+		ber10k = compute_ber10k(0, 456);
+		return _sched_compose_ph_data_ind(l1t, tn, 0, chan, NULL, 0,
+			   -110, 0, 0, ber10k,
+			   PRES_INFO_INVALID);
+	}
+
+	/* Once processed, erase mask so they are not used again, also invalidating ul_first_fn */
+	chan_state->ul_mask = 0x0;
+	rssi = chan_state->rssi_sum / chan_state->rssi_num;
+	toa256 = chan_state->toa256_sum / chan_state->toa_num;
+	/* decode */
+	rc = gsm0503_xcch_decode(l2, chan_state->ul_bursts, &n_errors, &n_bits_total);
+	if (rc) {
+		LOGL1S(DL1P, LOGL_NOTICE, l1t, tn, chan, fn, "Received bad data (%u/%u)\n",
+			chan_state->ul_first_fn, chan_state->ul_first_fn % l1ts->mf_period);
+		l2_len = 0;
+	} else
+		l2_len = GSM_MACBLOCK_LEN;
+
+	/* Send uplink measurement information to L2 */
+	l1if_process_meas_res(l1t->trx, tn, chan_state->ul_first_fn, trx_chan_desc[chan].chan_nr | tn,
+		n_errors, n_bits_total, rssi, toa256);
+	ber10k = compute_ber10k(n_bits_total, n_errors);
+	return _sched_compose_ph_data_ind(l1t, tn, chan_state->ul_first_fn, chan, l2, l2_len,
+					  rssi,  4 * toa256, 0, ber10k, PRES_INFO_UNKNOWN);
+}
+
 /*
  * TX on downlink
  */
@@ -194,16 +249,9 @@
 	if (L1SAP_IS_LINK_SACCH(trx_chan_desc[chan].link_id)) {
 		/* count and send BFI */
 		if (++(l1ts->chan_state[chan].lost_frames) > 1) {
-			/* TODO: Should we pass old TOA here? Otherwise we risk
-			 * unnecessary decreasing TA */
-
-			/* Send uplink measurement information to L2 */
-			l1if_process_meas_res(l1t->trx, tn, fn, trx_chan_desc[chan].chan_nr | tn,
-				456, 456, -110, 0);
-			/* FIXME: use actual values for BER etc */
-			_sched_compose_ph_data_ind(l1t, tn, 0, chan, NULL, 0,
-						   -110, 0, 0, 10000,
-						   PRES_INFO_INVALID);
+			_submit_ph_data_ind_with_ul_meas_res(l1t, tn, fn, chan, &l1ts->chan_state[chan]);
+			/* Don't keep re-sending same meas result cached over and over */
+			reset_ul_bursts(&l1ts->chan_state[chan], fn);
 		}
 	}
 
@@ -767,10 +815,6 @@
 	uint8_t *rssi_num = &chan_state->rssi_num;
 	int32_t *toa256_sum = &chan_state->toa256_sum;
 	uint8_t *toa_num = &chan_state->toa_num;
-	uint8_t l2[GSM_MACBLOCK_LEN], l2_len;
-	int n_errors, n_bits_total;
-	uint16_t ber10k;
-	int rc;
 
 	/* handle RACH, if handover RACH detection is turned on */
 	if (chan_state->ho_rach_detect == 1)
@@ -786,15 +830,8 @@
 	}
 
 	/* clear burst & store frame number of first burst */
-	if (bid == 0) {
-		memset(*bursts_p, 0, 464);
-		*mask = 0x0;
-		*first_fn = fn;
-		*rssi_sum = 0;
-		*rssi_num = 0;
-		*toa256_sum = 0;
-		*toa_num = 0;
-	}
+	if (bid == 0)
+		reset_ul_bursts(chan_state, fn);
 
 	/* update mask + RSSI */
 	*mask |= (1 << bid);
@@ -829,25 +866,8 @@
 			return 0;
 		}
 	}
-	*mask = 0x0;
 
-	/* decode */
-	rc = gsm0503_xcch_decode(l2, *bursts_p, &n_errors, &n_bits_total);
-	if (rc) {
-		LOGL1S(DL1P, LOGL_NOTICE, l1t, tn, chan, fn, "Received bad data (%u/%u)\n",
-			*first_fn, (*first_fn) % l1ts->mf_period);
-		l2_len = 0;
-	} else
-		l2_len = GSM_MACBLOCK_LEN;
-
-	/* Send uplink measurement information to L2 */
-	l1if_process_meas_res(l1t->trx, tn, *first_fn, trx_chan_desc[chan].chan_nr | tn,
-		n_errors, n_bits_total, *rssi_sum / *rssi_num, *toa256_sum / *toa_num);
-	ber10k = compute_ber10k(n_bits_total, n_errors);
-	return _sched_compose_ph_data_ind(l1t, tn, *first_fn, chan, l2, l2_len,
-					  *rssi_sum / *rssi_num,
-					  4 * (*toa256_sum) / *toa_num, 0, ber10k,
-					  PRES_INFO_UNKNOWN);
+	return _submit_ph_data_ind_with_ul_meas_res(l1t, tn, fn, chan, chan_state);
 }
 
 /*! \brief a single PDTCH burst was received by the PHY, process it */

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I910277df181df5082b234c1c97a75eebdffc2cb5
Gerrit-Change-Number: 11446
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181023/0cde8a02/attachment.htm>


More information about the gerrit-log mailing list