Commit a455ce7c authored by Laurent THOMAS's avatar Laurent THOMAS

fix F1-U bugs

parent 62f2d43f
......@@ -95,6 +95,22 @@ static void read_pipe(int p, char *b, int size) {
size -= ret;
}
}
int checkIfFedoraDistribution(void) {
return system("grep -iq 'ID_LIKE.*fedora' /etc/os-release ");
}
int checkIfGenericKernelOnFedora(void) {
int ret=system("uname -a | grep -q rt");
return 1 - ret;
}
int checkIfInsideContainer(void) {
int res=system("egrep -q 'libpod|podman|kubepods' /proc/self/cgroup");
if (res > 0)
return 1;
else
return 0;
}
/********************************************************************/
/* background process */
......
......@@ -233,7 +233,6 @@ typedef struct protocol_ctxt_s {
frame_t frame; /*!< \brief LTE frame number.*/
sub_frame_t subframe; /*!< \brief LTE sub frame number.*/
eNB_index_t eNB_index; /*!< \brief valid for UE indicating the index of connected eNB(s) */
boolean_t configured; /*!< \brief flag indicating whether the instance is configured or not */
boolean_t brOption;
} protocol_ctxt_t;
// warning time hardcoded
......
......@@ -319,7 +319,6 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
ctxt.rnti = f1ap_get_rnti_by_cu_id(true, instance, cu_ue_f1ap_id);
ctxt.enb_flag = 1;
ctxt.eNB_index = 0;
ctxt.configured = 1;
mem_block_t *mb = get_free_mem_block(ie->value.choice.RRCContainer.size,__func__);
memcpy((void *)mb->data,(void *)ie->value.choice.RRCContainer.buf,ie->value.choice.RRCContainer.size);
LOG_I(F1AP, "Calling pdcp_data_ind for UE RNTI %x srb_id %lu with size %ld (DCCH) \n", ctxt.rnti, srb_id, ie->value.choice.RRCContainer.size);
......
......@@ -249,12 +249,8 @@ boolean_t pdcp_data_req(
LOG_W(PDCP, PROTOCOL_CTXT_FMT" Instance is not configured for rb_id %ld Ignoring SDU...\n",
PROTOCOL_CTXT_ARGS(ctxt_pP),
rb_idP);
ctxt_pP->configured=FALSE;
return FALSE;
}
} else {
// instance for a given RB is configured
ctxt_pP->configured=TRUE;
}
if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
......
......@@ -525,7 +525,6 @@ int proto_agent_pdcp_data_ind_process(mod_id_t mod_id, const void *params, Proto
ctxt_pP.rnti = ctxt->fsp_rnti;
ctxt_pP.frame = ctxt->fsp_frame;
ctxt_pP.subframe = ctxt->fsp_subframe;
ctxt_pP.configured = 1;
ctxt_pP.brOption = 0;
ctxt_pP.eNB_index = ctxt->fsp_enb_index;
srb_flagP = rlc_data->fsp_srb_flag;
......
......@@ -263,7 +263,6 @@ static void *enb_tun_read_thread(void *_)
ctxt.frame = 0;
ctxt.subframe = 0;
ctxt.eNB_index = 0;
ctxt.configured = 1;
ctxt.brOption = 0;
ctxt.rnti = rnti;
......@@ -307,7 +306,6 @@ static void *ue_tun_read_thread(void *_)
ctxt.frame = 0;
ctxt.subframe = 0;
ctxt.eNB_index = 0;
ctxt.configured = 1;
ctxt.brOption = 0;
ctxt.rnti = rnti;
......@@ -515,11 +513,31 @@ rb_found:
ctxt.frame = 0;
ctxt.subframe = 0;
ctxt.eNB_index = 0;
ctxt.configured = 1;
ctxt.brOption = 0;
ctxt.rnti = ue->rnti;
if (RC.nrrrc != NULL && NODE_IS_CU(RC.nrrrc[0]->node_type)) {
MessageDef *message_p = itti_alloc_new_message_sized(TASK_PDCP_ENB, 0,
GTPV1U_GNB_TUNNEL_DATA_REQ,
sizeof(gtpv1u_gnb_tunnel_data_req_t)
+ size
+ GTPU_HEADER_OVERHEAD_MAX);
AssertFatal(message_p != NULL, "OUT OF MEMORY");
gtpv1u_gnb_tunnel_data_req_t *req=&GTPV1U_GNB_TUNNEL_DATA_REQ(message_p);
uint8_t *gtpu_buffer_p = (uint8_t*)(req+1);
memcpy(gtpu_buffer_p+GTPU_HEADER_OVERHEAD_MAX,
buf, size);
req->buffer = gtpu_buffer_p;
req->length = size;
req->offset = GTPU_HEADER_OVERHEAD_MAX;
req->rnti = ue->rnti;
req->pdusession_id = rb_id;
LOG_D(PDCP, "%s() (drb %d) sending message to gtp size %d\n",
__func__, rb_id, size);
itti_send_msg_to_task(TASK_VARIABLE, INSTANCE_DEFAULT, message_p);
return;
}
memblock = get_free_mem_block(size, __FUNCTION__);
memcpy(memblock->data, buf, size);
......@@ -603,7 +621,6 @@ srb_found:
ctxt.frame = 0;
ctxt.subframe = 0;
ctxt.eNB_index = 0;
ctxt.configured = 1;
ctxt.brOption = 0;
ctxt.rnti = ue->rnti;
......@@ -646,7 +663,6 @@ boolean_t pdcp_data_ind(
//ctxt_pP->enb_flag != 1 ||
ctxt_pP->instance != 0 ||
ctxt_pP->eNB_index != 0 ||
ctxt_pP->configured != 1 ||
ctxt_pP->brOption != 0) {
LOG_E(PDCP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
......@@ -697,7 +713,6 @@ void pdcp_run(const protocol_ctxt_t *const ctxt_pP)
.frame=-1,
.subframe=-1,
.eNB_index=0,
.configured=true,
.brOption=false
};
......@@ -1223,25 +1238,21 @@ boolean_t cu_f1u_data_req(
,const uint32_t *const destinationL2Id
#endif
) {
MessageDef *message_p = itti_alloc_new_message_sized(TASK_PDCP_ENB, 0,
GTPV1U_GNB_TUNNEL_DATA_REQ,
sizeof(gtpv1u_gnb_tunnel_data_req_t)
+ sdu_buffer_size
+ GTPU_HEADER_OVERHEAD_MAX);
AssertFatal(message_p != NULL, "OUT OF MEMORY");
gtpv1u_gnb_tunnel_data_req_t *req=&GTPV1U_GNB_TUNNEL_DATA_REQ(message_p);
uint8_t *gtpu_buffer_p = (uint8_t*)(req+1);
memcpy(gtpu_buffer_p+GTPU_HEADER_OVERHEAD_MAX,
sdu_buffer, sdu_buffer_size);
req->buffer = gtpu_buffer_p;
req->length = sdu_buffer_size;
req->offset = GTPU_HEADER_OVERHEAD_MAX;
req->rnti = ctxt_pP->rnti;
req->pdusession_id = rb_id;
LOG_D(PDCP, "%s() (drb %ld) sending message to gtp size %d\n",
__func__, rb_id, sdu_buffer_size);
itti_send_msg_to_task(TASK_VARIABLE, INSTANCE_DEFAULT, message_p);
return true;
//Force instance id to 0, OAI incoherent instance management
ctxt_pP->instance=0;
mem_block_t *memblock = get_free_mem_block(sdu_buffer_size, __func__);
if (memblock == NULL) {
LOG_E(RLC, "%s:%d:%s: ERROR: get_free_mem_block failed\n", __FILE__, __LINE__, __FUNCTION__);
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);
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 */
}
return ret;
}
boolean_t pdcp_data_req(
......
......@@ -461,7 +461,6 @@ rb_found:
ctx.frame = 0;
ctx.subframe = 0;
ctx.eNB_index = 0;
ctx.configured = 1;
ctx.brOption = 0;
/* used fields? */
......@@ -486,30 +485,32 @@ rb_found:
// return;
// }
if (NODE_IS_DU(type) && is_srb == 1) {
MessageDef *msg;
msg = itti_alloc_new_message(TASK_RLC_ENB, 0, F1AP_UL_RRC_MESSAGE);
uint8_t *message_buffer = itti_malloc (TASK_RLC_ENB, TASK_DU_F1, size);
memcpy (message_buffer, 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 = message_buffer;
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 if(NODE_IS_DU(type) && is_srb == 0) {
MessageDef *msg = itti_alloc_new_message_sized(TASK_RLC_ENB, 0, GTPV1U_GNB_TUNNEL_DATA_REQ, sizeof(gtpv1u_gnb_tunnel_data_req_t) + size);
gtpv1u_gnb_tunnel_data_req_t *req=&GTPV1U_GNB_TUNNEL_DATA_REQ(msg);
req->buffer=(uint8_t*)(req+1);
memcpy(req->buffer,buf,size);
req->length=size;
req->offset=0;
req->rnti=ue->rnti;
req->pdusession_id=rb_id;
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, 0, msg);
return;
if (NODE_IS_DU(type)) {
if(is_srb) {
MessageDef *msg;
msg = itti_alloc_new_message(TASK_RLC_ENB, 0, F1AP_UL_RRC_MESSAGE);
uint8_t *message_buffer = itti_malloc (TASK_RLC_ENB, TASK_DU_F1, size);
memcpy (message_buffer, 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 = message_buffer;
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 {
MessageDef *msg = itti_alloc_new_message_sized(TASK_RLC_ENB, 0, GTPV1U_GNB_TUNNEL_DATA_REQ,
sizeof(gtpv1u_gnb_tunnel_data_req_t) + size);
gtpv1u_gnb_tunnel_data_req_t *req=&GTPV1U_GNB_TUNNEL_DATA_REQ(msg);
req->buffer=(uint8_t*)(req+1);
memcpy(req->buffer,buf,size);
req->length=size;
req->offset=0;
req->rnti=ue->rnti;
req->pdusession_id=rb_id;
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, 0, msg);
return;
}
}
}
......@@ -923,10 +924,10 @@ rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt
if (/*ctxt_pP->enb_flag != 1 ||*/ ctxt_pP->module_id != 0 /*||
ctxt_pP->instance != 0 || ctxt_pP->eNB_index != 0 ||
ctxt_pP->configured != 1 || ctxt_pP->brOption != 0 */) {
LOG_E(RLC, "%s: ctxt_pP not handled (%d %d %ld %d %d %d)\n", __FUNCTION__,
ctxt_pP->brOption != 0 */) {
LOG_E(RLC, "%s: ctxt_pP not handled (%d %d %ld %d %d)\n", __FUNCTION__,
ctxt_pP->enb_flag , ctxt_pP->module_id, ctxt_pP->instance,
ctxt_pP->eNB_index, ctxt_pP->configured, ctxt_pP->brOption);
ctxt_pP->eNB_index, ctxt_pP->brOption);
exit(1);
}
......
......@@ -406,7 +406,6 @@ rb_found:
ctx.frame = 0;
ctx.subframe = 0;
ctx.eNB_index = 0;
ctx.configured = 1;
ctx.brOption = 0;
/* used fields? */
......@@ -832,10 +831,10 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP
if (0 /*||
ctxt_pP->instance != 0 || ctxt_pP->eNB_index != 0 ||
ctxt_pP->configured != 1 || ctxt_pP->brOption != 0 */) {
LOG_E(RLC, "%s: ctxt_pP not handled (%d %d %ld %d %d %d)\n", __FUNCTION__,
ctxt_pP->brOption != 0 */) {
LOG_E(RLC, "%s: ctxt_pP not handled (%d %d %ld %d %d)\n", __FUNCTION__,
ctxt_pP->enb_flag , ctxt_pP->module_id, ctxt_pP->instance,
ctxt_pP->eNB_index, ctxt_pP->configured, ctxt_pP->brOption);
ctxt_pP->eNB_index, ctxt_pP->brOption);
exit(1);
}
......@@ -1041,4 +1040,4 @@ void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP,
sdu_size_t sdu_sizeP,
mem_block_t *sdu_pP){
}
\ No newline at end of file
}
......@@ -3586,7 +3586,6 @@ void *rrc_gnb_task(void *args_p) {
.frame=-1,
.subframe=-1,
.eNB_index=0,
.configured=true,
.brOption=false
};
itti_mark_task_ready(TASK_RRC_GNB);
......
......@@ -432,11 +432,7 @@ NwGtpv1uRcT gtpv1u_eNB_process_stack_req(
);
if ( result == FALSE ) {
if (ctxt.configured == FALSE )
LOG_W(GTPU, "PDCP data request failed, cause: [UE:%x]RB is not configured!\n", ctxt.rnti) ;
else
LOG_W(GTPU, "PDCP data request failed\n");
LOG_W(GTPU, "PDCP data request failed\n");
return NW_GTPV1U_FAILURE;
}
} else {
......
......@@ -191,9 +191,6 @@ NwGtpv1uRcT gtpv1u_gNB_process_stack_req(
);
if ( result == FALSE ) {
if (ctxt.configured == FALSE )
LOG_W(GTPU, "gNB node PDCP data request failed, cause: [UE:%x]RB is not configured!\n", ctxt.rnti) ;
else
LOG_W(GTPU, "PDCP data request failed\n");
return NW_GTPV1U_FAILURE;
......@@ -390,9 +387,6 @@ NwGtpv1uRcT nr_gtpv1u_gNB_process_stack_req(
);
if ( result == FALSE ) {
if (ctxt.configured == FALSE )
LOG_W(GTPU, "gNB node PDCP data request failed, cause: [UE:%x]RB is not configured!\n", ctxt.rnti) ;
else
LOG_W(GTPU, "PDCP data request failed\n");
return NW_GTPV1U_FAILURE;
......
......@@ -691,7 +691,6 @@ static int Gtpv1uHandleEndMarker(int h,
ctxt.frame = 0;
ctxt.subframe = 0;
ctxt.eNB_index = 0;
ctxt.configured = 0;
ctxt.brOption = 0;
const srb_flag_t srb_flag=SRB_FLAG_NO;
const rb_id_t rb_id=tunnel->second.incoming_rb_id;
......@@ -757,7 +756,6 @@ static int Gtpv1uHandleGpdu(int h,
ctxt.frame = 0;
ctxt.subframe = 0;
ctxt.eNB_index = 0;
ctxt.configured = 0;
ctxt.brOption = 0;
const srb_flag_t srb_flag=SRB_FLAG_NO;
const rb_id_t rb_id=tunnel->second.incoming_rb_id;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment