aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2023-11-14 01:37:55 +0700
committerfixeria <vyanitskiy@sysmocom.de>2023-11-14 12:22:32 +0000
commit28b8759465ebc75179baef29984afa78aba6cb06 (patch)
treedf8e2b008beb4ddd2739b0908a8c3b9e6f1e0cb6
parent25aae40e17476f3650c1ec7f52b9106e1411b5de (diff)
osmo-bts-trx: eliminate ul_bursts_prev, use the primary buffer
When adding support for Circuit Switched Data calls, we had to enlarge the burst buffer size to accommodate bits for a maximum of 24 bursts. Let's take advantage of this by utilizing the currently unused part of the Uplink burst buffer for storing bits of previously decoded blocks. This eliminates the need to allocate additional memory for SACCH. Change-Id: I15047cd1df4476054b36f05616e41f5297d9bfe5 Related: SYS#5114, OS#4794, OS#4795, OS#4796
-rw-r--r--include/osmo-bts/scheduler.h1
-rw-r--r--src/common/scheduler.c6
-rw-r--r--src/osmo-bts-trx/sched_lchan_xcch.c14
3 files changed, 7 insertions, 14 deletions
diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h
index b9c73508..aea55959 100644
--- a/include/osmo-bts/scheduler.h
+++ b/include/osmo-bts/scheduler.h
@@ -92,7 +92,6 @@ struct l1sched_chan_state {
enum trx_mod_type dl_mod_type; /* Downlink modulation type */
uint8_t dl_mask; /* mask of transmitted bursts */
sbit_t *ul_bursts; /* burst buffer for RX */
- sbit_t *ul_bursts_prev;/* previous burst buffer for RX (repeated SACCH) */
uint32_t ul_first_fn; /* fn of first burst */
uint32_t ul_mask; /* mask of received bursts */
diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index 0e62b652..ef039327 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -1084,11 +1084,8 @@ static void _trx_sched_set_lchan(struct gsm_lchan *lchan,
const size_t buf_size = 24 * GSM_NBITS_NB_GMSK_PAYLOAD;
if (trx_chan_desc[chan].dl_fn != NULL)
chan_state->dl_bursts = talloc_zero_size(l1ts, buf_size);
- if (trx_chan_desc[chan].ul_fn != NULL) {
+ if (trx_chan_desc[chan].ul_fn != NULL)
chan_state->ul_bursts = talloc_zero_size(l1ts, buf_size);
- if (L1SAP_IS_LINK_SACCH(trx_chan_desc[chan].link_id))
- chan_state->ul_bursts_prev = talloc_zero_size(l1ts, buf_size);
- }
} else {
chan_state->ho_rach_detect = 0;
@@ -1100,7 +1097,6 @@ static void _trx_sched_set_lchan(struct gsm_lchan *lchan,
/* Release memory used by Rx/Tx burst buffers */
TALLOC_FREE(chan_state->dl_bursts);
TALLOC_FREE(chan_state->ul_bursts);
- TALLOC_FREE(chan_state->ul_bursts_prev);
}
chan_state->active = active;
diff --git a/src/osmo-bts-trx/sched_lchan_xcch.c b/src/osmo-bts-trx/sched_lchan_xcch.c
index a1a5e304..b6b51177 100644
--- a/src/osmo-bts-trx/sched_lchan_xcch.c
+++ b/src/osmo-bts-trx/sched_lchan_xcch.c
@@ -67,7 +67,9 @@ int rx_data_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi)
/* clear burst & store frame number of first burst */
if (bi->bid == 0) {
- memset(bursts_p, 0, BPLEN * 4);
+ if (rep_sacch) /* Keep a copy to ease decoding in the next repetition pass */
+ memcpy(BUFPOS(bursts_p, 4), BUFPOS(bursts_p, 0), BPLEN * 4);
+ memset(BUFPOS(bursts_p, 0), 0, BPLEN * 4);
*mask = 0x0;
*first_fn = bi->fn;
}
@@ -107,7 +109,7 @@ int rx_data_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi)
*mask = 0x0;
/* decode */
- rc = gsm0503_xcch_decode(l2, bursts_p, &n_errors, &n_bits_total);
+ rc = gsm0503_xcch_decode(l2, BUFPOS(bursts_p, 0), &n_errors, &n_bits_total);
if (rc) {
LOGL1SB(DL1P, LOGL_NOTICE, l1ts, bi,
BAD_DATA_MSG_FMT "\n", BAD_DATA_MSG_ARGS);
@@ -118,8 +120,8 @@ int rx_data_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi)
* information from the previous SACCH block. See also:
* 3GPP TS 44.006, section 11.2 */
if (rep_sacch) {
- add_sbits(bursts_p, chan_state->ul_bursts_prev);
- rc = gsm0503_xcch_decode(l2, bursts_p, &n_errors, &n_bits_total);
+ add_sbits(BUFPOS(bursts_p, 0), BUFPOS(bursts_p, 4));
+ rc = gsm0503_xcch_decode(l2, BUFPOS(bursts_p, 0), &n_errors, &n_bits_total);
if (rc) {
LOGL1SB(DL1P, LOGL_NOTICE, l1ts, bi,
"Combining current SACCH block with previous SACCH block also yields bad data (%u/%u)\n",
@@ -136,10 +138,6 @@ int rx_data_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi)
ber10k = compute_ber10k(n_bits_total, n_errors);
- /* Keep a copy to ease decoding in the next repetition pass */
- if (rep_sacch)
- memcpy(chan_state->ul_bursts_prev, bursts_p, BPLEN * 4);
-
return _sched_compose_ph_data_ind(l1ts, *first_fn, bi->chan,
&l2[0], l2_len,
ber10k,