This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcu/+/25053 )
Change subject: Move rate_ctr free to tbf subclass destructor
......................................................................
Move rate_ctr free to tbf subclass destructor
This way we clean up tbf_free entry point, and leave memory freeing for
later on at the end when talloc_free is called.
Change-Id: I1c45e3296e565725bcbbca391d9518772fffa89d
---
M src/tbf.cpp
M src/tbf_dl.cpp
M src/tbf_ul.cpp
M src/tbf_ul.h
4 files changed, 14 insertions(+), 10 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/53/25053/1
diff --git a/src/tbf.cpp b/src/tbf.cpp
index f56cba3..f022b0c 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -164,6 +164,7 @@
{
osmo_fsm_inst_free(state_fsm.fi);
state_fsm.fi = NULL;
+ rate_ctr_group_free(m_ctrs);
}
uint32_t gprs_rlcmac_tbf::tlli() const
@@ -269,19 +270,11 @@
{
/* update counters */
if (tbf->direction == GPRS_RLCMAC_UL_TBF) {
- gprs_rlcmac_ul_tbf *ul_tbf = as_ul_tbf(tbf);
bts_do_rate_ctr_inc(tbf->bts, CTR_TBF_UL_FREED);
if (tbf->state_is(TBF_ST_FLOW))
bts_do_rate_ctr_inc(tbf->bts, CTR_TBF_UL_ABORTED);
- rate_ctr_group_free(ul_tbf->m_ul_egprs_ctrs);
- rate_ctr_group_free(ul_tbf->m_ul_gprs_ctrs);
} else {
gprs_rlcmac_dl_tbf *dl_tbf = as_dl_tbf(tbf);
- if (tbf->is_egprs_enabled()) {
- rate_ctr_group_free(dl_tbf->m_dl_egprs_ctrs);
- } else {
- rate_ctr_group_free(dl_tbf->m_dl_gprs_ctrs);
- }
bts_do_rate_ctr_inc(tbf->bts, CTR_TBF_DL_FREED);
if (tbf->state_is(TBF_ST_FLOW))
bts_do_rate_ctr_inc(tbf->bts, CTR_TBF_DL_ABORTED);
@@ -297,8 +290,6 @@
if (tbf->ms())
tbf->set_ms(NULL);
- rate_ctr_group_free(tbf->m_ctrs);
-
LOGP(DTBF, LOGL_DEBUG, "********** %s-TBF ends here **********\n",
(tbf->direction != GPRS_RLCMAC_UL_TBF) ? "DL" : "UL");
talloc_free(tbf);
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index e76ea8c..2850fff 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -180,6 +180,11 @@
gprs_rlcmac_dl_tbf::~gprs_rlcmac_dl_tbf()
{
osmo_timer_del(&m_llc_timer);
+ if (is_egprs_enabled()) {
+ rate_ctr_group_free(m_dl_egprs_ctrs);
+ } else {
+ rate_ctr_group_free(m_dl_gprs_ctrs);
+ }
/* ~gprs_rlcmac_dl_tbf() is called automatically upon return */
}
diff --git a/src/tbf_ul.cpp b/src/tbf_ul.cpp
index 14cb0ea..9550011 100644
--- a/src/tbf_ul.cpp
+++ b/src/tbf_ul.cpp
@@ -90,6 +90,13 @@
tbf_ul_egprs_ctr_description,
};
+gprs_rlcmac_ul_tbf::~gprs_rlcmac_ul_tbf()
+{
+ rate_ctr_group_free(m_ul_egprs_ctrs);
+ rate_ctr_group_free(m_ul_gprs_ctrs);
+ /* ~gprs_rlcmac_dl_tbf() is called automatically upon return */
+}
+
static int ul_tbf_dtor(struct gprs_rlcmac_ul_tbf *tbf)
{
tbf->~gprs_rlcmac_ul_tbf();
diff --git a/src/tbf_ul.h b/src/tbf_ul.h
index 9396633..2bc908d 100644
--- a/src/tbf_ul.h
+++ b/src/tbf_ul.h
@@ -54,6 +54,7 @@
struct gprs_rlcmac_ul_tbf : public gprs_rlcmac_tbf {
gprs_rlcmac_ul_tbf(struct gprs_rlcmac_bts *bts, GprsMs *ms);
+ ~gprs_rlcmac_ul_tbf();
gprs_rlc_window *window();
struct msgb *create_ul_ack(uint32_t fn, uint8_t ts);
bool ctrl_ack_to_toggle();
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/25053
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I1c45e3296e565725bcbbca391d9518772fffa89d
Gerrit-Change-Number: 25053
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210726/b0ed1717/attachment.htm>