From 1f2f2cf0eb588b65fdc7a0d1e5a08540f45e8f76 Mon Sep 17 00:00:00 2001 From: Daniel Willmann Date: Mon, 25 Jan 2016 16:58:18 +0100 Subject: WIP: Wait for radio bearer before sending pdp context accept --- openbsc/src/gprs/sgsn_iu.c | 11 +++++++++-- openbsc/src/gprs/sgsn_libgtp.c | 29 +++++++++++++++++++---------- 2 files changed, 28 insertions(+), 12 deletions(-) (limited to 'openbsc') diff --git a/openbsc/src/gprs/sgsn_iu.c b/openbsc/src/gprs/sgsn_iu.c index 6da8f7224..0782513e6 100644 --- a/openbsc/src/gprs/sgsn_iu.c +++ b/openbsc/src/gprs/sgsn_iu.c @@ -30,6 +30,7 @@ struct ue_conn_ctx { struct llist_head list; struct osmo_sua_link *link; uint32_t conn_id; + struct sgsn_pdp_ctx *pdp; }; static LLIST_HEAD(conn_ctx_list); @@ -60,13 +61,15 @@ struct ue_conn_ctx *ue_conn_ctx_find(struct osmo_sua_link *link, uint32_t conn_i * RANAP handling ***********************************************************************/ -int gprs_iu_rab_act(struct sgsn_mm_ctx *mm, uint32_t gtp_ip, uint32_t gtp_tei) +int gprs_iu_rab_act(struct sgsn_pdp_ctx *pdp, uint32_t gtp_ip, uint32_t gtp_tei) { + struct sgsn_mm_ctx *mm = pdp->mm; struct ue_conn_ctx *uectx; struct osmo_scu_prim *prim; struct msgb *msg; uectx = mm->iu.ue_ctx; + uectx->pdp = pdp; msg = ranap_new_msg_rab_assign_data(1, gtp_ip, gtp_tei); msg->l2h = msg->data; @@ -217,7 +220,9 @@ static int ranap_handle_co_iu_rel_req(struct ue_conn_ctx *ctx, RANAP_Iu_ReleaseR return 0; } -static int ranap_handle_co_rab_ass_resp(void *ctx, RANAP_RAB_AssignmentResponseIEs_t *ies) +int send_act_pdp_cont_acc(struct sgsn_pdp_ctx *pctx); + +static int ranap_handle_co_rab_ass_resp(struct ue_conn_ctx *ctx, RANAP_RAB_AssignmentResponseIEs_t *ies) { int i, rc; @@ -236,6 +241,8 @@ static int ranap_handle_co_rab_ass_resp(void *ctx, RANAP_RAB_AssignmentResponseI LOGPC(DRANAP, LOGL_INFO, "\n"); + send_act_pdp_cont_acc(ctx->pdp); + return rc; } diff --git a/openbsc/src/gprs/sgsn_libgtp.c b/openbsc/src/gprs/sgsn_libgtp.c index 6393b1a4a..b2a0e7941 100644 --- a/openbsc/src/gprs/sgsn_libgtp.c +++ b/openbsc/src/gprs/sgsn_libgtp.c @@ -90,7 +90,7 @@ const struct value_string gtp_cause_strs[] = { { 0, NULL } }; -int gprs_iu_rab_act(struct sgsn_mm_ctx *mm, uint32_t gtp_ip, uint32_t gtp_tei); +int gprs_iu_rab_act(struct sgsn_pdp_ctx *mm, uint32_t gtp_ip, uint32_t gtp_tei); /* Generate the GTP IMSI IE according to 09.60 Section 7.9.2 */ static uint64_t imsi_str2gtp(char *str) @@ -351,20 +351,16 @@ static int create_pdp_conf(struct pdp_t *pdp, void *cbp, int cause) if (pctx->mm->ran_type == MM_CTX_T_GERAN_Gb) { /* Activate the SNDCP layer */ sndcp_sm_activate_ind(&pctx->mm->gb.llme->lle[pctx->sapi], pctx->nsapi); + + + return send_act_pdp_cont_acc(pctx); } else { /* Activate a radio bearer */ uint32_t ggsn_ip = 0xc0a80033; /* 192.168.0.51 */ - gprs_iu_rab_act(pctx->mm, ggsn_ip, pdp->teid_own); + gprs_iu_rab_act(pctx, ggsn_ip, pdp->teid_own); + return 0; } - /* Inform others about it */ - memset(&sig_data, 0, sizeof(sig_data)); - sig_data.pdp = pctx; - osmo_signal_dispatch(SS_SGSN, S_SGSN_PDP_ACT, &sig_data); - - /* Send PDP CTX ACT to MS */ - return gsm48_tx_gsm_act_pdp_acc(pctx); - reject: /* * In case of a timeout pdp will be NULL but we have a valid pointer @@ -386,6 +382,19 @@ reject: return EOF; } +int send_act_pdp_cont_acc(struct sgsn_pdp_ctx *pctx) +{ + struct sgsn_signal_data sig_data; + + /* Inform others about it */ + memset(&sig_data, 0, sizeof(sig_data)); + sig_data.pdp = pctx; + osmo_signal_dispatch(SS_SGSN, S_SGSN_PDP_ACT, &sig_data); + + /* Send PDP CTX ACT to MS */ + return gsm48_tx_gsm_act_pdp_acc(pctx); +} + /* Confirmation of a PDP Context Delete */ static int delete_pdp_conf(struct pdp_t *pdp, void *cbp, int cause) { -- cgit v1.2.3