aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2022-04-19 21:15:42 +0300
committerfixeria <vyanitskiy@sysmocom.de>2022-04-20 19:51:25 +0000
commit5a9eaf7088bcccf950fa55482f95645da523212f (patch)
treebc0c2dda2c65db5e27669b9997f18e8d263d3a15
parentfbbc019f7d70da2158c29be3c364ef460e108332 (diff)
osmo-bts-trx: tx_tchh_fn(): make handling of FACCH/H cleaner
If set, chan_state->dl_ongoing_facch indicates that we're sending the 2 (out of 6) middle bursts of FACCH/H. In this case there is no room for encoding an additional frame, because both even and odd numbered bits are occupied by a previously encoded FACCH/H. Right after calling tch_dl_dequeue(): * do not check the dequeued message against NULL, * do not compare the message length to GSM_MACBLOCK_LEN, * immediately free() it and jump to the sending part. Change-Id: Ib923b8f5cc1063e9fc18acd2bdd003fd09f4b70f Related: SYS#5919, OS#4823
-rw-r--r--src/osmo-bts-trx/sched_lchan_tchh.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/osmo-bts-trx/sched_lchan_tchh.c b/src/osmo-bts-trx/sched_lchan_tchh.c
index dcfbe3ec..0db9c182 100644
--- a/src/osmo-bts-trx/sched_lchan_tchh.c
+++ b/src/osmo-bts-trx/sched_lchan_tchh.c
@@ -391,8 +391,15 @@ int tx_tchh_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br)
/* dequeue a message to be transmitted */
msg = tch_dl_dequeue(l1ts, br);
+ /* if we're sending 2 middle bursts of FACCH/H */
+ if (chan_state->dl_ongoing_facch) {
+ msgb_free(msg); /* drop 2nd speech frame */
+ chan_state->dl_ongoing_facch = 0;
+ goto send_burst;
+ }
+
/* no message at all, send a dummy L2 frame on FACCH */
- if (msg == NULL && !chan_state->dl_ongoing_facch) {
+ if (msg == NULL) {
static const uint8_t dummy[GSM_MACBLOCK_LEN] = {
0x03, 0x03, 0x01, /* TODO: use randomized padding */
0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b,
@@ -409,9 +416,7 @@ int tx_tchh_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br)
gsm0503_tch_hr_encode(*bursts_p, msg->l2h, msgb_l2len(msg));
chan_state->dl_ongoing_facch = 1; /* first of two TCH frames */
chan_state->dl_facch_bursts = 6;
- } else if (chan_state->dl_ongoing_facch) /* second of two TCH frames */
- chan_state->dl_ongoing_facch = 0; /* we are done with FACCH */
- else if (tch_mode == GSM48_CMODE_SPEECH_AMR)
+ } else if (tch_mode == GSM48_CMODE_SPEECH_AMR)
/* the first FN 4,13,21 or 5,14,22 defines that CMI is included
* in frame, the first FN 0,8,17 or 1,9,18 defines that CMR is
* included in frame. */