From 8c55ccc9b74f97c418bf84ab5a92ca7707618c84 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Wed, 22 Sep 2021 17:09:24 +0200 Subject: [PATCH] Fix a critical bug introduced by F1-U in 4G --- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 2 +- openair2/LAYER2/rlc_v2/rlc_oai_api.c | 48 +++++++++++++++------------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index ee6fce8670..8d8b734b44 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -1546,7 +1546,7 @@ void pdcp_add_UE(const protocol_ctxt_t *const ctxt_pP) { pdcp_enb[ctxt_pP->module_id].rnti[i]=ctxt_pP->rnti; pdcp_enb[ctxt_pP->module_id].uid[i]=i; pdcp_enb[ctxt_pP->module_id].num_ues++; - printf("add new uid is %d %x\n\n", i, ctxt_pP->rnti); + LOG_I(PDCP,"add new uid is %d %x\n", i, ctxt_pP->rnti); pdcp_init_stats_UE(ctxt_pP->module_id, i); // ret=1; break; diff --git a/openair2/LAYER2/rlc_v2/rlc_oai_api.c b/openair2/LAYER2/rlc_v2/rlc_oai_api.c index 12a8d286c0..16c3db0cae 100644 --- a/openair2/LAYER2/rlc_v2/rlc_oai_api.c +++ b/openair2/LAYER2/rlc_v2/rlc_oai_api.c @@ -418,29 +418,31 @@ rb_found: AssertFatal(type != ngran_eNB_CU && type != ngran_ng_eNB_CU && type != ngran_gNB_CU, "Can't be CU, bad node type %d\n", type); - if (NODE_IS_DU(type) && is_srb == 1) { - MessageDef *msg = itti_alloc_new_message_sized(TASK_RLC_ENB, 0, F1AP_UL_RRC_MESSAGE, sizeof(*msg) + size); - F1AP_UL_RRC_MESSAGE(msg).rrc_container = (uint8_t*)(msg+1); - memcpy(F1AP_UL_RRC_MESSAGE(msg).rrc_container, buf, size); - F1AP_UL_RRC_MESSAGE(msg).rnti = ue->rnti; - F1AP_UL_RRC_MESSAGE(msg).srb_id = rb_id; - F1AP_UL_RRC_MESSAGE(msg).rrc_container_length = size; - itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(0 /*ctxt_pP->module_id*/), msg); - return; - } else { - // Fixme: very dirty workaround of incomplete F1-U implementation - instance_t DUuniqInstance=0; - MessageDef *msg = itti_alloc_new_message(TASK_RLC_ENB, 0, GTPV1U_ENB_TUNNEL_DATA_REQ); - gtpv1u_enb_tunnel_data_req_t *req=>PV1U_ENB_TUNNEL_DATA_REQ(msg); - req->buffer=malloc(size); - memcpy(req->buffer,buf,size); - req->length=size; - req->offset=0; - req->rnti=ue->rnti; - req->rab_id=rb_id+4; - LOG_D(RLC, "Received uplink user-plane traffic at RLC-DU to be sent to the CU, size %d \n", size); - itti_send_msg_to_task(OCP_GTPV1_U, DUuniqInstance, msg); - return; + if (NODE_IS_DU(type)) { + if (is_srb == 1) { + MessageDef *msg = itti_alloc_new_message_sized(TASK_RLC_ENB, 0, F1AP_UL_RRC_MESSAGE, sizeof(*msg) + size); + F1AP_UL_RRC_MESSAGE(msg).rrc_container = (uint8_t*)(msg+1); + memcpy(F1AP_UL_RRC_MESSAGE(msg).rrc_container, buf, size); + F1AP_UL_RRC_MESSAGE(msg).rnti = ue->rnti; + F1AP_UL_RRC_MESSAGE(msg).srb_id = rb_id; + F1AP_UL_RRC_MESSAGE(msg).rrc_container_length = size; + itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(0 /*ctxt_pP->module_id*/), msg); + return; + } else { + // Fixme: very dirty workaround of incomplete F1-U implementation + instance_t DUuniqInstance=0; + MessageDef *msg = itti_alloc_new_message(TASK_RLC_ENB, 0, GTPV1U_ENB_TUNNEL_DATA_REQ); + gtpv1u_enb_tunnel_data_req_t *req=>PV1U_ENB_TUNNEL_DATA_REQ(msg); + req->buffer=malloc(size); + memcpy(req->buffer,buf,size); + req->length=size; + req->offset=0; + req->rnti=ue->rnti; + req->rab_id=rb_id+4; + LOG_D(RLC, "Received uplink user-plane traffic at RLC-DU to be sent to the CU, size %d \n", size); + itti_send_msg_to_task(OCP_GTPV1_U, DUuniqInstance, msg); + return; + } } }