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.
This commit is contained in:
Andreas Eversberg 2012-07-15 16:27:01 +02:00
parent 06f96cd5a7
commit ee31b78cfd
3 changed files with 24 additions and 11 deletions

View File

@ -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;

View File

@ -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 "

View File

@ -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);
}