From 8f399de135ae93a5f0841836846a7c54a600d5f0 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Wed, 25 Dec 2013 20:22:35 +0100 Subject: tbf: Kill the tsc member as it duplicates data We can just use first_ts and the trx/pdch to extract this information. Avoid duplication of data. --- src/bts.cpp | 4 ++-- src/encoding.cpp | 4 ++-- src/gprs_rlcmac_ts_alloc.cpp | 5 ++--- src/tbf.cpp | 5 +++++ src/tbf.h | 2 +- 5 files changed, 12 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/bts.cpp b/src/bts.cpp index 69e5ad40..a25686df 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -450,7 +450,7 @@ int BTS::rcv_rach(uint8_t ra, uint32_t Fn, int16_t qta) m_bts.alpha, m_bts.gamma, -1); else plen = Encoding::write_immediate_assignment(&m_bts, immediate_assignment, 0, ra, - Fn, tbf->ta, tbf->trx->arfcn, tbf->first_ts, tbf->tsc, + Fn, tbf->ta, tbf->trx->arfcn, tbf->first_ts, tbf->tsc(), tbf->tfi(), tbf->dir.ul.usf[tbf->first_ts], 0, 0, 0, 0, m_bts.alpha, m_bts.gamma, -1); pcu_l1if_tx_agch(immediate_assignment, plen); @@ -506,7 +506,7 @@ void BTS::snd_dl_ass(gprs_rlcmac_tbf *tbf, uint8_t poll, const char *imsi) * so the assignment will not conflict with possible RACH requests. */ plen = Encoding::write_immediate_assignment(&m_bts, immediate_assignment, 1, 125, (tbf->pdch[tbf->first_ts]->last_rts_fn + 21216) % 2715648, tbf->ta, - tbf->trx->arfcn, tbf->first_ts, tbf->tsc, tbf->tfi(), 0, tbf->tlli(), poll, + tbf->trx->arfcn, tbf->first_ts, tbf->tsc(), tbf->tfi(), 0, tbf->tlli(), poll, tbf->poll_fn, 0, m_bts.alpha, m_bts.gamma, -1); pcu_l1if_tx_pch(immediate_assignment, plen, imsi); bitvec_free(immediate_assignment); diff --git a/src/encoding.cpp b/src/encoding.cpp index 94799868..8ec93c98 100644 --- a/src/encoding.cpp +++ b/src/encoding.cpp @@ -205,7 +205,7 @@ void Encoding::write_packet_uplink_assignment( #if 1 bitvec_write_field(dest, wp,0x1,1); // Frequency Parameters information elements = present - bitvec_write_field(dest, wp,tbf->tsc,3); // Training Sequence Code (TSC) + bitvec_write_field(dest, wp,tbf->tsc(),3); // Training Sequence Code (TSC) bitvec_write_field(dest, wp,0x0,2); // ARFCN = present bitvec_write_field(dest, wp,tbf->trx->arfcn,10); // ARFCN #else @@ -287,7 +287,7 @@ void Encoding::write_packet_downlink_assignment(RlcMacDownlink_t * block, uint8_ block->u.Packet_Downlink_Assignment.Exist_P0_and_BTS_PWR_CTRL_MODE = 0x0; // POWER CONTROL = off block->u.Packet_Downlink_Assignment.Exist_Frequency_Parameters = 0x1; // Frequency Parameters = on - block->u.Packet_Downlink_Assignment.Frequency_Parameters.TSC = tbf->tsc; // Training Sequence Code (TSC) + block->u.Packet_Downlink_Assignment.Frequency_Parameters.TSC = tbf->tsc(); // Training Sequence Code (TSC) block->u.Packet_Downlink_Assignment.Frequency_Parameters.UnionType = 0x0; // ARFCN = on block->u.Packet_Downlink_Assignment.Frequency_Parameters.u.ARFCN = tbf->trx->arfcn; // ARFCN diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp index 8d8e7f04..44c0efb2 100644 --- a/src/gprs_rlcmac_ts_alloc.cpp +++ b/src/gprs_rlcmac_ts_alloc.cpp @@ -155,7 +155,6 @@ int alloc_algorithm_a(struct gprs_rlcmac_bts *bts, return -EINVAL; pdch = &tbf->trx->pdch[ts]; - tbf->tsc = pdch->tsc; if (tbf->direction == GPRS_RLCMAC_UL_TBF) { int8_t usf; /* must be signed */ @@ -274,7 +273,7 @@ int alloc_algorithm_b(struct gprs_rlcmac_bts *bts, } /* check if TSC changes */ if (tsc < 0) - tbf->tsc = tsc = pdch->tsc; + tsc = pdch->tsc; else if (tsc != pdch->tsc) { LOGP(DRLCMAC, LOGL_ERROR, "Skipping TS %d of TRX=%d, " "because it has different TSC than lower TS " @@ -427,7 +426,7 @@ int alloc_algorithm_b(struct gprs_rlcmac_bts *bts, } /* check if TSC changes */ if (tsc < 0) - tbf->tsc = tsc = pdch->tsc; + tsc = pdch->tsc; else if (tsc != pdch->tsc) { LOGP(DRLCMAC, LOGL_ERROR, "Skipping TS %d of " "TRX=%d, because it has different TSC " diff --git a/src/tbf.cpp b/src/tbf.cpp index c7024058..ba615eca 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -1755,3 +1755,8 @@ void gprs_rlcmac_tbf::rotate_in_list() else llist_add(&list, &bts->bts_data()->dl_tbfs); } + +uint8_t gprs_rlcmac_tbf::tsc() const +{ + return trx->pdch[first_ts].tsc; +} diff --git a/src/tbf.h b/src/tbf.h index 414bc632..de2543cc 100644 --- a/src/tbf.h +++ b/src/tbf.h @@ -112,6 +112,7 @@ struct gprs_rlcmac_tbf { const uint32_t tlli, const char *imsi, const uint8_t ms_class, const uint16_t delay_csec, const uint8_t *data, const uint16_t len); + uint8_t tsc() const; int rlcmac_diag(); @@ -142,7 +143,6 @@ struct gprs_rlcmac_tbf { uint32_t state_flags; enum gprs_rlcmac_tbf_direction direction; struct gprs_rlcmac_trx *trx; - uint8_t tsc; uint8_t first_ts; /* first TS used by TBF */ uint8_t first_common_ts; /* first TS that the phone can send and reveive simultaniously */ -- cgit v1.2.3