aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2012-07-15 16:27:01 +0200
committerAndreas Eversberg <jolly@eversberg.eu>2012-07-15 16:27:01 +0200
commitee31b78cfd0945e92a8e11e1460e57886cd5b854 (patch)
treebf70afc74f6b2d54d95b87fb4038968452f8c94c
parent06f96cd5a72e475db44bda14a9bf86bed4260857 (diff)
Fixed contention resolution issue
In order to do downlink assignment during uplink TBF, the content resolution must be completed. It is completed when the first Packet Uplink Ack/Nack message is transmitted to the mobile.
-rw-r--r--src/gprs_rlcmac.h1
-rw-r--r--src/gprs_rlcmac_data.cpp20
-rw-r--r--src/gprs_rlcmac_sched.cpp14
3 files changed, 24 insertions, 11 deletions
diff --git a/src/gprs_rlcmac.h b/src/gprs_rlcmac.h
index 1e6bc0d2..ae188f13 100644
--- a/src/gprs_rlcmac.h
+++ b/src/gprs_rlcmac.h
@@ -134,6 +134,7 @@ struct gprs_rlcmac_tbf {
uint8_t tfi;
uint32_t tlli;
uint8_t tlli_valid;
+ uint8_t contention_resolution_done; /* set after done */
uint8_t trx;
uint16_t arfcn;
uint8_t tsc;
diff --git a/src/gprs_rlcmac_data.cpp b/src/gprs_rlcmac_data.cpp
index 9b3a0953..76cc0332 100644
--- a/src/gprs_rlcmac_data.cpp
+++ b/src/gprs_rlcmac_data.cpp
@@ -218,7 +218,7 @@ uplink_request:
break;
}
ul_tbf->tlli = tbf->tlli;
- ul_tbf->tlli_valid = 1; /* no content resolution */
+ ul_tbf->tlli_valid = 1; /* no contention resolution */
ul_tbf->ta = tbf->ta; /* use current TA */
tbf_new_state(ul_tbf, GPRS_RLCMAC_FLOW);
tbf_timer_start(ul_tbf, 3169, bts->t3169, 0);
@@ -550,6 +550,10 @@ struct msgb *gprs_rlcmac_send_uplink_ack(struct gprs_rlcmac_tbf *tbf,
bitvec_free(ack_vec);
free(mac_control_block);
+ /* now we must set this flag, so we are allowed to assign downlink
+ * TBF on PACCH. it is only allowed when TLLI is aknowledged. */
+ tbf->contention_resolution_done = 1;
+
if (final) {
tbf->poll_state = GPRS_RLCMAC_POLL_SCHED;
tbf->poll_fn = (fn + 13) % 2715648;
@@ -1143,6 +1147,8 @@ tx_block:
"sheduled in this TS %d, waiting for "
"TS %d\n", ts, tbf->control_ts);
else {
+ LOGP(DRLCMAC, LOGL_DEBUG, "Polling sheduled in this "
+ "TS %d\n", ts);
/* start timer whenever we send the final block */
if (rh->fbi == 1)
tbf_timer_start(tbf, 3191, bts->t3191, 0);
@@ -1308,9 +1314,17 @@ struct msgb *gprs_rlcmac_send_packet_downlink_assignment(
#endif
/* on uplink TBF we get the downlink TBF to be assigned. */
- if (tbf->direction == GPRS_RLCMAC_UL_TBF)
+ if (tbf->direction == GPRS_RLCMAC_UL_TBF) {
+ /* be sure to check first, if contention resolution is done,
+ * otherwise we cannot send the assignment yet */
+ if (!tbf->contention_resolution_done) {
+ LOGP(DRLCMAC, LOGL_NOTICE, "Cannot assign DL TBF now, "
+ "because contention resolution is not "
+ "finished.\n");
+ return NULL;
+ }
new_tbf = tbf_by_tlli(tbf->tlli, GPRS_RLCMAC_DL_TBF);
- else
+ } else
new_tbf = tbf;
if (!new_tbf) {
LOGP(DRLCMACDL, LOGL_ERROR, "We have a schedule for downlink "
diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp
index f88b09b5..cd995166 100644
--- a/src/gprs_rlcmac_sched.cpp
+++ b/src/gprs_rlcmac_sched.cpp
@@ -69,12 +69,12 @@ int gprs_rlcmac_rcv_rts_block(uint8_t trx, uint8_t ts, uint16_t arfcn,
if (tbf->poll_state == GPRS_RLCMAC_POLL_SCHED
&& tbf->poll_fn == poll_fn)
poll_tbf = tbf;
+ if (tbf->ul_ack_state == GPRS_RLCMAC_UL_ACK_SEND_ACK)
+ ul_ack_tbf = tbf;
if (tbf->dl_ass_state == GPRS_RLCMAC_DL_ASS_SEND_ASS)
dl_ass_tbf = tbf;
if (tbf->ul_ass_state == GPRS_RLCMAC_UL_ASS_SEND_ASS)
ul_ass_tbf = tbf;
- if (tbf->ul_ack_state == GPRS_RLCMAC_UL_ACK_SEND_ACK)
- ul_ack_tbf = tbf;
}
llist_for_each_entry(tbf, &gprs_rlcmac_dl_tbfs, list) {
/* this trx, this ts */
@@ -88,8 +88,6 @@ int gprs_rlcmac_rcv_rts_block(uint8_t trx, uint8_t ts, uint16_t arfcn,
dl_ass_tbf = tbf;
if (tbf->ul_ass_state == GPRS_RLCMAC_UL_ASS_SEND_ASS)
ul_ass_tbf = tbf;
- if (tbf->ul_ack_state == GPRS_RLCMAC_UL_ACK_SEND_ACK)
- ul_ack_tbf = tbf;
}
/* check uplink ressource for polling */
@@ -134,14 +132,14 @@ int gprs_rlcmac_rcv_rts_block(uint8_t trx, uint8_t ts, uint16_t arfcn,
if (dl_ass_tbf) {
tbf = dl_ass_tbf;
msg = gprs_rlcmac_send_packet_downlink_assignment(tbf, fn);
- } else
+ }
/* schedule PACKET UPLINK ASSIGNMENT */
- if (ul_ass_tbf) {
+ if (!msg && ul_ass_tbf) {
tbf = ul_ass_tbf;
msg = gprs_rlcmac_send_packet_uplink_assignment(tbf, fn);
- } else
+ }
/* schedule PACKET UPLINK ACK */
- if (ul_ack_tbf) {
+ if (!msg && ul_ack_tbf) {
tbf = ul_ack_tbf;
msg = gprs_rlcmac_send_uplink_ack(tbf, fn);
}