From d6d0d8b86fb16fd5a8d6090d26b6b7848a8281ce Mon Sep 17 00:00:00 2001 From: Daniel Willmann Date: Mon, 15 Feb 2016 11:55:47 +0100 Subject: WIP: Wait for radio bearer before sending pdp context accept --- openbsc/include/openbsc/iu.h | 5 ++++- openbsc/src/gprs/sgsn_libgtp.c | 29 +++++++++++++++++++---------- openbsc/src/libiu/iu.c | 17 ++++++++++++++--- 3 files changed, 37 insertions(+), 14 deletions(-) (limited to 'openbsc') diff --git a/openbsc/include/openbsc/iu.h b/openbsc/include/openbsc/iu.h index 3bcc37825..1146d686e 100644 --- a/openbsc/include/openbsc/iu.h +++ b/openbsc/include/openbsc/iu.h @@ -1,5 +1,6 @@ #pragma once +struct sgsn_pdp_ctx; struct msgb; struct gprs_ra_id; @@ -8,8 +9,10 @@ struct iu_cb_ctx { }; struct ue_conn_ctx { + struct llist_head list; struct osmo_sua_link *link; uint32_t conn_id; + struct sgsn_pdp_ctx *pdp; }; /* Implementations of iu_recv_cb_t shall find the ue_conn_ctx in msg->dst. */ @@ -23,4 +26,4 @@ int iu_init(void *ctx, const char *listen_addr, uint16_t listen_port, int iu_tx(struct msgb *msg, uint8_t sapi); int iu_rab_act_cs(struct ue_conn_ctx *ue_ctx, uint32_t rtp_ip, uint16_t rtp_port); -int iu_rab_act_ps(struct ue_conn_ctx *ue_ctx, uint32_t gtp_ip, uint32_t gtp_tei); +int iu_rab_act_ps(struct sgsn_pdp_ctx *pdp, uint32_t gtp_ip, uint32_t gtp_tei); diff --git a/openbsc/src/gprs/sgsn_libgtp.c b/openbsc/src/gprs/sgsn_libgtp.c index b84d4ba40..4b98fbbcc 100644 --- a/openbsc/src/gprs/sgsn_libgtp.c +++ b/openbsc/src/gprs/sgsn_libgtp.c @@ -91,7 +91,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) @@ -352,20 +352,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 */ - iu_rab_act_ps(pctx->mm->iu.ue_ctx, ggsn_ip, pdp->teid_own); + iu_rab_act_ps(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 @@ -387,6 +383,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) { diff --git a/openbsc/src/libiu/iu.c b/openbsc/src/libiu/iu.c index f6c5ced14..1c1d7173c 100644 --- a/openbsc/src/libiu/iu.c +++ b/openbsc/src/libiu/iu.c @@ -85,18 +85,25 @@ int iu_rab_act_cs(struct ue_conn_ctx *ue_ctx, uint32_t rtp_ip, uint16_t rtp_port { struct msgb *msg; + /* FIXME: Generate unique RAB ID per UE */ msg = ranap_new_msg_rab_assign_voice(1, rtp_ip, rtp_port); msg->l2h = msg->data; return iu_rab_act(ue_ctx, msg); } -int iu_rab_act_ps(struct ue_conn_ctx *ue_ctx, uint32_t gtp_ip, uint32_t gtp_tei) +int iu_rab_act_ps(struct sgsn_pdp_ctx *pdp, uint32_t gtp_ip, uint32_t gtp_tei) { struct msgb *msg; + struct sgsn_mm_ctx *mm = pdp->mm; + struct ue_conn_ctx *uectx; + uectx = mm->iu.ue_ctx; + uectx->pdp = pdp; + + /* FIXME: Generate unique RAB ID per UE */ msg = ranap_new_msg_rab_assign_data(1, gtp_ip, gtp_tei); msg->l2h = msg->data; - return iu_rab_act(ue_ctx, msg); + return iu_rab_act(uectx, msg); } int gprs_iu_rab_deact(struct sgsn_mm_ctx *mm) @@ -238,7 +245,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 rc; @@ -260,6 +269,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; } -- cgit v1.2.3