From 0ece97d718beace7a02b1e24bd78cbec22e252c8 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Mon, 18 Jan 2021 12:53:54 +0100 Subject: [PATCH] Rename 'bts_data' leftovers to 'bts' Before, we used tho have a BTs object split into 2 parts, a C gprs_rlcmac_bts struct and a C++ BTS struct, and "bts_data" naming was used to distinguish them in variable names. Nowadays the struct is finally combined into one, so there's no point in using this "bts_data" terminology, we use always "bts". Change-Id: I9852bf439292d1abc70711bea65698b21bde0ee8 --- src/gprs_rlcmac_sched.cpp | 16 ++++++++-------- src/gprs_rlcmac_ts_alloc.cpp | 12 ++++++------ src/pcu_l1_if.cpp | 15 +++++++-------- src/pcu_vty_functions.cpp | 8 ++++---- src/pcu_vty_functions.h | 10 +++++----- src/pdch.cpp | 17 ++++++----------- src/pdch.h | 1 - src/tbf.cpp | 13 +++---------- src/tbf.h | 3 +-- 9 files changed, 40 insertions(+), 55 deletions(-) diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp index 39e22c0f..40c194c3 100644 --- a/src/gprs_rlcmac_sched.cpp +++ b/src/gprs_rlcmac_sched.cpp @@ -130,29 +130,29 @@ static struct gprs_rlcmac_ul_tbf *sched_select_uplink(uint8_t trx, uint8_t ts, u } struct msgb *sched_app_info(struct gprs_rlcmac_tbf *tbf) { - struct gprs_rlcmac_bts *bts_data; + struct gprs_rlcmac_bts *bts; struct msgb *msg = NULL; if (!tbf || !tbf->ms()->app_info_pending) return NULL; - bts_data = the_pcu->bts; + bts = the_pcu->bts; - if (bts_data->app_info) { + if (bts->app_info) { LOGP(DRLCMACSCHED, LOGL_DEBUG, "Sending Packet Application Information message\n"); - msg = msgb_copy(bts_data->app_info, "app_info_msg_sched"); + msg = msgb_copy(bts->app_info, "app_info_msg_sched"); } else LOGP(DRLCMACSCHED, LOGL_ERROR, "MS has app_info_pending flag set, but no Packet Application Information" " message stored in BTS!\n"); tbf->ms()->app_info_pending = false; - bts_data->app_info_pending--; + bts->app_info_pending--; - if (!bts_data->app_info_pending) { + if (!bts->app_info_pending) { LOGP(DRLCMACSCHED, LOGL_DEBUG, "Packet Application Information successfully sent to all MS with active" " TBF\n"); - msgb_free(bts_data->app_info); - bts_data->app_info = NULL; + msgb_free(bts->app_info); + bts->app_info = NULL; } return msg; } diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp index f8b1c1fb..4c68a87d 100644 --- a/src/gprs_rlcmac_ts_alloc.cpp +++ b/src/gprs_rlcmac_ts_alloc.cpp @@ -239,7 +239,7 @@ static void assign_dlink_tbf(struct gprs_rlcmac_pdch *pdch, struct gprs_rlcmac_d attach_tbf_to_pdch(pdch, tbf); } -static int find_trx(const struct gprs_rlcmac_bts *bts_data, const GprsMs *ms, int8_t use_trx) +static int find_trx(const struct gprs_rlcmac_bts *bts, const GprsMs *ms, int8_t use_trx) { unsigned trx_no; unsigned ts; @@ -252,8 +252,8 @@ static int find_trx(const struct gprs_rlcmac_bts *bts_data, const GprsMs *ms, in return use_trx; /* Find the first TRX that has a PDCH with a free UL and DL TFI */ - for (trx_no = 0; trx_no < ARRAY_SIZE(bts_data->trx); trx_no += 1) { - const struct gprs_rlcmac_trx *trx = &bts_data->trx[trx_no]; + for (trx_no = 0; trx_no < ARRAY_SIZE(bts->trx); trx_no += 1) { + const struct gprs_rlcmac_trx *trx = &bts->trx[trx_no]; for (ts = 0; ts < ARRAY_SIZE(trx->pdch); ts++) { const struct gprs_rlcmac_pdch *pdch = &trx->pdch[ts]; if (!pdch->is_enabled()) @@ -272,14 +272,14 @@ static int find_trx(const struct gprs_rlcmac_bts *bts_data, const GprsMs *ms, in return -EBUSY; } -static bool idle_pdch_avail(const struct gprs_rlcmac_bts *bts_data) +static bool idle_pdch_avail(const struct gprs_rlcmac_bts *bts) { unsigned trx_no; unsigned ts; /* Find the first PDCH with an unused DL TS */ - for (trx_no = 0; trx_no < ARRAY_SIZE(bts_data->trx); trx_no += 1) { - const struct gprs_rlcmac_trx *trx = &bts_data->trx[trx_no]; + for (trx_no = 0; trx_no < ARRAY_SIZE(bts->trx); trx_no += 1) { + const struct gprs_rlcmac_trx *trx = &bts->trx[trx_no]; for (ts = 0; ts < ARRAY_SIZE(trx->pdch); ts++) { const struct gprs_rlcmac_pdch *pdch = &trx->pdch[ts]; if (!pdch->is_enabled()) diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp index ce0f55eb..e5ad1dea 100644 --- a/src/pcu_l1_if.cpp +++ b/src/pcu_l1_if.cpp @@ -814,36 +814,35 @@ static int pcu_rx_susp_req(struct gsm_pcu_if_susp_req *susp_req) static int pcu_rx_app_info_req(struct gsm_pcu_if_app_info_req *app_info_req) { struct gprs_rlcmac_bts *bts = the_pcu->bts; - struct gprs_rlcmac_bts *bts_data = bts; struct llist_head *tmp; LOGP(DL1IF, LOGL_DEBUG, "Application Information Request received: type=0x%08x len=%i\n", app_info_req->application_type, app_info_req->len); - bts_data->app_info_pending = 0; + bts->app_info_pending = 0; llist_for_each(tmp, bts_ms_store(bts)->ms_list()) { GprsMs *ms = llist_entry(tmp, typeof(*ms), list); if (!ms_dl_tbf(ms)) continue; - bts_data->app_info_pending++; + bts->app_info_pending++; ms->app_info_pending = true; } - if (!bts_data->app_info_pending) { + if (!bts->app_info_pending) { LOGP(DL1IF, LOGL_NOTICE, "Packet Application Information will not be sent, no subscribers with active" " TBF\n"); return -1; } - if (bts_data->app_info) { + if (bts->app_info) { LOGP(DL1IF, LOGL_NOTICE, "Previous Packet Application Information was not sent to all subscribers," " overwriting with new one\n"); - msgb_free(bts_data->app_info); + msgb_free(bts->app_info); } LOGP(DL1IF, LOGL_INFO, "Sending Packet Application Information to %i subscribers with active TBF\n", - bts_data->app_info_pending); - bts_data->app_info = gprs_rlcmac_app_info_msg(app_info_req); + bts->app_info_pending); + bts->app_info = gprs_rlcmac_app_info_msg(app_info_req); return 0; } diff --git a/src/pcu_vty_functions.cpp b/src/pcu_vty_functions.cpp index 0e9cc00a..231bce7c 100644 --- a/src/pcu_vty_functions.cpp +++ b/src/pcu_vty_functions.cpp @@ -242,13 +242,13 @@ int pcu_vty_show_ms_by_imsi(struct vty *vty, struct gprs_rlcmac_bts *bts, return show_ms(vty, ms); } -int pcu_vty_show_bts_pdch(struct vty *vty, const struct gprs_rlcmac_bts *bts_data) +int pcu_vty_show_bts_pdch(struct vty *vty, const struct gprs_rlcmac_bts *bts) { unsigned int trx_nr, ts_nr; - vty_out(vty, "BTS (%s)%s", bts_data->active ? "active" : "disabled", VTY_NEWLINE); - for (trx_nr = 0; trx_nr < ARRAY_SIZE(bts_data->trx); trx_nr++) { - const struct gprs_rlcmac_trx *trx = &bts_data->trx[trx_nr]; + vty_out(vty, "BTS (%s)%s", bts->active ? "active" : "disabled", VTY_NEWLINE); + for (trx_nr = 0; trx_nr < ARRAY_SIZE(bts->trx); trx_nr++) { + const struct gprs_rlcmac_trx *trx = &bts->trx[trx_nr]; for (ts_nr = 0; ts_nr < ARRAY_SIZE(trx->pdch); ts_nr++) { if (trx->pdch[ts_nr].is_enabled()) diff --git a/src/pcu_vty_functions.h b/src/pcu_vty_functions.h index 4528fb23..a68df27c 100644 --- a/src/pcu_vty_functions.h +++ b/src/pcu_vty_functions.h @@ -27,13 +27,13 @@ extern "C" { struct vty; struct gprs_rlcmac_bts; -int pcu_vty_show_tbf_all(struct vty *vty, struct gprs_rlcmac_bts *bts_data, uint32_t flags); -int pcu_vty_show_ms_all(struct vty *vty, struct gprs_rlcmac_bts *bts_data); -int pcu_vty_show_ms_by_tlli(struct vty *vty, struct gprs_rlcmac_bts *bts_data, +int pcu_vty_show_tbf_all(struct vty *vty, struct gprs_rlcmac_bts *bts, uint32_t flags); +int pcu_vty_show_ms_all(struct vty *vty, struct gprs_rlcmac_bts *bts); +int pcu_vty_show_ms_by_tlli(struct vty *vty, struct gprs_rlcmac_bts *bts, uint32_t tlli); -int pcu_vty_show_ms_by_imsi(struct vty *vty, struct gprs_rlcmac_bts *bts_data, +int pcu_vty_show_ms_by_imsi(struct vty *vty, struct gprs_rlcmac_bts *bts, const char *imsi); -int pcu_vty_show_bts_pdch(struct vty *vty, const struct gprs_rlcmac_bts *bts_data); +int pcu_vty_show_bts_pdch(struct vty *vty, const struct gprs_rlcmac_bts *bts); #ifdef __cplusplus } #endif diff --git a/src/pdch.cpp b/src/pdch.cpp index 49f0b854..9dd4072e 100644 --- a/src/pdch.cpp +++ b/src/pdch.cpp @@ -113,12 +113,12 @@ static void get_meas(struct pcu_l1_meas *meas, } } -static inline void sched_ul_ass_or_rej(struct gprs_rlcmac_bts *bts, gprs_rlcmac_bts *bts_data, struct gprs_rlcmac_dl_tbf *tbf) +static inline void sched_ul_ass_or_rej(struct gprs_rlcmac_bts *bts, struct gprs_rlcmac_dl_tbf *tbf) { bts_do_rate_ctr_inc(bts, CTR_CHANNEL_REQUEST_DESCRIPTION); /* This call will register the new TBF with the MS on success */ - gprs_rlcmac_ul_tbf *ul_tbf = tbf_alloc_ul(bts_data, tbf->ms(), tbf->trx->trx_no, tbf->tlli()); + gprs_rlcmac_ul_tbf *ul_tbf = tbf_alloc_ul(bts, tbf->ms(), tbf->trx->trx_no, tbf->tlli()); /* schedule uplink assignment or reject */ if (ul_tbf) { @@ -455,7 +455,7 @@ void gprs_rlcmac_pdch::rcv_control_dl_ack_nack(Packet_Downlink_Ack_Nack_t *ack_n } /* check for channel request */ if (ack_nack->Exist_Channel_Request_Description) - sched_ul_ass_or_rej(bts(), bts_data(), tbf); + sched_ul_ass_or_rej(bts(), tbf); /* get measurements */ if (tbf->ms()) { @@ -545,7 +545,7 @@ void gprs_rlcmac_pdch::rcv_control_egprs_dl_ack_nack(EGPRS_PD_AckNack_t *ack_nac /* check for channel request */ if (ack_nack->Exist_ChannelRequestDescription) - sched_ul_ass_or_rej(bts(), bts_data(), tbf); + sched_ul_ass_or_rej(bts(), tbf); /* get measurements */ if (tbf->ms()) { @@ -612,9 +612,9 @@ void gprs_rlcmac_pdch::rcv_resource_request(Packet_Resource_Request_t *request, tbf_free(ul_tbf); } - ul_tbf = tbf_alloc_ul(bts_data(), ms, trx_no(), tlli); + ul_tbf = tbf_alloc_ul(bts(), ms, trx_no(), tlli); if (!ul_tbf) { - handle_tbf_reject(bts_data(), ms, tlli, + handle_tbf_reject(bts(), ms, tlli, trx_no(), ts_no); goto return_unref; } @@ -984,11 +984,6 @@ uint8_t gprs_rlcmac_pdch::trx_no() const return trx->trx_no; } -inline gprs_rlcmac_bts *gprs_rlcmac_pdch::bts_data() const -{ - return trx->bts; -} - /* PTCCH (Packet Timing Advance Control Channel) */ void gprs_rlcmac_pdch::init_ptcch_msg(void) { diff --git a/src/pdch.h b/src/pdch.h index 7a544fe4..2413ef70 100644 --- a/src/pdch.h +++ b/src/pdch.h @@ -69,7 +69,6 @@ struct gprs_rlcmac_pdch { int rcv_data_block(uint8_t *data, uint8_t data_len, uint32_t fn, struct pcu_l1_meas *meas, enum CodingScheme cs); - gprs_rlcmac_bts *bts_data() const; struct gprs_rlcmac_bts *bts() const; uint8_t trx_no() const; diff --git a/src/tbf.cpp b/src/tbf.cpp index 05f4e2c4..3464242b 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -168,11 +168,6 @@ gprs_rlcmac_tbf::gprs_rlcmac_tbf(struct gprs_rlcmac_bts *bts_, GprsMs *ms, gprs_ m_name_buf[0] = '\0'; } -gprs_rlcmac_bts *gprs_rlcmac_tbf::bts_data() const -{ - return bts; -} - uint32_t gprs_rlcmac_tbf::tlli() const { return m_ms ? ms_tlli(m_ms) : GSM_RESERVED_TMSI; @@ -318,7 +313,7 @@ void tbf_free(struct gprs_rlcmac_tbf *tbf) talloc_free(tbf); } -uint16_t egprs_window_size(const struct gprs_rlcmac_bts *bts_data, uint8_t slots) +uint16_t egprs_window_size(const struct gprs_rlcmac_bts *bts, uint8_t slots) { uint8_t num_pdch = pcu_bitcount(slots); @@ -328,7 +323,6 @@ uint16_t egprs_window_size(const struct gprs_rlcmac_bts *bts_data, uint8_t slots int gprs_rlcmac_tbf::update() { - struct gprs_rlcmac_bts *bts_data = bts; int rc; if (direction != GPRS_RLCMAC_DL_TBF) @@ -337,7 +331,7 @@ int gprs_rlcmac_tbf::update() LOGP(DTBF, LOGL_DEBUG, "********** DL-TBF update **********\n"); tbf_unlink_pdch(this); - rc = the_pcu->alloc_algorithm(bts_data, ms(), this, false, -1); + rc = the_pcu->alloc_algorithm(bts, ms(), this, false, -1); /* if no resource */ if (rc < 0) { LOGPTBF(this, LOGL_ERROR, "No resource after update???\n"); @@ -738,7 +732,6 @@ void gprs_rlcmac_tbf::poll_timeout() int gprs_rlcmac_tbf::setup(int8_t use_trx, bool single_slot) { - struct gprs_rlcmac_bts *bts_data = bts; int rc; if (ms_mode(m_ms) != GPRS) @@ -746,7 +739,7 @@ int gprs_rlcmac_tbf::setup(int8_t use_trx, bool single_slot) m_created_ts = time(NULL); /* select algorithm */ - rc = the_pcu->alloc_algorithm(bts_data, m_ms, this, single_slot, use_trx); + rc = the_pcu->alloc_algorithm(bts, m_ms, this, single_slot, use_trx); /* if no resource */ if (rc < 0) { return -1; diff --git a/src/tbf.h b/src/tbf.h index cb4c9b9a..73266bf4 100644 --- a/src/tbf.h +++ b/src/tbf.h @@ -348,7 +348,6 @@ struct gprs_rlcmac_tbf { struct llist_item m_bts_list; protected: - gprs_rlcmac_bts *bts_data() const; void merge_and_clear_ms(GprsMs *old_ms); gprs_llc_queue *llc_queue(); @@ -567,6 +566,6 @@ inline enum gprs_rlcmac_tbf_direction reverse(enum gprs_rlcmac_tbf_direction dir ((int)GPRS_RLCMAC_UL_TBF - (int)dir + (int)GPRS_RLCMAC_DL_TBF); } -uint16_t egprs_window_size(const struct gprs_rlcmac_bts *bts_data, uint8_t slots); +uint16_t egprs_window_size(const struct gprs_rlcmac_bts *bts, uint8_t slots); #endif