aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2019-02-01 17:48:17 +0100
committerPhilipp Maier <pmaier@sysmocom.de>2019-02-01 18:00:36 +0100
commit3b4e2275a8d5bd57094082bd575328ee1a6af90b (patch)
tree9b0c83c1a6f04b4009b2b8aef125d9a355735727
parent5c205639f19059196e0259a5261f0442aec798fe (diff)
scheduler_trx: use stored block fn instead of calculating it.pmaier/first_fn
When the block is passed up into the higher layers it it marked with the frame number that points to the beginning of the block. At the moment some strange calculations are used to calculate the beginning of the block fn from the current fn that points at the end of the block: PDTCH: fn != (fn + GSM_HYPERFRAME - 3) % GSM_HYPERFRAME FACCH/F: fn != (fn + GSM_HYPERFRAME - 7) % GSM_HYPERFRAME TCH/F: fn != (fn + GSM_HYPERFRAME - 7) % GSM_HYPERFRAME Despite the fact that those equations do not look very trustworthy, it is also not necessary to calculate the fn since the code stores the fn of each beginning of a new block in chan_state->ul_first_fn (*first_fn), so we can just use the stored fn when passing the block up. This also makes the code more logical since the measurement indications already use the stored frame number as well. Change-Id: Ia27254bbf6e36426f7890ece6154dcd395673f63 Related: OS#2977
-rw-r--r--src/osmo-bts-trx/scheduler_trx.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c
index fa3aed22..30ef6746 100644
--- a/src/osmo-bts-trx/scheduler_trx.c
+++ b/src/osmo-bts-trx/scheduler_trx.c
@@ -946,9 +946,9 @@ int rx_pdtch_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
return 0;
}
ber10k = compute_ber10k(n_bits_total, n_errors);
- return _sched_compose_ph_data_ind(l1t, tn, (fn + GSM_HYPERFRAME - 3) % GSM_HYPERFRAME, chan,
- l2, rc, *rssi_sum / *rssi_num, 4 * (*toa256_sum) / *toa_num, 0,
- ber10k, PRES_INFO_BOTH);
+ return _sched_compose_ph_data_ind(l1t, tn, *first_fn, chan, l2, rc,
+ *rssi_sum / *rssi_num, 4 * (*toa256_sum) / *toa_num, 0, ber10k,
+ PRES_INFO_BOTH);
}
/*! \brief a single TCH/F burst was received by the PHY, process it */
@@ -1070,9 +1070,8 @@ int rx_tchf_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
/* FACCH */
if (rc == GSM_MACBLOCK_LEN) {
uint16_t ber10k = compute_ber10k(n_bits_total, n_errors);
- _sched_compose_ph_data_ind(l1t, tn, (fn + GSM_HYPERFRAME - 7) % GSM_HYPERFRAME, chan,
- tch_data + amr, GSM_MACBLOCK_LEN, rssi, 4 * toa256, 0,
- ber10k, PRES_INFO_UNKNOWN);
+ _sched_compose_ph_data_ind(l1t, tn, *first_fn, chan, tch_data + amr,
+ GSM_MACBLOCK_LEN, rssi, 4 * toa256, 0, ber10k, PRES_INFO_UNKNOWN);
bfi:
if (rsl_cmode == RSL_CMOD_SPD_SPEECH) {
/* indicate bad frame */
@@ -1124,7 +1123,7 @@ bfi:
/* TCH or BFI */
compose_l1sap:
- return _sched_compose_tch_ind(l1t, tn, (fn + GSM_HYPERFRAME - 7) % GSM_HYPERFRAME, chan,
+ return _sched_compose_tch_ind(l1t, tn, *first_fn, chan,
tch_data, rc);
}
@@ -1261,10 +1260,8 @@ int rx_tchh_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
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, tn,
- (fn + GSM_HYPERFRAME - 10 - ((fn % 26) >= 19)) % GSM_HYPERFRAME, chan,
- tch_data + amr, GSM_MACBLOCK_LEN, rssi, toa256/64, 0,
- ber10k, PRES_INFO_UNKNOWN);
+ _sched_compose_ph_data_ind(l1t, tn, *first_fn, chan, tch_data + amr,
+ GSM_MACBLOCK_LEN, rssi, toa256/64, 0, ber10k, PRES_INFO_UNKNOWN);
bfi:
if (rsl_cmode == RSL_CMOD_SPD_SPEECH) {
/* indicate bad frame */
@@ -1306,9 +1303,8 @@ compose_l1sap:
* with the slot 12, so an extra FN must be subtracted to get correct
* start of frame.
*/
- return _sched_compose_tch_ind(l1t, tn,
- (fn + GSM_HYPERFRAME - 10 - ((fn%26)==19) - ((fn%26)==20)) % GSM_HYPERFRAME,
- chan, tch_data, rc);
+ printf("TCHH\n");
+ return _sched_compose_tch_ind(l1t, tn, *first_fn, chan, tch_data, rc);
}
/* schedule all frames of all TRX for given FN */