tbf: Do not reuse old TBF after RACH requests

Currently existing TBF can be reused after an MS has sent a RACH
request. Since the MS can be or most probably is in packet idle mode
in that case, the TBF are no longer usable even if they share the
PDCHs and the control TS with the new one.

There are occasional freezes where the MS does no longer react to
messages sent on the PACCH.

This change aborts all pending TBFs if a new TBF is or has been
established via RACH.

Sponsored-by: On-Waves ehf
This commit is contained in:
Jacob Erlbeck 2016-01-21 20:48:39 +01:00
parent f04a5b33ec
commit 5f93f855a7
4 changed files with 33 additions and 28 deletions

View File

@ -1114,28 +1114,24 @@ void gprs_rlcmac_pdch::rcv_resource_request(Packet_Resource_Request_t *request,
ta = ms->ta();
}
/* We got a RACH so the MS was in packet idle mode and thus
* didn't have any active TBFs */
if (ul_tbf) {
LOGP(DRLCMACUL, LOGL_NOTICE, "Got RACH from "
"TLLI=0x%08x while %s still "
"exists. Killing pending UL TBF\n",
tlli, tbf_name(ul_tbf));
/* The MS will not use the old TBF again, so we can
* safely throw it away immediately */
tbf_free(ul_tbf);
ul_tbf = NULL;
}
if (dl_tbf) {
/* TODO: There a chance that releasing dl_tbf can be
* avoided if this PDCH is the control TS of dl_tbf,
* but this needs to be checked with the spec. If an MS
* losed the DL TBF because of PDCH mismatches only,
* this check would make sense. */
LOGP(DRLCMACUL, LOGL_NOTICE, "Got RACH from "
"TLLI=0x%08x while %s still exists. "
"Release pending DL TBF\n", tlli,
tbf_name(dl_tbf));
dl_tbf->release();
tbf_free(dl_tbf);
dl_tbf = NULL;
}
LOGP(DRLCMAC, LOGL_DEBUG, "MS requests UL TBF "
"in packet resource request of single "

View File

@ -1072,15 +1072,8 @@ int gprs_rlcmac_tbf::set_tlli_from_ul(uint32_t new_tlli)
if (!ms())
set_ms(old_ms);
/* there might be an active and valid downlink TBF */
if (!ms()->dl_tbf() && dl_tbf)
/* Move it to the current MS (see the guard above) */
dl_tbf->set_ms(ms());
}
/* The TLLI has been taken from an UL message */
update_ms(new_tlli, GPRS_RLCMAC_UL_TBF);
if (dl_tbf && dl_tbf->ms() != ms()) {
LOGP(DRLCMACUL, LOGL_NOTICE, "Got RACH from "
"TLLI=0x%08x while %s still exists. "
@ -1097,6 +1090,14 @@ int gprs_rlcmac_tbf::set_tlli_from_ul(uint32_t new_tlli)
tbf_free(ul_tbf);
ul_tbf = NULL;
}
/* The TLLI has been taken from an UL message */
update_ms(new_tlli, GPRS_RLCMAC_UL_TBF);
#if 0 /* REMOVEME ??? */
if (ms()->need_dl_tbf())
establish_dl_tbf_on_pacch();
#endif
return 1;
}

View File

@ -963,9 +963,8 @@ static void test_tbf_dl_flow_and_rach_single_phase()
OSMO_ASSERT(ms2 == ms);
OSMO_ASSERT(ms1 != ms);
/* DL TBF should be the same */
OSMO_ASSERT(ms->dl_tbf());
OSMO_ASSERT(ms->dl_tbf() == dl_tbf);
/* DL TBF should be removed */
OSMO_ASSERT(!ms->dl_tbf());
/* No queued packets should be lost */
OSMO_ASSERT(ms->llc_queue()->size() == 2);

View File

@ -1902,8 +1902,12 @@ Got RLC block, coding scheme: CS-1, length: 23 (23))
+++++++++++++++++++++++++ RX : Uplink Control Block +++++++++++++++++++++++++
------------------------- RX : Uplink Control Block -------------------------
Got RACH from TLLI=0xf1223344 while TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) still exists. Release pending DL TBF
TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) changes state from ASSIGN to WAIT RELEASE
TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=WAIT RELEASE) restarting timer 3193 while old timer 0 pending
TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) changes state from ASSIGN to RELEASING
TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=RELEASING) free
TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=RELEASING) stopping timer 0.
PDCH(TS 7, TRX 0): Detaching TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=RELEASING), 0 TBFs, USFs = 00, TFIs = 00000000.
Detaching TBF from MS object, TLLI = 0xf1223344, TBF = TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=RELEASING)
********** TBF ends here **********
MS requests UL TBF in packet resource request of single block, so we provide one:
********** TBF starts here **********
Allocating UL TBF: MS_CLASS=1/0
@ -1945,15 +1949,15 @@ Slot Allocation (Algorithm A) for class 1
- Skipping TS 4, because not enabled
- Skipping TS 5, because not enabled
- Skipping TS 6, because not enabled
- Assign downlink TS=7 TFI=1
PDCH(TS 7, TRX 0): Attaching TBF(TFI=1 TLLI=0x00000000 DIR=DL STATE=NULL), 2 TBFs, USFs = 01, TFIs = 00000003.
- Assign downlink TS=7 TFI=0
PDCH(TS 7, TRX 0): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 01, TFIs = 00000001.
- Setting Control TS 7
Attaching TBF to MS object, TLLI = 0xf1223344, TBF = TBF(TFI=1 TLLI=0xf1223344 DIR=DL STATE=NULL)
Allocated TBF(TFI=1 TLLI=0xf1223344 DIR=DL STATE=NULL): trx = 0, ul_slots = 80, dl_slots = 80
Attaching TBF to MS object, TLLI = 0xf1223344, TBF = TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=NULL)
Allocated TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=NULL): trx = 0, ul_slots = 80, dl_slots = 80
TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) Trigger downlink assignment on PACCH
Send dowlink assignment on PACCH, because TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) exists
TBF(TFI=1 TLLI=0xf1223344 DIR=DL STATE=NULL) changes state from NULL to ASSIGN
TBF(TFI=1 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) starting timer 0.
TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=NULL) changes state from NULL to ASSIGN
TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) starting timer 0.
Got RLC block, coding scheme: CS-1, length: 23 (23))
UL data: 3c 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Got CS-1 RLC block: R=0, SI=0, TFI=0, CPS=0, RSB=0, rc=184
@ -2096,8 +2100,13 @@ TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=FLOW): Got CS-1 RLC data block: CV=0, BSN
- BSN 0 storing in window (0..63)
TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=FLOW): data_length=20, data=f1 22 33 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Decoded premier TLLI=0x00000000 of UL DATA TFI=0.
Detaching TBF from MS object, TLLI = 0xf1223344, TBF = TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN)
Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=ASSIGN)
Got RACH from TLLI=0x00000000 while TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) still exists. Killing pending DL TBF
TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) changes state from ASSIGN to RELEASING
TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=RELEASING) free
TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=RELEASING) stopping timer 0.
PDCH(TS 7, TRX 0): Detaching TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=RELEASING), 0 TBFs, USFs = 01, TFIs = 00000000.
Detaching TBF from MS object, TLLI = 0xf1223344, TBF = TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=RELEASING)
********** TBF ends here **********
Modifying MS object, TLLI = 0x00000000, IMSI '' -> '0011223344'
Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1
Clearing MS object, TLLI: 0xf1223344, IMSI: '0011223344'