fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/35011?usp=email )


Change subject: osmo-bts-trx: eliminate ul_bursts_prev, use the primary buffer
......................................................................

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
---
M include/osmo-bts/scheduler.h
M src/common/scheduler.c
M src/osmo-bts-trx/sched_lchan_xcch.c
3 files changed, 24 insertions(+), 14 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/11/35011/1

diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h
index b9c7350..aea5595 100644
--- a/include/osmo-bts/scheduler.h
+++ b/include/osmo-bts/scheduler.h
@@ -92,7 +92,6 @@
        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 0e62b65..ef03932 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -1084,11 +1084,8 @@
                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 @@
                /* 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 a1a5e30..b6b5117 100644
--- a/src/osmo-bts-trx/sched_lchan_xcch.c
+++ b/src/osmo-bts-trx/sched_lchan_xcch.c
@@ -67,7 +67,9 @@

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

        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,

--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/35011?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I15047cd1df4476054b36f05616e41f5297d9bfe5
Gerrit-Change-Number: 35011
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanits...@sysmocom.de>
Gerrit-MessageType: newchange

Reply via email to