Change in ...osmo-sgsn[master]: WIP: implement ran change between 2g and 3g

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/.

lynxis lazus gerrit-no-reply at lists.osmocom.org
Wed Sep 11 01:41:47 UTC 2019


lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/15487


Change subject: WIP: implement ran change between 2g and 3g
......................................................................

WIP: implement ran change between 2g and 3g

Change-Id: I3fc614da6ba137e871ee0fe86ca22b6a4a354dd2
---
M include/osmocom/sgsn/gprs_mm_state_gb_fsm.h
M include/osmocom/sgsn/gprs_mm_state_iu_fsm.h
M src/sgsn/gprs_gmm.c
M src/sgsn/gprs_mm_state_gb_fsm.c
M src/sgsn/gprs_mm_state_iu_fsm.c
5 files changed, 36 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/87/15487/1

diff --git a/include/osmocom/sgsn/gprs_mm_state_gb_fsm.h b/include/osmocom/sgsn/gprs_mm_state_gb_fsm.h
index e69e1e1..4da5abe 100644
--- a/include/osmocom/sgsn/gprs_mm_state_gb_fsm.h
+++ b/include/osmocom/sgsn/gprs_mm_state_gb_fsm.h
@@ -21,6 +21,7 @@
 	/* E_FORCE_TO_STANDBY, TODO: not used */
 	/* E_ABNSORMAL_RLC_CONDITION, TODO: not used */
 	E_MM_RA_UPDATE,
+	E_MM_RAN_CHANGE, /* when a MS is moving to other RAN */
 };
 
 extern struct osmo_fsm mm_state_gb_fsm;
diff --git a/include/osmocom/sgsn/gprs_mm_state_iu_fsm.h b/include/osmocom/sgsn/gprs_mm_state_iu_fsm.h
index 05342f9..92bdd48 100644
--- a/include/osmocom/sgsn/gprs_mm_state_iu_fsm.h
+++ b/include/osmocom/sgsn/gprs_mm_state_iu_fsm.h
@@ -20,6 +20,7 @@
 	E_PMM_IMPLICIT_DETACH, /* = E_PS_ATTACH_REJECT, E_RAU_REJECT */
 	E_PMM_RA_UPDATE, /* = Serving RNC relocation */
 	E_PMM_USER_INACTIVITY, /* when the inactivity timer runs out */
+	E_PMM_RAN_CHANGE, /* when a UE is moving to other RAN */
 };
 
 extern struct osmo_fsm mm_state_iu_fsm;
diff --git a/src/sgsn/gprs_gmm.c b/src/sgsn/gprs_gmm.c
index afae369..68af317 100644
--- a/src/sgsn/gprs_gmm.c
+++ b/src/sgsn/gprs_gmm.c
@@ -1099,6 +1099,21 @@
 	osmo_fsm_inst_dispatch(ctx->gmm_fsm, E_GMM_COMMON_PROC_INIT_REQ, NULL);
 }
 
+static void migrate_ran(struct sgsn_mm_ctx *ctx,
+		       enum sgsn_ran_type new_ran)
+{
+	if (ctx->ran_type == new_ran)
+		return;
+
+	if (ctx->ran_type == MM_CTX_T_GERAN_Gb)
+		osmo_fsm_inst_dispatch(ctx->gb.mm_state_fsm, E_MM_RAN_CHANGE, NULL);
+
+	if (ctx->ran_type == MM_CTX_T_UTRAN_Iu)
+		osmo_fsm_inst_dispatch(ctx->iu.mm_state_fsm, E_PMM_RAN_CHANGE, NULL);
+
+	ctx->ran_type = new_ran;
+}
+
 /* 3GPP TS 24.008 § 9.4.1 Attach request */
 static int gsm48_rx_gmm_att_req(struct sgsn_mm_ctx *ctx, struct msgb *msg,
 				struct gprs_llc_llme *llme)
@@ -1228,6 +1243,12 @@
 		ctx->gb.tlli = msgb_tlli(msg);
 		ctx->gb.llme = llme;
 	}
+
+	if (MSG_IU_UE_CTX(msg))
+		migrate_ran(ctx, MM_CTX_T_UTRAN_Iu);
+	else
+		migrate_ran(ctx, MM_CTX_T_GERAN_Gb);
+
 	msgid2mmctx(ctx, msg);
 	/* Update MM Context with currient RA and Cell ID */
 	ctx->ra = ra_id;
@@ -1636,6 +1657,11 @@
 		goto rejected;
 	}
 
+	if (MSG_IU_UE_CTX(msg))
+		migrate_ran(mmctx, MM_CTX_T_UTRAN_Iu);
+	else
+		migrate_ran(mmctx, MM_CTX_T_GERAN_Gb);
+
 	/* Store new BVCI/NSEI in MM context (FIXME: delay until we ack?) */
 	msgid2mmctx(mmctx, msg);
 	/* Bump the statistics of received signalling msgs for this MM context */
diff --git a/src/sgsn/gprs_mm_state_gb_fsm.c b/src/sgsn/gprs_mm_state_gb_fsm.c
index 02f6747..34ec82d 100644
--- a/src/sgsn/gprs_mm_state_gb_fsm.c
+++ b/src/sgsn/gprs_mm_state_gb_fsm.c
@@ -46,6 +46,9 @@
 	unsigned long t_secs;
 
 	switch(event) {
+	case E_MM_RAN_CHANGE:
+		mm_state_gb_fsm_state_chg(fi, ST_MM_IDLE);
+		break;
 	case E_MM_READY_TIMER_EXPIRY:
 	case E_MM_IMPLICIT_DETACH:
 		mm_state_gb_fsm_state_chg(fi, ST_MM_STANDBY);
@@ -78,7 +81,7 @@
 		.action = st_mm_idle,
 	},
 	[ST_MM_READY] = {
-		.in_event_mask = X(E_MM_READY_TIMER_EXPIRY) | X(E_MM_RA_UPDATE) | X(E_MM_IMPLICIT_DETACH) | X(E_MM_PDU_RECEPTION),
+		.in_event_mask = X(E_MM_READY_TIMER_EXPIRY) | X(E_MM_RA_UPDATE) | X(E_MM_IMPLICIT_DETACH) | X(E_MM_PDU_RECEPTION) | X(E_MM_RAN_CHANGE),
 		.out_state_mask = X(ST_MM_IDLE) | X(ST_MM_STANDBY),
 		.name = "Ready",
 		.action = st_mm_ready,
@@ -97,6 +100,7 @@
 	OSMO_VALUE_STRING(E_MM_IMPLICIT_DETACH),
 	OSMO_VALUE_STRING(E_MM_READY_TIMER_EXPIRY),
 	OSMO_VALUE_STRING(E_MM_RA_UPDATE),
+	OSMO_VALUE_STRING(E_MM_RAN_CHANGE),
 	{ 0, NULL }
 };
 
diff --git a/src/sgsn/gprs_mm_state_iu_fsm.c b/src/sgsn/gprs_mm_state_iu_fsm.c
index 2996c4e..627a990 100644
--- a/src/sgsn/gprs_mm_state_iu_fsm.c
+++ b/src/sgsn/gprs_mm_state_iu_fsm.c
@@ -53,6 +53,7 @@
 	};
 
 	switch(event) {
+	case E_PMM_RAN_CHANGE:
 	case E_PMM_PS_CONN_RELEASE:
 		sgsn_ranap_iu_free(ctx);
 		mm_state_iu_fsm_state_chg(fi, ST_PMM_IDLE);
@@ -109,7 +110,7 @@
 		.action = st_pmm_detached,
 	},
 	[ST_PMM_CONNECTED] = {
-		.in_event_mask = X(E_PMM_PS_CONN_RELEASE) | X(E_PMM_RA_UPDATE) | X(E_PMM_IMPLICIT_DETACH) | X(E_PMM_USER_INACTIVITY),
+		.in_event_mask = X(E_PMM_PS_CONN_RELEASE) | X(E_PMM_RA_UPDATE) | X(E_PMM_IMPLICIT_DETACH) | X(E_PMM_USER_INACTIVITY) | X(E_PMM_RAN_CHANGE),
 		.out_state_mask = X(ST_PMM_DETACHED) | X(ST_PMM_IDLE),
 		.name = "Connected",
 		.action = st_pmm_connected,
@@ -130,6 +131,7 @@
 	OSMO_VALUE_STRING(E_PMM_IMPLICIT_DETACH),
 	OSMO_VALUE_STRING(E_PMM_RA_UPDATE),
 	OSMO_VALUE_STRING(E_PMM_USER_INACTIVITY),
+	OSMO_VALUE_STRING(E_PMM_RAN_CHANGE),
 	{ 0, NULL }
 };
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/15487
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I3fc614da6ba137e871ee0fe86ca22b6a4a354dd2
Gerrit-Change-Number: 15487
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190911/34a7f728/attachment.htm>


More information about the gerrit-log mailing list