From 09ef27ae04a11e758de81939ff479445d38e0b6d Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sun, 20 Oct 2013 16:37:05 +0200 Subject: pdch: Simplify the reset code, rename variables to XYZ_no Simplify the reset code now that the PDCH can know where it is located. Rename the variables in the sba to trx_no and ts_no as it stores the number and not the actual thing. --- src/bts.cpp | 4 ++-- src/bts.h | 3 +-- src/pcu_l1_if.cpp | 4 ++-- src/sba.cpp | 12 +++++++----- src/sba.h | 6 +++--- 5 files changed, 15 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/bts.cpp b/src/bts.cpp index 403b1e3..b2ec50f 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -226,7 +226,7 @@ void gprs_rlcmac_pdch::disable() } /* TODO: kill the parameter and make a pdch belong to a trx.. to a bts.. */ -void gprs_rlcmac_pdch::free_resources(BTS *bts, uint8_t trx, uint8_t ts) +void gprs_rlcmac_pdch::free_resources() { struct gprs_rlcmac_paging *pag; @@ -241,7 +241,7 @@ void gprs_rlcmac_pdch::free_resources(BTS *bts, uint8_t trx, uint8_t ts) while ((pag = dequeue_paging())) talloc_free(pag); - bts->sba()->free_resources(trx, ts); + trx->bts->sba()->free_resources(this); } struct gprs_rlcmac_paging *gprs_rlcmac_pdch::dequeue_paging() diff --git a/src/bts.h b/src/bts.h index c05779a..a8b6223 100644 --- a/src/bts.h +++ b/src/bts.h @@ -47,8 +47,7 @@ struct gprs_rlcmac_pdch { void add_paging(struct gprs_rlcmac_paging *pag); - /* TODO: the PDCH should know the trx/ts it belongs to */ - void free_resources(BTS *bts, uint8_t trx, uint8_t ts); + void free_resources(); bool is_enabled() const; diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp index ab9c134..53303d9 100644 --- a/src/pcu_l1_if.cpp +++ b/src/pcu_l1_if.cpp @@ -321,7 +321,7 @@ bssgp_failed: for (trx = 0; trx < 8; trx++) { bts->trx[trx].arfcn = info_ind->trx[trx].arfcn; for (ts = 0; ts < 8; ts++) - bts->trx[trx].pdch[ts].free_resources(bts->bts, trx, ts); + bts->trx[trx].pdch[ts].free_resources(); } gprs_bssgp_destroy_or_exit(); return 0; @@ -456,7 +456,7 @@ bssgp_failed: } else { if (pdch->is_enabled()) { pcu_tx_act_req(trx, ts, 0); - pdch->free_resources(bts->bts, trx, ts); + pdch->free_resources(); pdch->disable(); } } diff --git a/src/sba.cpp b/src/sba.cpp index 4b856e0..7396811 100644 --- a/src/sba.cpp +++ b/src/sba.cpp @@ -73,8 +73,8 @@ int SBAController::alloc( fn = (pdch->last_rts_fn + AGCH_START_OFFSET) % 2715648; - sba->trx = trx; - sba->ts = ts; + sba->trx_no = trx; + sba->ts_no = ts; sba->fn = fn; sba->ta = ta; @@ -91,7 +91,7 @@ gprs_rlcmac_sba *SBAController::find(uint8_t trx, uint8_t ts, uint32_t fn) struct gprs_rlcmac_sba *sba; llist_for_each_entry(sba, &m_sbas, list) { - if (sba->trx == trx && sba->ts == ts && sba->fn == fn) + if (sba->trx_no == trx && sba->ts_no == ts && sba->fn == fn) return sba; } @@ -124,12 +124,14 @@ int SBAController::timeout(struct gprs_rlcmac_sba *sba) return 0; } -void SBAController::free_resources(uint8_t trx, uint8_t ts) +void SBAController::free_resources(struct gprs_rlcmac_pdch *pdch) { struct gprs_rlcmac_sba *sba, *sba2; + const uint8_t trx_no = pdch->trx->trx_no; + const uint8_t ts_no = pdch->ts_no; llist_for_each_entry_safe(sba, sba2, &m_sbas, list) { - if (sba->trx == trx && sba->ts == ts) { + if (sba->trx_no == trx_no && sba->ts_no == ts_no) { llist_del(&sba->list); talloc_free(sba); } diff --git a/src/sba.h b/src/sba.h index c25aa14..b8d7675 100644 --- a/src/sba.h +++ b/src/sba.h @@ -35,8 +35,8 @@ struct gprs_rlcmac_sba; */ struct gprs_rlcmac_sba { struct llist_head list; - uint8_t trx; - uint8_t ts; + uint8_t trx_no; + uint8_t ts_no; uint32_t fn; uint8_t ta; }; @@ -57,7 +57,7 @@ public: uint32_t sched(uint8_t trx, uint8_t ts, uint32_t fn, uint8_t block_nr); int timeout(struct gprs_rlcmac_sba *sba); - void free_resources(uint8_t trx, uint8_t ts); + void free_resources(struct gprs_rlcmac_pdch *pdch); private: BTS &m_bts; -- cgit v1.2.3