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/trx_if.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/trx_if.c')
-rw-r--r-- | src/host/trxcon/trx_if.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/host/trxcon/trx_if.c b/src/host/trxcon/trx_if.c index 55d70341..343c6ca4 100644 --- a/src/host/trxcon/trx_if.c +++ b/src/host/trxcon/trx_if.c @@ -555,6 +555,7 @@ rsp_error: static int trx_data_rx_cb(struct osmo_fd *ofd, unsigned int what) { struct trx_instance *trx = ofd->data; + struct trx_meas_set meas; uint8_t buf[256]; sbit_t bits[148]; int8_t rssi, tn; @@ -595,8 +596,14 @@ static int trx_data_rx_cb(struct osmo_fd *ofd, unsigned int what) LOGP(DTRXD, LOGL_DEBUG, "RX burst tn=%u fn=%u rssi=%d toa=%d\n", tn, fn, rssi, toa256); + /* Group the measurements together */ + meas = (struct trx_meas_set) { + .toa256 = toa256, + .rssi = rssi, + }; + /* Poke scheduler */ - sched_trx_handle_rx_burst(trx, tn, fn, bits, 148, rssi, toa256); + sched_trx_handle_rx_burst(trx, tn, fn, bits, 148, &meas); /* Correct local clock counter */ if (fn % 51 == 0) |