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
Thu Oct 10 13:57:07 UTC 2019


dexter has uploaded this change for review. ( 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, 28 insertions(+), 19 deletions(-)



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

diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c
index 8b0c761..90ed1aa 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"
@@ -1141,6 +1142,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,7 +1227,8 @@
 	memcpy(*bursts_p, *bursts_p + 464, 464);
 
 	/* Send uplink measurement information to L2 */
-	l1if_process_meas_res(l1t->trx, bi->tn, *first_fn,
+	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);
@@ -1251,10 +1254,9 @@
 
 	/* FACCH */
 	if (rc == GSM_MACBLOCK_LEN) {
+		fn_begin = gsm0502_fn_remap(bi->fn, FN_REMAP_FACCH_F);
 		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,
+		_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,
@@ -1313,10 +1315,9 @@
 
 	/* 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_FACCH_F);
+	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 */
@@ -1341,6 +1342,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,10 +1438,13 @@
 	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);
+	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);
 
 	/* Check if the frame is bad */
 	if (rc < 0) {
@@ -1464,9 +1469,11 @@
 	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);
+		_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,
@@ -1527,10 +1534,12 @@
 	 * 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);
+	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: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191010/60fe1f58/attachment.htm>


More information about the gerrit-log mailing list