aboutsummaryrefslogtreecommitdiffstats
path: root/src/gprs_rlcmac_sched.cpp
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2012-07-13 14:46:03 +0200
committerAndreas Eversberg <jolly@eversberg.eu>2012-07-13 14:46:03 +0200
commitb0c7ea72c8157f1b8124bbe105aa05c46a77a005 (patch)
treedda9d26a9e6a8b12022a24bc3ae090b091cb2b97 /src/gprs_rlcmac_sched.cpp
parente266bd48aca6f5b7831eb7c44e4773e9884d4c56 (diff)
Changed data structures for TBF and PDCH instances, to allow multislot
The new data structure is required to define slot/TFI assigment for MS with multislot capability. Now there are two lists for TBFs: uplink and downlink. It is possible to have different TBFs with same TFI in the same direction, as long as they are assigned on different timeslots. See tbf.txt for description. Note: This does not implement any multislot support. It defines the new data structure. Currently only the first slot is assigned.
Diffstat (limited to 'src/gprs_rlcmac_sched.cpp')
-rw-r--r--src/gprs_rlcmac_sched.cpp58
1 files changed, 35 insertions, 23 deletions
diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp
index 4a4b85ca..7d9a156f 100644
--- a/src/gprs_rlcmac_sched.cpp
+++ b/src/gprs_rlcmac_sched.cpp
@@ -61,36 +61,43 @@ int gprs_rlcmac_rcv_rts_block(uint8_t trx, uint8_t ts, uint16_t arfcn,
poll_fn ++;
poll_fn = poll_fn % 2715648;
for (tfi = 0; tfi < 32; tfi++) {
- tbf = pdch->tbf[tfi];
- /* no TBF for this tfi, go next */
- if (!tbf)
- continue;
- /* no polling */
- if (tbf->poll_state != GPRS_RLCMAC_POLL_SCHED)
- continue;
- /* polling for next uplink block */
- if (tbf->poll_fn == poll_fn)
- break;
+ tbf = pdch->ul_tbf[tfi];
+ if (tbf) {
+ /* no polling */
+ if (tbf->poll_state != GPRS_RLCMAC_POLL_SCHED)
+ continue;
+ /* polling for next uplink block */
+ if (tbf->poll_fn == poll_fn)
+ break;
+ }
+ tbf = pdch->dl_tbf[tfi];
+ if (tbf) {
+ /* no polling */
+ if (tbf->poll_state != GPRS_RLCMAC_POLL_SCHED)
+ continue;
+ /* polling for next uplink block */
+ if (tbf->poll_fn == poll_fn)
+ break;
+ }
}
/* found uplink where a block is polled */
if (tfi < 32) {
LOGP(DRLCMACSCHED, LOGL_DEBUG, "Received RTS for PDCH: TRX=%d "
"TS=%d FN=%d block_nr=%d scheduling free USF for "
- "polling at FN=%d of TFI=%d\n", trx, ts, fn, block_nr,
- poll_fn, tfi);
+ "polling at FN=%d of %s TFI=%d\n", trx, ts, fn,
+ block_nr, poll_fn,
+ (tbf->direction == GPRS_RLCMAC_UL_TBF) ? "UL" : "DL",
+ tfi);
/* use free USF */
/* else, we search for uplink ressource */
} else {
/* select uplink ressource */
for (i = 0, tfi = pdch->next_ul_tfi; i < 32;
i++, tfi = (tfi + 1) & 31) {
- tbf = pdch->tbf[tfi];
+ tbf = pdch->ul_tbf[tfi];
/* no TBF for this tfi, go next */
if (!tbf)
continue;
- /* no UL TBF, go next */
- if (tbf->direction != GPRS_RLCMAC_UL_TBF)
- continue;
/* no UL ressources needed, go next */
/* we don't need to give ressources in FINISHED state,
* because we have received all blocks and only poll
@@ -99,11 +106,11 @@ int gprs_rlcmac_rcv_rts_block(uint8_t trx, uint8_t ts, uint16_t arfcn,
continue;
/* use this USF */
- usf = tbf->dir.ul.usf;
+ usf = tbf->dir.ul.usf[ts];
LOGP(DRLCMACSCHED, LOGL_DEBUG, "Received RTS for PDCH: "
"TRX=%d TS=%d FN=%d block_nr=%d scheduling "
"USF=%d for required uplink ressource of "
- "TBF=%d\n", trx, ts, fn, block_nr, usf, tfi);
+ "UL TBF=%d\n", trx, ts, fn, block_nr, usf, tfi);
/* next TBF to handle ressource is the next one */
pdch->next_ul_tfi = (tfi + 1) & 31;
break;
@@ -111,8 +118,11 @@ int gprs_rlcmac_rcv_rts_block(uint8_t trx, uint8_t ts, uint16_t arfcn,
}
/* Prio 1: select control message */
- for (tfi = 0; tfi < 32; tfi++) {
- tbf = pdch->tbf[tfi];
+ for (i = 0; i < 64; i++) {
+ if (i < 32)
+ tbf = pdch->ul_tbf[i];
+ else
+ tbf = pdch->dl_tbf[i & 31];
/* no TBF for this tfi, go next */
if (!tbf)
continue;
@@ -131,7 +141,9 @@ int gprs_rlcmac_rcv_rts_block(uint8_t trx, uint8_t ts, uint16_t arfcn,
msg = gprs_rlcmac_send_uplink_ack(tbf, fn);
if (msg) {
LOGP(DRLCMACSCHED, LOGL_DEBUG, "Scheduling control "
- "message at RTS for TBF=%d\n", tfi);
+ "message at RTS for %s TBF=%d\n",
+ (tbf->direction == GPRS_RLCMAC_UL_TBF)
+ ? "UL" : "DL", tbf->tfi);
break;
}
}
@@ -141,7 +153,7 @@ int gprs_rlcmac_rcv_rts_block(uint8_t trx, uint8_t ts, uint16_t arfcn,
/* select downlink ressource */
for (i = 0, tfi = pdch->next_dl_tfi; i < 32;
i++, tfi = (tfi + 1) & 31) {
- tbf = pdch->tbf[tfi];
+ tbf = pdch->dl_tbf[tfi];
/* no TBF for this tfi, go next */
if (!tbf)
continue;
@@ -154,7 +166,7 @@ int gprs_rlcmac_rcv_rts_block(uint8_t trx, uint8_t ts, uint16_t arfcn,
continue;
LOGP(DRLCMACSCHED, LOGL_DEBUG, "Scheduling data "
- "message at RTS for TBF=%d\n", tfi);
+ "message at RTS for DL TBF=%d\n", tfi);
/* next TBF to handle ressource is the next one */
pdch->next_dl_tfi = (tfi + 1) & 31;
/* generate DL data block */