aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-11-26 16:39:28 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-12-18 12:09:47 +0100
commit309638f1c0dfc706bfcd5b999af2003d7aacb76c (patch)
tree6a811772384d26f3aea7b9535493aee468ec0426
parent15acdad0b6d7a3649ab9a70137a4c11a23599d16 (diff)
scheduling hacks..
-rw-r--r--src/bts.h1
-rw-r--r--src/gprs_rlcmac_sched.cpp40
2 files changed, 25 insertions, 16 deletions
diff --git a/src/bts.h b/src/bts.h
index 923a6ed..67b3a59 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -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 a3211ee..3df8610 100644
--- a/src/gprs_rlcmac_sched.cpp
+++ b/src/gprs_rlcmac_sched.cpp
@@ -106,7 +106,7 @@ static uint8_t sched_select_uplink(uint8_t trx, uint8_t ts, uint32_t fn,
return usf;
}
-static struct msgb *sched_select_ctrl_msg(struct gprs_rlcmac_bts *bts,
+static struct msgb *sched_select_ctrl_msg(
uint8_t trx, uint8_t ts, uint32_t fn,
uint8_t block_nr, struct gprs_rlcmac_pdch *pdch,
struct gprs_rlcmac_tbf *ul_ass_tbf,
@@ -115,22 +115,30 @@ static struct msgb *sched_select_ctrl_msg(struct gprs_rlcmac_bts *bts,
{
struct msgb *msg = NULL;
struct gprs_rlcmac_tbf *tbf = NULL;
+ struct gprs_rlcmac_tbf *tbf_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(tbf_list); ++i) {
+ tbf = tbf_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;
+ pdch->next_ctrl_prio %= 3;
+ break;
}
+
/* any message */
if (msg) {
tbf->rotate_in_list();
@@ -257,7 +265,7 @@ int gprs_rlcmac_rcv_rts_block(struct gprs_rlcmac_bts *bts,
usf = sched_select_uplink(trx, ts, fn, block_nr, pdch);
/* Prio 1: select control message */
- msg = sched_select_ctrl_msg(bts, trx, ts, fn, block_nr, pdch, ul_ass_tbf,
+ msg = sched_select_ctrl_msg(trx, ts, fn, block_nr, pdch, ul_ass_tbf,
dl_ass_tbf, ul_ack_tbf);
/* Prio 2: select data message for downlink */