diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2021-03-03 17:30:50 +0100 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2021-03-03 20:28:51 +0100 |
commit | 4fe090146f3b76af7493f3dbbf537c21e403c13a (patch) | |
tree | 9cfc8019b099591a46120fcb2eae36cb1326839b /src | |
parent | 423bf8c408237df5bc77a9efcd2ccc1445c2d480 (diff) |
ms: clarify delayed MS release process related code and logging
Change-Id: Ieaea6ab07b4b2822bcf394f2d0e9298b9f3c5854
Diffstat (limited to 'src')
-rw-r--r-- | src/gprs_ms.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/gprs_ms.c b/src/gprs_ms.c index ab1a0678..2250fa9e 100644 --- a/src/gprs_ms.c +++ b/src/gprs_ms.c @@ -79,11 +79,10 @@ static struct gpr_ms_callback gprs_default_cb = { .ms_active = gprs_default_cb_ms_active, }; -void ms_timeout(void *data) +static void ms_release_timer_cb(void *data) { struct GprsMs *ms = (struct GprsMs *) data; - LOGP(DRLCMAC, LOGL_INFO, "Timeout for MS object, TLLI = 0x%08x\n", - ms_tlli(ms)); + LOGPMS(ms, DRLCMAC, LOGL_INFO, "Release timer expired\n"); if (ms->timer.data) { ms->timer.data = NULL; @@ -116,7 +115,7 @@ struct GprsMs *ms_alloc(struct gprs_rlcmac_bts *bts, uint32_t tlli) ms->imsi[0] = '\0'; memset(&ms->timer, 0, sizeof(ms->timer)); - ms->timer.cb = ms_timeout; + ms->timer.cb = ms_release_timer_cb; llc_queue_init(&ms->llc_queue); ms_set_mode(ms, GPRS); @@ -218,22 +217,26 @@ void ms_unref(struct GprsMs *ms) ms_update_status(ms); } -void ms_start_timer(struct GprsMs *ms) +static void ms_release_timer_start(struct GprsMs *ms) { if (ms->delay == 0) return; + LOGPMS(ms, DRLCMAC, LOGL_DEBUG, "Schedule MS release in %u secs\n", ms->delay); + if (!ms->timer.data) ms->timer.data = ms_ref(ms); osmo_timer_schedule(&ms->timer, ms->delay, 0); } -void ms_stop_timer(struct GprsMs *ms) +static void ms_release_timer_stop(struct GprsMs *ms) { if (!ms->timer.data) return; + LOGPMS(ms, DRLCMAC, LOGL_DEBUG, "Cancel scheduled MS release\n"); + osmo_timer_del(&ms->timer); ms->timer.data = NULL; ms_unref(ms); @@ -306,7 +309,7 @@ static void ms_attach_ul_tbf(struct GprsMs *ms, struct gprs_rlcmac_ul_tbf *tbf) ms->ul_tbf = tbf; if (tbf) - ms_stop_timer(ms); + ms_release_timer_stop(ms); ms_unref(ms); } @@ -327,7 +330,7 @@ static void ms_attach_dl_tbf(struct GprsMs *ms, struct gprs_rlcmac_dl_tbf *tbf) ms->dl_tbf = tbf; if (tbf) - ms_stop_timer(ms); + ms_release_timer_stop(ms); ms_unref(ms); } @@ -374,7 +377,7 @@ void ms_detach_tbf(struct GprsMs *ms, struct gprs_rlcmac_tbf *tbf) ms_set_reserved_slots(ms, NULL, 0, 0); if (ms_tlli(ms) != 0) - ms_start_timer(ms); + ms_release_timer_start(ms); } ms_update_status(ms); @@ -386,7 +389,7 @@ void ms_reset(struct GprsMs *ms) "Clearing MS object, TLLI: 0x%08x, IMSI: '%s'\n", ms_tlli(ms), ms_imsi(ms)); - ms_stop_timer(ms); + ms_release_timer_stop(ms); ms->tlli = GSM_RESERVED_TMSI; ms->new_dl_tlli = ms->tlli; |