aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-trx/scheduler_trx.c
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2019-07-07 20:17:05 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2019-07-21 21:55:51 +0700
commitaa54224e563bcde01bcd1dfc21c59552b421a815 (patch)
tree1fd10f2c4c11387d650c649e33ef350b656fd68f /src/osmo-bts-trx/scheduler_trx.c
parent4ff47ff39a70b89d1bc0f1ae6ecfb95b0007ec9b (diff)
osmo-bts-trx/scheduler: rx_data_fn(): provide actual C/I ratio to L1SAP
Diffstat (limited to 'src/osmo-bts-trx/scheduler_trx.c')
-rw-r--r--src/osmo-bts-trx/scheduler_trx.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c
index 8144956f..532eca54 100644
--- a/src/osmo-bts-trx/scheduler_trx.c
+++ b/src/osmo-bts-trx/scheduler_trx.c
@@ -896,8 +896,11 @@ int rx_data_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[GSM_MACBLOCK_LEN], l2_len;
int n_errors, n_bits_total;
+ int16_t lqual_cb;
uint16_t ber10k;
int rc;
@@ -924,6 +927,8 @@ int rx_data_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 */
@@ -933,6 +938,12 @@ int rx_data_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 */
burst = *bursts_p + bid * 116;
memcpy(burst, bi->burst + 3, 58);
@@ -978,13 +989,14 @@ int rx_data_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
n_errors, n_bits_total,
*rssi_sum / *rssi_num,
*toa256_sum / *toa_num);
+ 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, l2_len,
*rssi_sum / *rssi_num,
*toa256_sum / *toa_num,
- 0 /* FIXME: AVG C/I */,
- ber10k, PRES_INFO_UNKNOWN);
+ lqual_cb, ber10k,
+ PRES_INFO_UNKNOWN);
}
/*! \brief a single PDTCH burst was received by the PHY, process it */