diff --git a/openair2/ENB_APP/flexran_agent_common_internal.c b/openair2/ENB_APP/flexran_agent_common_internal.c index de937db0c6b332ddbb84faa9ddd8a367d8716bf8..e3fac4594b9c0976961b2890c05842b7721f3c1c 100644 --- a/openair2/ENB_APP/flexran_agent_common_internal.c +++ b/openair2/ENB_APP/flexran_agent_common_internal.c @@ -37,6 +37,7 @@ #include "assertions.h" #include "enb_app.h" +#if 0 void handle_reconfiguration(mid_t mod_id) { /* NOTE: this function might be extended by using stop_modem() @@ -69,6 +70,7 @@ void handle_reconfiguration(mid_t mod_id) LOG_I(ENB_APP, "lte-softmodem restart succeeded in %d ms\n", diff_ms); } } +#endif int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy_length) { @@ -109,7 +111,8 @@ int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy if (parse_enb_id(mod_id, &parser) == -1) { goto error; } else { // succeful parse and setting - handle_reconfiguration(mod_id); + /* TODO implement */ + //handle_reconfiguration(mod_id); } } else if (strcmp((char *) event.data.scalar.value, "mac") == 0) { LOG_D(ENB_APP, "This is intended for the mac system\n"); @@ -293,8 +296,7 @@ int parse_enb_config_parameters(mid_t mod_id, yaml_parser_t *parser) { yaml_event_delete(&event); } - /* reflect in RAN API */ - flexran_set_enb_vars(mod_id, RAN_LTE_OAI); + /* TODO: reflect in RAN API */ return 0; diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index e27ef3648af6f02fa7a8cf189bf718db383d175b..36538a3364b8813de4882e4ff1d95674f5290433 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -800,6 +800,7 @@ typedef struct { ///Contention resolution timer used during random access uint8_t mac_ContentionResolutionTimer; + /* TODO Navid MAX_NUM_LCID -> MAX_NUM_CCs? */ uint16_t max_rbs_allowed_slice[MAX_NUM_LCID][MAX_NUM_SLICES]; uint8_t max_mcs[MAX_NUM_LCID]; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c index a0da4f49616f0ebe3a2ae08e62ae9a713bd23d90..ae4afc8b42babdc69fdd02d9b9a06ace3ed3be33 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c @@ -64,7 +64,6 @@ #include "flexran.pb-c.h" #endif #include <dlfcn.h> -#endif #include "T.h" @@ -449,7 +448,7 @@ set_ul_DAI(int module_idP, int UE_idP, int CC_idP, int frameP, //------------------------------------------------------------------------------ void -schedule_dlsch(module_id_ module_idP, +schedule_dlsch(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP, int *mbsfn_flag) //------------------------------------------------------------------------------{ { @@ -466,7 +465,7 @@ schedule_dlsch(module_id_ module_idP, for (i = 0; i < n_active_slices; i++) { if (slice_percentage[i] < 0 ){ LOG_W(MAC, "[eNB %d] frame %d subframe %d:invalid slice %d percentage %f. resetting to zero", - mod_id, frame, subframe, i, slice_percentage[i]); + module_idP, frameP, subframeP, i, slice_percentage[i]); slice_percentage[i]=0; } total_slice_percentage+=slice_percentage[i]; @@ -488,7 +487,7 @@ schedule_dlsch(module_id_ module_idP, if (n_active_slices_current != n_active_slices ){ if ((n_active_slices > 0) && (n_active_slices <= MAX_NUM_SLICES)) { LOG_N(MAC,"[eNB %d]frame %d subframe %d: number of active DL slices has changed: %d-->%d\n", - mod_id, frame, subframe, n_active_slices_current, n_active_slices); + module_idP, frameP, subframeP, n_active_slices_current, n_active_slices); n_active_slices_current = n_active_slices; @@ -501,7 +500,7 @@ schedule_dlsch(module_id_ module_idP, // check if the slice rb share has changed, and log the console if (slice_percentage_current[i] != slice_percentage[i]){ // new slice percentage LOG_N(MAC,"[eNB %d][SLICE %d][DL] frame %d subframe %d: total percentage %f-->%f, slice RB percentage has changed: %f-->%f\n", - mod_id, i, frame, subframe, total_slice_percentage_current, total_slice_percentage, slice_percentage_current[i], slice_percentage[i]); + module_idP, i, frameP, subframeP, total_slice_percentage_current, total_slice_percentage, slice_percentage_current[i], slice_percentage[i]); total_slice_percentage_current= total_slice_percentage; slice_percentage_current[i] = slice_percentage[i]; @@ -511,10 +510,10 @@ schedule_dlsch(module_id_ module_idP, if (slice_maxmcs_current[i] != slice_maxmcs[i]){ if ((slice_maxmcs[i] >= 0) && (slice_maxmcs[i] < 29)){ LOG_N(MAC,"[eNB %d][SLICE %d][DL] frame %d subframe %d: slice MAX MCS has changed: %d-->%d\n", - mod_id, i, frame, subframe, slice_maxmcs_current[i], slice_maxmcs[i]); + module_idP, i, frameP, subframeP, slice_maxmcs_current[i], slice_maxmcs[i]); slice_maxmcs_current[i] = slice_maxmcs[i]; } else { - LOG_W(MAC,"[eNB %d][SLICE %d][DL] invalid slice max mcs %d, revert the previous value %d\n",mod_id, i, slice_maxmcs[i],slice_maxmcs_current[i]); + LOG_W(MAC,"[eNB %d][SLICE %d][DL] invalid slice max mcs %d, revert the previous value %d\n",module_idP, i, slice_maxmcs[i],slice_maxmcs_current[i]); slice_maxmcs[i]= slice_maxmcs_current[i]; } } @@ -522,7 +521,7 @@ schedule_dlsch(module_id_ module_idP, // check if a new scheduler, and log the console if (update_dl_scheduler_current[i] != update_dl_scheduler[i]){ LOG_N(MAC,"[eNB %d][SLICE %d][DL] frame %d subframe %d: DL scheduler for this slice is updated: %s \n", - mod_id, i, frame, subframe, dl_scheduler_type[i]); + module_idP, i, frameP, subframeP, dl_scheduler_type[i]); update_dl_scheduler_current[i] = update_dl_scheduler[i]; } @@ -531,16 +530,14 @@ schedule_dlsch(module_id_ module_idP, if (n_active_slices == n_active_slices_current){ LOG_W(MAC,"[eNB %d][SLICE %d][DL] invalid total RB share (%f->%f), reduce proportionally the RB share by 0.1\n", - mod_id,i, - total_slice_percentage_current, total_slice_percentage); + module_idP, i, total_slice_percentage_current, total_slice_percentage); if (slice_percentage[i] >= avg_slice_percentage){ slice_percentage[i]-=0.1; total_slice_percentage-=0.1; } } else { LOG_W(MAC,"[eNB %d][SLICE %d][DL] invalid total RB share (%f->%f), revert the number of slice to its previous value (%d->%d)\n", - mod_id,i, - total_slice_percentage_current, total_slice_percentage, + module_idP, i, total_slice_percentage_current, total_slice_percentage, n_active_slices, n_active_slices_current ); n_active_slices = n_active_slices_current; slice_percentage[i] = slice_percentage_current[i]; @@ -548,7 +545,8 @@ schedule_dlsch(module_id_ module_idP, } // Run each enabled slice-specific schedulers one by one - slice_sched_dl[i](mod_id, i, frame, subframe, mbsfn_flag,dl_info); + /* TODO Navid took out the dl_info additional information */ + slice_sched_dl[i](module_idP, i, frameP, subframeP, mbsfn_flag/*, dl_info*/); } } @@ -806,7 +804,7 @@ schedule_ue_spec(module_id_t module_idP,slice_id_t slice_idP, */ eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[ue_sched_ctl->dl_cqi[CC_id]]; - eNB_UE_stats->dlsch_mcs1 =cmin(eNB_UE_stats->dlsch_mcs1, flexran_slice_maxmcs(slice_idP));//openair_daq_vars.target_ue_dl_mcs); + eNB_UE_stats->dlsch_mcs1 =cmin(eNB_UE_stats->dlsch_mcs1, slice_maxmcs[slice_idP]);//openair_daq_vars.target_ue_dl_mcs); // store stats diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index fe885d38cc8d6dabb18b4b312413c7c1b69dfdb1..15f67871b195404745b48e5d45bb86283a2cb82e 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -61,6 +61,8 @@ #define ENABLE_MAC_PAYLOAD_DEBUG #define DEBUG_eNB_SCHEDULER 1 +extern int n_active_slices; + int choose(int n, int k) { int res = 1; @@ -1927,7 +1929,7 @@ int UE_num_active_CC(UE_list_t * listP, int ue_idP) int UE_PCCID(module_id_t mod_idP, int ue_idP) //------------------------------------------------------------------------------ { - if (RC.mac[mod_idP] == NULL) return 0; + if (!RC.mac || !RC.mac[mod_idP]) return 0; return (RC.mac[mod_idP]->UE_list.pCC_id[ue_idP]); } @@ -1935,7 +1937,7 @@ int UE_PCCID(module_id_t mod_idP, int ue_idP) rnti_t UE_RNTI(module_id_t mod_idP, int ue_idP) //------------------------------------------------------------------------------ { - if (RC.mac[mod_idP] == NULL) return 0; + if (!RC.mac || !RC.mac[mod_idP]) return 0; rnti_t rnti = RC.mac[mod_idP]-> UE_list.UE_template[UE_PCCID(mod_idP, ue_idP)][ue_idP].rnti; @@ -1953,7 +1955,7 @@ rnti_t UE_RNTI(module_id_t mod_idP, int ue_idP) boolean_t is_UE_active(module_id_t mod_idP, int ue_idP) //------------------------------------------------------------------------------ { - if (RC.mac[mod_idP] == NULL) return 0; + if (!RC.mac || !RC.mac[mod_idP]) return 0; return (RC.mac[mod_idP]->UE_list.active[ue_idP]); } diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 7076827896226add27326ae7fcfd67869ac1c6e9..f1bfac7949fa32114cfe11dde6c9b6b78d90af12 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -63,8 +63,8 @@ #include "header.pb-c.h" #include "flexran.pb-c.h" #include "flexran_agent_mac.h" -#include <dlfcn.h> #endif +#include <dlfcn.h> #include "T.h" @@ -943,13 +943,13 @@ unsigned char *parse_ulsch_header(unsigned char *mac_header, * (done below in schedule_ulsch). */ void -set_msg3_subframe(module_id_t Mod_id, +set_msg3_subframe(module_id_t mod_id, int CC_id, int frame, int subframe, int rnti, int Msg3_frame, int Msg3_subframe) { - eNB_MAC_INST *mac = RC.mac[Mod_id]; + eNB_MAC_INST *mac = RC.mac[mod_id]; int i; for (i = 0; i < NB_RA_PROC_MAX; i++) { if (mac->common_channels[CC_id].ra[i].state != IDLE && @@ -1086,7 +1086,7 @@ schedule_ulsch(module_id_t module_idP, frame_t frameP, for (i = 0; i < n_active_slices_uplink; i++) { if (slice_percentage_uplink[i] < 0 ){ LOG_W(MAC, "[eNB %d] frame %d subframe %d:invalid slice %d percentage %f. resetting to zero", - mod_id, frame, subframe, i, slice_percentage_uplink[i]); + module_idP, frameP, subframeP, i, slice_percentage_uplink[i]); slice_percentage_uplink[i]=0; } total_slice_percentage_uplink+=slice_percentage_uplink[i]; @@ -1112,7 +1112,7 @@ schedule_ulsch(module_id_t module_idP, frame_t frameP, if (n_active_slices_current_uplink != n_active_slices_uplink ){ if ((n_active_slices_uplink > 0) && (n_active_slices_uplink <= MAX_NUM_SLICES)) { LOG_N(MAC,"[eNB %d]frame %d subframe %d: number of active UL slices has changed: %d-->%d\n", - mod_id, frame, subframe, n_active_slices_current_uplink, n_active_slices_uplink); + module_idP, frameP, subframeP, n_active_slices_current_uplink, n_active_slices_uplink); n_active_slices_current_uplink = n_active_slices_uplink; @@ -1125,7 +1125,7 @@ schedule_ulsch(module_id_t module_idP, frame_t frameP, // check if the slice rb share has changed, and log the console if (slice_percentage_current_uplink[i] != slice_percentage_uplink[i]){ LOG_N(MAC,"[eNB %d][SLICE %d][UL] frame %d subframe %d: total percentage %f-->%f, slice RB percentage has changed: %f-->%f\n", - mod_id, i, frame, subframe, total_slice_percentage_current_uplink, total_slice_percentage_uplink, slice_percentage_current_uplink[i], slice_percentage_uplink[i]); + module_idP, i, frameP, subframeP, total_slice_percentage_current_uplink, total_slice_percentage_uplink, slice_percentage_current_uplink[i], slice_percentage_uplink[i]); total_slice_percentage_current_uplink= total_slice_percentage_uplink; slice_percentage_current_uplink[i] = slice_percentage_uplink[i]; @@ -1135,10 +1135,10 @@ schedule_ulsch(module_id_t module_idP, frame_t frameP, if (slice_maxmcs_current_uplink[i] != slice_maxmcs_uplink[i]){ if ((slice_maxmcs_uplink[i] >= 0) && (slice_maxmcs_uplink[i] <= 16)){ LOG_N(MAC,"[eNB %d][SLICE %d][UL] frame %d subframe %d: slice MAX MCS has changed: %d-->%d\n", - mod_id, i, frame, subframe, slice_maxmcs_current_uplink[i], slice_maxmcs_uplink[i]); + module_idP, i, frameP, subframeP, slice_maxmcs_current_uplink[i], slice_maxmcs_uplink[i]); slice_maxmcs_current_uplink[i] = slice_maxmcs_uplink[i]; } else { - LOG_W(MAC,"[eNB %d][SLICE %d][UL] invalid slice max mcs %d, revert the previous value %d\n",mod_id, i, slice_maxmcs_uplink[i],slice_maxmcs_current_uplink[i]); + LOG_W(MAC,"[eNB %d][SLICE %d][UL] invalid slice max mcs %d, revert the previous value %d\n",module_idP, i, slice_maxmcs_uplink[i],slice_maxmcs_current_uplink[i]); slice_maxmcs_uplink[i]= slice_maxmcs_current_uplink[i]; } @@ -1147,7 +1147,7 @@ schedule_ulsch(module_id_t module_idP, frame_t frameP, // check if a new scheduler, and log the console if (update_ul_scheduler_current[i] != update_ul_scheduler[i]){ LOG_N(MAC,"[eNB %d][SLICE %d][UL] frame %d subframe %d: UL scheduler for this slice is updated: %s \n", - mod_id, i, frame, subframe, ul_scheduler_type[i]); + module_idP, i, frameP, subframeP, ul_scheduler_type[i]); update_ul_scheduler_current[i] = update_ul_scheduler[i]; } @@ -1156,8 +1156,8 @@ schedule_ulsch(module_id_t module_idP, frame_t frameP, if (n_active_slices_uplink == n_active_slices_current_uplink){ LOG_W(MAC,"[eNB %d][SLICE %d][UL] invalid total RB share (%f->%f), reduce proportionally the RB share by 0.1\n", - mod_id,i, - total_slice_percentage_current_uplink, total_slice_percentage_uplink); + module_idP, i, total_slice_percentage_current_uplink, + total_slice_percentage_uplink); if (slice_percentage_uplink[i] > avg_slice_percentage_uplink){ slice_percentage_uplink[i]-=0.1; total_slice_percentage_uplink-=0.1; @@ -1165,9 +1165,9 @@ schedule_ulsch(module_id_t module_idP, frame_t frameP, } else { // here we can correct the values, e.g. reduce proportionally LOG_W(MAC,"[eNB %d][SLICE %d][UL] invalid total RB share (%f->%f), revert the number of slice to its previous value (%d->%d)\n", - mod_id,i, - total_slice_percentage_current_uplink, total_slice_percentage_uplink, - n_active_slices_uplink, n_active_slices_current_uplink); + module_idP, i, total_slice_percentage_current_uplink, + total_slice_percentage_uplink, n_active_slices_uplink, + n_active_slices_current_uplink); n_active_slices_uplink = n_active_slices_current_uplink; slice_percentage_uplink[i] = slice_percentage_current_uplink[i]; } diff --git a/openair2/LAYER2/MAC/pre_processor.c b/openair2/LAYER2/MAC/pre_processor.c index af5b6f660be4f2ed8a2fe3641cc3c47dad0bc42c..dbe0d820f29aafdae6148c472ac93f5e8b73c270 100644 --- a/openair2/LAYER2/MAC/pre_processor.c +++ b/openair2/LAYER2/MAC/pre_processor.c @@ -57,6 +57,8 @@ #define DEBUG_HEADER_PARSING 1 //#define DEBUG_PACKET_TRACE 1 +extern float slice_percentage[MAX_NUM_SLICES]; + //#define ICIC 0 /* @@ -267,7 +269,8 @@ assign_rbs_required(module_id_t Mod_id, to_prb(RC.mac[Mod_id]->common_channels[CC_id]. mib->message.dl_Bandwidth); - UE_list->ue_sched_ctl.max_allowed_rbs[CC_id][slice_id]= flexran_nb_rbs_allowed_slice(slice_percentage[slice_id],N_RB_DL); + /* TODO Navid: field max_rbs_allowed_slice is [MAX_NUM_LCID][MAX_NUM_SLICES] -> Why CC_id? or bug in definition? */ + UE_list->UE_sched_ctrl[UE_id].max_rbs_allowed_slice[CC_id][slice_id]= flexran_nb_rbs_allowed_slice(slice_percentage[slice_id],N_RB_DL); /* calculating required number of RBs for each UE */ while (TBS < @@ -275,10 +278,13 @@ assign_rbs_required(module_id_t Mod_id, dl_buffer_total) { nb_rbs_required[CC_id][UE_id] += min_rb_unit[CC_id]; - if (nb_rbs_required[CC_id][UE_id] > UE_list->ue_sched_ctl.max_allowed_rbs[CC_id][slice_id]) { + /* TODO Navid: field max_rbs_allowed_slice is [MAX_NUM_LCID][MAX_NUM_SLICES] -> Why CC_id? or bug in definition? */ + if (nb_rbs_required[CC_id][UE_id] > UE_list->UE_sched_ctrl[UE_id].max_rbs_allowed_slice[CC_id][slice_id]) { TBS = - get_TBS_DL(eNB_UE_stats->dlsch_mcs1, UE_list->ue_sched_ctl.max_allowed_rbs[CC_id][slice_id]); - nb_rbs_required[CC_id][UE_id] = UE_list->ue_sched_ctl.max_allowed_rbs[CC_id][slice_id]; + /* TODO Navid: field max_rbs_allowed_slice is [MAX_NUM_LCID][MAX_NUM_SLICES] -> Why CC_id? or bug in definition? */ + get_TBS_DL(eNB_UE_stats->dlsch_mcs1, UE_list->UE_sched_ctrl[UE_id].max_rbs_allowed_slice[CC_id][slice_id]); + /* TODO Navid: field max_rbs_allowed_slice is [MAX_NUM_LCID][MAX_NUM_SLICES] -> Why CC_id? */ + nb_rbs_required[CC_id][UE_id] = UE_list->UE_sched_ctrl[UE_id].max_rbs_allowed_slice[CC_id][slice_id]; break; } @@ -614,7 +620,7 @@ dlsch_scheduler_pre_processor(module_id_t Mod_id, if (UE_list->active[i] != TRUE) continue; - if (!flexran_slice_member(UE_id, slice_id)) + if (!flexran_slice_member(i, slice_id)) continue; UE_id = i; @@ -724,13 +730,15 @@ dlsch_scheduler_pre_processor(module_id_t Mod_id, message.dl_Bandwidth) - total_rbs_used[CC_id]; //recalcualte based on the what is left after retransmission - ue_sched_ctl.max_allowed_rbs[CC_id][slice_id]= flexran_nb_rbs_allowed_slice(slice_percentage[slice_id],N_RB_DL); + ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; + /* TODO Navid: as above */ + ue_sched_ctl->max_rbs_allowed_slice[CC_id][slice_id]= flexran_nb_rbs_allowed_slice(slice_percentage[slice_id],N_RB_DL); if (total_ue_count[CC_id] == 0) { average_rbs_per_user[CC_id] = 0; - } else if ((min_rb_unit[CC_id] * total_ue_count[CC_id]) <= (ue_sched_ctl.max_allowed_rbs[CC_id][slice_id])) { + } else if ((min_rb_unit[CC_id] * total_ue_count[CC_id]) <= (ue_sched_ctl->max_rbs_allowed_slice[CC_id][slice_id])) { average_rbs_per_user[CC_id] = - (uint16_t) floor(ue_sched_ctl.max_allowed_rbs[CC_id][slice_id] / total_ue_count[CC_id]); + (uint16_t) floor(ue_sched_ctl->max_rbs_allowed_slice[CC_id][slice_id] / total_ue_count[CC_id]); } else { average_rbs_per_user[CC_id] = min_rb_unit[CC_id]; // consider the total number of use that can be scheduled UE } @@ -1390,7 +1398,7 @@ ulsch_scheduler_pre_processor(module_id_t module_idP, int N_RB_UL; LOG_D(MAC, "In ulsch_preprocessor: assign max mcs min rb\n"); // maximize MCS and then allocate required RB according to the buffer occupancy with the limit of max available UL RB - assign_max_mcs_min_rb(module_idP, frameP, subframeP, first_rb); + assign_max_mcs_min_rb(module_idP, slice_id, frameP, subframeP, first_rb); LOG_D(MAC, "In ulsch_preprocessor: sort ue \n"); // sort ues diff --git a/openair2/LAYER2/MAC/proto.h b/openair2/LAYER2/MAC/proto.h index 842e1d7080e2e6fe49a42bb85bd51b3f9dd634b3..c7aa6290aef01d43c276a1b8a07b31a2e74be271 100644 --- a/openair2/LAYER2/MAC/proto.h +++ b/openair2/LAYER2/MAC/proto.h @@ -217,6 +217,8 @@ void dlsch_scheduler_pre_processor_reset(int module_idP, int UE_id, uint16_t nb_rbs_required_remaining [MAX_NUM_CCs][NUMBER_OF_UE_MAX], + unsigned char total_ue_count[MAX_NUM_CCs], + unsigned char total_rbs_used[MAX_NUM_CCs], unsigned char rballoc_sub[MAX_NUM_CCs] [N_RBG_MAX], @@ -665,7 +667,7 @@ void ulsch_scheduler_pre_processor(module_id_t module_idP, slice_id_t slice_id, void store_ulsch_buffer(module_id_t module_idP, int frameP, sub_frame_t subframeP); void sort_ue_ul(module_id_t module_idP, int frameP, sub_frame_t subframeP); -void assign_max_mcs_min_rb(module_id_t module_idP, int frameP, +void assign_max_mcs_min_rb(module_id_t module_idP, int slice_id, int frameP, sub_frame_t subframeP, uint16_t * first_rb); void adjust_bsr_info(int buffer_occupancy, uint16_t TBS, UE_TEMPLATE * UE_template); diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index c946dcf8184aafd4dc1363de8289282a334b0e6e..8402d1ba61918c8a5ec23928687d2eab74ecb355 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -2156,7 +2156,7 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt int i; // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE - eNB_RRC_INST* rrc_inst = &eNB_rrc_inst[ctxt_pP->module_id]; + eNB_RRC_INST* rrc_inst = RC.rrc[ctxt_pP->module_id]; struct PhysicalConfigDedicated** physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated; struct SRB_ToAddMod *SRB2_config = NULL; diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index 0626ad772598451290cd4facfd90eb01e1239fa8..6b418bb8ff0ff9ce947b6ec4c78a6c472c7c46d3 100644 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -239,9 +239,7 @@ static void* eNB_thread_rxtx( void* param ) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 ); -#ifdef DEBUG_THREADS - printf(" *** Exiting eNB thread RXn_TXnp4\n"); -#endif + LOG_D(PHY, " *** Exiting eNB thread RXn_TXnp4\n"); eNB_thread_rxtx_status = 0; return &eNB_thread_rxtx_status; @@ -624,8 +622,6 @@ void init_eNB_proc(int inst) { pthread_mutex_init( &proc->mutex_asynch_rxtx, NULL); pthread_mutex_init( &proc->mutex_RU,NULL); pthread_mutex_init( &proc->mutex_RU_PRACH,NULL); - pthread_mutex_init( &proc->mutex_synch,NULL); - pthread_mutex_init( &proc->mutex_FH, NULL); pthread_cond_init( &proc->cond_prach, NULL); pthread_cond_init( &proc->cond_asynch_rxtx, NULL); @@ -727,22 +723,12 @@ void kill_eNB_proc(int inst) { proc_rxtx[1].instance_cnt_rxtx = 0; pthread_mutex_unlock(&proc_rxtx[1].mutex_rxtx); } - pthread_mutex_lock(&PHY_vars_eNB_g[0][CC_id]->proc.mutex_synch); - PHY_vars_eNB_g[0][CC_id]->proc.instance_cnt_synch = 1; - pthread_mutex_unlock(&PHY_vars_eNB_g[0][CC_id]->proc.mutex_synch); proc->instance_cnt_prach = 0; pthread_cond_signal( &proc->cond_prach ); - pthread_cond_signal( &proc->cond_FH ); pthread_cond_signal( &proc->cond_asynch_rxtx ); - pthread_cond_signal( &proc->cond_synch ); pthread_cond_broadcast(&sync_phy_proc.cond_phy_proc_tx); - LOG_D(PHY, "joining pthread_FH\n"); - pthread_join( proc->pthread_FH, (void**)&status ); - pthread_mutex_destroy( &proc->mutex_FH ); - pthread_cond_destroy( &proc->cond_FH ); - LOG_D(PHY, "joining pthread_prach\n"); pthread_join( proc->pthread_prach, (void**)&status ); @@ -776,12 +762,7 @@ void kill_eNB_proc(int inst) { LOG_D(PHY, "joining pthread_single\n"); pthread_join(proc->pthread_single, (void**)&status ); - - LOG_D(PHY, "joining pthread_synch\n"); - pthread_join(proc->pthread_synch, (void**)&status ); - pthread_mutex_destroy(&proc->mutex_synch); - pthread_cond_destroy(&proc->cond_synch); - LOG_D(PHY, "joined all threads\n"); + LOG_D(PHY, "joined all eNB threads\n"); } } diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 315eee23cde00defc60eda93e5141561f4f65462..eab0a88c459699615b711a88b128a53df6e9ddcb 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -229,8 +229,6 @@ uint8_t abstraction_flag=0; /* forward declarations */ void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]); -/* override the enb configuration parameters */ -static void reconfigure_enb_params(int enb_id); /*---------------------BMC: timespec helpers -----------------------------*/ @@ -691,54 +689,6 @@ static void get_options(void) { } -static void reconfigure_enb_params(int enb_id) -{ - int CC_id, k; - const Enb_properties_array_t *enb_properties=enb_config_get(); - - for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { - - node_function[CC_id] = enb_properties->properties[enb_id]->cc_node_function[CC_id]; - node_timing[CC_id] = enb_properties->properties[enb_id]->cc_node_timing[CC_id]; - node_synch_ref[CC_id] = enb_properties->properties[enb_id]->cc_node_synch_ref[CC_id]; - - frame_parms[CC_id]->frame_type = enb_properties->properties[enb_id]->frame_type[CC_id]; - frame_parms[CC_id]->tdd_config = enb_properties->properties[enb_id]->tdd_config[CC_id]; - frame_parms[CC_id]->tdd_config_S = enb_properties->properties[enb_id]->tdd_config_s[CC_id]; - frame_parms[CC_id]->Ncp = enb_properties->properties[enb_id]->prefix_type[CC_id]; - - //for (j=0; j < enb_properties->properties[i]->nb_cc; j++ ){ - frame_parms[CC_id]->Nid_cell = enb_properties->properties[enb_id]->Nid_cell[CC_id]; - frame_parms[CC_id]->N_RB_DL = enb_properties->properties[enb_id]->N_RB_DL[CC_id]; - frame_parms[CC_id]->N_RB_UL = enb_properties->properties[enb_id]->N_RB_DL[CC_id]; - frame_parms[CC_id]->nb_antennas_tx = enb_properties->properties[enb_id]->nb_antennas_tx[CC_id]; - frame_parms[CC_id]->nb_antenna_ports_eNB = enb_properties->properties[enb_id]->nb_antenna_ports[CC_id]; - frame_parms[CC_id]->nb_antennas_rx = enb_properties->properties[enb_id]->nb_antennas_rx[CC_id]; - - frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.prach_ConfigIndex = enb_properties->properties[enb_id]->prach_config_index[CC_id]; - frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.prach_FreqOffset = enb_properties->properties[enb_id]->prach_freq_offset[CC_id]; - - frame_parms[CC_id]->mode1_flag = (frame_parms[CC_id]->nb_antenna_ports_eNB == 1) ? 1 : 0; - frame_parms[CC_id]->threequarter_fs = threequarter_fs; - - for (k = 0 ; k < 4; k++) { - downlink_frequency[CC_id][k] = enb_properties->properties[enb_id]->downlink_frequency[CC_id]; - uplink_frequency_offset[CC_id][k] = enb_properties->properties[enb_id]->uplink_frequency_offset[CC_id]; - rx_gain[CC_id][k] = (double)enb_properties->properties[enb_id]->rx_gain[CC_id]; - tx_gain[CC_id][k] = (double)enb_properties->properties[enb_id]->tx_gain[CC_id]; - } - - printf("Downlink frequency/ uplink offset of CC_id %d set to %ju/%d\n", CC_id, - enb_properties->properties[enb_id]->downlink_frequency[CC_id], - enb_properties->properties[enb_id]->uplink_frequency_offset[CC_id]); - - init_ul_hopping(frame_parms[CC_id]); - init_frame_parms(frame_parms[CC_id],1); - // phy_init_top(frame_parms[CC_id]); - phy_init_lte_top(frame_parms[CC_id]); - } // CC_id -} - #if T_TRACER int T_nowait = 0; /* by default we wait for the tracer */ int T_port = 2021; /* default port to listen to to wait for the tracer */ @@ -887,6 +837,7 @@ void init_openair0() { } } + void wait_RUs(void) { LOG_I(PHY,"Waiting for RUs to be configured ...\n"); @@ -923,70 +874,6 @@ void wait_eNBs(void) { printf("eNB L1 are configured\n"); } -void fill_PHY_vars_eNB_g(uint8_t abstraction_flag, uint8_t beta_ACK, uint8_t beta_RI, uint8_t beta_CQI) -{ - int CC_id, i, j, k, re; - for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - PHY_vars_eNB_g[0][CC_id] = init_lte_eNB(frame_parms[CC_id], - 0, - frame_parms[CC_id]->Nid_cell, - node_function[CC_id], - abstraction_flag); - PHY_vars_eNB_g[0][CC_id]->ue_dl_rb_alloc = 0x1fff; - PHY_vars_eNB_g[0][CC_id]->target_ue_dl_mcs = target_dl_mcs; - PHY_vars_eNB_g[0][CC_id]->ue_ul_nb_rb = 6; - PHY_vars_eNB_g[0][CC_id]->target_ue_ul_mcs = target_ul_mcs; - // initialization for phy-test - for (k = 0; k < NUMBER_OF_UE_MAX; k++) { - PHY_vars_eNB_g[0][CC_id]->transmission_mode[k] = transmission_mode; - if (transmission_mode == 7) - lte_gold_ue_spec_port5(PHY_vars_eNB_g[0][CC_id]->lte_gold_uespec_port5_table[k], - frame_parms[CC_id]->Nid_cell, - 0x1235+k); - } - if ((transmission_mode == 1) || (transmission_mode == 7)) { - for (j = 0; j < frame_parms[CC_id]->nb_antennas_tx; j++) - for (re = 0; re < frame_parms[CC_id]->ofdm_symbol_size; re++) - PHY_vars_eNB_g[0][CC_id]->common_vars.beam_weights[0][0][j][re] = 0x00007fff / frame_parms[CC_id]->nb_antennas_tx; - } - - if (phy_test==1) - PHY_vars_eNB_g[0][CC_id]->mac_enabled = 0; - else - PHY_vars_eNB_g[0][CC_id]->mac_enabled = 1; - - if (PHY_vars_eNB_g[0][CC_id]->mac_enabled == 0) { //set default parameters for testing mode - for (i = 0; i < NUMBER_OF_UE_MAX; i++) { - PHY_vars_eNB_g[0][CC_id]->pusch_config_dedicated[i].betaOffset_ACK_Index = beta_ACK; - PHY_vars_eNB_g[0][CC_id]->pusch_config_dedicated[i].betaOffset_RI_Index = beta_RI; - PHY_vars_eNB_g[0][CC_id]->pusch_config_dedicated[i].betaOffset_CQI_Index = beta_CQI; - - PHY_vars_eNB_g[0][CC_id]->scheduling_request_config[i].sr_PUCCH_ResourceIndex = i; - PHY_vars_eNB_g[0][CC_id]->scheduling_request_config[i].sr_ConfigIndex = 7+(i%3); - PHY_vars_eNB_g[0][CC_id]->scheduling_request_config[i].dsr_TransMax = sr_n4; - } - } - - compute_prach_seq(&PHY_vars_eNB_g[0][CC_id]->frame_parms.prach_config_common, - PHY_vars_eNB_g[0][CC_id]->frame_parms.frame_type, - PHY_vars_eNB_g[0][CC_id]->X_u); - - - PHY_vars_eNB_g[0][CC_id]->rx_total_gain_dB = (int)rx_gain[CC_id][0]; - - if (frame_parms[CC_id]->frame_type == FDD) { - PHY_vars_eNB_g[0][CC_id]->N_TA_offset = 0; - } else { - if (frame_parms[CC_id]->N_RB_DL == 100) - PHY_vars_eNB_g[0][CC_id]->N_TA_offset = 624; - else if (frame_parms[CC_id]->N_RB_DL == 50) - PHY_vars_eNB_g[0][CC_id]->N_TA_offset = 624/2; - else if (frame_parms[CC_id]->N_RB_DL == 25) - PHY_vars_eNB_g[0][CC_id]->N_TA_offset = 624/4; - } - } -} - #if defined(ENABLE_ITTI) && defined(FLEXRAN_AGENT_SB_IF) /* * helper function to terminate a certain ITTI task @@ -999,6 +886,7 @@ void terminate_task(task_id_t task_id, mid_t mod_id) itti_send_msg_to_task (task_id, ENB_MODULE_ID_TO_INSTANCE(mod_id), msg); } +#if 0 int stop_L1L2(int enb_id) { int CC_id; @@ -1107,6 +995,7 @@ int restart_L1L2(int enb_id) return 0; } #endif +#endif int main( int argc, char **argv ) { @@ -1274,19 +1163,14 @@ int main( int argc, char **argv ) flexran_agent_start(i); } - LOG_I(ENB_APP, " * Waiting for FlexRAN RTController command *\n"); - pthread_mutex_lock(&mutex_node_ctrl); - while (ENB_NORMAL_OPERATION != node_control_state) - pthread_cond_wait(&cond_node_ctrl, &mutex_node_ctrl); - pthread_mutex_unlock(&mutex_node_ctrl); - - /* reconfigure eNB in case FlexRAN controller applied changes */ - /* TODO needs to be done? */ - //for (i=0; i < NB_eNB_INST; i++){ - // LOG_I(ENB_APP, "Reconfigure eNB module %d and FlexRAN eNB variables\n", i); - // reconfigure_enb_params(i); - // flexran_set_enb_vars(i, RAN_LTE_OAI); - //} + /* TODO handle restart/initial blocking */ + //LOG_I(ENB_APP, " * Waiting for FlexRAN RTController command *\n"); + //pthread_mutex_lock(&mutex_node_ctrl); + //while (ENB_NORMAL_OPERATION != node_control_state) + // pthread_cond_wait(&cond_node_ctrl, &mutex_node_ctrl); + //pthread_mutex_unlock(&mutex_node_ctrl); + + /* TODO do eNB reconfiguration (handled implicitly?) */ #endif if (UE_flag==1) { @@ -1611,6 +1495,7 @@ int main( int argc, char **argv ) } } } + #endif printf("stopping MODEM threads\n"); diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h index 6274fc16107ca470b016608041e65f9ceb8aac8c..13e5ba6b91abbcba2df2ca48266c2b7d7f533904 100644 --- a/targets/RT/USER/lte-softmodem.h +++ b/targets/RT/USER/lte-softmodem.h @@ -269,7 +269,7 @@ extern int restart_L1L2(int enb_id); #ifdef FLEXRAN_AGENT_SB_IF #include "flexran_agent.h" // for locking -volatile ENB_MODULE_STATE node_control_state; +//volatile ENB_MODULE_STATE node_control_state; pthread_cond_t cond_node_ctrl; pthread_mutex_t mutex_node_ctrl; #endif