gmm: Rework sess_id to identify one GMME
The GMM layer doesn't really have to differentiate between SM connections, everything is sent over the LLC "GMM" SAPI. However, we still want to identify/related a given MS if there are multiple MS using the stack. Change-Id: Ib757f016824d918ce8b74ae0c2a652a6c1823556
This commit is contained in:
parent
ca7d0a9527
commit
644780008d
|
@ -48,9 +48,6 @@ struct gprs_gmm_ms_fsm_attach_ctx {
|
|||
bool with_imsi;
|
||||
bool explicit_att; /* true if by SMREG-ATTACH.req requested it */
|
||||
bool implicit_att; /* true if GMMSM-ESTABLISH.req requested it */
|
||||
/* Session Ids waiting for attach to happen during implicit_att: */
|
||||
uint32_t sess_id[16];
|
||||
uint8_t num_sess_id;
|
||||
/* Retransmission of ATTACH REQUEST (T3310) */
|
||||
uint8_t req_attempts;
|
||||
};
|
||||
|
@ -78,8 +75,7 @@ void gprs_gmm_ms_fsm_ctx_release(struct gprs_gmm_ms_fsm_ctx *ctx);
|
|||
int gprs_gmm_ms_fsm_ctx_request_attach(struct gprs_gmm_ms_fsm_ctx *ctx,
|
||||
enum osmo_gprs_gmm_attach_type attach_type,
|
||||
bool attach_with_imsi,
|
||||
bool explicit_attach,
|
||||
uint32_t sess_id);
|
||||
bool explicit_attach);
|
||||
|
||||
int gprs_gmm_ms_fsm_ctx_request_detach(struct gprs_gmm_ms_fsm_ctx *ctx,
|
||||
enum osmo_gprs_gmm_detach_ms_type detach_type,
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
/* 3GPP TS 44.064 § 8.3 TLLI assignment procedures */
|
||||
#define GPRS_GMM_TLLI_UNASSIGNED (0xffffffff)
|
||||
|
||||
#define GPRS_GMM_SESS_ID_UNASSIGNED (0xffffffff)
|
||||
|
||||
extern int g_gmm_log_cat[_OSMO_GPRS_GMM_LOGC_MAX];
|
||||
|
||||
#define LOGGMM(lvl, fmt, args...) LOGP(g_gmm_log_cat[OSMO_GPRS_GMM_LOGC_GMM], lvl, fmt, ## args)
|
||||
|
@ -53,6 +55,7 @@ struct gprs_gmm_entity {
|
|||
struct llist_head list; /* item in (struct gprs_gmm_ctx)->gmme_list */
|
||||
|
||||
struct gprs_gmm_ms_fsm_ctx ms_fsm;
|
||||
uint32_t sess_id; /* Used to identify the GMME in GMMSM SAP */
|
||||
uint32_t ptmsi;
|
||||
uint32_t old_ptmsi;
|
||||
uint32_t tlli;
|
||||
|
|
|
@ -149,6 +149,7 @@ struct gprs_gmm_entity *gprs_gmm_gmme_alloc(uint32_t ptmsi, const char *imsi)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
gmme->sess_id = GPRS_GMM_SESS_ID_UNASSIGNED;
|
||||
gmme->ptmsi = ptmsi;
|
||||
gmme->old_ptmsi = GSM_RESERVED_TMSI;
|
||||
gmme->old_tlli = GPRS_GMM_TLLI_UNASSIGNED;
|
||||
|
|
|
@ -132,14 +132,11 @@ static void st_gmm_ms_registered_initiated(struct osmo_fsm_inst *fi, uint32_t ev
|
|||
|
||||
if (att.implicit_att) {
|
||||
/* Submit GMMSM-ESTABLISH-CNF as per TS 24.007 Annex C.3 */
|
||||
unsigned int i;
|
||||
for (i = 0; i < att.num_sess_id; i++) {
|
||||
rc = gprs_gmm_submit_gmmsm_establish_cnf(ctx->gmme,
|
||||
att.sess_id[i],
|
||||
false, cause);
|
||||
if (rc < 0)
|
||||
return;
|
||||
}
|
||||
rc = gprs_gmm_submit_gmmsm_establish_cnf(ctx->gmme,
|
||||
ctx->gmme->sess_id,
|
||||
false, cause);
|
||||
if (rc < 0)
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case GPRS_GMM_MS_EV_ATTACH_ACCEPTED:
|
||||
|
@ -153,12 +150,9 @@ static void st_gmm_ms_registered_initiated(struct osmo_fsm_inst *fi, uint32_t ev
|
|||
}
|
||||
if (ctx->attach.implicit_att) {
|
||||
/* Submit GMMSM-ESTABLISH-CNF as per TS 24.007 Annex C.3 */
|
||||
unsigned int i;
|
||||
for (i = 0; i < ctx->attach.num_sess_id; i++) {
|
||||
rc = gprs_gmm_submit_gmmsm_establish_cnf(ctx->gmme, ctx->attach.sess_id[i], true, 0);
|
||||
if (rc < 0)
|
||||
return;
|
||||
}
|
||||
rc = gprs_gmm_submit_gmmsm_establish_cnf(ctx->gmme, ctx->gmme->sess_id, true, 0);
|
||||
if (rc < 0)
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case GPRS_GMM_MS_EV_DETACH_REQUESTED:
|
||||
|
@ -419,8 +413,7 @@ void gprs_gmm_ms_fsm_ctx_release(struct gprs_gmm_ms_fsm_ctx *ctx)
|
|||
int gprs_gmm_ms_fsm_ctx_request_attach(struct gprs_gmm_ms_fsm_ctx *ctx,
|
||||
enum osmo_gprs_gmm_attach_type attach_type,
|
||||
bool attach_with_imsi,
|
||||
bool explicit_attach,
|
||||
uint32_t sess_id)
|
||||
bool explicit_attach)
|
||||
{
|
||||
int rc;
|
||||
|
||||
|
@ -431,23 +424,6 @@ int gprs_gmm_ms_fsm_ctx_request_attach(struct gprs_gmm_ms_fsm_ctx *ctx,
|
|||
else
|
||||
ctx->attach.implicit_att = true;
|
||||
|
||||
if (!explicit_attach) {
|
||||
unsigned int i;
|
||||
bool found = false;
|
||||
if (ctx->attach.num_sess_id == ARRAY_SIZE(ctx->attach.sess_id))
|
||||
return -ENOMEM;
|
||||
for (i = 0; i < ctx->attach.num_sess_id; i++) {
|
||||
if (sess_id == ctx->attach.sess_id[i]) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
ctx->attach.sess_id[ctx->attach.num_sess_id] = sess_id;
|
||||
ctx->attach.num_sess_id++;
|
||||
}
|
||||
}
|
||||
|
||||
rc = osmo_fsm_inst_dispatch(ctx->fi, GPRS_GMM_MS_EV_ATTACH_REQUESTED, NULL);
|
||||
return rc;
|
||||
}
|
||||
|
|
|
@ -389,7 +389,7 @@ static int gprs_gmm_prim_handle_gmmreg_attach_req(struct osmo_gprs_gmm_prim *gmm
|
|||
rc = gprs_gmm_ms_fsm_ctx_request_attach(&gmme->ms_fsm,
|
||||
gmm_prim->gmmreg.attach_req.attach_type,
|
||||
gmm_prim->gmmreg.attach_req.attach_with_imsi,
|
||||
true, 0);
|
||||
true);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -485,6 +485,8 @@ static int gprs_gmm_prim_handle_gmmsm_establish_req(struct osmo_gprs_gmm_prim *g
|
|||
gmme = gprs_gmm_gmme_find_or_create_by_ptmsi_imsi(gmm_prim->gmmsm.establish_req.ptmsi,
|
||||
gmm_prim->gmmsm.establish_req.imsi);
|
||||
OSMO_ASSERT(gmme);
|
||||
/* Identify this GMME with this sess_id in GMMSM SAP from now on: */
|
||||
gmme->sess_id = gmm_prim->gmmsm.sess_id;
|
||||
|
||||
if (gmme->ms_fsm.fi->state == GPRS_GMM_MS_ST_REGISTERED) {
|
||||
rc = gprs_gmm_submit_gmmsm_establish_cnf(gmme, gmm_prim->gmmsm.sess_id, true, 0);
|
||||
|
@ -499,8 +501,7 @@ static int gprs_gmm_prim_handle_gmmsm_establish_req(struct osmo_gprs_gmm_prim *g
|
|||
rc = gprs_gmm_ms_fsm_ctx_request_attach(&gmme->ms_fsm,
|
||||
gmm_prim->gmmsm.establish_req.attach_type,
|
||||
gmm_prim->gmmsm.establish_req.attach_with_imsi,
|
||||
false,
|
||||
gmm_prim->gmmsm.sess_id);
|
||||
false);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue