From 32ebb876f48c920967896fadc3f23a989144e4dc Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Wed, 22 Sep 2021 10:52:38 +0200 Subject: [PATCH] F1-U in gtp-U LTE case, working --- openair2/F1AP/f1ap_cu_ue_context_management.c | 4 ++-- openair2/F1AP/f1ap_du_ue_context_management.c | 12 +++++++++--- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 8 ++++++-- openair2/LAYER2/rlc_v2/rlc_oai_api.c | 9 ++++++++- openair3/ocp-gtpu/gtp_itf.cpp | 4 ++-- 5 files changed, 27 insertions(+), 10 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 15a0e39cca..5030e84e35 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -522,8 +522,8 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_ul_tnl[j].teid= newGtpuCreateTunnel(getCxt(CUtype, instance)->gtpInst, f1ap_ue_context_setup_req->rnti, - f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id-4, - f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id-4, + f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id, + f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id, 0xFFFF, // We will set the right value from DU answer addr, f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_dl_tnl[0].port, diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 33a40bd8ac..70556e78c7 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -55,7 +55,11 @@ boolean_t lteDURecvCb( protocol_ctxt_t *ctxt_pP, // The buffer comes from the stack in gtp-u thread, we have a make a separate buffer to enqueue in a inter-thread message queue mem_block_t *sdu=get_free_mem_block(sdu_buffer_sizeP, __func__); memcpy(sdu->data, sdu_buffer_pP, sdu_buffer_sizeP); - du_rlc_data_req(ctxt_pP,srb_flagP, false, rb_idP,muiP, confirmP, sdu_buffer_sizeP, sdu); + // weird rb id management in 4G, not fully understand (looks bad design) + // overcomplex: if i understand, on the interface DRB start at 4 because there can be SRB 0..3 + // but it would be much simpler to use absolute numbering + // instead of this "srb flag" associated to these +/-4 + du_rlc_data_req(ctxt_pP,srb_flagP, false, rb_idP-4,muiP, confirmP, sdu_buffer_sizeP, sdu); return true; } @@ -175,6 +179,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, addr, 2152, lteDURecvCb); + drb_p->up_dl_tnl_length++; } } } @@ -220,7 +225,6 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ctxt.enb_flag = 1; mem_block_t *pdcp_pdu_p = get_free_mem_block(ieRRC->value.choice.RRCContainer.size, __func__); memcpy(&pdcp_pdu_p->data[0], ieRRC->value.choice.RRCContainer.buf, ieRRC->value.choice.RRCContainer.size); - /* for rfsim */ du_rlc_data_req(&ctxt, 1, 0x00, 1, 1, 0, ieRRC->value.choice.RRCContainer.size, pdcp_pdu_p); } else { LOG_E(F1AP, " RRCContainer in UEContextSetupRequestIEs size id 0\n"); @@ -229,9 +233,11 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, LOG_W(F1AP, "can't find RRCContainer in UEContextSetupRequestIEs by id %ld \n", F1AP_ProtocolIE_ID_id_RRCContainer); } - //DU_send_UE_CONTEXT_SETUP_RESPONSE(instance, f1ap_ue_context_setup_req); if (RC.nrrrc && RC.nrrrc[instance]->node_type == ngran_gNB_DU) itti_send_msg_to_task(TASK_RRC_GNB, instance, msg_p); + else + // in 4G, race conditon is to fix + DU_send_UE_CONTEXT_SETUP_RESPONSE(instance, f1ap_ue_context_setup_req); return 0; } diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index c507d83dcc..ee6fce8670 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -159,7 +159,11 @@ boolean_t cu_f1u_data_req( exit(1); } memcpy(memblock->data,sdu_buffer, sdu_buffer_size); - int ret=pdcp_data_ind(ctxt_pP,srb_flagP, false, rb_id, sdu_buffer_size, memblock, NULL, NULL); + // weird rb id management in 4G, not fully understand (looks bad design) + // overcomplex: if i understand, on the interface DRB start at 4 because there can be SRB 0..3 + // but it would be much simpler to use absolute numbering + // instead of this "srb flag" associated to these +/-4 + int ret=pdcp_data_ind(ctxt_pP,srb_flagP, false, rb_id-4, sdu_buffer_size, memblock, NULL, NULL); if (!ret) { LOG_E(RLC, "%s:%d:%s: ERROR: pdcp_data_ind failed\n", __FILE__, __LINE__, __FUNCTION__); /* what to do in case of failure? for the moment: nothing */ @@ -221,7 +225,7 @@ rlc_op_status_t cu_send_to_du(const protocol_ctxt_t *const ctxt, req->length = size; req->offset = GTPU_HEADER_OVERHEAD_MAX; req->rnti = ctxt->rnti; - req->rab_id = rb_id; + req->rab_id = rb_id+4; LOG_D(PDCP, "%s() (drb %ld) sending message to gtp size %d\n", __func__, rb_id, size); extern instance_t CUuniqInstance; diff --git a/openair2/LAYER2/rlc_v2/rlc_oai_api.c b/openair2/LAYER2/rlc_v2/rlc_oai_api.c index b31393d67f..12a8d286c0 100644 --- a/openair2/LAYER2/rlc_v2/rlc_oai_api.c +++ b/openair2/LAYER2/rlc_v2/rlc_oai_api.c @@ -1054,5 +1054,12 @@ void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP){ - + rlc_data_req (ctxt_pP, + srb_flagP, + MBMS_flagP, + rb_idP, + muiP, + confirmP, + sdu_sizeP, + sdu_pP, NULL, NULL); } diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index b90b89b21a..330e680d3e 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -171,7 +171,7 @@ static void gtpv1uSend(instance_t instance, gtpv1u_enb_tunnel_data_req_t *req, b map::iterator ptr2=ptrRnti->second.bearers.find(rab_id); if ( ptr2 == ptrRnti->second.bearers.end() ) { - LOG_E(GTPU,"sending a packet to a non existant RNTI:RAB: %x/%x\n", rnti, rab_id); + LOG_E(GTPU,"GTP-U instance: %ld sending a packet to a non existant RNTI:RAB: %x/%x\n", instance, rnti, rab_id); pthread_mutex_unlock(&globGtp.gtp_lock); return; } @@ -253,7 +253,7 @@ static void gtpv1uEndTunnel(instance_t instance, gtpv1u_enb_tunnel_data_req_t *r map::iterator ptr2=ptrRnti->second.bearers.find(rab_id); if ( ptr2 == ptrRnti->second.bearers.end() ) { - LOG_E(GTPU,"sending a packet to a non existant RNTI:RAB: %x/%x\n", rnti, rab_id); + LOG_E(GTPU,"GTP-U instance: %ld sending a packet to a non existant RNTI:RAB: %x/%x\n", instance, rnti, rab_id); pthread_mutex_unlock(&globGtp.gtp_lock); return; }