From ccd1252bd76169439cb66f3a50e4575e0f03ec0b Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Fri, 30 Aug 2019 17:06:36 +0200 Subject: Introduce FSM mm_state_iu_fsm Implement TS 23.060 6.1.2 Mobility Management States (Iu 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: I4c9cf8c27194817c56e8949af0205e1cc14af317 --- include/osmocom/sgsn/Makefile.am | 1 + include/osmocom/sgsn/gprs_gmm.h | 2 -- include/osmocom/sgsn/gprs_mm_state_iu_fsm.h | 24 ++++++++++++++++++++++++ include/osmocom/sgsn/gprs_sgsn.h | 9 +-------- 4 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 include/osmocom/sgsn/gprs_mm_state_iu_fsm.h (limited to 'include') diff --git a/include/osmocom/sgsn/Makefile.am b/include/osmocom/sgsn/Makefile.am index d6ee4451e..0ab00fe46 100644 --- a/include/osmocom/sgsn/Makefile.am +++ b/include/osmocom/sgsn/Makefile.am @@ -8,6 +8,7 @@ noinst_HEADERS = \ gprs_gmm.h \ gprs_gmm_attach.h \ gprs_mm_state_gb_fsm.h \ + gprs_mm_state_iu_fsm.h \ gprs_llc.h \ gprs_llc_xid.h \ gprs_ranap.h \ diff --git a/include/osmocom/sgsn/gprs_gmm.h b/include/osmocom/sgsn/gprs_gmm.h index 2fa12e597..982cd93d6 100644 --- a/include/osmocom/sgsn/gprs_gmm.h +++ b/include/osmocom/sgsn/gprs_gmm.h @@ -49,7 +49,5 @@ void extract_subscr_hlr(struct sgsn_mm_ctx *ctx); void pdp_ctx_detach_mm_ctx(struct sgsn_pdp_ctx *pdp); -void mmctx_set_pmm_state(struct sgsn_mm_ctx *ctx, enum gprs_mm_state_iu state); - void msgid2mmctx(struct sgsn_mm_ctx *mm, const struct msgb *msg); #endif /* _GPRS_GMM_H */ diff --git a/include/osmocom/sgsn/gprs_mm_state_iu_fsm.h b/include/osmocom/sgsn/gprs_mm_state_iu_fsm.h new file mode 100644 index 000000000..7f02bcc45 --- /dev/null +++ b/include/osmocom/sgsn/gprs_mm_state_iu_fsm.h @@ -0,0 +1,24 @@ +#pragma once + +#include + +struct sgsn_mm_ctx; + + +/* TS 23.060 6.1.1 Mobility Management States (A/Gb mode) */ +enum mm_state_iu_fsm_states { + ST_PMM_DETACHED, + ST_PMM_CONNECTED, + ST_PMM_IDLE +}; + +enum mm_state_iu_fsm_events { + E_PMM_PS_ATTACH, + /* E_PS_DETACH, TODO: not used */ + E_PMM_PS_CONN_RELEASE, + E_PMM_PS_CONN_ESTABLISH, + E_PMM_IMPLICIT_DETACH, /* = E_PS_ATTACH_REJECT, E_RAU_REJECT */ + E_PMM_RA_UPDATE, /* = Serving RNC relocation */ +}; + +extern struct osmo_fsm mm_state_iu_fsm; diff --git a/include/osmocom/sgsn/gprs_sgsn.h b/include/osmocom/sgsn/gprs_sgsn.h index 382019c2d..8f16c5b30 100644 --- a/include/osmocom/sgsn/gprs_sgsn.h +++ b/include/osmocom/sgsn/gprs_sgsn.h @@ -32,13 +32,6 @@ enum gprs_gmm_state { GMM_DEREGISTERED_INIT, /* 4.1.3.3.1.4 */ }; -/* TS 23.060 6.1.2 Mobility Management States (Iu mode) */ -enum gprs_mm_state_iu { - PMM_DETACHED, - PMM_CONNECTED, - PMM_IDLE -}; - enum gprs_mm_ctr { GMM_CTR_PKTS_SIG_IN, GMM_CTR_PKTS_SIG_OUT, @@ -171,7 +164,7 @@ struct sgsn_mm_ctx { struct ranap_ue_conn_ctx *ue_ctx; struct service_info service; /* TS 23.060 6.1.2 Mobility Management States (Iu mode) */ - enum gprs_mm_state_iu mm_state; + struct osmo_fsm_inst *mm_state_fsm; } iu; struct { struct osmo_fsm_inst *fsm; -- cgit v1.2.3