diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp index c4d27e85..9b977f29 100644 --- a/src/gprs_bssgp_pcu.cpp +++ b/src/gprs_bssgp_pcu.cpp @@ -177,9 +177,8 @@ int gprs_bssgp_pcu_rx_dl_ud(struct msgb *msg, struct tlv_parsed *tp) /* check for uplink data, so we copy our informations */ tbf = tbf_by_tlli(tlli, GPRS_RLCMAC_UL_TBF); - if (tbf && tbf->contention_resolution_done - && (tbf->state != GPRS_RLCMAC_FINISHED - || tbf->ul_ack_state != GPRS_RLCMAC_UL_ACK_WAIT_ACK)) { + if (tbf && tbf->dir.ul.contention_resolution_done + && !tbf->dir.ul.final_ack_sent) { use_trx = tbf->trx; first_ts = tbf->first_ts; ta = tbf->ta; diff --git a/src/gprs_rlcmac.h b/src/gprs_rlcmac.h index 7291f77a..fc4173de 100644 --- a/src/gprs_rlcmac.h +++ b/src/gprs_rlcmac.h @@ -139,7 +139,6 @@ 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; @@ -187,6 +186,8 @@ struct gprs_rlcmac_tbf { int32_t rx_counter; /* count all received blocks */ uint8_t n3103; /* N3103 counter */ uint8_t usf[8]; /* list USFs per PDCH (timeslot) */ + uint8_t contention_resolution_done; /* set after done */ + uint8_t final_ack_sent; /* set if we sent final ack */ } ul; } dir; uint8_t rlc_block[RLC_MAX_SNS/2][RLC_MAX_LEN]; /* block history */ diff --git a/src/gprs_rlcmac_data.cpp b/src/gprs_rlcmac_data.cpp index 58985e0d..69cfe136 100644 --- a/src/gprs_rlcmac_data.cpp +++ b/src/gprs_rlcmac_data.cpp @@ -256,7 +256,7 @@ uplink_request: } ul_tbf->tlli = tbf->tlli; ul_tbf->tlli_valid = 1; /* no contention resolution */ - ul_tbf->contention_resolution_done = 1; + ul_tbf->dir.ul.contention_resolution_done = 1; ul_tbf->ta = tbf->ta; /* use current TA */ tbf_new_state(ul_tbf, GPRS_RLCMAC_ASSIGN); tbf_timer_start(ul_tbf, 3169, bts->t3169, 0); @@ -586,13 +586,14 @@ struct msgb *gprs_rlcmac_send_uplink_ack(struct gprs_rlcmac_tbf *tbf, /* 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; + tbf->dir.ul.contention_resolution_done = 1; if (final) { tbf->poll_state = GPRS_RLCMAC_POLL_SCHED; tbf->poll_fn = (fn + 13) % 2715648; /* waiting for final acknowledge */ tbf->ul_ack_state = GPRS_RLCMAC_UL_ACK_WAIT_ACK; + tbf->dir.ul.final_ack_sent = 1; } else tbf->ul_ack_state = GPRS_RLCMAC_UL_ACK_NONE; @@ -1432,7 +1433,7 @@ struct msgb *gprs_rlcmac_send_packet_downlink_assignment( 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) { + if (!tbf->dir.ul.contention_resolution_done) { LOGP(DRLCMAC, LOGL_DEBUG, "Cannot assign DL TBF now, " "because contention resolution is not " "finished.\n");