aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2019-06-27 04:12:50 +0700
committerlaforge <laforge@gnumonks.org>2019-07-16 04:16:13 +0000
commit54e104496a30c7a9a4a562e40cf59a025d111f1c (patch)
tree9e6f7094a703a3111b0653b6928f94730a4922e0
parent01cc8c0d211158d46ecfe2755f3b9aa7c6995e7b (diff)
osmo-bts/scheduler: provide actual C/I values to OsmoPCU
C/I (Carrier-to-Interference ratio) is a value in cB (centiBels), computed from the training sequence of each received burst, by comparing the "ideal" training sequence with the actual one. So far, there was no way to expose more measurements from OsmoTRX, excluding both RSSI and ToA. Since the new version of TRXD header, we can receive C/I indications and send the averaged (per 4 bursts) values to OsmoPCU (as a part of PCUIF_DATA.ind). Please note that we also need to attach C/I measurements to the following L1SAP primitives: - PRIM_PH_RACH.ind, - PRIM_PH_DATA.ind, - PRIM_TCH.ind, but this will be done in the follow up changes. Change-Id: Ia58043bd2381a4d34d604522e02899ae64ee0d26 Fixes: OS#1855
-rw-r--r--include/osmo-bts/scheduler.h4
-rw-r--r--src/osmo-bts-trx/scheduler_trx.c17
2 files changed, 18 insertions, 3 deletions
diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h
index 4f40636..e693e3e 100644
--- a/include/osmo-bts/scheduler.h
+++ b/include/osmo-bts/scheduler.h
@@ -79,11 +79,13 @@ struct l1sched_chan_state {
uint32_t ul_first_fn; /* fn of first burst */
uint8_t ul_mask; /* mask of received bursts */
- /* RSSI / TOA */
+ /* measurements */
uint8_t rssi_num; /* number of RSSI values */
float rssi_sum; /* sum of RSSI values */
uint8_t toa_num; /* number of TOA values */
int32_t toa256_sum; /* sum of TOA values (1/256 symbol) */
+ uint8_t ci_cb_num; /* number of C/I values */
+ int32_t ci_cb_sum; /* sum of C/I values (in centiBels) */
/* loss detection */
uint8_t lost_frames; /* how many L2 frames were lost */
diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c
index 294e73c..7bdbc4f 100644
--- a/src/osmo-bts-trx/scheduler_trx.c
+++ b/src/osmo-bts-trx/scheduler_trx.c
@@ -982,8 +982,11 @@ int rx_pdtch_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
uint8_t *rssi_num = &chan_state->rssi_num;
int32_t *toa256_sum = &chan_state->toa256_sum;
uint8_t *toa_num = &chan_state->toa_num;
+ int32_t *ci_cb_sum = &chan_state->ci_cb_sum;
+ uint8_t *ci_cb_num = &chan_state->ci_cb_num;
uint8_t l2[EGPRS_0503_MAX_BYTES];
int n_errors, n_bursts_bits, n_bits_total;
+ int16_t lqual_cb;
uint16_t ber10k;
int rc;
@@ -1007,6 +1010,8 @@ int rx_pdtch_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
*rssi_num = 0;
*toa256_sum = 0;
*toa_num = 0;
+ *ci_cb_sum = 0;
+ *ci_cb_num = 0;
}
/* update mask + rssi */
@@ -1016,6 +1021,12 @@ int rx_pdtch_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
*toa256_sum += bi->toa256;
(*toa_num)++;
+ /* C/I: Carrier-to-Interference ratio (in centiBels) */
+ if (bi->flags & TRX_BI_F_CI_CB) {
+ *ci_cb_sum += bi->ci_cb;
+ (*ci_cb_num)++;
+ }
+
/* copy burst to buffer of 4 bursts */
if (bi->burst_len == EGPRS_BURST_LEN) {
burst = *bursts_p + bid * 348;
@@ -1069,13 +1080,15 @@ int rx_pdtch_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
bi->fn % l1ts->mf_period, l1ts->mf_period);
return 0;
}
+
+ lqual_cb = *ci_cb_num ? (*ci_cb_sum / *ci_cb_num) : 0;
ber10k = compute_ber10k(n_bits_total, n_errors);
return _sched_compose_ph_data_ind(l1t, bi->tn,
*first_fn, chan, l2, rc,
*rssi_sum / *rssi_num,
*toa256_sum / *toa_num,
- 0 /* FIXME: AVG C/I */,
- ber10k, PRES_INFO_BOTH);
+ lqual_cb, ber10k,
+ PRES_INFO_BOTH);
}
/*! \brief a single TCH/F burst was received by the PHY, process it */