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
This commit is contained in:
Vadim Yanitskiy 2023-11-14 01:37:55 +07:00 committed by fixeria
parent 25aae40e17
commit 28b8759465
3 changed files with 7 additions and 14 deletions

View File

@ -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 */

View File

@ -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;

View File

@ -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,