pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/38084?usp=email )
Change subject: bts: Remove acc timers during talloc destructor ...................................................................... bts: Remove acc timers during talloc destructor This went unnoticed because so far there's not clear way to free a BTS, eg. through VTY. Change-Id: I0f94d8fc775953ee98eebc4d80f825404c4f92b2 --- M include/osmocom/bsc/acc.h M src/osmo-bsc/acc.c M src/osmo-bsc/bts.c M tests/acc/acc_test.c M tests/gsm0408/gsm0408_test.c 5 files changed, 21 insertions(+), 3 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve fixeria: Looks good to me, approved diff --git a/include/osmocom/bsc/acc.h b/include/osmocom/bsc/acc.h index 531a69a..5674825 100644 --- a/include/osmocom/bsc/acc.h +++ b/include/osmocom/bsc/acc.h @@ -53,6 +53,7 @@ }; void acc_mgr_init(struct acc_mgr *acc_mgr, struct gsm_bts *bts); +void acc_mgr_deinit(struct acc_mgr *acc_mgr); uint8_t acc_mgr_get_len_allowed_adm(struct acc_mgr *acc_mgr); uint8_t acc_mgr_get_len_allowed_ramp(struct acc_mgr *acc_mgr); void acc_mgr_set_len_allowed_adm(struct acc_mgr *acc_mgr, uint8_t len_allowed_adm); @@ -164,6 +165,7 @@ void acc_ramp_global_init(void); void acc_ramp_init(struct acc_ramp *acc_ramp, struct gsm_bts *bts); +void acc_ramp_deinit(struct acc_ramp *acc_ramp); int acc_ramp_set_step_size(struct acc_ramp *acc_ramp, unsigned int step_size); int acc_ramp_set_step_interval(struct acc_ramp *acc_ramp, unsigned int step_interval); int acc_ramp_set_chan_load_thresholds(struct acc_ramp *acc_ramp, unsigned int low_threshold, unsigned int up_threshold); diff --git a/src/osmo-bsc/acc.c b/src/osmo-bsc/acc.c index 80a3576..4b5aba0 100644 --- a/src/osmo-bsc/acc.c +++ b/src/osmo-bsc/acc.c @@ -296,6 +296,11 @@ acc_mgr_gen_subset(acc_mgr, false); } +void acc_mgr_deinit(struct acc_mgr *acc_mgr) +{ + osmo_timer_del(&acc_mgr->rotate_timer); +} + uint8_t acc_mgr_get_len_allowed_adm(struct acc_mgr *acc_mgr) { return acc_mgr->len_allowed_adm; @@ -475,6 +480,17 @@ } /*! + * Deinitialize an acc_ramp data structure. + * Called when the user is going to free the structure. + * + * \param[in] acc_ramp Pointer to acc_ramp structure to be deinitialized. + */ +void acc_ramp_deinit(struct acc_ramp *acc_ramp) +{ + osmo_timer_del(&acc_ramp->step_timer); +} + +/*! * Change the ramping step size which controls how many ACCs will be allowed per ramping step. * Returns negative on error (step_size out of range), else zero. * \param[in] acc_ramp Pointer to acc_ramp structure. diff --git a/src/osmo-bsc/bts.c b/src/osmo-bsc/bts.c index 50a8579..790a8d4 100644 --- a/src/osmo-bsc/bts.c +++ b/src/osmo-bsc/bts.c @@ -163,6 +163,9 @@ paging_destructor(bts); bts_setup_ramp_remove(bts); + acc_ramp_deinit(&bts->acc_ramp); + acc_mgr_deinit(&bts->acc_mgr); + osmo_timer_del(&bts->cbch_timer); bts->site_mgr->bts[0] = NULL; diff --git a/tests/acc/acc_test.c b/tests/acc/acc_test.c index 3dcdc1b..84a63b0 100644 --- a/tests/acc/acc_test.c +++ b/tests/acc/acc_test.c @@ -58,8 +58,6 @@ #define bts_del(bts) _bts_del(bts, __func__) static inline void _bts_del(struct gsm_bts *bts, const char *msg) { - osmo_timer_del(&bts->acc_mgr.rotate_timer); - osmo_timer_del(&bts->acc_ramp.step_timer); talloc_free(bts->site_mgr); fprintf(stderr, "BTS deallocated OK in %s()\n", msg); } diff --git a/tests/gsm0408/gsm0408_test.c b/tests/gsm0408/gsm0408_test.c index b35df60..4f4b4d4 100644 --- a/tests/gsm0408/gsm0408_test.c +++ b/tests/gsm0408/gsm0408_test.c @@ -137,7 +137,6 @@ #define bts_del(bts) _bts_del(bts, __func__) static inline void _bts_del(struct gsm_bts *bts, const char *msg) { - osmo_timer_del(&bts->acc_mgr.rotate_timer); talloc_free(bts->site_mgr); printf("BTS deallocated OK in %s()\n", msg); } -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/38084?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I0f94d8fc775953ee98eebc4d80f825404c4f92b2 Gerrit-Change-Number: 38084 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pes...@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanits...@sysmocom.de> Gerrit-Reviewer: laforge <lafo...@osmocom.org> Gerrit-Reviewer: pespin <pes...@sysmocom.de>