summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2017-01-31 16:32:33 +0100
committerAlexander Couzens <lynxis@fe80.eu>2017-01-31 16:53:11 +0100
commit03121afb4ca71cea5bbe1e06501a8685cca0593c (patch)
treec04870061296137b83fb0d83f5da0c337ef7356b
parent1b1bf1a4be6400b19758d436389fb380299dd8e8 (diff)
split MM states from PMM stateslynxis/rbs2000
-rw-r--r--openbsc/include/openbsc/gprs_sgsn.h6
-rw-r--r--openbsc/src/gprs/gprs_gmm.c21
2 files changed, 19 insertions, 8 deletions
diff --git a/openbsc/include/openbsc/gprs_sgsn.h b/openbsc/include/openbsc/gprs_sgsn.h
index 1828921..62470be 100644
--- a/openbsc/include/openbsc/gprs_sgsn.h
+++ b/openbsc/include/openbsc/gprs_sgsn.h
@@ -36,9 +36,9 @@ enum gprs_pmm_state {
PMM_DETACHED,
PMM_CONNECTED,
PMM_IDLE,
- MM_IDLE = PMM_DETACHED,
- MM_READY = PMM_CONNECTED,
- MM_STANDBY = PMM_IDLE,
+ MM_IDLE,
+ MM_READY,
+ MM_STANDBY,
};
enum gprs_mm_ctr {
diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c
index ed01500..fffbe9c 100644
--- a/openbsc/src/gprs/gprs_gmm.c
+++ b/openbsc/src/gprs/gprs_gmm.c
@@ -119,8 +119,20 @@ static void mmctx_change_gtpu_endpoints_to_sgsn(struct sgsn_mm_ctx *mm_ctx)
}
}
-void mmctx_set_pmm_state(struct sgsn_mm_ctx *ctx, enum gprs_pmm_state state)
+void mmctx_set_pmm_state(struct sgsn_mm_ctx *ctx, enum gprs_pmm_state iu, enum gprs_pmm_state gb)
{
+ enum gprs_pmm_state state;
+
+ switch (ctx->ran_type) {
+ case MM_CTX_T_GERAN_Gb:
+ state = gb;
+ break;
+ case MM_CTX_T_GERAN_Iu:
+ case MM_CTX_T_UTRAN_Iu:
+ state = iu;
+ break;
+ }
+
if (ctx->pmm_state == state)
return;
@@ -277,8 +289,7 @@ static void mm_ctx_cleanup_free(struct sgsn_mm_ctx *ctx, const char *log_text)
/* Mark MM state as deregistered */
ctx->gmm_state = GMM_DEREGISTERED;
-
- mmctx_set_pmm_state(ctx, PMM_DETACHED);
+ mmctx_set_pmm_state(ctx, PMM_DETACHED, MM_IDLE);
sgsn_mm_ctx_cleanup_free(ctx);
}
@@ -1832,7 +1843,7 @@ static int gsm0408_rcv_gmm(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
mmctx->gb.tlli_new);
}
mmctx->gmm_state = GMM_REGISTERED_NORMAL;
- mmctx_set_pmm_state(mmctx, PMM_CONNECTED);
+ mmctx_set_pmm_state(mmctx, PMM_CONNECTED, MM_READY);
rc = 0;
memset(&sig_data, 0, sizeof(sig_data));
@@ -1855,7 +1866,7 @@ static int gsm0408_rcv_gmm(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
mmctx->gb.tlli_new);
}
mmctx->gmm_state = GMM_REGISTERED_NORMAL;
- mmctx_set_pmm_state(mmctx, PMM_CONNECTED);
+ mmctx_set_pmm_state(mmctx, PMM_CONNECTED, MM_READY);
rc = 0;
memset(&sig_data, 0, sizeof(sig_data));