Commit 99301f43 authored by Robert Schmidt's avatar Robert Schmidt

Call schedule_ue_spec() once for each CC

parent 81fb7628
......@@ -420,17 +420,8 @@ set_ul_DAI(int module_idP,
//------------------------------------------------------------------------------
void
schedule_dlsch(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP, int *mbsfn_flag) {
int i = 0;
slice_info_t *sli = &RC.mac[module_idP]->slice_info;
memset(sli->rballoc_sub, 0, sizeof(sli->rballoc_sub));
for (i = 0; i < sli->n_dl; i++) {
// Run each enabled slice-specific schedulers one by one
sli->dl[i].sched_cb(module_idP,
i,
frameP,
subframeP,
mbsfn_flag/*, dl_info*/);
for (int CC_id = 0; CC_id < RC.nb_mac_CC[module_idP]; CC_id++) {
schedule_ue_spec(module_idP, CC_id, frameP, subframeP, mbsfn_flag);
}
}
......@@ -454,13 +445,12 @@ void getRepetition(UE_TEMPLATE *pue_template,unsigned int *maxRep, unsigned int
*/
void
schedule_ue_spec(module_id_t module_idP,
int slice_idxP,
int CC_id,
frame_t frameP,
sub_frame_t subframeP,
int *mbsfn_flag)
//------------------------------------------------------------------------------
{
int CC_id;
int UE_id;
int aggregation;
mac_rlc_status_resp_t rlc_status;
......@@ -478,7 +468,6 @@ schedule_ue_spec(module_id_t module_idP,
uint8_t ra_ii;
eNB_UE_STATS *eNB_UE_stats = NULL;
UE_TEMPLATE *ue_template = NULL;
eNB_STATS *eNB_stats = NULL;
RRC_release_ctrl_t *release_ctrl = NULL;
DLSCH_PDU *dlsch_pdu = NULL;
RA_t *ra = NULL;
......@@ -491,11 +480,11 @@ schedule_ue_spec(module_id_t module_idP,
int tpc = 1;
UE_sched_ctrl_t *ue_sched_ctrl;
int mcs;
int i;
int min_rb_unit[NFAPI_CC_MAX];
int N_RB_DL[NFAPI_CC_MAX];
int total_nb_available_rb[NFAPI_CC_MAX];
int N_RBG[NFAPI_CC_MAX];
const int min_rb_unit = get_min_rb_unit(module_idP, CC_id);
const int dl_Bandwidth = cc[CC_id].mib->message.dl_Bandwidth;
const int N_RB_DL = to_prb(dl_Bandwidth);
const int N_RBG = to_rbg(dl_Bandwidth);
int total_nb_available_rb = N_RB_DL;
nfapi_dl_config_request_body_t *dl_req;
nfapi_dl_config_request_pdu_t *dl_config_pdu;
int tdd_sfa;
......@@ -503,22 +492,19 @@ schedule_ue_spec(module_id_t module_idP,
int header_length_last;
int header_length_total;
rrc_eNB_ue_context_t *ue_contextP = NULL;
int nb_mac_CC = RC.nb_mac_CC[module_idP];
long dl_Bandwidth;
if(is_pmch_subframe(frameP,subframeP,&RC.eNB[module_idP][0]->frame_parms)){
//LOG_E(MAC,"Frame[%d] SF:%d This SF should not be allocated\n",frameP,subframeP);
return ;
}
start_meas(&eNB->schedule_dlsch);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH,
VCD_FUNCTION_IN);
// for TDD: check that we have to act here, otherwise return
if (cc[0].tdd_Config) {
tdd_sfa = cc[0].tdd_Config->subframeAssignment;
if (cc[CC_id].tdd_Config) {
tdd_sfa = cc[CC_id].tdd_Config->subframeAssignment;
switch (subframeP) {
case 0:
......@@ -567,33 +553,25 @@ schedule_ue_spec(module_id_t module_idP,
aggregation = 2;
for (CC_id = 0, eNB_stats = &eNB->eNB_stats[0]; CC_id < nb_mac_CC; CC_id++, eNB_stats++) {
dl_Bandwidth = cc[CC_id].mib->message.dl_Bandwidth;
N_RB_DL[CC_id] = to_prb(dl_Bandwidth);
min_rb_unit[CC_id] = get_min_rb_unit(module_idP, CC_id);
// get number of PRBs less those used by common channels
total_nb_available_rb[CC_id] = N_RB_DL[CC_id];
for (i = 0; i < N_RB_DL[CC_id]; i++)
for (int i = 0; i < N_RB_DL; i++)
if (cc[CC_id].vrb_map[i] != 0)
total_nb_available_rb[CC_id]--;
total_nb_available_rb--;
N_RBG[CC_id] = to_rbg(dl_Bandwidth);
// store the global enb stats:
eNB_stats->num_dlactive_UEs = UE_list->num_UEs;
eNB_stats->available_prbs = total_nb_available_rb[CC_id];
eNB_stats->total_available_prbs += total_nb_available_rb[CC_id];
eNB_stats->dlsch_bytes_tx = 0;
eNB_stats->dlsch_pdus_tx = 0;
}
eNB->eNB_stats[CC_id].num_dlactive_UEs = UE_list->num_UEs;
eNB->eNB_stats[CC_id].available_prbs = total_nb_available_rb;
eNB->eNB_stats[CC_id].total_available_prbs += total_nb_available_rb;
eNB->eNB_stats[CC_id].dlsch_bytes_tx = 0;
eNB->eNB_stats[CC_id].dlsch_pdus_tx = 0;
// CALLING Pre_Processor for downlink scheduling
// (Returns estimation of RBs required by each UE and the allocation on sub-band)
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR,
VCD_FUNCTION_IN);
start_meas(&eNB->schedule_dlsch_preprocessor);
memset(eNB->slice_info.rballoc_sub, 0, sizeof(eNB->slice_info.rballoc_sub));
dlsch_scheduler_pre_processor(module_idP,
slice_idxP,
0, //slice_idxP,
frameP,
subframeP,
mbsfn_flag,
......@@ -610,18 +588,17 @@ schedule_ue_spec(module_id_t module_idP,
/* the interslice multiplexing re-sorts the UE_list for the slices it tries
* to multiplex, so we need to sort it for the current slice again */
sort_UEs(module_idP,
slice_idxP,
0,//slice_idxP,
frameP,
subframeP);
}
for (CC_id = 0; CC_id < nb_mac_CC; CC_id++) {
LOG_D(MAC, "doing schedule_ue_spec for CC_id %d\n",
CC_id);
dl_req = &eNB->DL_req[CC_id].dl_config_request_body;
if (mbsfn_flag[CC_id] > 0)
continue;
//if (mbsfn_flag[CC_id] > 0)
// return;
for (UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
LOG_D(MAC, "doing schedule_ue_spec for CC_id %d UE %d\n",
......@@ -743,14 +720,14 @@ schedule_ue_spec(module_id_t module_idP,
eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[ue_sched_ctrl->dl_cqi[CC_id]];
} else { // this operation is also done in the preprocessor
eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1,
eNB->slice_info.dl[slice_idxP].maxmcs); // cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs);
eNB->slice_info.dl[0/*slice_idxP*/].maxmcs); // cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs);
}
// Store stats
// eNB_UE_stats->dl_cqi= eNB_UE_stats->dl_cqi;
// Initializing the rb allocation indicator for each UE
for (j = 0; j < N_RBG[CC_id]; j++) {
for (j = 0; j < N_RBG; j++) {
ue_template->rballoc_subband[harq_pid][j] = 0;
}
......@@ -804,22 +781,22 @@ schedule_ue_spec(module_id_t module_idP,
}
if (nb_rb == ue_sched_ctrl->pre_nb_available_rbs[CC_id]) {
for (j = 0; j < N_RBG[CC_id]; j++) { // for indicating the rballoc for each sub-band
for (j = 0; j < N_RBG; j++) { // for indicating the rballoc for each sub-band
ue_template->rballoc_subband[harq_pid][j] = ue_sched_ctrl->rballoc_sub_UE[CC_id][j];
}
} else {
nb_rb_temp = nb_rb;
j = 0;
while ((nb_rb_temp > 0) && (j < N_RBG[CC_id])) {
while ((nb_rb_temp > 0) && (j < N_RBG)) {
if (ue_sched_ctrl->rballoc_sub_UE[CC_id][j] == 1) {
if (ue_template->rballoc_subband[harq_pid][j])
LOG_W(MAC, "WARN: rballoc_subband not free for retrans?\n");
ue_template->rballoc_subband[harq_pid][j] = ue_sched_ctrl->rballoc_sub_UE[CC_id][j];
nb_rb_temp -= min_rb_unit[CC_id];
nb_rb_temp -= min_rb_unit;
if ((j == N_RBG[CC_id] - 1) && (N_RB_DL[CC_id] == 25 || N_RB_DL[CC_id] == 50))
if ((j == N_RBG - 1) && (N_RB_DL == 25 || N_RB_DL == 50))
nb_rb_temp++;
}
......@@ -985,7 +962,9 @@ schedule_ue_spec(module_id_t module_idP,
ENB_FLAG_YES,
MBMS_FLAG_NO,
DCCH,
TBS - ta_len - header_length_total - sdu_length_total - 3, 0, 0
TBS - ta_len - header_length_total - sdu_length_total - 3,
0,
0
);
sdu_lengths[0] = 0;
......@@ -1004,7 +983,9 @@ schedule_ue_spec(module_id_t module_idP,
MBMS_FLAG_NO,
DCCH,
TBS, //not used
(char *)&dlsch_buffer[0], 0, 0
(char *)&dlsch_buffer[0],
0,
0
);
if((rrc_release_info.num_UEs > 0) && (rlc_am_mui.rrc_mui_num > 0)) {
......@@ -1122,7 +1103,9 @@ schedule_ue_spec(module_id_t module_idP,
ENB_FLAG_YES,
MBMS_FLAG_NO,
DCCH + 1,
TBS - ta_len - header_length_total - sdu_length_total - 3, 0, 0
TBS - ta_len - header_length_total - sdu_length_total - 3,
0,
0
);
// DCCH SDU
sdu_lengths[num_sdus] = 0;
......@@ -1138,7 +1121,9 @@ schedule_ue_spec(module_id_t module_idP,
ENB_FLAG_YES,
MBMS_FLAG_NO, DCCH + 1,
TBS, //not used
(char *) &dlsch_buffer[sdu_length_total], 0, 0
(char *) &dlsch_buffer[sdu_length_total],
0,
0
);
T(T_ENB_MAC_UE_DL_SDU,
T_INT(module_idP),
......@@ -1211,7 +1196,9 @@ schedule_ue_spec(module_id_t module_idP,
MBMS_FLAG_NO,
lcid,
TBS, //not used
(char *) &dlsch_buffer[sdu_length_total], 0, 0
(char *) &dlsch_buffer[sdu_length_total],
0,
0
);
T(T_ENB_MAC_UE_DL_SDU,
T_INT(module_idP),
......@@ -1269,13 +1256,13 @@ schedule_ue_spec(module_id_t module_idP,
if (mcs == 0) {
nb_rb = 4; // don't let the TBS get too small
} else {
nb_rb = min_rb_unit[CC_id];
nb_rb = min_rb_unit;
}
TBS = get_TBS_DL(mcs, nb_rb);
while (TBS < sdu_length_total + header_length_total + ta_len) {
nb_rb += min_rb_unit[CC_id]; //
nb_rb += min_rb_unit; //
if (nb_rb > nb_available_rb) { // if we've gone beyond the maximum number of RBs
// (can happen if N_RB_DL is odd)
......@@ -1290,21 +1277,21 @@ schedule_ue_spec(module_id_t module_idP,
}
if (nb_rb == ue_sched_ctrl->pre_nb_available_rbs[CC_id]) {
for (j = 0; j < N_RBG[CC_id]; ++j) { // for indicating the rballoc for each sub-band
for (j = 0; j < N_RBG; ++j) { // for indicating the rballoc for each sub-band
ue_template->rballoc_subband[harq_pid][j] = ue_sched_ctrl->rballoc_sub_UE[CC_id][j];
}
} else {
nb_rb_temp = nb_rb;
j = 0;
while ((nb_rb_temp > 0) && (j < N_RBG[CC_id])) {
while ((nb_rb_temp > 0) && (j < N_RBG)) {
if (ue_sched_ctrl->rballoc_sub_UE[CC_id][j] == 1) {
ue_template->rballoc_subband[harq_pid][j] = ue_sched_ctrl->rballoc_sub_UE[CC_id][j];
if ((j == N_RBG[CC_id] - 1) && ((N_RB_DL[CC_id] == 25) || (N_RB_DL[CC_id] == 50))) {
nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id] + 1;
if ((j == N_RBG - 1) && ((N_RB_DL == 25) || (N_RB_DL == 50))) {
nb_rb_temp = nb_rb_temp - min_rb_unit + 1;
} else {
nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id];
nb_rb_temp = nb_rb_temp - min_rb_unit;
}
}
......@@ -1384,7 +1371,7 @@ schedule_ue_spec(module_id_t module_idP,
#ifdef DEBUG_eNB_SCHEDULER
LOG_T(MAC, "[eNB %d] First 16 bytes of DLSCH : \n");
for (i = 0; i < 16; i++) {
for (int i = 0; i < 16; i++) {
LOG_T(MAC, "%x.",
dlsch_buffer[i]);
}
......@@ -1637,7 +1624,6 @@ schedule_ue_spec(module_id_t module_idP,
subframeP);
}
} // UE_id loop
} // CC_id loop
fill_DLSCH_dci(module_idP,
frameP,
......
......@@ -156,8 +156,11 @@ void fill_DLSCH_dci(module_id_t module_idP,frame_t frameP,sub_frame_t subframe,i
void schedule_dlsch(module_id_t module_idP, frame_t frameP,
sub_frame_t subframe, int *mbsfn_flag);
void schedule_ue_spec(module_id_t module_idP, int slice_idxP,
frame_t frameP,sub_frame_t subframe, int *mbsfn_flag);
void schedule_ue_spec(module_id_t module_idP,
int CC_id,
frame_t frameP,
sub_frame_t subframe,
int *mbsfn_flag);
void schedule_ue_spec_br(module_id_t module_idP,
frame_t frameP,
sub_frame_t subframeP);
......
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