From d21e961a8ba3eb1b162a04385400a71931fca30c Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Fri, 26 Jun 2020 14:20:37 +0200 Subject: [PATCH] tbf: Drop unneeded method set_tlli_from_ul Since commit 322456ed474a733094c9f3e240295b469023ad14 (and previous one), it is expected that a tbf object ALWAYS has a MS object referend to it, even if it's a temporary copy which will later be merged when TLLI/IMSI is retrieved and it is found that several MS objects relate to the same MS. The purpose of set_tlli_from_ul was mainly to update TBF's ms() to old_ms before going through usual tbf->update_ms() path. That's not really needed since ms() is already always set and TBFs for old_ms are already freed in update_ms() and children function. Change-Id: Ie8795e7a02032336e53febb65c11f9150c36d2a0 --- src/tbf.cpp | 46 ------------------------------------------- src/tbf.h | 1 - src/tbf_dl.cpp | 2 -- src/tbf_ul.cpp | 2 +- tests/tbf/TbfTest.err | 3 +-- 5 files changed, 2 insertions(+), 52 deletions(-) diff --git a/src/tbf.cpp b/src/tbf.cpp index 0cc01295..f77b1e29 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -392,9 +392,6 @@ void gprs_rlcmac_tbf::merge_and_clear_ms(GprsMs *old_ms) void gprs_rlcmac_tbf::update_ms(uint32_t tlli, enum gprs_rlcmac_tbf_direction dir) { - if (!ms()) - return; - if (!tlli) return; @@ -1439,49 +1436,6 @@ int gprs_rlcmac_tbf::establish_dl_tbf_on_pacch() return 0; } -int gprs_rlcmac_tbf::set_tlli_from_ul(uint32_t new_tlli) -{ - struct gprs_rlcmac_tbf *dl_tbf = NULL; - struct gprs_rlcmac_tbf *ul_tbf = NULL; - GprsMs *old_ms; - - OSMO_ASSERT(direction == GPRS_RLCMAC_UL_TBF); - - old_ms = bts->ms_by_tlli(new_tlli); - /* Keep the old MS object for the update_ms() */ - GprsMs::Guard guard(old_ms); - if (old_ms) { - /* Get them before calling set_ms() */ - dl_tbf = old_ms->dl_tbf(); - ul_tbf = old_ms->ul_tbf(); - - if (!ms()) - set_ms(old_ms); - } - - if (dl_tbf && dl_tbf->ms() != ms()) { - LOGPTBFUL(dl_tbf, LOGL_NOTICE, - "Got RACH from TLLI=0x%08x while TBF still exists: killing pending DL TBF\n", new_tlli); - tbf_free(dl_tbf); - dl_tbf = NULL; - } - if (ul_tbf && ul_tbf->ms() != ms()) { - LOGPTBFUL(ul_tbf, LOGL_NOTICE, - "Got RACH from TLLI=0x%08x while TBF still exists: killing pending UL TBF\n", 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; -} - const char *tbf_name(gprs_rlcmac_tbf *tbf) { return tbf ? tbf->name() : "(no TBF)"; diff --git a/src/tbf.h b/src/tbf.h index be3336a9..528bee35 100644 --- a/src/tbf.h +++ b/src/tbf.h @@ -319,7 +319,6 @@ struct gprs_rlcmac_tbf { protected: gprs_rlcmac_bts *bts_data() const; void enable_egprs(); - int set_tlli_from_ul(uint32_t new_tlli); void merge_and_clear_ms(GprsMs *old_ms); gprs_llc_queue *llc_queue(); diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp index 03149bad..02aaa3a0 100644 --- a/src/tbf_dl.cpp +++ b/src/tbf_dl.cpp @@ -151,8 +151,6 @@ static int tbf_new_dl_assignment(struct gprs_rlcmac_bts *bts, ul_tbf = ms->ul_tbf(); ta = ms->ta(); - /* TODO: if (!ms) create MS before tbf_alloc is called? */ - if (ul_tbf && ul_tbf->m_contention_resolution_done && !ul_tbf->m_final_ack_sent) { use_trx = ul_tbf->trx->trx_no; diff --git a/src/tbf_ul.cpp b/src/tbf_ul.cpp index 31150801..489fc871 100644 --- a/src/tbf_ul.cpp +++ b/src/tbf_ul.cpp @@ -305,7 +305,7 @@ int gprs_rlcmac_ul_tbf::rcv_data_block_acknowledged( LOGPTBFUL(this, LOGL_INFO, "Decoded premier TLLI=0x%08x of UL DATA TFI=%d.\n", new_tlli, rlc->tfi); - set_tlli_from_ul(new_tlli); + update_ms(new_tlli, GPRS_RLCMAC_UL_TBF); } else if (new_tlli && new_tlli != tlli()) { LOGPTBFUL(this, LOGL_NOTICE, "TLLI mismatch on UL DATA TFI=%d. (Ignoring due to contention resolution)\n", diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err index 827f5ce5..0d097ee2 100644 --- a/tests/tbf/TbfTest.err +++ b/tests/tbf/TbfTest.err @@ -2079,7 +2079,6 @@ TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=FLOW) Got CS-1 RLC data block: CV=0, BSN= TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=FLOW) 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 TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=FLOW) Decoded premier TLLI=0xf1223344 of UL DATA TFI=0. -TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) Got RACH from TLLI=0xf1223344 while TBF 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 T0 [freeing TBF] @@ -2089,8 +2088,8 @@ Detaching TBF from MS object, TLLI = 0xf1223344, TBF = TBF(TFI=0 TLLI=0xf1223344 Modifying MS object, TLLI = 0x00000000, IMSI '' -> '0011223344' Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 Clearing MS object, TLLI: 0xf1223344, IMSI: '0011223344' -Modifying MS object, UL TLLI: 0x00000000 -> 0xf1223344, not yet confirmed Destroying MS object, TLLI = 0x00000000 +Modifying MS object, UL TLLI: 0x00000000 -> 0xf1223344, not yet confirmed TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) Assembling frames: (len=20) TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) Frame 1 starts at offset 4, length=16, is_complete=1 TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) complete UL frame len=16