diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-11-26 16:39:28 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-12-25 15:31:46 +0100 |
commit | 705653b2d71b7bd9eefc260effc22c6030b16bb1 (patch) | |
tree | 9a08b2d51b2f35ae2574b9bf2ecf458ec58b6403 | |
parent | aadfc2e1212c45073f2b3e41930686991dd24f46 (diff) |
sched: Attempt to improve the fairness and schedule UL/AL ACK/ASS
It is possible that certain UL ACK messages are not sent when there
are many many uplink and downlink assignments. Try to be more fair
and schedule them round-robin. This way no starvation should occur.
-rw-r--r-- | src/bts.h | 1 | ||||
-rw-r--r-- | src/gprs_rlcmac_sched.cpp | 36 |
2 files changed, 23 insertions, 14 deletions
@@ -67,6 +67,7 @@ struct gprs_rlcmac_pdch { uint8_t tsc; /* TSC of this slot */ uint8_t next_ul_tfi; /* next uplink TBF/TFI to schedule (0..31) */ uint8_t next_dl_tfi; /* next downlink TBF/TFI to schedule (0..31) */ + uint8_t next_ctrl_prio; /* next kind of ctrl message to schedule */ struct gprs_rlcmac_tbf *ul_tbf[32]; /* array of UL TBF, by UL TFI */ struct gprs_rlcmac_tbf *dl_tbf[32]; /* array of DL TBF, by DL TFI */ struct llist_head paging_list; /* list of paging messages */ diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp index b061e910..123e375f 100644 --- a/src/gprs_rlcmac_sched.cpp +++ b/src/gprs_rlcmac_sched.cpp @@ -115,22 +115,30 @@ static struct msgb *sched_select_ctrl_msg( { struct msgb *msg = NULL; struct gprs_rlcmac_tbf *tbf = NULL; + struct gprs_rlcmac_tbf *next_list[3] = { ul_ass_tbf, dl_ass_tbf, ul_ack_tbf }; - /* schedule PACKET UPLINK ASSIGNMENT (1st priority) */ - if (ul_ass_tbf) { - tbf = ul_ass_tbf; - msg = tbf->create_ul_ass(fn); - } - /* schedule PACKET DOWNLINK ASSIGNMENT (2nd priotiry) */ - if (!msg && dl_ass_tbf) { - tbf = dl_ass_tbf; - msg = tbf->create_dl_ass(fn); - } - /* schedule PACKET UPLINK ACK (3rd priority) */ - if (!msg && ul_ack_tbf) { - tbf = ul_ack_tbf; - msg = tbf->create_ul_ack(fn); + for (size_t i = 0; i < ARRAY_SIZE(next_list); ++i) { + tbf = next_list[(pdch->next_ctrl_prio + i) % 3]; + if (!tbf) + continue; + + if (tbf == ul_ass_tbf) + msg = tbf->create_ul_ass(fn); + else if (tbf == dl_ass_tbf) + msg = tbf->create_dl_ass(fn); + else + msg = tbf->create_ul_ack(fn); + + if (!msg) { + tbf = NULL; + continue; + } + + pdch->next_ctrl_prio += i + 1; + pdch->next_ctrl_prio %= 3; + break; } + /* any message */ if (msg) { tbf->rotate_in_list(); |