osmo-bts-trx: rx_{tchf,tchh}_fn(): shift Rx burst buffer on bid=0

For both TCH/F and TCH/H, the receive burst buffer needs to be
periodically shifted leftwards due to the nature of block-diagonal
interleaving.  Currently we do this on receipt of bid=3 for TCH/F
and bid=1 for TCH/H, right after attempting to decode the buffer.

If for some reason we return early before attempting to decode the
buffer, the content of that buffer might not be shifted and some
bursts might be overwritten.  This can be easily avoided by doing
the shifting on receipt of bid=0 for both TCH/H and TCH/F.

Change-Id: I0bd69f5a8f5c665fb5f00c127bc3fe1d91167abb
This commit is contained in:
Vadim Yanitskiy 2022-03-19 19:21:29 +03:00 committed by fixeria
parent b8b6066450
commit 6d04bd95ee
2 changed files with 6 additions and 7 deletions

View File

@ -81,8 +81,9 @@ int rx_tchf_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi)
return -ENOMEM;
}
/* clear burst */
/* shift the buffer by 4 bursts leftwards */
if (bi->bid == 0) {
memcpy(*bursts_p, *bursts_p + 464, 464);
memset(*bursts_p + 464, 0, 464);
*mask = 0x0;
}
@ -205,7 +206,6 @@ int rx_tchf_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi)
tch_mode);
return -EINVAL;
}
memcpy(*bursts_p, *bursts_p + 464, 464);
/* average measurements of the last N (depends on mode) bursts */
trx_sched_meas_avg(chan_state, &meas_avg, meas_avg_mode);

View File

@ -87,8 +87,10 @@ int rx_tchh_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi)
return -ENOMEM;
}
/* clear burst */
/* shift the buffer by 2 bursts leftwards */
if (bi->bid == 0) {
memcpy(*bursts_p, *bursts_p + 232, 232);
memcpy(*bursts_p + 232, *bursts_p + 464, 232);
memset(*bursts_p + 464, 0, 232);
*mask = 0x0;
}
@ -122,8 +124,6 @@ int rx_tchh_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi)
/* skip decoding of the last 4 bursts of FACCH/H */
if (chan_state->ul_ongoing_facch) {
chan_state->ul_ongoing_facch = 0;
memcpy(*bursts_p, *bursts_p + 232, 232);
memcpy(*bursts_p + 232, *bursts_p + 464, 232);
/* we have already sent the first BFI when a FACCH/H frame
* was decoded (see below), now send the second one. */
trx_sched_meas_avg(chan_state, &meas_avg, meas_avg_mode);
@ -238,8 +238,7 @@ int rx_tchh_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi)
tch_mode);
return -EINVAL;
}
memcpy(*bursts_p, *bursts_p + 232, 232);
memcpy(*bursts_p + 232, *bursts_p + 464, 232);
ber10k = compute_ber10k(n_bits_total, n_errors);
/* average measurements of the last N (depends on mode) bursts */