Review at  https://gerrit.osmocom.org/7807

trxcon: Prefix SACCH fill frame with L1 header

The main problem here is that the existing implementatin missing the L1
header in this message.  A SACCH message doesn't have a 23byte LAPDm
message, but only a 21 byte LAPDm message prefixed by a 2-byte Layer1
header. So on the receiver in the BTS, right now the first two bytes of
the UL SACCH frame are misinterpreted as L1 header.

This it what causes RLL ERROR INDICATION on the Abis side, which is why
our BTS_Tests fail.

Change-Id: Id7776bf3604d0e8a32e04547e01b8bd377903272
Related: OS#3170
---
M src/host/trxcon/sched_prim.c
1 file changed, 12 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/07/7807/1

diff --git a/src/host/trxcon/sched_prim.c b/src/host/trxcon/sched_prim.c
index e1c87bb..2ee06d7 100644
--- a/src/host/trxcon/sched_prim.c
+++ b/src/host/trxcon/sched_prim.c
@@ -275,8 +275,18 @@
                /* FIXME: should we do anything for CSD? */
                return 0;
        } else {
+               uint8_t *cur = prim_buffer;
+
+               if (CHAN_IS_SACCH(chan)) {
+                       /* Add 2-byte SACCH header */
+                       /* FIXME: How to get TA and MS Tx Power from 
l1l->trx->tx_power + l1l->trx->ta? */
+                       cur[0] = cur[1] = 0x00;
+                       cur += 2;
+               }
+
                /* Copy a fill frame payload */
-               memcpy(prim_buffer, lapdm_fill_frame, sizeof(lapdm_fill_frame));
+               memcpy(cur, lapdm_fill_frame, sizeof(lapdm_fill_frame));
+               cur += sizeof(lapdm_fill_frame);
 
                /**
                 * TS 144.006, section 5.2 "Frame delimitation and fill bits"
@@ -284,7 +294,7 @@
                 * be set to the binary value "00101011", each fill bit should
                 * be set to a random value when sent by the network.
                 */
-               for (i = sizeof(lapdm_fill_frame); i < GSM_MACBLOCK_LEN; i++)
+               for (i = cur - prim_buffer; i < GSM_MACBLOCK_LEN; i++)
                        prim_buffer[i] = (uint8_t) rand();
 
                /* Define a prim length */

-- 
To view, visit https://gerrit.osmocom.org/7807
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id7776bf3604d0e8a32e04547e01b8bd377903272
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <lafo...@gnumonks.org>

Reply via email to