From 0eabffdc35bef3bb678014d4c377ab8a2ac5951f Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Mon, 2 Mar 2015 14:28:12 +0100 Subject: sched: Modify DL scheduling to use different priorities Currently the DL blocks are scheduled round robin to each TBF that is either in state FLOW or FINISHED and not waiting for an IMM.ASS confirmation. This way, if single blocks has been NACK'ed by the MS and the PCU has already resent the missing packets, the PCU starts retransmitting them until it has received an ACK/NACK even if other TBF have RLC blocks that need to be transmitted. This commit changes sched_select_downlink to select the next TBF with the highest priority, where blocks that are going to be resent again have a lower priority unless the window is stalling. If there is only one TBF the old behaviour is kept, since there is no other TBF that can have a higher priority. If there is much packet loss on a single phone, this modification can lead to a higher latency for that MS. Sponsored-by: On-Waves ehf --- src/gprs_rlcmac_sched.cpp | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'src/gprs_rlcmac_sched.cpp') diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp index 40a183b4..c8977e41 100644 --- a/src/gprs_rlcmac_sched.cpp +++ b/src/gprs_rlcmac_sched.cpp @@ -167,8 +167,9 @@ static struct msgb *sched_select_downlink(struct gprs_rlcmac_bts *bts, uint8_t block_nr, struct gprs_rlcmac_pdch *pdch) { struct msgb *msg = NULL; - struct gprs_rlcmac_dl_tbf *tbf = NULL; - uint8_t i, tfi; + struct gprs_rlcmac_dl_tbf *tbf, *prio_tbf = NULL; + int prio, max_prio = -1; + uint8_t i, tfi, prio_tfi; /* select downlink resource */ for (i = 0, tfi = pdch->next_dl_tfi; i < 32; @@ -189,13 +190,29 @@ static struct msgb *sched_select_downlink(struct gprs_rlcmac_bts *bts, if (tbf->m_wait_confirm) continue; + /* compute priority */ + if (tbf->state_is(GPRS_RLCMAC_FINISHED) && + tbf->m_window.resend_needed() < 0) + /* would re-retransmit blocks */ + prio = 1; + else + prio = 2; + + /* get the TBF with the highest priority */ + if (prio > max_prio) { + prio_tfi = tfi; + prio_tbf = tbf; + max_prio = prio; + } + } + + if (prio_tbf) { LOGP(DRLCMACSCHED, LOGL_DEBUG, "Scheduling data message at " - "RTS for DL TFI=%d (TRX=%d, TS=%d)\n", tfi, trx, ts); + "RTS for DL TFI=%d (TRX=%d, TS=%d)\n", prio_tfi, trx, ts); /* next TBF to handle resource is the next one */ - pdch->next_dl_tfi = (tfi + 1) & 31; + pdch->next_dl_tfi = (prio_tfi + 1) & 31; /* generate DL data block */ - msg = tbf->create_dl_acked_block(fn, ts); - break; + msg = prio_tbf->create_dl_acked_block(fn, ts); } return msg; -- cgit v1.2.3