diff options
author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2015-09-01 11:38:40 +0200 |
---|---|---|
committer | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2015-09-01 12:01:20 +0200 |
commit | c8cbfc2c9800929a46ffa71e3bd0f34aa9b42f33 (patch) | |
tree | 71e435baa88eb4d786c89a3a157892894c5b2fdf | |
parent | ae0a799f4472a75912b444cc2f09361aaea27963 (diff) |
bts: Start a DL TBF if needed after establishment of an UL TBF
Currently an existing DL TBF can get lost in the process of
establishing an UL TBF via RACH. This can lead to stalled connections
until the network sends more LLC frames.
This commit adds a check for a non-empty LLC queue after the UL TBF
has been established to rcv_control_ack (GPRS_RLCMAC_UL_ASS_WAIT_ACK
path) to eventually establish a new DL TBF on the UL TBF's PACCH.
Sponsored-by: On-Waves ehf
-rw-r--r-- | src/bts.cpp | 6 | ||||
-rw-r--r-- | src/gprs_ms.h | 9 | ||||
-rw-r--r-- | tests/tbf/TbfTest.cpp | 5 | ||||
-rw-r--r-- | tests/tbf/TbfTest.err | 19 |
4 files changed, 36 insertions, 3 deletions
diff --git a/src/bts.cpp b/src/bts.cpp index 65289158..39737f4e 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -834,6 +834,12 @@ void gprs_rlcmac_pdch::rcv_control_ack(Packet_Control_Acknowledgement_t *packet, "assignment for UL %s\n", tbf_name(new_tbf)); } tbf_assign_control_ts(new_tbf); + /* there might be LLC packets waiting in the queue, but the DL + * TBF might have been released while the UL TBF has been + * established */ + if (new_tbf->ms()->need_dl_tbf()) + new_tbf->establish_dl_tbf_on_pacch(); + return; } LOGP(DRLCMAC, LOGL_ERROR, "Error: received PACET CONTROL ACK " diff --git a/src/gprs_ms.h b/src/gprs_ms.h index 1f080ff2..e820e196 100644 --- a/src/gprs_ms.h +++ b/src/gprs_ms.h @@ -110,6 +110,7 @@ public: void update_error_rate(gprs_rlcmac_tbf *tbf, int percent); bool is_idle() const; + bool need_dl_tbf() const; void* operator new(size_t num); void operator delete(void* p); @@ -175,6 +176,14 @@ inline bool GprsMs::is_idle() const return !m_ul_tbf && !m_dl_tbf && !m_ref && llist_empty(&m_old_tbfs); } +inline bool GprsMs::need_dl_tbf() const +{ + if (dl_tbf() != NULL && dl_tbf()->state_is_not(GPRS_RLCMAC_WAIT_RELEASE)) + return false; + + return llc_queue()->size() > 0; +} + inline uint32_t GprsMs::tlli() const { return m_new_ul_tlli ? m_new_ul_tlli : diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp index 2af7e3a9..92679bcf 100644 --- a/tests/tbf/TbfTest.cpp +++ b/tests/tbf/TbfTest.cpp @@ -895,9 +895,8 @@ static void test_tbf_dl_flow_and_rach_two_phase() ms = the_bts.ms_by_tlli(tlli1); OSMO_ASSERT(ms2 == ms); - /* DL TBF should be the same */ - /* OSMO_ASSERT(ms->dl_tbf()); */ - /* OSMO_ASSERT(ms->dl_tbf() == dl_tbf); */ + /* A DL TBF should still exist */ + OSMO_ASSERT(ms->dl_tbf()); /* No queued packets should be lost */ OSMO_ASSERT(ms->llc_queue()->size() == 2); diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err index 8401e083..70b5c570 100644 --- a/tests/tbf/TbfTest.err +++ b/tests/tbf/TbfTest.err @@ -1825,6 +1825,25 @@ Sending data request: trx=0 ts=7 sapi=5 arfcn=0 fn=2654327 block=9 data=4f 28 5e RX: [PCU <- BTS] TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=ASSIGN) Packet Control Ack TBF: [DOWNLINK] UPLINK ASSIGNED TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=ASSIGN) TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=ASSIGN) changes state from ASSIGN to FLOW +********** TBF starts here ********** +Allocating DL TBF: MS_CLASS=1 +Slot Allocation (Algorithm A) for class 1 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- 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. +- 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 +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. UL DATA TFI=0 received (V(Q)=0 .. V(R)=0) TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) restarting timer 3169 while old timer 3169 pending - BSN 0 storing in window (0..63) |