diff options
author | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2023-07-10 05:24:28 +0700 |
---|---|---|
committer | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2023-07-12 03:52:34 +0700 |
commit | 44282c0fe8957ef43853ab982e9bf4a30e54efde (patch) | |
tree | 512713b1d598ab9c539c03af2dd7a24ec7ee0438 /src | |
parent | 21aacfe7096ef27fe40c22d20a86d2303f9cba91 (diff) |
trxcon/l1sched: simplify and unify prim_dequeue_tchf()
Make it easier to read and more similar to prim_dequeue_tchh().
Change-Id: Ie79069e5cc8acd193a326ac9d334fe070552e320
Diffstat (limited to 'src')
-rw-r--r-- | src/host/trxcon/src/sched_lchan_tchf.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/src/host/trxcon/src/sched_lchan_tchf.c b/src/host/trxcon/src/sched_lchan_tchf.c index 6d48fc77..a87efafe 100644 --- a/src/host/trxcon/src/sched_lchan_tchf.c +++ b/src/host/trxcon/src/sched_lchan_tchf.c @@ -215,26 +215,20 @@ bfi: static struct msgb *prim_dequeue_tchf(struct l1sched_lchan_state *lchan) { - struct msgb *facch; - struct msgb *tch; - - /* Attempt to find a pair of FACCH/F and TCH/F frames */ - facch = l1sched_lchan_prim_dequeue_tch(lchan, true); - tch = l1sched_lchan_prim_dequeue_tch(lchan, false); - - /* Prioritize FACCH/F, if found */ - if (facch) { - /* One TCH/F prim is replaced */ - if (tch) - msgb_free(tch); - return facch; - } else if (tch) { - /* Only TCH/F prim was found */ - return tch; - } else { - /* Nothing was found */ - return NULL; + struct msgb *msg_facch; + struct msgb *msg_tch; + + /* dequeue a pair of TCH and FACCH frames */ + msg_tch = l1sched_lchan_prim_dequeue_tch(lchan, false); + msg_facch = l1sched_lchan_prim_dequeue_tch(lchan, true); + + /* prioritize FACCH over TCH */ + if (msg_facch != NULL) { + msgb_free(msg_tch); /* drop one TCH/FS block */ + return msg_facch; } + + return msg_tch; } int tx_tchf_fn(struct l1sched_lchan_state *lchan, |