fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/27835 )
Change subject: osmo-bts-trx: tx_tchh_fn(): make handling of FACCH/H cleaner ......................................................................
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 --- M src/osmo-bts-trx/sched_lchan_tchh.c 1 file changed, 9 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/35/27835/1
diff --git a/src/osmo-bts-trx/sched_lchan_tchh.c b/src/osmo-bts-trx/sched_lchan_tchh.c index 6402476..5866788 100644 --- a/src/osmo-bts-trx/sched_lchan_tchh.c +++ b/src/osmo-bts-trx/sched_lchan_tchh.c @@ -390,8 +390,15 @@ /* 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); /* steal 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, @@ -408,9 +415,7 @@ 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. */