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.
This commit is contained in:
Holger Hans Peter Freyther 2013-10-20 16:37:05 +02:00
parent 4ed1dae533
commit 09ef27ae04
5 changed files with 15 additions and 14 deletions

View File

@ -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()

View File

@ -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;

View File

@ -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();
}
}

View File

@ -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);
}

View File

@ -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;