diff options
author | Vadim Yanitskiy <axilirator@gmail.com> | 2020-03-02 02:55:01 +0700 |
---|---|---|
committer | laforge <laforge@osmocom.org> | 2020-03-08 22:50:54 +0000 |
commit | 2060b5b7cc3b63b64e651d3cda5ed50b44593a05 (patch) | |
tree | 754a193733d7132e7f21e31cf4aae2d5552066e6 /src/host/trxcon/sched_lchan_common.c | |
parent | d534d43fc16a91ccc36283c72c0f39a3742a307f (diff) |
trxcon/scheduler: refactor Downlink measurement processing
So far we used to store the sums of ToA and RSSI measurements in the
logical channel state, and after decoding of a block, we did calculate
the average. This approach works fine for xCCH and PDTCH, but when it
comes to block-diagonal interleaving (which is used on TCH/F and TCH/H
channels), the results are incorrect. The problem is that a burst on
TCH may carry 57 bits of one encoded frame and 57 bits of another.
Instead of calculating the sum of measurements on the fly, let's push
them into a circular buffer (the measurement history), and keep them
there even after decoding of a block. This would allow us to calculate
the average of N last measurements depending on the interleaving type.
A single circular buffer can hold up to 8 unique measurements, so the
recent measurements would basically override the oldest ones.
Change-Id: I211ee3314f0a284112a4deddc0e93028f4a27cef
Diffstat (limited to 'src/host/trxcon/sched_lchan_common.c')
-rw-r--r-- | src/host/trxcon/sched_lchan_common.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/host/trxcon/sched_lchan_common.c b/src/host/trxcon/sched_lchan_common.c index 813f3157..55ec7e95 100644 --- a/src/host/trxcon/sched_lchan_common.c +++ b/src/host/trxcon/sched_lchan_common.c @@ -126,9 +126,9 @@ int sched_send_dt_ind(struct trx_instance *trx, struct trx_ts *ts, struct trx_lchan_state *lchan, uint8_t *l2, size_t l2_len, int bit_error_count, bool dec_failed, bool traffic) { + const struct trx_meas_set *meas = &lchan->meas_avg; const struct trx_lchan_desc *lchan_desc; struct l1ctl_info_dl dl_hdr; - int dbm_avg = 0; /* Set up pointers */ lchan_desc = &trx_lchan_desc[lchan->type]; @@ -140,15 +140,8 @@ int sched_send_dt_ind(struct trx_instance *trx, struct trx_ts *ts, dl_hdr.frame_nr = htonl(lchan->rx_first_fn); dl_hdr.num_biterr = bit_error_count; - /* Convert average RSSI to RX level */ - if (lchan->meas.num) { - /* RX level: 0 .. 63 in typical GSM notation (dBm + 110) */ - dbm_avg = lchan->meas.rssi_sum / lchan->meas.num; - dl_hdr.rx_level = dbm2rxlev(dbm_avg); - } else { - /* No measurements, assuming the worst */ - dl_hdr.rx_level = 0; - } + /* RX level: 0 .. 63 in typical GSM notation (dBm + 110) */ + dl_hdr.rx_level = dbm2rxlev(meas->rssi); /* FIXME: set proper values */ dl_hdr.snr = 0; @@ -162,7 +155,7 @@ int sched_send_dt_ind(struct trx_instance *trx, struct trx_ts *ts, /* Optional GSMTAP logging */ if (l2_len > 0 && (!traffic || lchan_desc->chan_nr == RSL_CHAN_OSMO_PDCH)) { sched_gsmtap_send(lchan->type, lchan->rx_first_fn, ts->index, - trx->band_arfcn, dbm_avg, 0, l2, l2_len); + trx->band_arfcn, meas->rssi, 0, l2, l2_len); } return 0; |