Commit 9f8a468d authored by laurent's avatar laurent

remove eNB threads for RRC and MAC, MAC thread was only for DRX config...

remove eNB threads for RRC and MAC, MAC thread was only for DRX config (useless) and RRC thread has many race conditions with MAC+PHY
parent d3d76080
......@@ -302,7 +302,6 @@ void *rrc_enb_process_msg(void *);
TASK_DEF(TASK_L2L1, TASK_PRIORITY_MAX, 200, NULL, NULL) \
TASK_DEF(TASK_BM, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_PHY_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_MAC_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_MAC_GNB, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RLC_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RRC_ENB_NB_IoT, TASK_PRIORITY_MED, 200, NULL, NULL) \
......@@ -310,8 +309,8 @@ void *rrc_enb_process_msg(void *);
TASK_DEF(TASK_PDCP_GNB, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_DATA_FORWARDING, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_END_MARKER, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RRC_ENB, TASK_PRIORITY_MED, 200, NULL,NULL)\
TASK_DEF(TASK_RRC_GNB, TASK_PRIORITY_MED, 200, NULL,NULL)\
TASK_DEF(TASK_RRC_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RRC_GNB, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RAL_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_S1AP, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_NGAP, TASK_PRIORITY_MED, 200, NULL, NULL) \
......@@ -334,7 +333,7 @@ void *rrc_enb_process_msg(void *);
TASK_DEF(TASK_RRC_NRUE, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_NAS_UE, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RAL_UE, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_GTPV1_U, TASK_PRIORITY_MED, 1000,NULL, NULL)\
TASK_DEF(TASK_GTPV1_U, TASK_PRIORITY_MED, 1000, NULL, NULL) \
TASK_DEF(TASK_CU_F1, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_DU_F1, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_CUCP_E1, TASK_PRIORITY_MED, 200, NULL, NULL) \
......
......@@ -53,11 +53,8 @@ int create_tasks(uint32_t enb_nb) {
LOG_I(ENB_APP, "Creating ENB_APP eNB Task\n");
rc = itti_create_task (TASK_ENB_APP, eNB_app_task, NULL);
AssertFatal(rc >= 0, "Create task for eNB APP failed\n");
LOG_I(RRC,"Creating RRC eNB Task\n");
rc = itti_create_task (TASK_RRC_ENB, rrc_enb_task, NULL);
AssertFatal(rc >= 0, "Create task for RRC eNB failed\n");
rrc_enb_init();
itti_mark_task_ready(TASK_RRC_ENB);
if (get_softmodem_params()->emulate_l1 || (EPC_MODE_ENABLED && split73 != SPLIT73_DU)) {
rc = itti_create_task(TASK_SCTP, sctp_eNB_task, NULL);
AssertFatal(rc >= 0, "Create task for SCTP failed\n");
......@@ -89,11 +86,5 @@ int create_tasks(uint32_t enb_nb) {
AssertFatal(rc >= 0, "Create task for GTPV1U failed\n");
}
if (!NODE_IS_CU(type)) {
LOG_I(MAC,"Creating MAC eNB Task\n");
rc = itti_create_task(TASK_MAC_ENB, mac_enb_task, NULL);
AssertFatal(rc >= 0, "Create task for MAC eNB failed\n");
}
return 0;
}
......@@ -482,6 +482,7 @@ int main ( int argc, char **argv )
MessageDef *msg_p = itti_alloc_new_message (TASK_ENB_APP, 0, RRC_CONFIGURATION_REQ);
RRC_CONFIGURATION_REQ(msg_p) = RC.rrc[enb_id]->configuration;
itti_send_msg_to_task (TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p);
rrc_enb_process_itti_msg(NULL);
}
node_type = RC.rrc[0]->node_type;
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -116,8 +116,8 @@ void read_config_and_init(void);
int RCconfig_X2(MessageDef *msg_p, uint32_t i);
int RCconfig_M2(MessageDef *msg_p, uint32_t i);
void fill_SL_configuration(MessageDef *msg_p, ccparams_sidelink_t *SLconfig,int cell_idx,int cc_idx,char *config_fname);
void fill_eMTC_configuration(MessageDef *msg_p, ccparams_eMTC_t *eMTCconfig, int cell_idx,int cc_idx,char *config_fname,char *brparamspath);
void fill_SL_configuration(RrcConfigurationReq *RRCcfg, ccparams_sidelink_t *SLconfig, int cell_idx, int cc_idx, char *config_fname);
void fill_eMTC_configuration(RrcConfigurationReq *RRCcfg, ccparams_eMTC_t *eMTCconfig, int cell_idx, int cc_idx, char *config_fname, char *brparamspath);
int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i);
void handle_f1ap_setup_resp(f1ap_setup_resp_t *resp);
......
This diff is collapsed.
This diff is collapsed.
......@@ -353,12 +353,9 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
if (mac_MainConfig->drx_Config == NULL) {
LOG_W(F1AP, "drx_Configuration parameter is NULL, cannot configure local UE parameters or CDRX is deactivated\n");
} else {
MessageDef *message_p = NULL;
rrc_mac_drx_config_req_t req = {.rnti = ctxt.rntiMaybeUEid, .drx_Configuration = mac_MainConfig->drx_Config};
/* Send DRX configuration to MAC task to configure timers of local UE context */
message_p = itti_alloc_new_message(TASK_DU_F1, 0, RRC_MAC_DRX_CONFIG_REQ);
RRC_MAC_DRX_CONFIG_REQ(message_p).rnti = ctxt.rntiMaybeUEid;
RRC_MAC_DRX_CONFIG_REQ(message_p).drx_Configuration = mac_MainConfig->drx_Config;
itti_send_msg_to_task(TASK_MAC_ENB, ctxt.instance, message_p);
eNB_Config_Local_DRX(instance, &req);
LOG_D(F1AP, "DRX configured in MAC Main Configuration for RRC Connection Reconfiguration\n");
}
......
......@@ -470,7 +470,7 @@ check_ul_failure(module_id_t module_idP, int CC_id, int UE_id,
if (UE_info->UE_sched_ctrl[UE_id].ul_failure_timer > 4000) {
// note: probably ul_failure_timer should be less than UE radio link failure time(see T310/N310/N311)
if (NODE_IS_DU(RC.rrc[module_idP]->node_type)) {
MessageDef *m = itti_alloc_new_message(TASK_MAC_ENB, 0, F1AP_UE_CONTEXT_RELEASE_REQ);
MessageDef *m = itti_alloc_new_message(TASK_PHY_ENB, 0, F1AP_UE_CONTEXT_RELEASE_REQ);
F1AP_UE_CONTEXT_RELEASE_REQ(m).rnti = rnti;
F1AP_UE_CONTEXT_RELEASE_REQ(m).cause = F1AP_CAUSE_RADIO_NETWORK;
F1AP_UE_CONTEXT_RELEASE_REQ(m).cause_value = 1; // 1 = F1AP_CauseRadioNetwork_rl_failure
......
......@@ -1396,10 +1396,16 @@ initiate_ra_proc(module_id_t module_idP,
ra[i].RA_rnti = ra_rnti;
ra[i].preamble_index = preamble_index;
failure_cnt = 0;
LOG_D(MAC,
LOG_I(MAC,
"[eNB %d][RAPROC] CC_id %d Frame %d Activating RAR generation in Frame %d, subframe %d for process %d, rnti %x, state %d\n",
module_idP, CC_id, frameP, ra[i].Msg2_frame,
ra[i].Msg2_subframe, i, ra[i].rnti, ra[i].state);
module_idP,
CC_id,
frameP,
ra[i].Msg2_frame,
ra[i].Msg2_subframe,
i,
ra[i].rnti,
ra[i].state);
return;
}
}
......
......@@ -3206,11 +3206,7 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP,
UE_template->nb_rb_ul[harq_pid] = rb_table[rb_table_index];
UE_template->first_rb_ul[harq_pid] = first_rb[CC_id];
UE_template->cqi_req[harq_pid] = cqi_req;
UE_sched_ctrl->ul_scheduled |= (1<<harq_pid);
if (UE_id == UE_info->list.head)
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_SCHEDULED,UE_sched_ctrl->ul_scheduled);
UE_sched_ctrl->ul_scheduled |= (1 << harq_pid);
// adjust total UL buffer status by TBS, wait for UL sdus to do final update
/*LOG_D(MAC,"[eNB %d] CC_id %d UE %d/%x : adjusting ul_total_buffer, old %d, TBS %d\n", module_idP,CC_id,UE_id,rnti,UE_template->ul_total_buffer,UE_template->TBS_UL[harq_pid]);
if (UE_template->ul_total_buffer > UE_template->TBS_UL[harq_pid])
......
......@@ -1989,12 +1989,11 @@ find_UE_id(module_id_t mod_idP,
rnti_t rntiP)
//------------------------------------------------------------------------------
{
int UE_id;
UE_info_t *UE_info = &RC.mac[mod_idP]->UE_info;
if(!UE_info)
return -1;
for (UE_id = 0; UE_id < MAX_MOBILES_PER_ENB; UE_id++) {
for (int UE_id = 0; UE_id < MAX_MOBILES_PER_ENB; UE_id++) {
if (UE_info->active[UE_id] == true) {
int CC_id = UE_PCCID(mod_idP, UE_id);
if (CC_id>=0 && CC_id<NFAPI_CC_MAX && UE_info->UE_template[CC_id][UE_id].rnti == rntiP) {
......@@ -2144,6 +2143,7 @@ inline void add_ue_list(UE_list_t *listP, int UE_id) {
while (*cur >= 0)
cur = &listP->next[*cur];
*cur = UE_id;
LOG_D(MAC, "added UE %d in UE list\n", UE_id);
}
//------------------------------------------------------------------------------
......
......@@ -109,6 +109,7 @@ void lte_dump_mac_stats(eNB_MAC_INST *mac, FILE *fd)
UE_info->eNB_UE_stats[CC_id][UE_id].dlsch_errors);
}
}
fflush(fd);
return;
}
......@@ -270,47 +271,3 @@ int l2_init_eNB(void)
return (1);
}
//-----------------------------------------------------------------------------
/*
* Main loop of MAC itti message handling
*/
void *mac_enb_task(void *arg)
//-----------------------------------------------------------------------------
{
MessageDef *received_msg = NULL;
int result;
itti_mark_task_ready(TASK_MAC_ENB); // void function 10/2019
LOG_I(MAC,"Starting main loop of MAC message task\n");
while (1) {
itti_receive_msg(TASK_MAC_ENB, &received_msg);
switch (ITTI_MSG_ID(received_msg)) {
case RRC_MAC_DRX_CONFIG_REQ:
LOG_I(MAC, "MAC Task Received RRC_MAC_DRX_CONFIG_REQ\n");
/* Set timers and thresholds values in local MAC context of UE */
eNB_Config_Local_DRX(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.rrc_mac_drx_config_req);
break;
case TERMINATE_MESSAGE:
LOG_W(MAC, " *** Exiting MAC thread\n");
itti_exit_task();
break;
default:
LOG_E(MAC, "MAC instance received unhandled message: %d:%s\n",
ITTI_MSG_ID(received_msg),
ITTI_MSG_NAME(received_msg));
break;
} // end switch
result = itti_free(ITTI_MSG_ORIGIN_ID(received_msg), received_msg);
AssertFatal(result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
received_msg = NULL;
} // end while
return NULL;
}
This diff is collapsed.
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