From 9abc5f79826c9dd9a918caaa69afd33cca0867f1 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 15 Apr 2018 11:05:45 +0200 Subject: [PATCH] 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 --- src/host/trxcon/sched_prim.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/host/trxcon/sched_prim.c b/src/host/trxcon/sched_prim.c index e1c87bbf..2ee06d73 100644 --- a/src/host/trxcon/sched_prim.c +++ b/src/host/trxcon/sched_prim.c @@ -275,8 +275,18 @@ int sched_prim_dummy(struct trx_lchan_state *lchan) /* 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 @@ int sched_prim_dummy(struct trx_lchan_state *lchan) * 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 */ -- 2.11.4.GIT