summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2020-03-04 21:41:01 +0700
committerlaforge <laforge@osmocom.org>2020-03-16 10:32:42 +0000
commitd81231672f27218bb1c65862aa4602eddbb1dfa2 (patch)
treeaf1d7df54420d8c5490409c1485e6b1e90921ea5
parentf5fa7dbd1973a2ae3b10ec8977c8ea99b63532d6 (diff)
trxcon/scheduler: align Downlink reception to the first burst
It may happen that the burst reception would start from bid != 0: <0005> sched_trx.c:263 (Re)configure TDMA timeslot #2 as TCH/H+SACCH <0005> sched_trx.c:420 Activating lchan=TCH/H(0) on ts=2 <0005> sched_trx.c:420 Activating lchan=SACCH/TH(0) on ts=2 <0006> sched_lchan_xcch.c:96 Received incomplete data frame at fn=0 (0/104) for SACCH/TH(0) <0006> sched_lchan_xcch.c:106 Received bad data frame at fn=0 (0/104) for SACCH/TH(0) so in that case, both measurement processing and the frame number calculation would yield incorrect and/or incomplete results. The Rx burst mask can be used to eliminate this problem. In particular, if we shift it left instead of cleaning, it would never be equal 0x00 after at least one burst is received. This would allow us to skip decoding of an incomplete frame at the beginning when the logical channel was just activated. Note that TCH/H handler is not affected because it already uses the strategy described above, so we keep it unchanged. Change-Id: Ib8ddf2edd5ef84f2ab12155f7a8874c9fc56d436 Related: OS#3554
-rw-r--r--src/host/trxcon/sched_lchan_pdtch.c9
-rw-r--r--src/host/trxcon/sched_lchan_tchf.c9
-rw-r--r--src/host/trxcon/sched_lchan_xcch.c9
3 files changed, 18 insertions, 9 deletions
diff --git a/src/host/trxcon/sched_lchan_pdtch.c b/src/host/trxcon/sched_lchan_pdtch.c
index d965daa0..8de947e6 100644
--- a/src/host/trxcon/sched_lchan_pdtch.c
+++ b/src/host/trxcon/sched_lchan_pdtch.c
@@ -58,9 +58,9 @@ int rx_pdtch_fn(struct trx_instance *trx, struct trx_ts *ts,
LOGP(DSCHD, LOGL_DEBUG, "Packet data received on %s: "
"fn=%u ts=%u bid=%u\n", lchan_desc->name, fn, ts->index, bid);
- /* Reset internal state */
- if (bid == 0)
- *mask = 0x0;
+ /* Align to the first burst of a block */
+ if (*mask == 0x00 && bid != 0)
+ return 0;
/* Update mask */
*mask |= (1 << bid);
@@ -92,6 +92,9 @@ int rx_pdtch_fn(struct trx_instance *trx, struct trx_ts *ts,
return -1;
}
+ /* Keep the mask updated */
+ *mask = *mask << 4;
+
/* Attempt to decode */
rc = gsm0503_pdtch_decode(l2, buffer,
NULL, &n_errors, &n_bits_total);
diff --git a/src/host/trxcon/sched_lchan_tchf.c b/src/host/trxcon/sched_lchan_tchf.c
index 198d25fc..312425ba 100644
--- a/src/host/trxcon/sched_lchan_tchf.c
+++ b/src/host/trxcon/sched_lchan_tchf.c
@@ -60,9 +60,9 @@ int rx_tchf_fn(struct trx_instance *trx, struct trx_ts *ts,
LOGP(DSCHD, LOGL_DEBUG, "Traffic received on %s: fn=%u ts=%u bid=%u\n",
lchan_desc->name, fn, ts->index, bid);
- /* Reset internal state */
- if (bid == 0)
- *mask = 0x00;
+ /* Align to the first burst of a block */
+ if (*mask == 0x00 && bid != 0)
+ return 0;
/* Update mask */
*mask |= (1 << bid);
@@ -95,6 +95,9 @@ int rx_tchf_fn(struct trx_instance *trx, struct trx_ts *ts,
goto bfi;
}
+ /* Keep the mask updated */
+ *mask = *mask << 4;
+
switch (lchan->tch_mode) {
case GSM48_CMODE_SIGN:
case GSM48_CMODE_SPEECH_V1: /* FR */
diff --git a/src/host/trxcon/sched_lchan_xcch.c b/src/host/trxcon/sched_lchan_xcch.c
index 0818e209..a0b61adc 100644
--- a/src/host/trxcon/sched_lchan_xcch.c
+++ b/src/host/trxcon/sched_lchan_xcch.c
@@ -57,9 +57,9 @@ int rx_data_fn(struct trx_instance *trx, struct trx_ts *ts,
LOGP(DSCHD, LOGL_DEBUG, "Data received on %s: fn=%u ts=%u bid=%u\n",
lchan_desc->name, fn, ts->index, bid);
- /* Reset internal state */
- if (bid == 0)
- *mask = 0x0;
+ /* Align to the first burst of a block */
+ if (*mask == 0x00 && bid != 0)
+ return 0;
/* Update mask */
*mask |= (1 << bid);
@@ -93,6 +93,9 @@ int rx_data_fn(struct trx_instance *trx, struct trx_ts *ts,
* abort here. */
}
+ /* Keep the mask updated */
+ *mask = *mask << 4;
+
/* Attempt to decode */
rc = gsm0503_xcch_decode(l2, buffer, &n_errors, &n_bits_total);
if (rc) {