From 02514bc592923b9c082942d64fcf06db2e4bfd44 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Fri, 30 Aug 2019 16:14:22 +0200 Subject: Introduce FSM mm_state_gb_fsm Implement TS 23.060 6.1.1 Mobility Management States (A/Gb mode) using osmocom FSM and drop old implementation. Most of the logic on each state is still kept in gprs_gmm.c, will be inserted into the FSM later. Change-Id: I04004423e993107374d5a3549b8a93ac169251dd --- src/gprs/gprs_sgsn.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/gprs/gprs_sgsn.c') diff --git a/src/gprs/gprs_sgsn.c b/src/gprs/gprs_sgsn.c index 6acc66e9c..82855a6eb 100644 --- a/src/gprs/gprs_sgsn.c +++ b/src/gprs/gprs_sgsn.c @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -243,6 +244,7 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_alloc_gb(uint32_t tlli, const struct gprs_ra_id *raid) { struct sgsn_mm_ctx *ctx; + char buf[32]; ctx = sgsn_mm_ctx_alloc(tlli); if (!ctx) @@ -251,8 +253,9 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_alloc_gb(uint32_t tlli, memcpy(&ctx->ra, raid, sizeof(ctx->ra)); ctx->ran_type = MM_CTX_T_GERAN_Gb; ctx->gb.tlli = tlli; - ctx->gb.mm_state = MM_IDLE; ctx->ciph_algo = sgsn->cfg.cipher; + snprintf(buf, sizeof(buf), "%" PRIu32, tlli); + ctx->gb.mm_state_fsm = osmo_fsm_inst_alloc(&mm_state_gb_fsm, ctx, ctx, LOGL_DEBUG, buf); LOGMMCTXP(LOGL_DEBUG, ctx, "Allocated with %s cipher.\n", get_value_string(gprs_cipher_names, ctx->ciph_algo)); @@ -334,11 +337,6 @@ void sgsn_mm_ctx_cleanup_free(struct sgsn_mm_ctx *mm) osmo_timer_del(&mm->timer); } - if (osmo_timer_pending(&mm->gb.state_timer)) { - LOGMMCTXP(LOGL_INFO, mm, "Cancelling MM state timer %u\n", mm->gb.state_T); - osmo_timer_del(&mm->gb.state_timer); - } - memset(&sig_data, 0, sizeof(sig_data)); sig_data.mm = mm; osmo_signal_dispatch(SS_SGSN, S_SGSN_MM_FREE, &sig_data); @@ -353,6 +351,8 @@ void sgsn_mm_ctx_cleanup_free(struct sgsn_mm_ctx *mm) if (mm->gmm_att_req.fsm) gmm_att_req_free(mm); + if (mm->gb.mm_state_fsm) + osmo_fsm_inst_free(mm->gb.mm_state_fsm); sgsn_mm_ctx_free(mm); mm = NULL; -- cgit v1.2.3