From 5e007d9445b1fe0233b8d4618d6c1a01ec446788 Mon Sep 17 00:00:00 2001 From: Daniel Willmann Date: Fri, 8 Apr 2016 12:14:56 +0200 Subject: gprs: Use different RAB IDs for activation --- openbsc/include/openbsc/gprs_sgsn.h | 2 ++ openbsc/src/gprs/gprs_gmm.c | 26 ++++++++++++++++++-------- openbsc/src/gprs/gprs_sgsn.c | 5 +++++ openbsc/src/gprs/sgsn_libgtp.c | 5 ++++- 4 files changed, 29 insertions(+), 9 deletions(-) (limited to 'openbsc') diff --git a/openbsc/include/openbsc/gprs_sgsn.h b/openbsc/include/openbsc/gprs_sgsn.h index ca47d134b..28c319f59 100644 --- a/openbsc/include/openbsc/gprs_sgsn.h +++ b/openbsc/include/openbsc/gprs_sgsn.h @@ -149,6 +149,7 @@ struct sgsn_mm_ctx { void *ue_ctx; struct service_info service; int integrity_active; + uint8_t rab_id; } iu; /* VLR number */ uint32_t new_sgsn_addr; @@ -225,6 +226,7 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_by_tlli(uint32_t tlli, struct sgsn_mm_ctx *sgsn_mm_ctx_by_ptmsi(uint32_t tmsi); struct sgsn_mm_ctx *sgsn_mm_ctx_by_imsi(const char *imsi); struct sgsn_mm_ctx *sgsn_mm_ctx_by_ue_ctx(const void *uectx); +uint8_t rab_id_from_mm_ctx(struct sgsn_mm_ctx *mm); /* look-up by matching TLLI and P-TMSI (think twice before using this) */ struct sgsn_mm_ctx *sgsn_mm_ctx_by_tlli_and_ptmsi(uint32_t tlli, diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c index c1a4e508a..ae0e200ce 100644 --- a/openbsc/src/gprs/gprs_gmm.c +++ b/openbsc/src/gprs/gprs_gmm.c @@ -698,9 +698,23 @@ static int gsm48_tx_gmm_service_rej(struct sgsn_mm_ctx *mm, static int gsm48_tx_gmm_ra_upd_ack(struct sgsn_mm_ctx *mm); +void activate_pdp_rabs(struct sgsn_mm_ctx *ctx) +{ + /* Send RAB activation requests for all PDP contexts */ + if (ctx->iu.service.type == 1) { + struct sgsn_pdp_ctx *pdp; + uint8_t rab_id; + llist_for_each_entry(pdp, &ctx->pdp_list, list) { + rab_id = rab_id_from_mm_ctx(ctx); + iu_rab_act_ps(rab_id, pdp); + } + } +} + /* Check if we can already authorize a subscriber */ static int gsm48_gmm_authorize(struct sgsn_mm_ctx *ctx) { + int rc; #ifndef PTMSI_ALLOC struct sgsn_signal_data sig_data; #endif @@ -783,15 +797,11 @@ static int gsm48_gmm_authorize(struct sgsn_mm_ctx *ctx) /* TODO: PMM State transition */ ctx->pending_req = 0; - /* Send RAB activation requests for all PDP contexts */ - if (ctx->iu.service.type == 1) { - struct sgsn_pdp_ctx *pdp; - llist_for_each_entry(pdp, &ctx->pdp_list, list) { - iu_rab_act_ps(1, pdp); - } - } + rc = gsm48_tx_gmm_service_ack(ctx); - return gsm48_tx_gmm_service_ack(ctx); + activate_pdp_rabs(ctx); + + return rc; case GSM48_MT_GMM_RA_UPD_REQ: /* Send RA UPDATE ACCEPT */ return gsm48_tx_gmm_ra_upd_ack(ctx); diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c index 1a77daa9d..8c188bf59 100644 --- a/openbsc/src/gprs/gprs_sgsn.c +++ b/openbsc/src/gprs/gprs_sgsn.c @@ -105,6 +105,10 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_by_ue_ctx(const void *uectx) return NULL; } +uint8_t rab_id_from_mm_ctx(struct sgsn_mm_ctx *mm) +{ + return mm->iu.rab_id++; +} /* look-up a SGSN MM context based on TLLI + RAI */ struct sgsn_mm_ctx *sgsn_mm_ctx_by_tlli(uint32_t tlli, @@ -204,6 +208,7 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_alloc_iu(void *uectx) ctx->ran_type = MM_CTX_T_UTRAN_Iu; ctx->iu.ue_ctx = uectx; + ctx->iu.rab_id = 1; ctx->mm_state = GMM_DEREGISTERED; ctx->auth_triplet.key_seq = GSM_KEY_SEQ_INVAL; ctx->ctrg = rate_ctr_group_alloc(ctx, &mmctx_ctrg_desc, 0); diff --git a/openbsc/src/gprs/sgsn_libgtp.c b/openbsc/src/gprs/sgsn_libgtp.c index 21e8ebce5..cdda0ad57 100644 --- a/openbsc/src/gprs/sgsn_libgtp.c +++ b/openbsc/src/gprs/sgsn_libgtp.c @@ -370,7 +370,10 @@ static int create_pdp_conf(struct pdp_t *pdp, void *cbp, int cause) return send_act_pdp_cont_acc(pctx); } else { /* Activate a radio bearer */ - iu_rab_act_ps(1, pctx); + uint8_t rab_id; + + rab_id = rab_id_from_mm_ctx(pctx); + iu_rab_act_ps(rab_id, pctx); return 0; } -- cgit v1.2.3