pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/33000 )
Change subject: gmm: Implement submitting GMMSM-RELEASE.ind when MS becomes detached ......................................................................
gmm: Implement submitting GMMSM-RELEASE.ind when MS becomes detached
Change-Id: I74176eba870b19b30666ab5deef5eb56f0f0fd83 --- M include/osmocom/gprs/gmm/gmm_private.h M src/gmm/gmm.c M src/gmm/gmm_ms_fsm.c M tests/gmm/gmm_prim_test.c M tests/gmm/gmm_prim_test.ok 5 files changed, 30 insertions(+), 7 deletions(-)
Approvals: laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified pespin: Looks good to me, approved
diff --git a/include/osmocom/gprs/gmm/gmm_private.h b/include/osmocom/gprs/gmm/gmm_private.h index d93f724..df3f496 100644 --- a/include/osmocom/gprs/gmm/gmm_private.h +++ b/include/osmocom/gprs/gmm/gmm_private.h @@ -102,7 +102,7 @@ struct osmo_gprs_gmm_prim *gprs_gmm_prim_alloc_gmmrr_assign_req(uint32_t old_tlli, uint32_t new_tlli);
struct osmo_gprs_gmm_prim *gprs_gmm_prim_alloc_gmmsm_establish_cnf(uint32_t id, uint8_t cause); -struct osmo_gprs_gmm_prim *gprs_gmm_prim_alloc_gmmrr_release_ind(uint32_t id); +struct osmo_gprs_gmm_prim *gprs_gmm_prim_alloc_gmmsm_release_ind(uint32_t id); struct osmo_gprs_gmm_prim *gprs_gmm_prim_alloc_gmmsm_unitdata_ind(uint32_t id, uint8_t *smpdu, unsigned int smpdu_len);
/* gmm.c: */ @@ -131,6 +131,7 @@
int gprs_gmm_submit_gmmreg_attach_cnf(struct gprs_gmm_entity *gmme, bool accepted, uint8_t cause); int gprs_gmm_submit_gmmsm_establish_cnf(struct gprs_gmm_entity *gmme, bool accepted, uint8_t cause); +int gprs_gmm_submit_gmmsm_release_ind(struct gprs_gmm_entity *gmme); int gprs_gmm_submit_llgmm_assing_req(const struct gprs_gmm_entity *gmme);
/* misc.c */ diff --git a/src/gmm/gmm.c b/src/gmm/gmm.c index ade4059..2fb341e 100644 --- a/src/gmm/gmm.c +++ b/src/gmm/gmm.c @@ -453,6 +453,16 @@ return rc; }
+int gprs_gmm_submit_gmmsm_release_ind(struct gprs_gmm_entity *gmme) +{ + struct osmo_gprs_gmm_prim *gmm_prim_tx; + int rc; + + gmm_prim_tx = gprs_gmm_prim_alloc_gmmsm_release_ind(gmme->sess_id); + rc = gprs_gmm_prim_call_up_cb(gmm_prim_tx); + return rc; +} + static int gprs_gmm_submit_gmmrr_assing_req(struct gprs_gmm_entity *gmme) { struct osmo_gprs_gmm_prim *gmm_prim_tx; @@ -911,8 +921,6 @@ if (force_standby_indicated) gprs_gmm_gmme_ready_timer_stop(gmme);
- /* TODO: submit GMMSM-RELEASE-IND */ - /* Submit LLGMM-ASSIGN-REQ as per TS 24.007 Annex C.3 */ gmme->old_tlli = gmme->tlli; gmme->tlli = GPRS_GMM_TLLI_UNASSIGNED; diff --git a/src/gmm/gmm_ms_fsm.c b/src/gmm/gmm_ms_fsm.c index 95e421b..a344494 100644 --- a/src/gmm/gmm_ms_fsm.c +++ b/src/gmm/gmm_ms_fsm.c @@ -89,6 +89,10 @@
memset(&ctx->attach, 0, sizeof(ctx->attach)); gprs_gmm_gmme_t3312_stop(ctx->gmme); + + /* TS 24.007 9.5.1.4: informs SM layerthat the MS has been GPRS detached, e.g. by timer expiry */ + if (prev_state != GPRS_GMM_MS_ST_NULL) + gprs_gmm_submit_gmmsm_release_ind(ctx->gmme); }
static void st_gmm_ms_deregistered(struct osmo_fsm_inst *fi, uint32_t event, void *data) diff --git a/tests/gmm/gmm_prim_test.c b/tests/gmm/gmm_prim_test.c index 50d40d8..27b9336 100644 --- a/tests/gmm/gmm_prim_test.c +++ b/tests/gmm/gmm_prim_test.c @@ -294,10 +294,10 @@ osmo_hexdump(gmm_prim->gmmsm.unitdata_ind.smpdu, gmm_prim->gmmsm.unitdata_ind.smpdu_len)); break; - //case OSMO_PRIM(OSMO_GPRS_GMM_GMMSM_DETACH, PRIM_OP_CONFIRM): - // printf("%s(): Rx %s detach_type='%s'\n", __func__, pdu_name, - // osmo_gprs_gmm_detach_ms_type_name(gmm_prim->gmmsm.detach_cnf.detach_type)); - // break; + case OSMO_PRIM(OSMO_GPRS_GMM_GMMSM_RELEASE, PRIM_OP_INDICATION): + printf("%s(): Rx %s sess_id=%u\n", __func__, pdu_name, + gmm_prim->gmmsm.sess_id); + break; default: printf("%s(): Unexpected Rx %s\n", __func__, pdu_name); OSMO_ASSERT(0) diff --git a/tests/gmm/gmm_prim_test.ok b/tests/gmm/gmm_prim_test.ok index 6cf672a..2ff27f6 100644 --- a/tests/gmm/gmm_prim_test.ok +++ b/tests/gmm/gmm_prim_test.ok @@ -23,6 +23,7 @@ test_gmm_prim_llc_down_cb(): Rx LL-UNITDATA.request TLLI=0xec999002 SAPI=GMM l3=[08 05 20 0a 00 05 f4 ec 99 90 02 ] test_gmm_prim_llc_down_cb(): Rx LLGMM-ASSIGN.request old_TLLI=0xec999002 new_TLLI=0xffffffff test_gmm_prim_up_cb(): Rx GMMREG-DETACH.confirm detach_type='GPRS detach' +test_gmm_prim_up_cb(): Rx GMMSM-RELEASE.indication sess_id=4294967295 ==== test_gmm_prim_ms_gmmreg() [end] ==== ==== test_gmm_prim_ms_gmmsm() [start] ==== sys={0.000000}, mono={0.000000}: clock_override_set