diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2021-02-25 18:08:10 +0100 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2021-02-26 11:50:21 +0100 |
commit | c85e093969d64ec99f1dec1ece3f2ff92d70dd51 (patch) | |
tree | 72a5a9f6c4ee89e64bb3f0acc6298056a848ad48 /src | |
parent | 36177c6b584ebb6e301d55e5bc5d9eb76f80c368 (diff) |
Remove uneeded ms param from alloc_algorithm_func_t func
Since a while ago, the data architecture was changed so that TBF is
guaranteed to always have a MS object associated. Hence, it makes no
sense to pass the MS object as a separate param as we can take it from
tbf object and makes code less confusing.
Change-Id: Idc0c76cf6f007afa4236480cdad0d8e99dabec5f
Diffstat (limited to 'src')
-rw-r--r-- | src/gprs_pcu.h | 1 | ||||
-rw-r--r-- | src/gprs_rlcmac.h | 6 | ||||
-rw-r--r-- | src/gprs_rlcmac_ts_alloc.cpp | 26 | ||||
-rw-r--r-- | src/tbf.cpp | 4 |
4 files changed, 15 insertions, 22 deletions
diff --git a/src/gprs_pcu.h b/src/gprs_pcu.h index 76e3937a..a17144c0 100644 --- a/src/gprs_pcu.h +++ b/src/gprs_pcu.h @@ -67,7 +67,6 @@ struct GprsMs; struct gprs_rlcmac_tbf; typedef int (*alloc_algorithm_func_t)(struct gprs_rlcmac_bts *bts, - struct GprsMs *ms, struct gprs_rlcmac_tbf *tbf, bool single, int8_t use_tbf); diff --git a/src/gprs_rlcmac.h b/src/gprs_rlcmac.h index 69fd6a40..cf95c37f 100644 --- a/src/gprs_rlcmac.h +++ b/src/gprs_rlcmac.h @@ -104,13 +104,13 @@ int gprs_rlcmac_rcv_rts_block(struct gprs_rlcmac_bts *bts, extern "C" { #endif -int alloc_algorithm_a(struct gprs_rlcmac_bts *bts, struct GprsMs *ms, struct gprs_rlcmac_tbf *tbf, bool single, +int alloc_algorithm_a(struct gprs_rlcmac_bts *bts, struct gprs_rlcmac_tbf *tbf, bool single, int8_t use_trx); -int alloc_algorithm_b(struct gprs_rlcmac_bts *bts, struct GprsMs *ms, struct gprs_rlcmac_tbf *tbf, bool single, +int alloc_algorithm_b(struct gprs_rlcmac_bts *bts, struct gprs_rlcmac_tbf *tbf, bool single, int8_t use_trx); -int alloc_algorithm_dynamic(struct gprs_rlcmac_bts *bts, struct GprsMs *ms, struct gprs_rlcmac_tbf *tbf, bool single, +int alloc_algorithm_dynamic(struct gprs_rlcmac_bts *bts, struct gprs_rlcmac_tbf *tbf, bool single, int8_t use_trx); int gprs_rlcmac_paging_request(struct gprs_rlcmac_bts *bts, const struct osmo_mobile_identity *mi, uint16_t pgroup); diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp index 72024239..1dc31f6f 100644 --- a/src/gprs_rlcmac_ts_alloc.cpp +++ b/src/gprs_rlcmac_ts_alloc.cpp @@ -338,13 +338,12 @@ static int tfi_find_free(const struct gprs_rlcmac_bts *bts, const gprs_rlcmac_tr * Assign single slot for uplink and downlink * * \param[in,out] bts Pointer to BTS struct - * \param[in,out] ms_ Pointer to MS object * \param[in,out] tbf_ Pointer to TBF struct * \param[in] single flag indicating if we should force single-slot allocation * \param[in] use_trx which TRX to use or -1 if it should be selected during allocation * \returns negative error code or 0 on success */ -int alloc_algorithm_a(struct gprs_rlcmac_bts *bts, GprsMs *ms_, struct gprs_rlcmac_tbf *tbf_, bool single, +int alloc_algorithm_a(struct gprs_rlcmac_bts *bts, struct gprs_rlcmac_tbf *tbf_, bool single, int8_t use_trx) { struct gprs_rlcmac_pdch *pdch; @@ -355,7 +354,7 @@ int alloc_algorithm_a(struct gprs_rlcmac_bts *bts, GprsMs *ms_, struct gprs_rlcm int usf = -1; uint8_t mask = 0xff; const char *mask_reason = NULL; - const GprsMs *ms = ms_; + struct GprsMs *ms = tbf_->ms(); const gprs_rlcmac_tbf *tbf = tbf_; gprs_rlcmac_trx *trx = ms_current_trx(ms); @@ -420,7 +419,7 @@ int alloc_algorithm_a(struct gprs_rlcmac_bts *bts, GprsMs *ms_, struct gprs_rlcm tbf_->trx = trx; /* the only one TS is the common TS */ tbf_->first_ts = tbf_->first_common_ts = ts; - ms_set_reserved_slots(ms_, trx, 1 << ts, 1 << ts); + ms_set_reserved_slots(ms, trx, 1 << ts, 1 << ts); tbf_->upgrade_to_multislot = 0; bts_do_rate_ctr_inc(bts, CTR_TBF_ALLOC_ALGO_A); @@ -853,13 +852,12 @@ static void assign_dl_tbf_slots(struct gprs_rlcmac_dl_tbf *dl_tbf, gprs_rlcmac_t * Assign one uplink slot. (With free USF) * * \param[in,out] bts Pointer to BTS struct - * \param[in,out] ms_ Pointer to MS object * \param[in,out] tbf_ Pointer to TBF struct * \param[in] single flag indicating if we should force single-slot allocation * \param[in] use_trx which TRX to use or -1 if it should be selected during allocation * \returns negative error code or 0 on success */ -int alloc_algorithm_b(struct gprs_rlcmac_bts *bts, GprsMs *ms_, struct gprs_rlcmac_tbf *tbf_, bool single, +int alloc_algorithm_b(struct gprs_rlcmac_bts *bts, struct gprs_rlcmac_tbf *tbf_, bool single, int8_t use_trx) { uint8_t dl_slots; @@ -873,7 +871,7 @@ int alloc_algorithm_b(struct gprs_rlcmac_bts *bts, GprsMs *ms_, struct gprs_rlcm int usf[8] = {-1, -1, -1, -1, -1, -1, -1, -1}; int rc; int tfi; - const GprsMs *ms = ms_; + struct GprsMs *ms = tbf_->ms(); const gprs_rlcmac_tbf *tbf = tbf_; gprs_rlcmac_trx *trx; @@ -881,10 +879,7 @@ int alloc_algorithm_b(struct gprs_rlcmac_bts *bts, GprsMs *ms_, struct gprs_rlcm /* Step 1: Get current state from the MS object */ - if (!ms) { - LOGP(DRLCMAC, LOGL_ERROR, "MS not set\n"); - return -EINVAL; - } + OSMO_ASSERT(ms); dl_slots = ms_reserved_dl_slots(ms); ul_slots = ms_reserved_ul_slots(ms); @@ -958,7 +953,7 @@ int alloc_algorithm_b(struct gprs_rlcmac_bts *bts, GprsMs *ms_, struct gprs_rlcm /* Step 4: Update MS and TBF and really allocate the resources */ - update_ms_reserved_slots(trx, ms_, reserved_ul_slots, reserved_dl_slots, ul_slots, dl_slots); + update_ms_reserved_slots(trx, ms, reserved_ul_slots, reserved_dl_slots, ul_slots, dl_slots); tbf_->trx = trx; tbf_->first_common_ts = first_common_ts; @@ -983,13 +978,12 @@ int alloc_algorithm_b(struct gprs_rlcmac_bts *bts, GprsMs *ms_, struct gprs_rlcm * goal is to provide the highest possible bandwidth per MS. * * \param[in,out] bts Pointer to BTS struct - * \param[in,out] ms_ Pointer to MS object * \param[in,out] tbf_ Pointer to TBF struct * \param[in] single flag indicating if we should force single-slot allocation * \param[in] use_trx which TRX to use or -1 if it should be selected during allocation * \returns negative error code or 0 on success */ -int alloc_algorithm_dynamic(struct gprs_rlcmac_bts *bts, GprsMs *ms_, struct gprs_rlcmac_tbf *tbf_, bool single, +int alloc_algorithm_dynamic(struct gprs_rlcmac_bts *bts, struct gprs_rlcmac_tbf *tbf_, bool single, int8_t use_trx) { int rc; @@ -1002,7 +996,7 @@ int alloc_algorithm_dynamic(struct gprs_rlcmac_bts *bts, GprsMs *ms_, struct gpr } if (!bts->multislot_disabled) { - rc = alloc_algorithm_b(bts, ms_, tbf_, single, use_trx); + rc = alloc_algorithm_b(bts, tbf_, single, use_trx); if (rc >= 0) return rc; @@ -1011,7 +1005,7 @@ int alloc_algorithm_dynamic(struct gprs_rlcmac_bts *bts, GprsMs *ms_, struct gpr bts->multislot_disabled = 1; } - return alloc_algorithm_a(bts, ms_, tbf_, single, use_trx); + return alloc_algorithm_a(bts, tbf_, single, use_trx); } int gprs_alloc_max_dl_slots_per_ms(const struct gprs_rlcmac_bts *bts, uint8_t ms_class) diff --git a/src/tbf.cpp b/src/tbf.cpp index 2f583750..5ca34f4f 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -331,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, ms(), this, false, -1); + rc = the_pcu->alloc_algorithm(bts, this, false, -1); /* if no resource */ if (rc < 0) { LOGPTBF(this, LOGL_ERROR, "No resource after update???\n"); @@ -749,7 +749,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, m_ms, this, single_slot, use_trx); + rc = the_pcu->alloc_algorithm(bts, this, single_slot, use_trx); /* if no resource */ if (rc < 0) { LOGPTBF(this, LOGL_NOTICE, |