From 1ff70c26e3a79aa583f5da8f595364efdebbfa06 Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Mon, 1 Feb 2016 19:42:09 +0100 Subject: [PATCH] sched: Do PACCH assignments for the same direction last Currently the selection of a pending control message is done round robin. It can possibly happen, that a DL assigment is sent on a DL TBF while an UL assignment is pending. The MS will replace the old DL TBF in that case, so that it can no longer be used for the PACCH so that the UL assignment is lost. Give assigment requests for the same direction a lower priority. Sponsored-by: On-Waves ehf --- src/gprs_rlcmac_sched.cpp | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp index e03f84be..313e23f4 100644 --- a/src/gprs_rlcmac_sched.cpp +++ b/src/gprs_rlcmac_sched.cpp @@ -130,14 +130,18 @@ static struct msgb *sched_select_ctrl_msg( if (!tbf) continue; - if (tbf == ul_ass_tbf) + /* + * Assignments for the same direction have lower precedence, + * because they may kill the TBF when the CONTOL ACK is + * received, thus preventing the others from being processed. + */ + + if (tbf == ul_ass_tbf && tbf->direction == GPRS_RLCMAC_DL_TBF) msg = ul_ass_tbf->create_ul_ass(fn, ts); - else if (tbf == dl_ass_tbf) + else if (tbf == dl_ass_tbf && tbf->direction == GPRS_RLCMAC_UL_TBF) msg = dl_ass_tbf->create_dl_ass(fn, ts); else if (tbf == ul_ack_tbf) msg = ul_ack_tbf->create_ul_ack(fn, ts); - else - abort(); if (!msg) { tbf = NULL; @@ -149,6 +153,21 @@ static struct msgb *sched_select_ctrl_msg( break; } + if (!msg) { + /* + * If one of these is left, the response (CONTROL ACK) from the + * MS will kill the current TBF, only one of them can be + * non-NULL + */ + if (dl_ass_tbf) { + tbf = dl_ass_tbf; + msg = dl_ass_tbf->create_dl_ass(fn, ts); + } else if (ul_ass_tbf) { + tbf = ul_ass_tbf; + msg = ul_ass_tbf->create_ul_ass(fn, ts); + } + } + /* any message */ if (msg) { tbf->rotate_in_list();