fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/34523?usp=email )
Change subject: trxcon/l1sched: rework dequeueing of PDCH Tx prims ......................................................................
trxcon/l1sched: rework dequeueing of PDCH Tx prims
When an UL BLOCK.req is received late, i.e. after the first Tx burst of the respective TDMA Fn was requested by the PHY, a domino effect can be observed: the stale Tx primitive remains in the queue and prevents transmission of the next primitive, even if the later was received in time. This breaks transmission of consecutive UL blocks.
Don't let stale primitives poison the Tx queue: drop them like before, but keep looking for a primitive with the matching TDMA Fn. If found a primitive with TDMA Fn past the current one, stop the iteration.
Change-Id: I439615639b8e840b9fd4f3af6934d9f298f32216 Depends: libosmocore.git I9590f2e836fc48650decf1564b6ab46306c4fe2d Depends: libosmocore.git Ie8bb9c49c6f81b8f4a1766547d6943f9880d1186 Related: OS#5500 --- M src/host/trxcon/src/sched_lchan_pdtch.c 1 file changed, 40 insertions(+), 12 deletions(-)
Approvals: pespin: Looks good to me, but someone else must approve laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified fixeria: Looks good to me, approved
diff --git a/src/host/trxcon/src/sched_lchan_pdtch.c b/src/host/trxcon/src/sched_lchan_pdtch.c index 0f8a25f..915b060 100644 --- a/src/host/trxcon/src/sched_lchan_pdtch.c +++ b/src/host/trxcon/src/sched_lchan_pdtch.c @@ -26,6 +26,7 @@ #include <osmocom/core/logging.h> #include <osmocom/core/bits.h>
+#include <osmocom/gsm/gsm0502.h> #include <osmocom/gsm/gsm_utils.h> #include <osmocom/gsm/protocol/gsm_04_08.h> #include <osmocom/coding/gsm0503_coding.h> @@ -104,20 +105,25 @@
static struct msgb *prim_dequeue_pdtch(struct l1sched_lchan_state *lchan, uint32_t fn) { - const struct l1sched_prim *prim; - struct msgb *msg; + while (!llist_empty(&lchan->tx_prims)) { + struct msgb *msg = llist_first_entry(&lchan->tx_prims, struct msgb, list); + const struct l1sched_prim *prim = l1sched_prim_from_msgb(msg); + int ret = gsm0502_fncmp(prim->data_req.frame_nr, fn);
- msg = msgb_dequeue(&lchan->tx_prims); - if (msg == NULL) - return NULL; - prim = l1sched_prim_from_msgb(msg); + if (OSMO_LIKELY(ret == 0)) { /* it's a match! */ + llist_del(&msg->list); + return msg; + } else if (ret > 0) { /* not now, come back later */ + break; + } /* else: the ship has sailed, drop your ticket */
- if (OSMO_LIKELY(prim->data_req.frame_nr == fn)) - return msg; - LOGP_LCHAND(lchan, LOGL_ERROR, - "%s(): dropping Tx primitive (current Fn=%u, prim Fn=%u)\n", - __func__, fn, prim->data_req.frame_nr); - msgb_free(msg); + LOGP_LCHAND(lchan, LOGL_ERROR, + "%s(): dropping stale Tx primitive (current Fn=%u, prim Fn=%u)\n", + __func__, fn, prim->data_req.frame_nr); + llist_del(&msg->list); + msgb_free(msg); + } + return NULL; }