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/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/12009 Change subject: gprs/gprs_gmm: implement T3314. Timeout to reset MM state to STANDBY ...................................................................... gprs/gprs_gmm: implement T3314. Timeout to reset MM state to STANDBY When a MS MM state is READY the exakt location is known (PCU). T3141 set the MM state to STANDBY, where only the RA is known. Introduce a second set of timer variables, because state timer can run while another packet state timer is timing out. Change-Id: I4ce23ebe50d141076c20c9c56990b7103cd25e55 --- M include/osmocom/sgsn/gprs_sgsn.h M src/gprs/gprs_gmm.c M src/gprs/gprs_sgsn.c 3 files changed, 100 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/09/12009/1 diff --git a/include/osmocom/sgsn/gprs_sgsn.h b/include/osmocom/sgsn/gprs_sgsn.h index cf78766..c9933e4 100644 --- a/include/osmocom/sgsn/gprs_sgsn.h +++ b/include/osmocom/sgsn/gprs_sgsn.h @@ -225,6 +225,10 @@ unsigned int T; /* Txxxx number */ unsigned int num_T_exp; /* number of consecutive T expirations */ + /* timer for pmm state */ + struct osmo_timer_list state_timer; + unsigned int state_T; /* Txxxx number but only used for pmm_states */ + enum gprs_t3350_mode t3350_mode; uint8_t t3370_id_type; uint8_t pending_req; /* the request's message type */ diff --git a/src/gprs/gprs_gmm.c b/src/gprs/gprs_gmm.c index cc6ea4a..53de36d 100644 --- a/src/gprs/gprs_gmm.c +++ b/src/gprs/gprs_gmm.c @@ -115,6 +115,12 @@ static int gsm48_gmm_authorize(struct sgsn_mm_ctx *ctx); +static void mmctx_state_timer_cb(void *_mm); +static void mmctx_state_timer_start(struct sgsn_mm_ctx *mm, unsigned int T, int seconds); +static void mmctx_state_timer_stop(struct sgsn_mm_ctx *mm, unsigned int T); + +static void msgid2mmctx(struct sgsn_mm_ctx *mm, const struct msgb *msg); + static void mmctx_change_gtpu_endpoints_to_sgsn(struct sgsn_mm_ctx *mm_ctx) { struct sgsn_pdp_ctx *pdp; @@ -165,9 +171,79 @@ get_value_string(gprs_pmm_state_names, ctx->pmm_state), get_value_string(gprs_pmm_state_names, state)); + switch (state) { + case MM_READY: + /* T3314 change state to MM_STANDBY */ + mmctx_state_timer_start(ctx, 3314, sgsn->cfg.timers.T3314); + break; + case MM_IDLE: + mmctx_state_timer_stop(ctx, 3314); + break; + case MM_STANDBY: + mmctx_state_timer_stop(ctx, 3314); + break; + default: + /* when changing to state != MM_READY */ + break; + } + ctx->pmm_state = state; } +void mmctx_recv_pdu(struct sgsn_mm_ctx *ctx, struct msgb *msg) +{ + msgid2mmctx(ctx, msg); + + if (ctx->ran_type != MM_CTX_T_GERAN_Gb) + return; + + switch (ctx->pmm_state) { + case MM_STANDBY: + mmctx_set_mm_state(ctx, MM_READY); + break; + case MM_READY: /* the timer is started when switching to READY */ + mmctx_state_timer_start(ctx, 3314, sgsn->cfg.timers.T3314); + break; + default: + break; + } +} + +static void mmctx_state_timer_cb(void *_mm) +{ + struct sgsn_mm_ctx *mm = _mm; + + if (mm->ran_type != MM_CTX_T_GERAN_Gb) + return; + + switch (mm->state_T) { + case 3314: + if (mm->pmm_state == MM_READY) + mmctx_set_mm_state(mm, MM_STANDBY); + break; + default: + LOGMMCTXP(LOGL_ERROR, mm, "state timer expired in unknown mode %u\n", + mm->state_T); + break; + } +} + +static void mmctx_state_timer_start(struct sgsn_mm_ctx *mm, unsigned int T, int seconds) +{ + mm->state_T = T; + mm->state_timer.data = mm; + mm->state_timer.cb = &mmctx_state_timer_cb; + + osmo_timer_schedule(&mm->state_timer, seconds, 0); +} + +static void mmctx_state_timer_stop(struct sgsn_mm_ctx *mm, unsigned int T) +{ + if (mm->state_T == T) + osmo_timer_del(&mm->state_timer); +} + + #ifdef BUILD_IU int sgsn_ranap_rab_ass_resp(struct sgsn_mm_ctx *ctx, RANAP_RAB_SetupOrModifiedItemIEs_t *setup_ies); int sgsn_ranap_iu_event(struct ranap_ue_conn_ctx *ctx, enum ranap_iu_event_type type, void *data) @@ -2895,6 +2971,21 @@ return rc; } +/* Update the MM context, called also for other PDUs than MM PDU from Gb */ +void gsm0408_gprs_notify_pdu_gb(struct msgb *msg) +{ + struct sgsn_mm_ctx *mmctx; + struct gprs_ra_id ra_id; + + bssgp_parse_cell_id(&ra_id, msgb_bcid(msg)); + mmctx = sgsn_mm_ctx_by_tlli(msgb_tlli(msg), &ra_id); + if (!mmctx) { + return; + } + + mmctx_recv_pdu(mmctx, msg); +} + /* Main entry point for incoming 04.08 GPRS messages from Gb */ int gsm0408_gprs_rcvmsg_gb(struct msgb *msg, struct gprs_llc_llme *llme, bool drop_cipherable) diff --git a/src/gprs/gprs_sgsn.c b/src/gprs/gprs_sgsn.c index 01f039a..fe089e4 100644 --- a/src/gprs/gprs_sgsn.c +++ b/src/gprs/gprs_sgsn.c @@ -342,6 +342,11 @@ osmo_timer_del(&mm->timer); } + if (osmo_timer_pending(&mm->state_timer)) { + LOGMMCTXP(LOGL_INFO, mm, "Cancelling MM timer %u\n", mm->state_T); + osmo_timer_del(&mm->state_timer); + } + memset(&sig_data, 0, sizeof(sig_data)); sig_data.mm = mm; osmo_signal_dispatch(SS_SGSN, S_SGSN_MM_FREE, &sig_data); -- To view, visit https://gerrit.osmocom.org/12009 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I4ce23ebe50d141076c20c9c56990b7103cd25e55 Gerrit-Change-Number: 12009 Gerrit-PatchSet: 1 Gerrit-Owner: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181129/b93b9b35/attachment.htm>