fixeria has uploaded this change for review.

View Change

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
---
M src/osmo-bts-trx/sched_lchan_tchf.c
M src/osmo-bts-trx/sched_lchan_tchh.c
2 files changed, 6 insertions(+), 7 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/54/27554/1
diff --git a/src/osmo-bts-trx/sched_lchan_tchf.c b/src/osmo-bts-trx/sched_lchan_tchf.c
index c6c5532..a689a1f 100644
--- a/src/osmo-bts-trx/sched_lchan_tchf.c
+++ b/src/osmo-bts-trx/sched_lchan_tchf.c
@@ -81,8 +81,9 @@
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 @@
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);
diff --git a/src/osmo-bts-trx/sched_lchan_tchh.c b/src/osmo-bts-trx/sched_lchan_tchh.c
index 3a66321..6b49974 100644
--- a/src/osmo-bts-trx/sched_lchan_tchh.c
+++ b/src/osmo-bts-trx/sched_lchan_tchh.c
@@ -87,8 +87,10 @@
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 @@
/* 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 @@
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 */

To view, visit change 27554. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I0bd69f5a8f5c665fb5f00c127bc3fe1d91167abb
Gerrit-Change-Number: 27554
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de>
Gerrit-MessageType: newchange