Commit 31b7b31b authored by Niccolò Iardella's avatar Niccolò Iardella Committed by Robert Schmidt

Refactoring and optimization

parent 22348335
......@@ -626,8 +626,12 @@ void dlsch_scheduler_pre_processor_accounting(module_id_t Mod_id,
rnti_t rnti;
uint8_t harq_pid, round;
uint8_t total_rbs_used[MAX_NUM_CCs];
uint8_t rbs_retx[MAX_NUM_CCs];
uint16_t average_rbs_per_user[MAX_NUM_CCs];
int ue_count_newtx[MAX_NUM_CCs];
int ue_count_retx[MAX_NUM_CCs];
uint8_t ue_retx_flag[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
int N_RB_DL;
UE_list_t *UE_list = &RC.mac[Mod_id]->UE_list;
......@@ -635,10 +639,15 @@ void dlsch_scheduler_pre_processor_accounting(module_id_t Mod_id,
COMMON_channels_t *cc;
// Reset
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
for (CC_id = 0; CC_id < MAX_NUM_CCs; ++CC_id) {
total_ue_count[CC_id] = 0;
total_rbs_used[CC_id] = 0;
ue_count_newtx[CC_id] = 0;
ue_count_retx[CC_id] = 0;
rbs_retx[CC_id] = 0;
average_rbs_per_user[CC_id] = 0;
for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; ++UE_id) {
ue_retx_flag[CC_id][UE_id] = 0;
}
}
// Find total UE count, and account the RBs required for retransmissions
......@@ -660,16 +669,17 @@ void dlsch_scheduler_pre_processor_accounting(module_id_t Mod_id,
harq_pid = ((frameP * 10) + subframeP) & 7;
round = ue_sched_ctl->round[CC_id][harq_pid];
average_rbs_per_user[CC_id] = 0;
if (nb_rbs_required[CC_id][UE_id] > 0) {
total_ue_count[CC_id]++;
}
if (round != 8) {
nb_rbs_required[CC_id][UE_id] = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid];
total_rbs_used[CC_id] += nb_rbs_required[CC_id][UE_id];
}
//nb_rbs_required_remaining[UE_id] = nb_rbs_required[UE_id];
if (nb_rbs_required[CC_id][UE_id] > 0) {
total_ue_count[CC_id] = total_ue_count[CC_id] + 1;
rbs_retx[CC_id] += nb_rbs_required[CC_id][UE_id];
ue_count_retx[CC_id]++;
ue_retx_flag[CC_id][UE_id] = 1;
} else {
ue_count_newtx[CC_id]++;
}
}
}
......@@ -682,20 +692,10 @@ void dlsch_scheduler_pre_processor_accounting(module_id_t Mod_id,
if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync == 1) continue;
if (!ue_slice_membership(UE_id, slice_id)) continue;
for (i = 0; i < UE_num_active_CC(UE_list, UE_id); i++) {
for (i = 0; i < UE_num_active_CC(UE_list, UE_id); ++i) {
CC_id = UE_list->ordered_CCids[i][UE_id];
// hypothetical assignment
/*
* If schedule is enabled and if the priority of the UEs is modified
* The average rbs per logical channel per user will depend on the level of
* priority. Concerning the hypothetical assignement, we should assign more
* rbs to prioritized users. Maybe, we can do a mapping between the
* average rbs per user and the level of priority or multiply the average rbs
* per user by a coefficient which represents the degree of priority.
*/
N_RB_DL = to_prb(RC.mac[Mod_id]->common_channels[CC_id].mib->message.dl_Bandwidth) - total_rbs_used[CC_id];
N_RB_DL = to_prb(RC.mac[Mod_id]->common_channels[CC_id].mib->message.dl_Bandwidth) - rbs_retx[CC_id];
// recalculate based on the what is left after retransmission
ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
......@@ -709,7 +709,7 @@ void dlsch_scheduler_pre_processor_accounting(module_id_t Mod_id,
(uint16_t) floor(ue_sched_ctl->max_rbs_allowed_slice[CC_id][slice_id] / total_ue_count[CC_id]);
} else {
// consider the total number of use that can be scheduled UE
average_rbs_per_user[CC_id] = min_rb_unit[CC_id];
average_rbs_per_user[CC_id] = (uint16_t)min_rb_unit[CC_id];
}
}
}
......@@ -718,13 +718,9 @@ void dlsch_scheduler_pre_processor_accounting(module_id_t Mod_id,
// extend nb_rbs_required to capture per LCID RB required
for (UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
rnti = UE_RNTI(Mod_id, UE_id);
if (rnti == NOT_A_RNTI)
continue;
if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync == 1)
continue;
if (!ue_slice_membership(UE_id, slice_id))
continue;
if (rnti == NOT_A_RNTI) continue;
if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync == 1) continue;
if (!ue_slice_membership(UE_id, slice_id)) continue;
for (i = 0; i < UE_num_active_CC(UE_list, UE_id); i++) {
CC_id = UE_list->ordered_CCids[i][UE_id];
......@@ -763,7 +759,7 @@ void dlsch_scheduler_pre_processor_positioning(module_id_t Mod_id,
uint8_t transmission_mode;
uint8_t slice_allocation_mask[MAX_NUM_CCs][N_RBG_MAX];
uint16_t nb_rbs_required_remaining[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
uint16_t nb_rbs_remaining[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
rnti_t rnti;
UE_list_t *UE_list = &RC.mac[Mod_id]->UE_list;
......@@ -780,22 +776,22 @@ void dlsch_scheduler_pre_processor_positioning(module_id_t Mod_id,
CC_id = UE_list->ordered_CCids[i][UE_id];
if (r1 == 0) {
nb_rbs_required_remaining[CC_id][UE_id] =
nb_rbs_remaining[CC_id][UE_id] =
nb_rbs_accounted[CC_id][UE_id];
} else { // rb required based only on the buffer - rb allocated in the 1st round + extra reaming rb form the 1st round
nb_rbs_required_remaining[CC_id][UE_id] =
nb_rbs_remaining[CC_id][UE_id] =
nb_rbs_required[CC_id][UE_id] -
nb_rbs_accounted[CC_id][UE_id] +
nb_rbs_required_remaining[CC_id][UE_id];
if (nb_rbs_required_remaining[CC_id][UE_id] < 0)
nb_rbs_remaining[CC_id][UE_id];
if (nb_rbs_remaining[CC_id][UE_id] < 0)
abort();
}
if (nb_rbs_required[CC_id][UE_id] > 0)
LOG_D(MAC,
"round %d : nb_rbs_required_remaining[%d][%d]= %d (remaining_1 %d, required %d, pre_nb_available_rbs %d, N_RBG %d, rb_unit %d)\n",
"round %d : nb_rbs_remaining[%d][%d]= %d (accounted %d, required %d, pre_nb_available_rbs %d, N_RBG %d, rb_unit %d)\n",
r1, CC_id, UE_id,
nb_rbs_required_remaining[CC_id][UE_id],
nb_rbs_remaining[CC_id][UE_id],
nb_rbs_accounted[CC_id][UE_id],
nb_rbs_required[CC_id][UE_id],
UE_list->UE_sched_ctrl[UE_id].pre_nb_available_rbs[CC_id],
......@@ -833,10 +829,9 @@ void dlsch_scheduler_pre_processor_positioning(module_id_t Mod_id,
UE_id,
CC_id,
N_RBG[CC_id],
transmission_mode,
min_rb_unit[CC_id],
nb_rbs_required,
nb_rbs_required_remaining,
nb_rbs_remaining,
rballoc_sub,
slice_allocation_mask,
MIMO_mode_indicator);
......@@ -1053,6 +1048,7 @@ dlsch_scheduler_pre_processor(module_id_t Mod_id,
MIMO_mode_indicator,
mbsfn_flag); // TODO Not sure if useful
// STATUS
// Store the DLSCH buffer for each logical channel
store_dlsch_buffer(Mod_id, slice_id, frameP, subframeP);
......@@ -1374,7 +1370,6 @@ dlsch_scheduler_pre_processor_allocate(module_id_t Mod_id,
int UE_id,
uint8_t CC_id,
int N_RBG,
int tm,
int min_rb_unit,
uint16_t nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
uint16_t nb_rbs_remaining[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
......@@ -1383,6 +1378,7 @@ dlsch_scheduler_pre_processor_allocate(module_id_t Mod_id,
unsigned char MIMO_mode_indicator[MAX_NUM_CCs][N_RBG_MAX]) {
int i;
int tm = get_tmode(Mod_id, CC_id, UE_id);
UE_list_t *UE_list = &RC.mac[Mod_id]->UE_list;
UE_sched_ctrl *ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
int N_RB_DL = to_prb(RC.mac[Mod_id]->common_channels[CC_id].mib->message.dl_Bandwidth);
......
......@@ -254,7 +254,6 @@ void dlsch_scheduler_pre_processor_allocate(module_id_t Mod_id,
int UE_id,
uint8_t CC_id,
int N_RBG,
int transmission_mode,
int min_rb_unit,
uint16_t nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
uint16_t nb_rbs_required_remaining[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
......
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