From 0a6540d8bf6ff221c7a6c9c54d691bf9e005f0e9 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Wed, 27 Jun 2018 17:45:19 +0100 Subject: [PATCH] Saving QCI into ESM context. Different QCIs should be working now. --- lib/include/srslte/asn1/gtpc_msg.h | 4 ++-- srsepc/hdr/mme/s1ap_common.h | 1 - srsepc/src/mme/mme_gtpc.cc | 7 +++---- srsepc/src/mme/s1ap_ctx_mngmt_proc.cc | 9 ++++----- srsepc/src/mme/s1ap_nas_transport.cc | 20 ++++++++++++++++---- srsepc/src/spgw/spgw.cc | 3 --- 6 files changed, 25 insertions(+), 19 deletions(-) diff --git a/lib/include/srslte/asn1/gtpc_msg.h b/lib/include/srslte/asn1/gtpc_msg.h index 7fdb2620b..42b6ad3cf 100644 --- a/lib/include/srslte/asn1/gtpc_msg.h +++ b/lib/include/srslte/asn1/gtpc_msg.h @@ -269,8 +269,8 @@ struct gtpc_create_session_response struct gtpc_f_teid_ie s12_sgw_f_teid; bool s2b_u_pgw_f_teid_present; struct gtpc_f_teid_ie s2b_u_pgw_f_teid; - //bearer_level_qos_present - //bearer_level_qos + bool bearer_level_qos_present; + struct gtpc_bearer_qos_ie bearer_level_qos; //charging_id_present //charging_id //bearer_flags_present diff --git a/srsepc/hdr/mme/s1ap_common.h b/srsepc/hdr/mme/s1ap_common.h index 1910bf2bd..262d034b1 100644 --- a/srsepc/hdr/mme/s1ap_common.h +++ b/srsepc/hdr/mme/s1ap_common.h @@ -161,7 +161,6 @@ typedef struct{ ue_emm_ctx_t emm_ctx; eps_sec_ctx_t sec_ctx; ue_ecm_ctx_t ecm_ctx; - erab_ctx_t erabs_ctx[MAX_ERABS_PER_UE]; } ue_ctx_t; }//namespace diff --git a/srsepc/src/mme/mme_gtpc.cc b/srsepc/src/mme/mme_gtpc.cc index 631d0d76c..db286ae3b 100644 --- a/srsepc/src/mme/mme_gtpc.cc +++ b/srsepc/src/mme/mme_gtpc.cc @@ -92,7 +92,7 @@ mme_gtpc::get_new_ctrl_teid() return m_next_ctrl_teid++; //FIXME Use a Id pool? } void -mme_gtpc::send_create_session_request(uint64_t imsi, uint8_t qci) +mme_gtpc::send_create_session_request(uint64_t imsi) { m_mme_gtpc_log->info("Sending Create Session Request.\n"); m_mme_gtpc_log->console("Sending Create Session Request.\n"); @@ -130,7 +130,6 @@ mme_gtpc::send_create_session_request(uint64_t imsi, uint8_t qci) //Bearer QoS cs_req->eps_bearer_context_created.ebi = 5; - cs_req->eps_bearer_context_created.bearer_qos.qci=qci; //Check whether this UE is already registed std::map::iterator it = m_imsi_to_gtpc_ctx.find(imsi); @@ -248,10 +247,10 @@ mme_gtpc::handle_create_session_response(srslte::gtpc_pdu *cs_resp_pdu) //Set EPS bearer context //FIXME default EPS bearer is hard-coded int default_bearer=5; - erab_ctx_t *erab_ctx = &ecm_ctx->erabs_ctx[default_bearer]; + erab_ctx_t *erab_ctx = &ecm_ctx->erabs_ctx[default_bearer]; erab_ctx->pdn_addr_alloc= cs_resp->paa; erab_ctx->sgw_s1u_fteid = cs_resp->eps_bearer_context_created.s1_u_sgw_f_teid; - + m_mme_gtpc_log->console("QCI %d\n", erab_ctx->qci); m_s1ap->m_s1ap_ctx_mngmt_proc->send_initial_context_setup_request(emm_ctx, ecm_ctx, erab_ctx); return; } diff --git a/srsepc/src/mme/s1ap_ctx_mngmt_proc.cc b/srsepc/src/mme/s1ap_ctx_mngmt_proc.cc index 2ba49ae01..b9d599d3e 100644 --- a/srsepc/src/mme/s1ap_ctx_mngmt_proc.cc +++ b/srsepc/src/mme/s1ap_ctx_mngmt_proc.cc @@ -114,13 +114,13 @@ s1ap_ctx_mngmt_proc::send_initial_context_setup_request(ue_emm_ctx_t *emm_ctx, in_ctxt_req->E_RABToBeSetupListCtxtSUReq.len = 1; erab_ctx_req->e_RAB_ID.E_RAB_ID = erab_ctx->erab_id; //Setup E-RAB QoS parameters - erab_ctx_req->e_RABlevelQoSParameters.qCI.QCI = 9; + erab_ctx_req->e_RABlevelQoSParameters.qCI.QCI = erab_ctx->qci; erab_ctx_req->e_RABlevelQoSParameters.allocationRetentionPriority.priorityLevel.PriorityLevel = 15 ;//Lowest erab_ctx_req->e_RABlevelQoSParameters.allocationRetentionPriority.pre_emptionCapability = LIBLTE_S1AP_PRE_EMPTIONCAPABILITY_SHALL_NOT_TRIGGER_PRE_EMPTION; erab_ctx_req->e_RABlevelQoSParameters.allocationRetentionPriority.pre_emptionVulnerability = LIBLTE_S1AP_PRE_EMPTIONVULNERABILITY_PRE_EMPTABLE; - erab_ctx_req->e_RABlevelQoSParameters.gbrQosInformation_present=false; - + + //Set E-RAB S-GW F-TEID //if (cs_resp->eps_bearer_context_created.s1_u_sgw_f_teid_present == false){ // m_s1ap_log->error("Did not receive S1-U TEID in create session response\n"); @@ -188,8 +188,6 @@ s1ap_ctx_mngmt_proc::send_initial_context_setup_request(ue_emm_ctx_t *emm_ctx, //Change E-RAB state to Context Setup Requested and save S-GW control F-TEID ecm_ctx->erabs_ctx[erab_ctx_req->e_RAB_ID.E_RAB_ID].state = ERAB_CTX_REQUESTED; - //ecm_ctx->erabs_ctx[erab_ctx_req->e_RAB_ID.E_RAB_ID].sgw_ctrl_fteid.teid = sgw_ctrl_fteid.teid; - //ecm_ctx->erabs_ctx[erab_ctx_req->e_RAB_ID.E_RAB_ID].sgw_ctrl_fteid.ipv4 = sgw_ctrl_fteid.ipv4; struct in_addr addr; addr.s_addr = htonl(sgw_s1u_ip); @@ -199,6 +197,7 @@ s1ap_ctx_mngmt_proc::send_initial_context_setup_request(ue_emm_ctx_t *emm_ctx, m_s1ap_log->console("Initial Context Setup Request -- E-RAB id %d\n",erab_ctx_req->e_RAB_ID.E_RAB_ID); m_s1ap_log->console("Initial Context Setup Request -- S1-U TEID 0x%x. IP %s \n", sgw_s1u_teid,inet_ntoa(addr)); m_s1ap_log->console("Initial Context Setup Request -- S1-U TEID 0x%x. IP %s \n", sgw_s1u_teid,inet_ntoa(addr)); + m_s1ap_log->console("Initial Context Setup Request -- QCI %d \n", erab_ctx_req->e_RABlevelQoSParameters.qCI.QCI); m_pool->deallocate(reply_buffer); m_pool->deallocate(nas_buffer); diff --git a/srsepc/src/mme/s1ap_nas_transport.cc b/srsepc/src/mme/s1ap_nas_transport.cc index ec65ce8d1..a527cf029 100644 --- a/srsepc/src/mme/s1ap_nas_transport.cc +++ b/srsepc/src/mme/s1ap_nas_transport.cc @@ -709,6 +709,11 @@ s1ap_nas_transport::handle_nas_guti_attach_request( uint32_t enb_ue_s1ap_id, } else { + //Get subscriber info from HSS + uint8_t default_bearer=5; + m_hss->gen_update_loc_answer(emm_ctx->imsi,&ue_ctx->ecm_ctx.erabs_ctx[default_bearer].qci); + m_s1ap_log->debug("Getting subscription information -- QCI %d\n", ue_ctx->ecm_ctx.erabs_ctx[default_bearer].qci); + m_s1ap_log->console("Getting subscription information -- QCI %d\n", ue_ctx->ecm_ctx.erabs_ctx[default_bearer].qci); m_mme_gtpc->send_create_session_request(emm_ctx->imsi); *reply_flag = false; //No reply needed } @@ -1082,12 +1087,13 @@ s1ap_nas_transport::handle_nas_security_mode_complete(srslte::byte_buffer_t *nas else { //Get subscriber info from HSS - uint8_t qci; - m_hss->gen_update_loc_answer(emm_ctx->imsi,&qci); - m_s1ap_log->console("QCI %d\n", qci); + uint8_t default_bearer=5; + m_hss->gen_update_loc_answer(emm_ctx->imsi,&ue_ctx->ecm_ctx.erabs_ctx[default_bearer].qci); + m_s1ap_log->debug("Getting subscription information -- QCI %d\n", ue_ctx->ecm_ctx.erabs_ctx[default_bearer].qci); + m_s1ap_log->console("Getting subscription information -- QCI %d\n", ue_ctx->ecm_ctx.erabs_ctx[default_bearer].qci); //FIXME The packging of GTP-C messages is not ready. //This means that GTP-U tunnels are created with function calls, as opposed to GTP-C. - m_mme_gtpc->send_create_session_request(emm_ctx->imsi,qci); + m_mme_gtpc->send_create_session_request(emm_ctx->imsi); *reply_flag = false; //No reply needed } return true; @@ -1166,6 +1172,12 @@ s1ap_nas_transport::handle_esm_information_response(srslte::byte_buffer_t *nas_m m_s1ap_log->console("ESM Info: %d Protocol Configuration Options\n",esm_info_resp.protocol_cnfg_opts.N_opts); } + //Get subscriber info from HSS + uint8_t default_bearer=5; + m_hss->gen_update_loc_answer(ue_ctx->emm_ctx.imsi,&ue_ctx->ecm_ctx.erabs_ctx[default_bearer].qci); + m_s1ap_log->debug("Getting subscription information -- QCI %d\n", ue_ctx->ecm_ctx.erabs_ctx[default_bearer].qci); + m_s1ap_log->console("Getting subscription information -- QCI %d\n", ue_ctx->ecm_ctx.erabs_ctx[default_bearer].qci); + //FIXME The packging of GTP-C messages is not ready. //This means that GTP-U tunnels are created with function calls, as opposed to GTP-C. m_mme_gtpc->send_create_session_request(ue_ctx->emm_ctx.imsi); diff --git a/srsepc/src/spgw/spgw.cc b/srsepc/src/spgw/spgw.cc index 40dc0b97f..ab1614764 100644 --- a/srsepc/src/spgw/spgw.cc +++ b/srsepc/src/spgw/spgw.cc @@ -538,9 +538,6 @@ spgw::handle_create_session_request(struct srslte::gtpc_create_session_request * cs_resp->eps_bearer_context_created.s1_u_sgw_f_teid_present=true; cs_resp->eps_bearer_context_created.s1_u_sgw_f_teid = tunnel_ctx->up_user_fteid; - //Bearer QoS - cs_resp->eps_bearer_context_created.bearer_qos.qci = cs_req->eps_bearer_context_created.bearer_qos.qci; - //Fill in the PAA cs_resp->paa_present = true; cs_resp->paa.pdn_type = srslte::GTPC_PDN_TYPE_IPV4;