diff options
-rw-r--r-- | src/bts.cpp | 40 | ||||
-rw-r--r-- | src/bts.h | 3 | ||||
-rw-r--r-- | src/tbf.cpp | 37 | ||||
-rw-r--r-- | src/tbf.h | 5 | ||||
-rw-r--r-- | src/tbf_dl.cpp | 11 | ||||
-rw-r--r-- | tests/alloc/AllocTest.cpp | 16 | ||||
-rw-r--r-- | tests/tbf/TbfTest.cpp | 2 | ||||
-rw-r--r-- | tests/tbf/TbfTest.err | 5 |
8 files changed, 19 insertions, 100 deletions
diff --git a/src/bts.cpp b/src/bts.cpp index 72c33ed4..371d3691 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -217,39 +217,6 @@ int BTS::add_paging(uint8_t chan_needed, uint8_t *identity_lv) return 0; } -/* search for active downlink tbf */ -gprs_rlcmac_dl_tbf *BTS::dl_tbf_by_tlli(uint32_t tlli) -{ - return static_cast<gprs_rlcmac_dl_tbf *>(tbf_by_tlli(tlli, GPRS_RLCMAC_DL_TBF)); -} - -/* search for active uplink tbf */ -gprs_rlcmac_ul_tbf *BTS::ul_tbf_by_tlli(uint32_t tlli) -{ - return static_cast<gprs_rlcmac_ul_tbf *>(tbf_by_tlli(tlli, GPRS_RLCMAC_UL_TBF)); -} - -/* search for active downlink or uplink tbf */ -gprs_rlcmac_tbf *BTS::tbf_by_tlli(uint32_t tlli, enum gprs_rlcmac_tbf_direction dir) -{ - struct gprs_rlcmac_tbf *tbf; - struct llist_pods *lpods; - if (dir == GPRS_RLCMAC_UL_TBF) { - llist_pods_for_each_entry(tbf, &m_bts.ul_tbfs, list, lpods) { - if (tbf->state_is_not(GPRS_RLCMAC_RELEASING) - && tbf->tlli() == tlli && tbf->is_tlli_valid()) - return tbf; - } - } else { - llist_pods_for_each_entry(tbf, &m_bts.dl_tbfs, list, lpods) { - if (tbf->state_is_not(GPRS_RLCMAC_RELEASING) - && tbf->tlli() == tlli && tbf->is_tlli_valid()) - return tbf; - } - } - return NULL; -} - gprs_rlcmac_dl_tbf *BTS::dl_tbf_by_poll_fn(uint32_t fn, uint8_t trx, uint8_t ts) { struct gprs_rlcmac_dl_tbf *tbf; @@ -377,9 +344,10 @@ int BTS::tfi_find_free(enum gprs_rlcmac_tbf_direction dir, int BTS::rcv_imm_ass_cnf(const uint8_t *data, uint32_t fn) { - struct gprs_rlcmac_dl_tbf *dl_tbf; + struct gprs_rlcmac_dl_tbf *dl_tbf = NULL; uint8_t plen; uint32_t tlli; + GprsMs *ms; /* move to IA Rest Octets */ plen = data[0] >> 2; @@ -399,7 +367,9 @@ int BTS::rcv_imm_ass_cnf(const uint8_t *data, uint32_t fn) tlli |= (*data++) << 4; tlli |= (*data++) >> 4; - dl_tbf = dl_tbf_by_tlli(tlli); + ms = ms_by_tlli(tlli); + if (ms) + dl_tbf = ms->dl_tbf(); if (!dl_tbf) { LOGP(DRLCMAC, LOGL_ERROR, "Got IMM.ASS confirm, but TLLI=%08x " "does not exit\n", tlli); @@ -206,8 +206,6 @@ public: /** add paging to paging queue(s) */ int add_paging(uint8_t chan_needed, uint8_t *identity_lv); - gprs_rlcmac_dl_tbf *dl_tbf_by_tlli(uint32_t tlli); - gprs_rlcmac_ul_tbf *ul_tbf_by_tlli(uint32_t tlli); gprs_rlcmac_dl_tbf *dl_tbf_by_poll_fn(uint32_t fn, uint8_t trx, uint8_t ts); gprs_rlcmac_ul_tbf *ul_tbf_by_poll_fn(uint32_t fn, uint8_t trx, uint8_t ts); gprs_rlcmac_dl_tbf *dl_tbf_by_tfi(uint8_t tfi, uint8_t trx); @@ -258,7 +256,6 @@ private: SBAController m_sba; TimingAdvance m_ta; struct rate_ctr_group *m_ratectrs; - gprs_rlcmac_tbf *tbf_by_tlli(uint32_t tlli, enum gprs_rlcmac_tbf_direction dir); gprs_rlcmac_tbf *tbf_by_tfi(uint8_t tfi, uint8_t trx, enum gprs_rlcmac_tbf_direction dir); GprsMsStorage m_ms_store; diff --git a/src/tbf.cpp b/src/tbf.cpp index e3602e2b..8f8e5385 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -48,7 +48,7 @@ gprs_rlcmac_bts *gprs_rlcmac_tbf::bts_data() const uint32_t gprs_rlcmac_tbf::tlli() const { - return m_ms ? m_ms->tlli() : m_tlli; + return m_ms ? m_ms->tlli() : 0; } void gprs_rlcmac_tbf::assign_imsi(const char *imsi) @@ -129,8 +129,6 @@ gprs_rlcmac_ul_tbf *tbf_alloc_ul(struct gprs_rlcmac_bts *bts, /* FIXME: send reject */ return NULL; } - tbf->m_tlli = tlli; - tbf->m_tlli_valid = 1; /* no contention resolution */ tbf->m_contention_resolution_done = 1; tbf->ta = ta; /* use current TA */ tbf->set_state(GPRS_RLCMAC_ASSIGN); @@ -242,14 +240,8 @@ int gprs_rlcmac_tbf::update() if (direction != GPRS_RLCMAC_DL_TBF) return -EINVAL; - if (ms()) { + if (ms()) ul_tbf = ms()->ul_tbf(); - } else if (is_tlli_valid()) { - LOGP(DRLCMAC, LOGL_NOTICE, - "Using ul_tbf_by_tlli() since there is no MS object for " - "TLLI 0x%08x\n", m_tlli); - ul_tbf = bts->ul_tbf_by_tlli(m_tlli); - } tbf_unlink_pdch(this); rc = bts_data->alloc_algorithm(bts_data, ul_tbf, this, bts_data->alloc_algorithm_curst, 0); @@ -762,8 +754,8 @@ struct msgb *gprs_rlcmac_tbf::create_ul_ass(uint32_t fn) bitvec_unhex(ass_vec, "2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b"); Encoding::write_packet_uplink_assignment(bts_data(), ass_vec, m_tfi, - (direction == GPRS_RLCMAC_DL_TBF), m_tlli, - m_tlli_valid, new_tbf, 1, bts_data()->alpha, + (direction == GPRS_RLCMAC_DL_TBF), tlli(), + is_tlli_valid(), new_tbf, 1, bts_data()->alpha, bts_data()->gamma, -1); bitvec_pack(ass_vec, msgb_put(msg, 23)); RlcMacDownlink_t * mac_control_block = (RlcMacDownlink_t *)talloc_zero(tall_pcu_ctx, RlcMacDownlink_t); @@ -809,25 +801,10 @@ void gprs_rlcmac_tbf::free_all(struct gprs_rlcmac_pdch *pdch) } } -void gprs_rlcmac_tbf::tlli_mark_valid() -{ - m_tlli_valid = true; -} - void gprs_rlcmac_tbf::update_tlli(uint32_t tlli) { - if (tlli == m_tlli) - return; - - bool changedUl = false; - /* update the timing advance for the new tlli */ - bts->timing_advance()->update(m_tlli, tlli, ta); - - LOGP(DRLCMAC, LOGL_NOTICE, - "%s changing tlli from TLLI=0x%08x TLLI=0x%08x ul_changed=%d\n", - tbf_name(this), m_tlli, tlli, changedUl); - m_tlli = tlli; + bts->timing_advance()->update(0, tlli, ta); } int gprs_rlcmac_tbf::extract_tlli(const uint8_t *data, const size_t len) @@ -883,8 +860,6 @@ int gprs_rlcmac_tbf::extract_tlli(const uint8_t *data, const size_t len) tbf_free(ul_tbf); ul_tbf = NULL; } - /* mark TLLI valid now */ - tlli_mark_valid(); /* store current timing advance */ bts->timing_advance()->remember(tlli(), ta); return 1; @@ -899,7 +874,7 @@ const char *gprs_rlcmac_tbf::name() const { snprintf(m_name_buf, sizeof(m_name_buf) - 1, "TBF(TFI=%d TLLI=0x%08x DIR=%s STATE=%s)", - m_tfi, m_tlli, + m_tfi, tlli(), direction == GPRS_RLCMAC_UL_TBF ? "UL" : "DL", state_name() ); @@ -141,7 +141,6 @@ struct gprs_rlcmac_tbf { void update_tlli(uint32_t tlli); uint32_t tlli() const; bool is_tlli_valid() const; - void tlli_mark_valid(); /** MS updating */ void update_ms(uint32_t tlli, enum gprs_rlcmac_tbf_direction); @@ -221,8 +220,6 @@ struct gprs_rlcmac_tbf { * private fields. We can't make it private as it is breaking the * llist macros. */ - uint32_t m_tlli; - uint8_t m_tlli_valid; uint8_t m_tfi; time_t m_created_ts; @@ -295,7 +292,7 @@ inline GprsMs *gprs_rlcmac_tbf::ms() inline bool gprs_rlcmac_tbf::is_tlli_valid() const { - return m_tlli_valid; + return tlli() != 0; } inline uint8_t gprs_rlcmac_tbf::tfi() const diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp index d2720aed..605239a3 100644 --- a/src/tbf_dl.cpp +++ b/src/tbf_dl.cpp @@ -205,8 +205,6 @@ static int tbf_new_dl_assignment(struct gprs_rlcmac_bts *bts, bts->bts->llc_dropped_frame(); return -EBUSY; } - dl_tbf->m_tlli = tlli; - dl_tbf->m_tlli_valid = 1; dl_tbf->ta = ta; dl_tbf->update_ms(tlli, GPRS_RLCMAC_DL_TBF); @@ -316,7 +314,7 @@ struct msgb *gprs_rlcmac_dl_tbf::llc_dequeue(bssgp_bvc_ctx *bctx) frames = 0xff; if (octets > 0xffffff) octets = 0xffffff; - bssgp_tx_llc_discarded(bctx, m_tlli, frames, octets); + bssgp_tx_llc_discarded(bctx, tlli(), frames, octets); } return msg; @@ -796,15 +794,13 @@ void gprs_rlcmac_dl_tbf::reuse_tbf(const uint8_t *data, const uint16_t len) if (!new_tbf) { LOGP(DRLCMAC, LOGL_NOTICE, "No PDCH resource\n"); - bssgp_tx_llc_discarded(gprs_bssgp_pcu_current_bctx(), m_tlli, + bssgp_tx_llc_discarded(gprs_bssgp_pcu_current_bctx(), tlli(), 1, len); bts->llc_dropped_frame(); return; } new_tbf->set_ms(ms()); - new_tbf->m_tlli = m_tlli; - new_tbf->m_tlli_valid = m_tlli_valid; new_tbf->ta = ta; new_tbf->assign_imsi(m_imsi); @@ -820,9 +816,6 @@ void gprs_rlcmac_dl_tbf::reuse_tbf(const uint8_t *data, const uint16_t len) m_wait_confirm = 0; m_window.reset(); - /* mark TLLI as invalid */ - m_tlli_valid = 0; - /* keep to flags */ state_flags &= GPRS_RLCMAC_FLAG_TO_MASK; state_flags &= ~(1 << GPRS_RLCMAC_FLAG_CCCH); diff --git a/tests/alloc/AllocTest.cpp b/tests/alloc/AllocTest.cpp index e453de6a..552d8aa8 100644 --- a/tests/alloc/AllocTest.cpp +++ b/tests/alloc/AllocTest.cpp @@ -188,18 +188,14 @@ static void test_alloc_b(int ms_class) tfi = the_bts.tfi_find_free(GPRS_RLCMAC_UL_TBF, &trx_no, -1); OSMO_ASSERT(tfi >= 0); dl_tbf = tbf_alloc_dl_tbf(bts, NULL, tfi, trx_no, ms_class, 1); - dl_tbf->m_tlli = 0x23; - dl_tbf->m_tlli_valid = true; - dl_tbf->update_ms(dl_tbf->m_tlli, GPRS_RLCMAC_DL_TBF); + dl_tbf->update_ms(0x23, GPRS_RLCMAC_DL_TBF); OSMO_ASSERT(dl_tbf); dump_assignment(dl_tbf, "DL"); tfi = the_bts.tfi_find_free(GPRS_RLCMAC_UL_TBF, &trx_no, -1); OSMO_ASSERT(tfi >= 0); ul_tbf = tbf_alloc_ul_tbf(bts, dl_tbf, tfi, trx_no, ms_class, 0); - ul_tbf->m_tlli = 0x23; - ul_tbf->m_tlli_valid = true; - ul_tbf->update_ms(ul_tbf->m_tlli, GPRS_RLCMAC_UL_TBF); + ul_tbf->update_ms(0x23, GPRS_RLCMAC_UL_TBF); ul_tbf->m_contention_resolution_done = 1; OSMO_ASSERT(ul_tbf); dump_assignment(ul_tbf, "UL"); @@ -348,17 +344,13 @@ static void test_alloc_b(bool ts0, bool ts1, bool ts2, bool ts3, bool ts4, bool OSMO_ASSERT(tfi >= 0); dl_tbf = tbf_alloc_dl_tbf(bts, NULL, tfi, trx_no, ms_class, 1); OSMO_ASSERT(dl_tbf); - dl_tbf->m_tlli = 0x23; - dl_tbf->m_tlli_valid = true; - dl_tbf->update_ms(dl_tbf->m_tlli, GPRS_RLCMAC_DL_TBF); + dl_tbf->update_ms(0x23, GPRS_RLCMAC_DL_TBF); tfi = the_bts.tfi_find_free(GPRS_RLCMAC_UL_TBF, &trx_no, -1); OSMO_ASSERT(tfi >= 0); ul_tbf = tbf_alloc_ul_tbf(bts, dl_tbf, tfi, trx_no, ms_class, 0); OSMO_ASSERT(ul_tbf); - ul_tbf->m_tlli = 0x23; - ul_tbf->m_tlli_valid = true; - ul_tbf->update_ms(ul_tbf->m_tlli, GPRS_RLCMAC_UL_TBF); + ul_tbf->update_ms(0x23, GPRS_RLCMAC_UL_TBF); ul_tbf->m_contention_resolution_done = 1; OSMO_ASSERT(dl_tbf->first_common_ts == ul_tbf->first_common_ts); diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp index 081feef2..1ba76c74 100644 --- a/tests/tbf/TbfTest.cpp +++ b/tests/tbf/TbfTest.cpp @@ -64,7 +64,6 @@ static void test_tbf_tlli_update() NULL, 0, 0, 0, 0); dl_tbf->update_tlli(0x2342); - dl_tbf->tlli_mark_valid(); dl_tbf->update_ms(0x2342, GPRS_RLCMAC_DL_TBF); dl_tbf->ta = 4; the_bts.timing_advance()->remember(0x2342, dl_tbf->ta); @@ -73,7 +72,6 @@ static void test_tbf_tlli_update() dl_tbf, 0, 0, 0, 0); ul_tbf->update_tlli(0x2342); - ul_tbf->tlli_mark_valid(); ms = the_bts.ms_by_tlli(0x2342); diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err index 6569ccc3..1c8322e3 100644 --- a/tests/tbf/TbfTest.err +++ b/tests/tbf/TbfTest.err @@ -5,7 +5,6 @@ Slot Allocation (Algorithm A) for class 0 - Skipping TS 1, because not enabled - Assign downlink TS=2 - Setting Control TS 2 -TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) changing tlli from TLLI=0x00000000 TLLI=0x00002342 ul_changed=0 Creating MS object, TLLI = 0x00002342 Attaching TBF to MS object, TLLI = 0x00002342, TBF = TBF(TFI=0 TLLI=0x00002342 DIR=DL STATE=NULL) ********** TBF starts here ********** @@ -15,9 +14,7 @@ Slot Allocation (Algorithm A) for class 0 - Skipping TS 1, because not enabled - Assign uplink TS=2 USF=0 - Setting Control TS 2 -Attaching TBF to MS object, TLLI = 0x00002342, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=NULL) -TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=NULL) changing tlli from TLLI=0x00000000 TLLI=0x00002342 ul_changed=0 -TBF(TFI=0 TLLI=0x00002342 DIR=DL STATE=NULL) changing tlli from TLLI=0x00002342 TLLI=0x00004232 ul_changed=0 +Attaching TBF to MS object, TLLI = 0x00002342, TBF = TBF(TFI=0 TLLI=0x00002342 DIR=UL STATE=NULL) The MS object cannot fully confirm an unexpected TLLI: 0x00004232, partly confirmed Modifying MS object, TLLI: 0x00002342 -> 0x00004232, already confirmed partly Searching for first unallocated TFI: TRX=0 first TS=4 |