Change in osmo-bts[master]: scheduler_trx: use gsm0502_fn_remap() to calculate frame number

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
Tue Oct 29 10:16:56 UTC 2019


dexter has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/15757 )

Change subject: scheduler_trx: use gsm0502_fn_remap() to calculate frame number
......................................................................

scheduler_trx: use gsm0502_fn_remap() to calculate frame number

When sched_compose_tch_ind, sched_compose_ph_data_ind or l1if_process_meas_res
is called from rx_tchf_fn or rx_tchh_fn the frame number of the beginning of
the block is required. At the moment this frame number is calculated
wrongly using strange formulas. Lets use gsm0502_fn_remap() to calculate
the beginning of the block properly

Change-Id: I37601ddd85e4287dd9e41ad4a8cb7d314de1a83d
Depends: libosmocore I3d71c66f8c401f5afbad9b1c86c24580dab9e0ce
Related: OS#3803
---
M src/osmo-bts-trx/scheduler_trx.c
1 file changed, 35 insertions(+), 26 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  fixeria: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c
index d63987b..88e4f3a 100644
--- a/src/osmo-bts-trx/scheduler_trx.c
+++ b/src/osmo-bts-trx/scheduler_trx.c
@@ -46,6 +46,7 @@
 #include <osmo-bts/msg_utils.h>
 #include <osmo-bts/scheduler.h>
 #include <osmo-bts/scheduler_backend.h>
+#include <osmocom/gsm/gsm0502.h>
 
 #include "l1_if.h"
 #include "trx_if.h"
@@ -1142,6 +1143,7 @@
 	bool bfi_flag = false;
 	struct gsm_lchan *lchan =
 		get_lchan_by_chan_nr(l1t->trx, trx_chan_desc[chan].chan_nr | bi->tn);
+	unsigned int fn_begin;
 
 	/* handle rach, if handover rach detection is turned on */
 	if (chan_state->ho_rach_detect == 1)
@@ -1225,12 +1227,6 @@
 	}
 	memcpy(*bursts_p, *bursts_p + 464, 464);
 
-	/* Send uplink measurement information to L2 */
-	l1if_process_meas_res(l1t->trx, bi->tn, *first_fn,
-			      trx_chan_desc[chan].chan_nr | bi->tn,
-			      n_errors, n_bits_total,
-			      bi->rssi, bi->toa256);
-
 	/* Check if the frame is bad */
 	if (rc < 0) {
 		LOGL1S(DL1P, LOGL_NOTICE, l1t, bi->tn, chan, bi->fn,
@@ -1253,9 +1249,12 @@
 	/* FACCH */
 	if (rc == GSM_MACBLOCK_LEN) {
 		uint16_t ber10k = compute_ber10k(n_bits_total, n_errors);
-		_sched_compose_ph_data_ind(l1t, bi->tn,
-			/* FIXME: this calculation is wrong */
-			(bi->fn + GSM_HYPERFRAME - 7) % GSM_HYPERFRAME, chan,
+		fn_begin = gsm0502_fn_remap(bi->fn, FN_REMAP_FACCH_F);
+		l1if_process_meas_res(l1t->trx, bi->tn, fn_begin,
+				      trx_chan_desc[chan].chan_nr | bi->tn,
+				      n_errors, n_bits_total,
+				      bi->rssi, bi->toa256);
+		_sched_compose_ph_data_ind(l1t, bi->tn, fn_begin, chan,
 			tch_data + amr, GSM_MACBLOCK_LEN,
 			/* FIXME: AVG RSSI and ToA256 */
 			bi->rssi, bi->toa256,
@@ -1314,10 +1313,13 @@
 
 	/* TCH or BFI */
 compose_l1sap:
-	return _sched_compose_tch_ind(l1t, bi->tn,
-		/* FIXME: this calculation is wrong */
-		(bi->fn + GSM_HYPERFRAME - 7) % GSM_HYPERFRAME, chan,
-		tch_data, rc);
+	fn_begin = gsm0502_fn_remap(bi->fn, FN_REMAP_TCH_F);
+	l1if_process_meas_res(l1t->trx, bi->tn, fn_begin,
+			      trx_chan_desc[chan].chan_nr | bi->tn,
+			      n_errors, n_bits_total,
+			      bi->rssi, bi->toa256);
+	return _sched_compose_tch_ind(l1t, bi->tn, fn_begin, chan,
+				      tch_data, rc);
 }
 
 /*! \brief a single TCH/H burst was received by the PHY, process it */
@@ -1342,6 +1344,7 @@
 	 * Even FN ending at: 10,11,19,20,2,3
 	 */
 	int fn_is_odd = (((bi->fn + 26 - 10) % 26) >> 2) & 1;
+	unsigned int fn_begin;
 
 	/* handle RACH, if handover RACH detection is turned on */
 	if (chan_state->ho_rach_detect == 1)
@@ -1436,12 +1439,6 @@
 	memcpy(*bursts_p, *bursts_p + 232, 232);
 	memcpy(*bursts_p + 232, *bursts_p + 464, 232);
 
-	/* Send uplink measurement information to L2 */
-	l1if_process_meas_res(l1t->trx, bi->tn,
-		*first_fn /* FIXME: this is wrong */,
-		trx_chan_desc[chan].chan_nr | bi->tn,
-		n_errors, n_bits_total, bi->rssi, bi->toa256);
-
 	/* Check if the frame is bad */
 	if (rc < 0) {
 		LOGL1S(DL1P, LOGL_NOTICE, l1t, bi->tn, chan, bi->fn,
@@ -1465,9 +1462,15 @@
 	if (rc == GSM_MACBLOCK_LEN) {
 		chan_state->ul_ongoing_facch = 1;
 		uint16_t ber10k = compute_ber10k(n_bits_total, n_errors);
-		_sched_compose_ph_data_ind(l1t, bi->tn,
-			/* FIXME: what the hell is this?!? */
-			(bi->fn + GSM_HYPERFRAME - 10 - ((bi->fn % 26) >= 19)) % GSM_HYPERFRAME, chan,
+		if (lchan->nr == 0)
+			fn_begin = gsm0502_fn_remap(bi->fn, FN_REMAP_FACCH_H0);
+		else
+			fn_begin = gsm0502_fn_remap(bi->fn, FN_REMAP_FACCH_H1);
+		l1if_process_meas_res(l1t->trx, bi->tn, fn_begin,
+				      trx_chan_desc[chan].chan_nr | bi->tn,
+				      n_errors, n_bits_total, bi->rssi,
+				      bi->toa256);
+		_sched_compose_ph_data_ind(l1t, bi->tn, fn_begin, chan,
 			tch_data + amr, GSM_MACBLOCK_LEN,
 			/* FIXME: AVG both RSSI and ToA */
 			bi->rssi, bi->toa256,
@@ -1528,10 +1531,16 @@
 	 * with the slot 12, so an extra FN must be subtracted to get correct
 	 * start of frame.
 	 */
-	return _sched_compose_tch_ind(l1t, bi->tn,
-		/* FIXME: what the hell is this?!? */
-		(bi->fn + GSM_HYPERFRAME - 10 - ((bi->fn%26)==19) - ((bi->fn%26)==20)) % GSM_HYPERFRAME,
-		chan, tch_data, rc);
+	if (lchan->nr == 0)
+		fn_begin = gsm0502_fn_remap(bi->fn, FN_REMAP_TCH_H0);
+	else
+		fn_begin = gsm0502_fn_remap(bi->fn, FN_REMAP_TCH_H1);
+	l1if_process_meas_res(l1t->trx, bi->tn, fn_begin,
+			      trx_chan_desc[chan].chan_nr | bi->tn,
+			      n_errors, n_bits_total, bi->rssi,
+			      bi->toa256);
+	return _sched_compose_tch_ind(l1t, bi->tn, fn_begin, chan,
+				      tch_data, rc);
 }
 
 /* schedule all frames of all TRX for given FN */

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I37601ddd85e4287dd9e41ad4a8cb7d314de1a83d
Gerrit-Change-Number: 15757
Gerrit-PatchSet: 4
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
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/20191029/da71935d/attachment.htm>


More information about the gerrit-log mailing list