Commit ab0e4aad authored by Xenofon Foukas's avatar Xenofon Foukas

Reintroduced support for agent scheduler after merge with develop

parent a91a25c9
...@@ -86,7 +86,6 @@ schedule_ue_spec_default( ...@@ -86,7 +86,6 @@ schedule_ue_spec_default(
//TODO //TODO
uint8_t CC_id; uint8_t CC_id;
int UE_id; int UE_id;
uint16_t nCCE[MAX_NUM_CCs];
int N_RBG[MAX_NUM_CCs]; int N_RBG[MAX_NUM_CCs];
unsigned char aggregation; unsigned char aggregation;
mac_rlc_status_resp_t rlc_status; mac_rlc_status_resp_t rlc_status;
...@@ -103,9 +102,8 @@ schedule_ue_spec_default( ...@@ -103,9 +102,8 @@ schedule_ue_spec_default(
// uint8_t dl_pow_off[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; // uint8_t dl_pow_off[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
// unsigned char rballoc_sub_UE[MAX_NUM_CCs][NUMBER_OF_UE_MAX][N_RBG_MAX]; // unsigned char rballoc_sub_UE[MAX_NUM_CCs][NUMBER_OF_UE_MAX][N_RBG_MAX];
// uint16_t pre_nb_available_rbs[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; // uint16_t pre_nb_available_rbs[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
int mcs; int mcs, mcs_tmp;
uint16_t min_rb_unit[MAX_NUM_CCs]; uint16_t min_rb_unit[MAX_NUM_CCs];
short ta_update = 0;
eNB_MAC_INST *eNB = &eNB_mac_inst[mod_id]; eNB_MAC_INST *eNB = &eNB_mac_inst[mod_id];
UE_list_t *UE_list = &eNB->UE_list; UE_list_t *UE_list = &eNB->UE_list;
LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]; LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs];
...@@ -144,15 +142,18 @@ schedule_ue_spec_default( ...@@ -144,15 +142,18 @@ schedule_ue_spec_default(
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
min_rb_unit[CC_id] = get_min_rb_unit(mod_id, CC_id); min_rb_unit[CC_id] = get_min_rb_unit(mod_id, CC_id);
frame_parms[CC_id] = mac_xface->get_lte_frame_parms(mod_id, CC_id); frame_parms[CC_id] = mac_xface->get_lte_frame_parms(mod_id, CC_id);
//total_nb_available_rb[CC_id] = frame_parms[CC_id]->N_RB_DL - nb_rb_used[CC_id]; // get number of PRBs less those used by common channels
//nCCE[CC_id] = mac_xface->get_nCCE_max(mod_id, CC_id) - nCCE_used[CC_id]; total_nb_available_rb[CC_id] = frame_parms[CC_id]->N_RB_DL;
for (i=0;i<frame_parms[CC_id]->N_RB_DL;i++)
if (eNB->common_channels[CC_id].vrb_map[i]!=0)
total_nb_available_rb[CC_id]--;
N_RBG[CC_id] = frame_parms[CC_id]->N_RBG; N_RBG[CC_id] = frame_parms[CC_id]->N_RBG;
// store the global enb stats: // store the global enb stats:
eNB->eNB_stats[CC_id].num_dlactive_UEs = UE_list->num_UEs; eNB->eNB_stats[CC_id].num_dlactive_UEs = UE_list->num_UEs;
eNB->eNB_stats[CC_id].available_prbs = total_nb_available_rb[CC_id]; eNB->eNB_stats[CC_id].available_prbs = total_nb_available_rb[CC_id];
eNB->eNB_stats[CC_id].total_available_prbs += total_nb_available_rb[CC_id]; eNB->eNB_stats[CC_id].total_available_prbs += total_nb_available_rb[CC_id];
eNB->eNB_stats[CC_id].available_ncces = nCCE[CC_id];
eNB->eNB_stats[CC_id].dlsch_bytes_tx=0; eNB->eNB_stats[CC_id].dlsch_bytes_tx=0;
eNB->eNB_stats[CC_id].dlsch_pdus_tx=0; eNB->eNB_stats[CC_id].dlsch_pdus_tx=0;
} }
...@@ -192,15 +193,17 @@ schedule_ue_spec_default( ...@@ -192,15 +193,17 @@ schedule_ue_spec_default(
continue_flag=1; continue_flag=1;
} }
if ((ue_sched_ctl->pre_nb_available_rbs[CC_id] == 0) || (nCCE[CC_id] < (1<<aggregation))) { if ((ue_sched_ctl->pre_nb_available_rbs[CC_id] == 0) || // no RBs allocated
// LOG_D(MAC,"[eNB %d] Frame %d : no RB allocated for UE %d on CC_id %d: continue \n", CCE_allocation_infeasible(mod_id, CC_id, 0, subframe, aggregation, rnti)
// mod_id, frame, UE_id, CC_id, nb_rb_used[CC_id], ue_sched_ctl->pre_nb_available_rbs[CC_id], nCCE[CC_id], aggregation); ) {
LOG_D(MAC,"[eNB %d] Frame %d : no RB allocated for UE %d on CC_id %d: continue \n",
mod_id, frame, UE_id, CC_id);
//if(mac_xface->get_transmission_mode(module_idP,rnti)==5) //if(mac_xface->get_transmission_mode(module_idP,rnti)==5)
continue_flag=1; //to next user (there might be rbs availiable for other UEs in TM5 continue_flag=1; //to next user (there might be rbs availiable for other UEs in TM5
// else // else
// break; // break;
} }
if (frame_parms[CC_id]->frame_type == TDD) { if (frame_parms[CC_id]->frame_type == TDD) {
set_ue_dai (subframe, set_ue_dai (subframe,
frame_parms[CC_id]->tdd_config, frame_parms[CC_id]->tdd_config,
...@@ -233,6 +236,8 @@ schedule_ue_spec_default( ...@@ -233,6 +236,8 @@ schedule_ue_spec_default(
nb_available_rb = ue_sched_ctl->pre_nb_available_rbs[CC_id]; nb_available_rb = ue_sched_ctl->pre_nb_available_rbs[CC_id];
harq_pid = ue_sched_ctl->harq_pid[CC_id]; harq_pid = ue_sched_ctl->harq_pid[CC_id];
round = ue_sched_ctl->round[CC_id]; round = ue_sched_ctl->round[CC_id];
/* TODO: Must add these stats (probably in the apply_scheduling function) */
//UE_list->eNB_UE_stats[CC_id][UE_id].crnti= rnti; //UE_list->eNB_UE_stats[CC_id][UE_id].crnti= rnti;
//UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status=mac_eNB_get_rrc_status(mod_id, rnti); //UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status=mac_eNB_get_rrc_status(mod_id, rnti);
//UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid; //UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid;
...@@ -248,15 +253,18 @@ schedule_ue_spec_default( ...@@ -248,15 +253,18 @@ schedule_ue_spec_default(
*/ */
mcs = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; mcs = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]];
/*TODO: Must also update these stats*/
//eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; //eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]];
//eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs); //eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs);
#ifdef EXMIMO #ifdef EXMIMO
// if (mac_xface->get_transmission_mode(mod_id, CC_id, rnti)==5) { if (mac_xface->get_transmission_mode(mod_id, CC_id, rnti)==5) {
// eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1,16); mcs = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]];
// } //eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1,16);
}
#endif #endif
...@@ -264,14 +272,13 @@ schedule_ue_spec_default( ...@@ -264,14 +272,13 @@ schedule_ue_spec_default(
//UE_list->eNB_UE_stats[CC_id][UE_id].dl_cqi= eNB_UE_stats->DL_cqi[0]; //UE_list->eNB_UE_stats[CC_id][UE_id].dl_cqi= eNB_UE_stats->DL_cqi[0];
// initializing the rb allocation indicator for each UE // initializing the rb allocation indicator for each UE
for(j=0; j<frame_parms[CC_id]->N_RBG; j++) { for(j = 0; j < frame_parms[CC_id]->N_RBG; j++) {
UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = 0; UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = 0;
} }
LOG_D(MAC,"[eNB %d] Frame %d: Scheduling UE %d on CC_id %d (rnti %x, harq_pid %d, round %d, rb %d, cqi %d, mcs %d, ncc %d, rrc %d)\n", LOG_D(MAC,"[eNB %d] Frame %d: Scheduling UE %d on CC_id %d (rnti %x, harq_pid %d, round %d, rb %d, cqi %d, mcs %d, rrc %d)\n",
mod_id, frame, UE_id, CC_id, rnti, harq_pid, round, nb_available_rb, mod_id, frame, UE_id, CC_id, rnti, harq_pid, round, nb_available_rb,
eNB_UE_stats->DL_cqi[0], mcs, eNB_UE_stats->DL_cqi[0], mcs,
nCCE[CC_id],
UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status); UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status);
dl_dci = (Protocol__PrpDlDci*) malloc(sizeof(Protocol__PrpDlDci)); dl_dci = (Protocol__PrpDlDci*) malloc(sizeof(Protocol__PrpDlDci));
...@@ -301,14 +308,14 @@ schedule_ue_spec_default( ...@@ -301,14 +308,14 @@ schedule_ue_spec_default(
if (nb_rb <= nb_available_rb) { if (nb_rb <= nb_available_rb) {
if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) { if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) {
for(j=0; j<frame_parms[CC_id]->N_RBG; j++) { // for indicating the rballoc for each sub-band for(j = 0; j < frame_parms[CC_id]->N_RBG; j++) { // for indicating the rballoc for each sub-band
UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j];
} }
} else { } else {
nb_rb_temp = nb_rb; nb_rb_temp = nb_rb;
j = 0; j = 0;
while((nb_rb_temp > 0) && (j<frame_parms[CC_id]->N_RBG)) { while((nb_rb_temp > 0) && (j < frame_parms[CC_id]->N_RBG)) {
if(ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 1) { if(ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 1) {
UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j];
if((j == frame_parms[CC_id]->N_RBG-1) && if((j == frame_parms[CC_id]->N_RBG-1) &&
...@@ -326,8 +333,6 @@ schedule_ue_spec_default( ...@@ -326,8 +333,6 @@ schedule_ue_spec_default(
nb_available_rb -= nb_rb; nb_available_rb -= nb_rb;
aggregation = process_ue_cqi(mod_id, UE_id); aggregation = process_ue_cqi(mod_id, UE_id);
nCCE[CC_id]-=(1<<aggregation); // adjust the remaining nCCE
//nCCE_used[CC_id] += (1<<aggregation);
PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb; PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb;
PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id]; PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id];
...@@ -344,7 +349,8 @@ schedule_ue_spec_default( ...@@ -344,7 +349,8 @@ schedule_ue_spec_default(
dl_dci->res_alloc = 0; dl_dci->res_alloc = 0;
dl_dci->n_mcs = 1; dl_dci->n_mcs = 1;
dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t)); dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t));
dl_dci->mcs[0] = mcs; //eNB_UE_stats->dlsch_mcs1; dl_dci->mcs[0] = mcs;
//TODO:Need to fix tpc for retransmissions
dl_dci->has_tpc = 1; dl_dci->has_tpc = 1;
dl_dci->tpc = 1; dl_dci->tpc = 1;
dl_dci->has_vrb_format = 1; dl_dci->has_vrb_format = 1;
...@@ -352,7 +358,7 @@ schedule_ue_spec_default( ...@@ -352,7 +358,7 @@ schedule_ue_spec_default(
dl_dci->has_format = 1; dl_dci->has_format = 1;
dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1; dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1;
dl_dci->has_rb_bitmap = 1; dl_dci->has_rb_bitmap = 1;
dl_dci->rb_bitmap = allocate_prbs_sub(UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid], UE_list->UE_template[CC_id][UE_id].rballoc_subband); dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, UE_list->UE_template[CC_id][UE_id].rballoc_subband);
dl_dci->has_rb_shift = 1; dl_dci->has_rb_shift = 1;
dl_dci->rb_shift = 0; dl_dci->rb_shift = 0;
dl_dci->n_ndi = 1; dl_dci->n_ndi = 1;
...@@ -374,29 +380,48 @@ schedule_ue_spec_default( ...@@ -374,29 +380,48 @@ schedule_ue_spec_default(
case 4: case 4:
dl_dci->has_res_alloc = 1; dl_dci->has_res_alloc = 1;
dl_dci->res_alloc = 0; dl_dci->res_alloc = 0;
dl_dci->n_mcs = 2;
dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t) * dl_dci->n_mcs);
dl_dci->mcs[0] = mcs;
dl_dci->mcs[1] = mcs;
//TODO:Need to fix tpc for retransmissions
dl_dci->has_tpc = 1;
dl_dci->tpc = 1;
dl_dci->has_vrb_format = 1; dl_dci->has_vrb_format = 1;
dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED;
dl_dci->has_format = 1; dl_dci->has_format = 1;
dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A; dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A;
dl_dci->has_rb_bitmap = 1;
dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, UE_list->UE_template[CC_id][UE_id].rballoc_subband);
dl_dci->has_rb_shift = 1;
dl_dci->rb_shift = 0;
dl_dci->n_ndi = 2; dl_dci->n_ndi = 2;
dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi);
dl_dci->ndi[0] = 0; dl_dci->ndi[0] = 0;
dl_dci->ndi[1] = 0; dl_dci->ndi[1] = 0;
//dl_dci->has_rb_bitmap = 1;
//dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub);
dl_dci->has_rb_shift = 1;
dl_dci->rb_shift = 0;
dl_dci->has_dai = 1;
dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3;
dl_dci->n_rv = 2; dl_dci->n_rv = 2;
dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv);
dl_dci->rv[0] = round&3; dl_dci->rv[0] = round&3;
dl_dci->rv[1] = round&3; dl_dci->rv[1] = round&3;
if (frame_parms[CC_id]->frame_type == TDD) {
dl_dci->has_dai = 1;
dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3;
LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n",
mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1));
} else {
LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n",
mod_id, CC_id, harq_pid, round);
}
break; break;
case 5: case 5:
dl_dci->has_res_alloc = 1; dl_dci->has_res_alloc = 1;
dl_dci->res_alloc = 0; dl_dci->res_alloc = 0;
dl_dci->n_mcs = 1;
dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t));
dl_dci->mcs[0] = mcs;
//TODO:Need to fix tpc for retransmissions
dl_dci->has_tpc = 1;
dl_dci->tpc = 1;
dl_dci->has_vrb_format = 1; dl_dci->has_vrb_format = 1;
dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED;
dl_dci->has_format = 1; dl_dci->has_format = 1;
...@@ -404,8 +429,8 @@ schedule_ue_spec_default( ...@@ -404,8 +429,8 @@ schedule_ue_spec_default(
dl_dci->n_ndi = 1; dl_dci->n_ndi = 1;
dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi);
dl_dci->ndi[0] = 0; dl_dci->ndi[0] = 0;
//dl_dci->has_rb_bitmap = 1; dl_dci->has_rb_bitmap = 1;
//dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, UE_list->UE_template[CC_id][UE_id].rballoc_subband);
dl_dci->has_rb_shift = 1; dl_dci->has_rb_shift = 1;
dl_dci->rb_shift = 0; dl_dci->rb_shift = 0;
dl_dci->has_dai = 1; dl_dci->has_dai = 1;
...@@ -425,6 +450,12 @@ schedule_ue_spec_default( ...@@ -425,6 +450,12 @@ schedule_ue_spec_default(
case 6: case 6:
dl_dci->has_res_alloc = 1; dl_dci->has_res_alloc = 1;
dl_dci->res_alloc = 0; dl_dci->res_alloc = 0;
dl_dci->n_mcs = 1;
dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t));
dl_dci->mcs[0] = mcs;
//TODO:Need to fix tpc for retransmissions
dl_dci->has_tpc = 1;
dl_dci->tpc = 1;
dl_dci->has_vrb_format = 1; dl_dci->has_vrb_format = 1;
dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED;
dl_dci->has_format = 1; dl_dci->has_format = 1;
...@@ -432,8 +463,8 @@ schedule_ue_spec_default( ...@@ -432,8 +463,8 @@ schedule_ue_spec_default(
dl_dci->n_ndi = 1; dl_dci->n_ndi = 1;
dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi);
dl_dci->ndi[0] = 0; dl_dci->ndi[0] = 0;
//dl_dci->has_rb_bitmap = 1; dl_dci->has_rb_bitmap = 1;
//dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, UE_list->UE_template[CC_id][UE_id].rballoc_subband);
dl_dci->has_rb_shift = 1; dl_dci->has_rb_shift = 1;
dl_dci->rb_shift = 0; dl_dci->rb_shift = 0;
dl_dci->has_dai = 1; dl_dci->has_dai = 1;
...@@ -447,17 +478,18 @@ schedule_ue_spec_default( ...@@ -447,17 +478,18 @@ schedule_ue_spec_default(
break; break;
} }
add_ue_dlsch_info(mod_id, /*We now probably don't need this*/
CC_id, /* add_ue_dlsch_info(mod_id, */
UE_id, /* CC_id, */
subframe, /* UE_id, */
S_DL_SCHEDULED); /* subframe, */
/* S_DL_SCHEDULED); */
//eNB_UE_stats->dlsch_trials[round]++; //eNB_UE_stats->dlsch_trials[round]++;
//UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission+=1; //UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission+=1;
//UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx=nb_rb; //UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx=nb_rb;
//UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx+=nb_rb; //UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx+=nb_rb;
//UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used_retx=nCCE[CC_id]; //UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used_retx=nCCECC_id];
//UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=eNB_UE_stats->dlsch_mcs1; //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=eNB_UE_stats->dlsch_mcs1;
//UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=eNB_UE_stats->dlsch_mcs1; //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=eNB_UE_stats->dlsch_mcs1;
...@@ -475,33 +507,12 @@ schedule_ue_spec_default( ...@@ -475,33 +507,12 @@ schedule_ue_spec_default(
//TBS = mac_xface->get_TBS(eNB_UE_stats->DL_cqi[0]<<1,nb_available_rb); //TBS = mac_xface->get_TBS(eNB_UE_stats->DL_cqi[0]<<1,nb_available_rb);
TBS = mac_xface->get_TBS_DL(mcs, nb_available_rb); TBS = mac_xface->get_TBS_DL(mcs, nb_available_rb);
dci_tbs = TBS; dci_tbs = TBS;
// check first for RLC data on DCCH // check first for RLC data on DCCH
// add the length for all the control elements (timing adv, drx, etc) : header + payload // add the length for all the control elements (timing adv, drx, etc) : header + payload
//#ifndef EXMIMO_IOT ta_len = (ue_sched_ctl->ta_update!=0) ? 2 : 0;
// to be checked by RK, NN, FK
uint8_t update_TA=4;
switch (frame_parms[CC_id]->N_RB_DL) {
case 6:
update_TA = 1;
break;
case 25:
update_TA = 4;
break;
case 50:
update_TA = 8;
break;
case 100:
update_TA = 16;
break;
}
ta_len = ((eNB_UE_stats->timing_advance_update/update_TA)!=0) ? 2 : 0;
dl_data[num_ues_added]->n_ce_bitmap = 2; dl_data[num_ues_added]->n_ce_bitmap = 2;
dl_data[num_ues_added]->ce_bitmap = (uint32_t *) malloc(sizeof(uint32_t) * 2); dl_data[num_ues_added]->ce_bitmap = (uint32_t *) malloc(sizeof(uint32_t) * 2);
...@@ -509,6 +520,7 @@ schedule_ue_spec_default( ...@@ -509,6 +520,7 @@ schedule_ue_spec_default(
ce_flags |= PROTOCOL__PRP_CE_TYPE__PRPCET_TA; ce_flags |= PROTOCOL__PRP_CE_TYPE__PRPCET_TA;
} }
/*TODO: Add other flags if DRX and other CE are required*/
// Add the control element flags to the progran message // Add the control element flags to the progran message
dl_data[num_ues_added]->ce_bitmap[0] = ce_flags; dl_data[num_ues_added]->ce_bitmap[0] = ce_flags;
...@@ -519,24 +531,22 @@ schedule_ue_spec_default( ...@@ -519,24 +531,22 @@ schedule_ue_spec_default(
// Need to see if we have space for data from this channel // Need to see if we have space for data from this channel
if ( TBS-ta_len-header_len_dcch > 0 ) { if ( TBS-ta_len-header_len_dcch > 0 ) {
//If we have space, we need to see how much data we can request at most (if any are available) //If we have space, we need to see how much data we can request at most (if any available)
rlc_status = mac_rlc_status_ind(mod_id,
rlc_status = mac_rlc_status_ind( rnti,
mod_id, mod_id,
rnti, frame,
mod_id, ENB_FLAG_YES,
frame, MBMS_FLAG_NO,
ENB_FLAG_YES, DCCH,
MBMS_FLAG_NO, (dci_tbs-ta_len-header_len_dcch)); // transport block set size
DCCH,
(TBS-ta_len-header_len_dcch)); // transport block set size
//If data are available in the DCCH //If data are available in the DCCH
if (rlc_status.bytes_in_buffer > 0) { if (rlc_status.bytes_in_buffer > 0) {
LOG_D(MAC, "[TEST]Have %d bytes in buffer DCCH during first call\n", rlc_status.bytes_in_buffer);
// Fill at most 1/3 of the remaining TB //Fill in as much as possible
data_to_request = 3;//cmin(3, rlc_status.bytes_in_buffer); data_to_request = cmin(dci_tbs-ta_len-header_len_dcch, rlc_status.bytes_in_buffer) + 1;
LOG_D(MAC, "[TEST]Will request %d \n", data_to_request);
rlc_pdus[0] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); rlc_pdus[0] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu));
protocol__prp_rlc_pdu__init(rlc_pdus[0]); protocol__prp_rlc_pdu__init(rlc_pdus[0]);
rlc_pdus[0]->n_rlc_pdu_tb = 2; rlc_pdus[0]->n_rlc_pdu_tb = 2;
...@@ -562,26 +572,25 @@ schedule_ue_spec_default( ...@@ -562,26 +572,25 @@ schedule_ue_spec_default(
} }
// check for DCCH1 and update header information (assume 2 byte sub-header) // check for DCCH1 and update header information (assume 2 byte sub-header)
if (TBS-ta_len-header_len_dcch+2-sdu_length_total > 0 ) { if (dci_tbs-ta_len-header_len_dcch-sdu_length_total > 0 ) {
//If we have space, we need to see how much data we can request at most (if any are available) //If we have space, we need to see how much data we can request at most (if any are available)
rlc_status = mac_rlc_status_ind( rlc_status = mac_rlc_status_ind(mod_id,
mod_id,
rnti, rnti,
mod_id, mod_id,
frame, frame,
ENB_FLAG_YES, ENB_FLAG_YES,
MBMS_FLAG_NO, MBMS_FLAG_NO,
DCCH+1, DCCH+1,
(TBS-ta_len-header_len_dcch+2-sdu_length_total)); // transport block set size less allocations for timing advance and (dci_tbs-ta_len-header_len_dcch-sdu_length_total)); // transport block set size less allocations for timing advance and
// DCCH SDU // DCCH SDU
// If data are available in DCCH1 // If data are available in DCCH1
if (rlc_status.bytes_in_buffer > 0) { if (rlc_status.bytes_in_buffer > 0) {
header_len_dcch += 2; header_len_dcch += 2;
//Fill another 1/3 of the remaining TB //Fill in as much as possible
data_to_request = 3;//cmin(3, rlc_status.bytes_in_buffer); data_to_request = cmin(dci_tbs-ta_len-header_len_dcch-sdu_length_total, rlc_status.bytes_in_buffer) + 1;
rlc_pdus[1] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); rlc_pdus[1] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu));
protocol__prp_rlc_pdu__init(rlc_pdus[1]); protocol__prp_rlc_pdu__init(rlc_pdus[1]);
...@@ -589,7 +598,7 @@ schedule_ue_spec_default( ...@@ -589,7 +598,7 @@ schedule_ue_spec_default(
rlc_pdus[1]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); rlc_pdus[1]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2);
rlc_pdus[1]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); rlc_pdus[1]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb));
rlc_pdus[1]->rlc_pdu_tb[0]->has_logical_channel_id = 1; rlc_pdus[1]->rlc_pdu_tb[0]->has_logical_channel_id = 1;
rlc_pdus[1]->rlc_pdu_tb[0]->logical_channel_id = DCCH; rlc_pdus[1]->rlc_pdu_tb[0]->logical_channel_id = DCCH+1;
rlc_pdus[1]->rlc_pdu_tb[0]->has_size = 1; rlc_pdus[1]->rlc_pdu_tb[0]->has_size = 1;
rlc_pdus[1]->rlc_pdu_tb[0]->size = data_to_request; rlc_pdus[1]->rlc_pdu_tb[0]->size = data_to_request;
rlc_pdus[1]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); rlc_pdus[1]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb));
...@@ -610,27 +619,26 @@ schedule_ue_spec_default( ...@@ -610,27 +619,26 @@ schedule_ue_spec_default(
LOG_D(MAC,"[eNB %d], Frame %d, DTCH->DLSCH, CC_id %d, Checking RLC status (rab %d, tbs %d, len %d)\n", LOG_D(MAC,"[eNB %d], Frame %d, DTCH->DLSCH, CC_id %d, Checking RLC status (rab %d, tbs %d, len %d)\n",
mod_id, frame, CC_id, DTCH, TBS, mod_id, frame, CC_id, DTCH, TBS,
TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch);
if (TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch > 0 ) { if (dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch > 0 ) {
//If we have space, we need to see how much data we can request at most (if any are available) //If we have space, we need to see how much data we can request at most (if any are available)
rlc_status = mac_rlc_status_ind( rlc_status = mac_rlc_status_ind(mod_id,
mod_id,
rnti, rnti,
mod_id, mod_id,
frame, frame,
ENB_FLAG_YES, ENB_FLAG_YES,
MBMS_FLAG_NO, MBMS_FLAG_NO,
DTCH, DTCH,
TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch);
// If data are available in DTCH // If data are available in DTCH
if (rlc_status.bytes_in_buffer > 0) { if (rlc_status.bytes_in_buffer > 0) {
LOG_D(MAC, "[TEST] Have %d bytes in buffer DTCH during first call\n", rlc_status.bytes_in_buffer);
//Fill what remains in the TB //Fill what remains in the TB
data_to_request = 3;//cmin(3, rlc_status.bytes_in_buffer); data_to_request = cmin(dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch, rlc_status.bytes_in_buffer) + 1;
LOG_D(MAC, "[TEST]Will request %d \n", data_to_request);
rlc_pdus[2] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); rlc_pdus[2] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu));
protocol__prp_rlc_pdu__init(rlc_pdus[2]); protocol__prp_rlc_pdu__init(rlc_pdus[2]);
rlc_pdus[2]->n_rlc_pdu_tb = 2; rlc_pdus[2]->n_rlc_pdu_tb = 2;
...@@ -654,14 +662,14 @@ schedule_ue_spec_default( ...@@ -654,14 +662,14 @@ schedule_ue_spec_default(
} }
} else { } else {
header_len_dtch = 0; header_len_dtch = 3;
} }
} }
// Add rlc_pdus to the dl_data message // Add rlc_pdus to the dl_data message
dl_data[num_ues_added]->rlc_pdu = (Protocol__PrpRlcPdu **) malloc(sizeof(Protocol__PrpRlcPdu *) * dl_data[num_ues_added]->rlc_pdu = (Protocol__PrpRlcPdu **) malloc(sizeof(Protocol__PrpRlcPdu *) *
dl_data[num_ues_added]->n_rlc_pdu); dl_data[num_ues_added]->n_rlc_pdu);
for (i = 0; i< dl_data[num_ues_added]->n_rlc_pdu; i++) { for (i = 0; i < dl_data[num_ues_added]->n_rlc_pdu; i++) {
dl_data[num_ues_added]->rlc_pdu[i] = rlc_pdus[i]; dl_data[num_ues_added]->rlc_pdu[i] = rlc_pdus[i];
} }
...@@ -674,51 +682,48 @@ schedule_ue_spec_default( ...@@ -674,51 +682,48 @@ schedule_ue_spec_default(
header_len_dtch_tmp = header_len_dtch; header_len_dtch_tmp = header_len_dtch;
if (header_len_dtch == 0) { if (header_len_dtch == 0) {
header_len_dcch = (header_len_dcch >0) ? 1 : header_len_dcch; // remove length field header_len_dcch = (header_len_dcch > 0) ? 1 : header_len_dcch; // remove length field
} else { } else {
header_len_dtch = (header_len_dtch > 0) ? 1 :header_len_dtch; // remove length field for the last SDU header_len_dtch = (header_len_dtch > 0) ? 1 : header_len_dtch; // remove length field for the last SDU
} }
int mcs2; mcs_tmp = mcs;
mcs2 = mcs;
// TODO: Need to compute this and not take it from the stats // TODO: Need to compute this and not take it from the stats
// mcs = eNB_UE_stats->dlsch_mcs1; // mcs = eNB_UE_stats->dlsch_mcs1;
if (mcs2==0) { if (mcs_tmp == 0) {
nb_rb = 4; // don't let the TBS get too small nb_rb = 4; // don't let the TBS get too small
} else { } else {
nb_rb=min_rb_unit[CC_id]; nb_rb=min_rb_unit[CC_id];
} }
TBS = mac_xface->get_TBS_DL(mcs2,nb_rb); TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb);
while (TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) { while (TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) {
nb_rb += min_rb_unit[CC_id]; // nb_rb += min_rb_unit[CC_id]; //
if (nb_rb>nb_available_rb) { // if we've gone beyond the maximum number of RBs if (nb_rb > nb_available_rb) { // if we've gone beyond the maximum number of RBs
// (can happen if N_RB_DL is odd) // (can happen if N_RB_DL is odd)
TBS = mac_xface->get_TBS_DL(mcs2, nb_available_rb); TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_available_rb);
nb_rb = nb_available_rb; nb_rb = nb_available_rb;
break; break;
} }
TBS = mac_xface->get_TBS_DL(mcs, nb_rb); TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb);
} }
if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) { if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) {
for(j=0; j<frame_parms[CC_id]->N_RBG; j++) { // for indicating the rballoc for each sub-band for(j = 0; j < frame_parms[CC_id]->N_RBG; j++) { // for indicating the rballoc for each sub-band
UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j];
} }
} else { } else {
nb_rb_temp = nb_rb; nb_rb_temp = nb_rb;
j = 0; j = 0;
while((nb_rb_temp > 0) && (j<frame_parms[CC_id]->N_RBG)) { while((nb_rb_temp > 0) && (j < frame_parms[CC_id]->N_RBG)) {
if(ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 1) { if(ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 1) {
UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j];
if ((j == frame_parms[CC_id]->N_RBG-1) && if ((j == frame_parms[CC_id]->N_RBG-1) &&
((frame_parms[CC_id]->N_RB_DL == 25)|| ((frame_parms[CC_id]->N_RB_DL == 25)||
(frame_parms[CC_id]->N_RB_DL == 50))) { (frame_parms[CC_id]->N_RB_DL == 50))) {
...@@ -735,44 +740,41 @@ schedule_ue_spec_default( ...@@ -735,44 +740,41 @@ schedule_ue_spec_default(
PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb; PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb;
PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id]; PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id];
for(j=0; j<frame_parms[CC_id]->N_RBG; j++) { for(j = 0; j < frame_parms[CC_id]->N_RBG; j++) {
PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j]; PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j];
} }
// decrease mcs until TBS falls below required length // decrease mcs until TBS falls below required length
while ((TBS > (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && (mcs2>0)) { while ((TBS > (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && (mcs_tmp > 0)) {
mcs2--; mcs_tmp--;
TBS = mac_xface->get_TBS_DL(mcs2,nb_rb); TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb);
} }
// if we have decreased too much or we don't have enough RBs, increase MCS // if we have decreased too much or we don't have enough RBs, increase MCS
while ((TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && ((( ue_sched_ctl->dl_pow_off[CC_id]>0) && (mcs2<28)) while ((TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) &&
|| ( (ue_sched_ctl->dl_pow_off[CC_id]==0) && (mcs2<=15)))) { ((( ue_sched_ctl->dl_pow_off[CC_id] > 0) && (mcs_tmp < 28)) || ( (ue_sched_ctl->dl_pow_off[CC_id]==0) && (mcs_tmp <= 15)))) {
mcs2++; mcs_tmp++;
TBS = mac_xface->get_TBS_DL(mcs2,nb_rb); TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb);
} }
dl_dci->n_tbs_size = 2; LOG_D(MAC,"dlsch_mcs and TBS before and after the rate matching = (%d, %d) (%d, %d)\n", mcs, mcs_tmp, dci_tbs, TBS);
dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * 2);
dl_dci->tbs_size[0] = TBS;
dl_dci->tbs_size[1] = TBS;
LOG_D(MAC,"dlsch_mcs before and after the rate matching = (%d, %d)\n", mcs, mcs2); dci_tbs = TBS;
mcs = mcs_tmp;
aggregation = process_ue_cqi(mod_id,UE_id); aggregation = process_ue_cqi(mod_id,UE_id);
dl_dci->has_aggr_level = 1; dl_dci->has_aggr_level = 1;
dl_dci->aggr_level = aggregation; dl_dci->aggr_level = aggregation;
dl_dci->has_cce_index = 1;
// dl_dci->cce_index = nCCE_used[CC_id];
nCCE[CC_id]-=(1<<aggregation); // adjust the remaining nCCE
// nCCE_used[CC_id]+=(1<<aggregation); // adjust the remaining nCCE
UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid] = nb_rb; UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid] = nb_rb;
add_ue_dlsch_info(mod_id, /*Deactivate here as well*/
CC_id, /* add_ue_dlsch_info(mod_id, */
UE_id, /* CC_id, */
subframe, /* UE_id, */
S_DL_SCHEDULED); /* subframe, */
/* S_DL_SCHEDULED); */
if (frame_parms[CC_id]->frame_type == TDD) { if (frame_parms[CC_id]->frame_type == TDD) {
UE_list->UE_template[CC_id][UE_id].DAI++; UE_list->UE_template[CC_id][UE_id].DAI++;
...@@ -838,8 +840,8 @@ schedule_ue_spec_default( ...@@ -838,8 +840,8 @@ schedule_ue_spec_default(
dl_dci->rb_shift = 0; dl_dci->rb_shift = 0;
dl_dci->n_ndi = 1; dl_dci->n_ndi = 1;
dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi);
dl_dci->ndi[0] = 1; //1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];
dl_dci->n_rv = 1; dl_dci->n_rv = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];
dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv);
dl_dci->rv[0] = 0; dl_dci->rv[0] = 0;
dl_dci->has_tpc = 1; dl_dci->has_tpc = 1;
...@@ -848,16 +850,11 @@ schedule_ue_spec_default( ...@@ -848,16 +850,11 @@ schedule_ue_spec_default(
dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs);
dl_dci->mcs[0] = mcs; dl_dci->mcs[0] = mcs;
dl_dci->n_tbs_size = 1; dl_dci->n_tbs_size = 1;
dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t)); dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size);
dl_dci->tbs_size[0] = dci_tbs; dl_dci->tbs_size[0] = dci_tbs;
if (frame_parms[CC_id]->frame_type == TDD) { if (frame_parms[CC_id]->frame_type == TDD) {
dl_dci->has_dai = 1; dl_dci->has_dai = 1;
dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3;
LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n",
mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1));
} else {
LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n",
mod_id, CC_id, harq_pid, round);
} }
break; break;
case 3: case 3:
...@@ -873,26 +870,25 @@ schedule_ue_spec_default( ...@@ -873,26 +870,25 @@ schedule_ue_spec_default(
dl_dci->rb_shift = 0; dl_dci->rb_shift = 0;
dl_dci->n_ndi = 2; dl_dci->n_ndi = 2;
dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi);
dl_dci->ndi[0] = 1; //1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];;
dl_dci->ndi[1] = 0; dl_dci->ndi[1] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];;
dl_dci->n_rv = 2; dl_dci->n_rv = 2;
dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv);
dl_dci->rv[0] = 0; dl_dci->rv[0] = 0;
dl_dci->rv[1] = 1; dl_dci->rv[1] = 0;
dl_dci->has_tpc = 1; dl_dci->has_tpc = 1;
dl_dci->tpc = tpc; dl_dci->tpc = tpc;
dl_dci->n_mcs = 2; dl_dci->n_mcs = 2;
dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs);
dl_dci->mcs[0] = mcs; dl_dci->mcs[0] = mcs;
dl_dci->mcs[1] = 0; dl_dci->mcs[1] = mcs;
dl_dci->n_tbs_size = 2;
dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size);
dl_dci->tbs_size[0] = dci_tbs;
dl_dci->tbs_size[1] = dci_tbs;
if (frame_parms[CC_id]->frame_type == TDD) { if (frame_parms[CC_id]->frame_type == TDD) {
dl_dci->has_dai = 1; dl_dci->has_dai = 1;
dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3;
LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n",
mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1));
} else {
LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n",
mod_id, CC_id, harq_pid, round);
} }
break; break;
case 4: case 4:
...@@ -901,33 +897,32 @@ schedule_ue_spec_default( ...@@ -901,33 +897,32 @@ schedule_ue_spec_default(
dl_dci->has_vrb_format = 1; dl_dci->has_vrb_format = 1;
dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED;
dl_dci->has_format = 1; dl_dci->has_format = 1;
dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2; dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A;
dl_dci->has_rb_bitmap = 1; dl_dci->has_rb_bitmap = 1;
dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub);
dl_dci->has_rb_shift = 1; dl_dci->has_rb_shift = 1;
dl_dci->rb_shift = 0; dl_dci->rb_shift = 0;
dl_dci->n_ndi = 2; dl_dci->n_ndi = 2;
dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi);
dl_dci->ndi[0] = 1; // 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];;
dl_dci->ndi[1] = 0; dl_dci->ndi[1] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];;
dl_dci->n_rv = 2; dl_dci->n_rv = 2;
dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv);
dl_dci->rv[0] = 0; dl_dci->rv[0] = 0;
dl_dci->rv[1] = round&3; dl_dci->rv[1] = 0;
dl_dci->has_tpc = 1; dl_dci->has_tpc = 1;
dl_dci->tpc = tpc; dl_dci->tpc = tpc;
dl_dci->n_mcs = 2; dl_dci->n_mcs = 2;
dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs);
dl_dci->mcs[0] = mcs; dl_dci->mcs[0] = mcs;
dl_dci->mcs[1] = 0; dl_dci->mcs[1] = mcs;
dl_dci->n_tbs_size = 2;
dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size);
dl_dci->tbs_size[0] = dci_tbs;
dl_dci->tbs_size[1] = dci_tbs;
if (frame_parms[CC_id]->frame_type == TDD) { if (frame_parms[CC_id]->frame_type == TDD) {
dl_dci->has_dai = 1; dl_dci->has_dai = 1;
dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3;
LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n",
mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1));
} else {
LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n",
mod_id, CC_id, harq_pid, round);
} }
break; break;
case 5: case 5:
...@@ -942,8 +937,8 @@ schedule_ue_spec_default( ...@@ -942,8 +937,8 @@ schedule_ue_spec_default(
dl_dci->has_rb_shift = 1; dl_dci->has_rb_shift = 1;
dl_dci->rb_shift = 0; dl_dci->rb_shift = 0;
dl_dci->n_ndi = 1; dl_dci->n_ndi = 1;
dl_dci->ndi = 1;//(uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); dl_dci->ndi = 1;
dl_dci->ndi[0] = 1; dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];;
dl_dci->n_rv = 1; dl_dci->n_rv = 1;
dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv);
dl_dci->rv[0] = round&3; dl_dci->rv[0] = round&3;
...@@ -952,14 +947,12 @@ schedule_ue_spec_default( ...@@ -952,14 +947,12 @@ schedule_ue_spec_default(
dl_dci->n_mcs = 1; dl_dci->n_mcs = 1;
dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs);
dl_dci->mcs[0] = mcs; dl_dci->mcs[0] = mcs;
dl_dci->n_tbs_size = 1;
dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size);
dl_dci->tbs_size[0] = dci_tbs;
if (frame_parms[CC_id]->frame_type == TDD) { if (frame_parms[CC_id]->frame_type == TDD) {
dl_dci->has_dai = 1; dl_dci->has_dai = 1;
dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3;
LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n",
mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1));
} else {
LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n",
mod_id, CC_id, harq_pid, round);
} }
if(ue_sched_ctl->dl_pow_off[CC_id] == 2) { if(ue_sched_ctl->dl_pow_off[CC_id] == 2) {
...@@ -985,7 +978,7 @@ schedule_ue_spec_default( ...@@ -985,7 +978,7 @@ schedule_ue_spec_default(
dl_dci->rb_shift = 0; dl_dci->rb_shift = 0;
dl_dci->n_ndi = 1; dl_dci->n_ndi = 1;
dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi);
dl_dci->ndi[0] = 1; dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];;
dl_dci->n_rv = 1; dl_dci->n_rv = 1;
dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv);
dl_dci->rv[0] = round&3; dl_dci->rv[0] = round&3;
...@@ -997,11 +990,6 @@ schedule_ue_spec_default( ...@@ -997,11 +990,6 @@ schedule_ue_spec_default(
if (frame_parms[CC_id]->frame_type == TDD) { if (frame_parms[CC_id]->frame_type == TDD) {
dl_dci->has_dai = 1; dl_dci->has_dai = 1;
dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3;
LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n",
mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1));
} else {
LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n",
mod_id, CC_id, harq_pid, round);
} }
dl_dci->has_dl_power_offset = 1; dl_dci->has_dl_power_offset = 1;
...@@ -1011,14 +999,14 @@ schedule_ue_spec_default( ...@@ -1011,14 +999,14 @@ schedule_ue_spec_default(
break; break;
} }
// Toggle NDI for next time // Toggle NDI for next time
//LOG_D(MAC,"CC_id %d Frame %d, subframeP %d: Toggling Format1 NDI for UE %d (rnti %x/%d) oldNDI %d\n", LOG_D(MAC,"CC_id %d Frame %d, subframeP %d: Toggling Format1 NDI for UE %d (rnti %x/%d) oldNDI %d\n",
// CC_id, frame, subframe, UE_id, CC_id, frame, subframe, UE_id,
// UE_list->UE_template[CC_id][UE_id].rnti,harq_pid, UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]); UE_list->UE_template[CC_id][UE_id].rnti,harq_pid, UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]);
//UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]=1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]=1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];
// Increase the pointer for the number of scheduled UEs // Increase the pointer for the number of scheduled UEs
num_ues_added++; num_ues_added++;
} else { // There is no data from RLC or MAC header, so don't schedule } else { // There is no data from RLC or MAC header, so don't schedule
} }
} }
...@@ -1047,7 +1035,6 @@ void apply_scheduling_decisions(mid_t mod_id, ...@@ -1047,7 +1035,6 @@ void apply_scheduling_decisions(mid_t mod_id,
uint8_t CC_id; uint8_t CC_id;
int UE_id; int UE_id;
uint16_t nCCE[MAX_NUM_CCs];
int N_RBG[MAX_NUM_CCs]; int N_RBG[MAX_NUM_CCs];
unsigned char aggregation; unsigned char aggregation;
mac_rlc_status_resp_t rlc_status; mac_rlc_status_resp_t rlc_status;
...@@ -1097,7 +1084,7 @@ void apply_scheduling_decisions(mid_t mod_id, ...@@ -1097,7 +1084,7 @@ void apply_scheduling_decisions(mid_t mod_id,
UE_id = find_ue(rnti, PHY_vars_eNB_g[mod_id][CC_id]); UE_id = find_ue(rnti, PHY_vars_eNB_g[mod_id][CC_id]);
//NOTICE: Maybe later will not be required, once scheduler fully restructured //NOTICE: Maybe later will not be required, once scheduler fully restructured
eNB_dlsch_info[mod_id][CC_id][UE_id].status = S_DL_WAITING; //eNB_dlsch_info[mod_id][CC_id][UE_id].status = S_DL_WAITING;
ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti);
...@@ -1275,6 +1262,7 @@ void apply_scheduling_decisions(mid_t mod_id, ...@@ -1275,6 +1262,7 @@ void apply_scheduling_decisions(mid_t mod_id,
ta_len = 0; ta_len = 0;
} }
} }
n_lc = dl_data->n_rlc_pdu; n_lc = dl_data->n_rlc_pdu;
num_sdus = 0; num_sdus = 0;
...@@ -1282,7 +1270,7 @@ void apply_scheduling_decisions(mid_t mod_id, ...@@ -1282,7 +1270,7 @@ void apply_scheduling_decisions(mid_t mod_id,
for (i = 0; i < n_lc; i++) { for (i = 0; i < n_lc; i++) {
lcid = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->logical_channel_id; lcid = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->logical_channel_id;
rlc_size = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->size; rlc_size = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->size;
LOG_D(MAC,"[TEST]Have to check %d channels\n", n_lc);
if (rlc_size > 0) { if (rlc_size > 0) {
rlc_status = mac_rlc_status_ind( rlc_status = mac_rlc_status_ind(
mod_id, mod_id,
...@@ -1294,11 +1282,13 @@ void apply_scheduling_decisions(mid_t mod_id, ...@@ -1294,11 +1282,13 @@ void apply_scheduling_decisions(mid_t mod_id,
lcid, lcid,
rlc_size); // transport block set size rlc_size); // transport block set size
sdu_lengths[i]=0; sdu_lengths[i] = 0;
LOG_D(MAC,"[eNB %d] Frame %d, LCID %d, CC_id %d, Requesting %d bytes from RLC (RRC message)\n", LOG_D(MAC,"[eNB %d] Frame %d, LCID %d, CC_id %d, Requesting %d bytes from RLC (RRC message)\n",
mod_id, frame, lcid, CC_id, rlc_size); mod_id, frame, lcid, CC_id, rlc_size);
LOG_D(MAC, "[TEST] Have %d bytes in buffer DCCH during second call\n", rlc_status.bytes_in_buffer);
sdu_lengths[i] += mac_rlc_data_req( sdu_lengths[i] += mac_rlc_data_req(
mod_id, mod_id,
rnti, rnti,
...@@ -1309,6 +1299,8 @@ void apply_scheduling_decisions(mid_t mod_id, ...@@ -1309,6 +1299,8 @@ void apply_scheduling_decisions(mid_t mod_id,
lcid, lcid,
(char *)&dlsch_buffer[sdu_lengths[i]]); (char *)&dlsch_buffer[sdu_lengths[i]]);
LOG_D(MAC, "[TEST] This is what I actuallty got %d\n", sdu_lengths[i]);
LOG_D(MAC,"[eNB %d][DCCH] CC_id %d Got %d bytes from RLC\n",mod_id, CC_id, sdu_lengths[i]); LOG_D(MAC,"[eNB %d][DCCH] CC_id %d Got %d bytes from RLC\n",mod_id, CC_id, sdu_lengths[i]);
sdu_length_total += sdu_lengths[i]; sdu_length_total += sdu_lengths[i];
sdu_lcids[i] = lcid; sdu_lcids[i] = lcid;
...@@ -1331,72 +1323,58 @@ void apply_scheduling_decisions(mid_t mod_id, ...@@ -1331,72 +1323,58 @@ void apply_scheduling_decisions(mid_t mod_id,
} // SDU creation end } // SDU creation end
if (header_len_dtch==0) { if (((sdu_length_total + header_len_dcch + header_len_dtch) > 0)) {
header_len_dcch = (header_len_dcch >0) ? 1 : header_len_dcch; // remove length field
} else {
header_len_dtch = (header_len_dtch > 0) ? 1 :header_len_dtch; // remove length field for the last SDU
}
// there is a payload header_len_dcch_tmp = header_len_dcch;
if (((sdu_length_total + header_len_dcch + header_len_dtch ) > 0)) { header_len_dtch_tmp = header_len_dtch;
if ((TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) <= 2) {
padding = (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len); if (header_len_dtch==0) {
post_padding = 0; header_len_dcch = (header_len_dcch >0) ? 1 : header_len_dcch; // remove length field
} else { } else {
padding = 0; header_len_dtch = (header_len_dtch > 0) ? 1 :header_len_dtch; // remove length field for the last SDU
}
// adjust the header len
if (header_len_dtch==0) { // there is a payload
header_len_dcch = header_len_dcch_tmp; LOG_D(MAC, "[TEST] This is the padding %d\n", TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len);
} else { //if (( header_len_dcch==0)&&((header_len_dtch==1)||(header_len_dtch==2))) if (((sdu_length_total + header_len_dcch + header_len_dtch ) > 0)) {
header_len_dtch = header_len_dtch_tmp; if ((TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) <= 2) {
} padding = (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len);
post_padding = 0;
} else {
padding = 0;
post_padding = TBS - sdu_length_total - header_len_dcch - header_len_dtch - ta_len ; // 1 is for the postpadding header // adjust the header len
} if (header_len_dtch==0) {
} header_len_dcch = header_len_dcch_tmp;
} else { //if (( header_len_dcch==0)&&((header_len_dtch==1)||(header_len_dtch==2)))
uint8_t update_TA=4; header_len_dtch = header_len_dtch_tmp;
}
switch (frame_parms[CC_id]->N_RB_DL) {
case 6: post_padding = TBS - sdu_length_total - header_len_dcch - header_len_dtch - ta_len ; // 1 is for the postpadding header
update_TA = 1; }
break; }
case 25: LOG_D(MAC, "[TEST] This is the current SDU length %d and this is the TBS %d\n", sdu_length_total, TBS);
update_TA = 4;
break;
if (ta_len > 0) {
case 50: ta_update = ue_sched_ctl->ta_update;
update_TA = 8; } else {
break; ta_update = 0;
}
case 100:
update_TA = 16; offset = generate_dlsch_header((unsigned char*)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0],
break; // offset = generate_dlsch_header((unsigned char*)eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0],
} num_sdus, //num_sdus
sdu_lengths, //
if (ta_len > 0) { sdu_lcids,
ta_update = eNB_UE_stats->timing_advance_update/update_TA; 255, // no drx
} else { ta_update, // timing advance
ta_update = 0; NULL, // contention res id
} padding,
/*#else post_padding);
ta_update = 0;
#endif*/
offset = generate_dlsch_header((unsigned char*)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0],
// offset = generate_dlsch_header((unsigned char*)eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0],
num_sdus, //num_sdus
sdu_lengths, //
sdu_lcids,
255, // no drx
ta_update, // timing advance
NULL, // contention res id
padding,
post_padding);
#ifdef DEBUG_eNB_SCHEDULER #ifdef DEBUG_eNB_SCHEDULER
LOG_T(MAC,"[eNB %d] First 16 bytes of DLSCH : \n"); LOG_T(MAC,"[eNB %d] First 16 bytes of DLSCH : \n");
...@@ -1428,9 +1406,13 @@ void apply_scheduling_decisions(mid_t mod_id, ...@@ -1428,9 +1406,13 @@ void apply_scheduling_decisions(mid_t mod_id,
eNB->eNB_stats[CC_id].dlsch_bytes_tx+=sdu_length_total; eNB->eNB_stats[CC_id].dlsch_bytes_tx+=sdu_length_total;
eNB->eNB_stats[CC_id].dlsch_pdus_tx+=1; eNB->eNB_stats[CC_id].dlsch_pdus_tx+=1;
UE_list->eNB_UE_stats[CC_id][UE_id].crnti= rnti;
UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status=mac_eNB_get_rrc_status(mod_id, rnti);
UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid;
UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round;
UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb; UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb;
UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb; UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb;
UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used = nCCE[CC_id];
UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=dl_dci->mcs[0]; UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=dl_dci->mcs[0];
UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=dl_dci->mcs[0]; UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=dl_dci->mcs[0];
UE_list->eNB_UE_stats[CC_id][UE_id].TBS = TBS; UE_list->eNB_UE_stats[CC_id][UE_id].TBS = TBS;
...@@ -1441,6 +1423,10 @@ void apply_scheduling_decisions(mid_t mod_id, ...@@ -1441,6 +1423,10 @@ void apply_scheduling_decisions(mid_t mod_id,
UE_list->eNB_UE_stats[CC_id][UE_id].total_num_pdus+=1; UE_list->eNB_UE_stats[CC_id][UE_id].total_num_pdus+=1;
// TODO // TODO
}
} else { } else {
// No need to create anything apart of DCI in case of retransmission // No need to create anything apart of DCI in case of retransmission
......
...@@ -59,12 +59,18 @@ ...@@ -59,12 +59,18 @@
//#include "LAYER2/MAC/pre_processor.c" //#include "LAYER2/MAC/pre_processor.c"
#include "pdcp.h" #include "pdcp.h"
//Agent-related headers
#include "ENB_APP/enb_agent_extern.h"
#include "ENB_APP/enb_agent_mac.h"
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
# include "intertask_interface.h" # include "intertask_interface.h"
#endif #endif
#define ENABLE_MAC_PAYLOAD_DEBUG #define ENABLE_MAC_PAYLOAD_DEBUG
#define DEBUG_eNB_SCHEDULER 1 #define DEBUG_eNB_SCHEDULER 1
//#define ENABLE_ENB_AGENT_DL_SCHEDULER
//#define DEBUG_HEADER_PARSING 1 //#define DEBUG_HEADER_PARSING 1
//#define DEBUG_PACKET_TRACE 1 //#define DEBUG_PACKET_TRACE 1
...@@ -99,6 +105,8 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, ...@@ -99,6 +105,8 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
UE_list_t *UE_list=&eNB_mac_inst[module_idP].UE_list; UE_list_t *UE_list=&eNB_mac_inst[module_idP].UE_list;
rnti_t rnti; rnti_t rnti;
Protocol__ProgranMessage *msg;
LOG_D(MAC,"[eNB %d] Frame %d, Subframe %d, entering MAC scheduler (UE_list->head %d)\n",module_idP, frameP, subframeP,UE_list->head); LOG_D(MAC,"[eNB %d] Frame %d, Subframe %d, entering MAC scheduler (UE_list->head %d)\n",module_idP, frameP, subframeP,UE_list->head);
start_meas(&eNB_mac_inst[module_idP].eNB_scheduler); start_meas(&eNB_mac_inst[module_idP].eNB_scheduler);
...@@ -252,10 +260,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, ...@@ -252,10 +260,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
(mac_xface->lte_frame_parms->tdd_config == 6)) { (mac_xface->lte_frame_parms->tdd_config == 6)) {
//schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,4);//,calibration_flag); //schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,4);//,calibration_flag);
} }
#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER
schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status);
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
enb_agent_mac_create_empty_dl_config(module_idP, &msg);
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
apply_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
}
#endif
break; break;
case 1: case 1:
...@@ -267,12 +292,16 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, ...@@ -267,12 +292,16 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
case 0: case 0:
case 1: case 1:
schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,7); schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,7);
#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#endif
break; break;
case 6: case 6:
schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,8); schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,8);
#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#endif
break; break;
default: default:
...@@ -280,8 +309,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, ...@@ -280,8 +309,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
} }
} else { //FDD } else { //FDD
schedule_ulsch(module_idP,frameP,cooperation_flag,1,5); schedule_ulsch(module_idP,frameP,cooperation_flag,1,5);
#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER
schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status);
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
enb_agent_mac_create_empty_dl_config(module_idP, &msg);
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
apply_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
}
#endif
} }
break; break;
...@@ -292,8 +340,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, ...@@ -292,8 +340,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
// FDD, normal UL/DLSCH // FDD, normal UL/DLSCH
if (mac_xface->lte_frame_parms->frame_type == FDD) { //FDD if (mac_xface->lte_frame_parms->frame_type == FDD) { //FDD
schedule_ulsch(module_idP,frameP,cooperation_flag,2,6); schedule_ulsch(module_idP,frameP,cooperation_flag,2,6);
#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER
schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status);
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
enb_agent_mac_create_empty_dl_config(module_idP, &msg);
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
apply_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
}
#endif
} }
break; break;
...@@ -310,8 +377,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, ...@@ -310,8 +377,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
// no break here! // no break here!
case 5: case 5:
#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER
schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status);
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
enb_agent_mac_create_empty_dl_config(module_idP, &msg);
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
apply_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
}
#endif
break; break;
default: default:
...@@ -320,8 +406,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, ...@@ -320,8 +406,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
} else { //FDD } else { //FDD
schedule_ulsch(module_idP,frameP,cooperation_flag,3,7); schedule_ulsch(module_idP,frameP,cooperation_flag,3,7);
#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER
schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status);
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
enb_agent_mac_create_empty_dl_config(module_idP, &msg);
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
apply_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
}
#endif
} }
break; break;
...@@ -345,9 +450,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, ...@@ -345,9 +450,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
// no break here! // no break here!
case 5: case 5:
#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER
schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status);
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
enb_agent_mac_create_empty_dl_config(module_idP, &msg);
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
apply_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
}
#endif
break; break;
default: default:
...@@ -358,8 +481,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, ...@@ -358,8 +481,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
// schedule_RA(module_idP,frameP, subframeP, 0); // schedule_RA(module_idP,frameP, subframeP, 0);
schedule_ulsch(module_idP, frameP, cooperation_flag, 4, 8); schedule_ulsch(module_idP, frameP, cooperation_flag, 4, 8);
#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER
schedule_ue_spec(module_idP, frameP, subframeP, mbsfn_status); schedule_ue_spec(module_idP, frameP, subframeP, mbsfn_status);
fill_DLSCH_dci(module_idP, frameP, subframeP, mbsfn_status); fill_DLSCH_dci(module_idP, frameP, subframeP, mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
enb_agent_mac_create_empty_dl_config(module_idP, &msg);
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
apply_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
}
#endif
} }
} }
...@@ -376,15 +518,55 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, ...@@ -376,15 +518,55 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
if (mac_xface->lte_frame_parms->frame_type == FDD) { if (mac_xface->lte_frame_parms->frame_type == FDD) {
schedule_RA(module_idP,frameP,subframeP,1); schedule_RA(module_idP,frameP,subframeP,1);
schedule_ulsch(module_idP,frameP,cooperation_flag,5,9); schedule_ulsch(module_idP,frameP,cooperation_flag,5,9);
#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER
schedule_ue_spec(module_idP, frameP, subframeP, mbsfn_status); schedule_ue_spec(module_idP, frameP, subframeP, mbsfn_status);
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
enb_agent_mac_create_empty_dl_config(module_idP, &msg);
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
apply_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
}
#endif
} else if ((mac_xface->lte_frame_parms->tdd_config == 0) || // TDD Config 0 } else if ((mac_xface->lte_frame_parms->tdd_config == 0) || // TDD Config 0
(mac_xface->lte_frame_parms->tdd_config == 6)) { // TDD Config 6 (mac_xface->lte_frame_parms->tdd_config == 6)) { // TDD Config 6
//schedule_ulsch(module_idP,cooperation_flag,subframeP); //schedule_ulsch(module_idP,cooperation_flag,subframeP);
#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#endif
} else { } else {
#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER
schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status);
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
enb_agent_mac_create_empty_dl_config(module_idP, &msg);
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
apply_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
}
#endif
} }
break; break;
...@@ -402,25 +584,67 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, ...@@ -402,25 +584,67 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
case 1: case 1:
schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,2); schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,2);
// schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); // schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status);
#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#endif
break; break;
case 6: case 6:
schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,3); schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,3);
// schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); // schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status);
#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#endif
break; break;
case 5: case 5:
schedule_RA(module_idP,frameP,subframeP,2); schedule_RA(module_idP,frameP,subframeP,2);
#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER
schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status);
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
enb_agent_mac_create_empty_dl_config(module_idP, &msg);
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
apply_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
}
#endif
break; break;
case 3: case 3:
case 4: case 4:
#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER
schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status);
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
enb_agent_mac_create_empty_dl_config(module_idP, &msg);
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
apply_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
}
#endif
break; break;
default: default:
...@@ -428,8 +652,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, ...@@ -428,8 +652,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
} }
} else { //FDD } else { //FDD
// schedule_ulsch(module_idP,frameP,cooperation_flag,6,0); // schedule_ulsch(module_idP,frameP,cooperation_flag,6,0);
#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER
schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status);
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
enb_agent_mac_create_empty_dl_config(module_idP, &msg);
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
apply_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
}
#endif
} }
break; break;
...@@ -443,13 +686,51 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, ...@@ -443,13 +686,51 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
case 3: case 3:
case 4: case 4:
schedule_RA(module_idP,frameP,subframeP,3); // 3 = Msg3 subframeP, not schedule_RA(module_idP,frameP,subframeP,3); // 3 = Msg3 subframeP, not
#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER
schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status);
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
enb_agent_mac_create_empty_dl_config(module_idP, &msg);
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
apply_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
}
#endif
break; break;
case 5: case 5:
#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER
schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status);
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
enb_agent_mac_create_empty_dl_config(module_idP, &msg);
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
apply_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
}
#endif
break; break;
default: default:
...@@ -457,8 +738,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, ...@@ -457,8 +738,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
} }
} else { //FDD } else { //FDD
//schedule_ulsch(module_idP,frameP,cooperation_flag,7,1); //schedule_ulsch(module_idP,frameP,cooperation_flag,7,1);
#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER
schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status);
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
enb_agent_mac_create_empty_dl_config(module_idP, &msg);
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
apply_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
}
#endif
} }
break; break;
...@@ -477,8 +777,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, ...@@ -477,8 +777,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
// schedule_RA(module_idP,subframeP); // schedule_RA(module_idP,subframeP);
schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,2); schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,2);
#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER
schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status);
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
enb_agent_mac_create_empty_dl_config(module_idP, &msg);
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
apply_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
}
#endif
break; break;
default: default:
...@@ -486,8 +805,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, ...@@ -486,8 +805,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
} }
} else { //FDD } else { //FDD
//schedule_ulsch(module_idP,frameP,cooperation_flag,8,2); //schedule_ulsch(module_idP,frameP,cooperation_flag,8,2);
#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER
schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status);
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
enb_agent_mac_create_empty_dl_config(module_idP, &msg);
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
apply_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
}
#endif
} }
break; break;
...@@ -500,29 +838,105 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, ...@@ -500,29 +838,105 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
case 1: case 1:
schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,3); schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,3);
schedule_RA(module_idP,frameP,subframeP,7); // 7 = Msg3 subframeP, not schedule_RA(module_idP,frameP,subframeP,7); // 7 = Msg3 subframeP, not
#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER
schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status);
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
enb_agent_mac_create_empty_dl_config(module_idP, &msg);
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
apply_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
}
#endif
break; break;
case 3: case 3:
case 4: case 4:
schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,3); schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,3);
#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER
schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status);
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
enb_agent_mac_create_empty_dl_config(module_idP, &msg);
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
apply_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
}
#endif
break; break;
case 6: case 6:
schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,4); schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,4);
//schedule_RA(module_idP,frameP,subframeP); //schedule_RA(module_idP,frameP,subframeP);
#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER
schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status);
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
enb_agent_mac_create_empty_dl_config(module_idP, &msg);
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
apply_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
}
#endif
break; break;
case 2: case 2:
case 5: case 5:
//schedule_RA(module_idP,frameP,subframeP); //schedule_RA(module_idP,frameP,subframeP);
#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER
schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status);
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
enb_agent_mac_create_empty_dl_config(module_idP, &msg);
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
apply_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
}
#endif
break; break;
default: default:
...@@ -530,8 +944,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, ...@@ -530,8 +944,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
} }
} else { //FDD } else { //FDD
// schedule_ulsch(module_idP,frameP,cooperation_flag,9,3); // schedule_ulsch(module_idP,frameP,cooperation_flag,9,3);
#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER
schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status);
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
enb_agent_mac_create_empty_dl_config(module_idP, &msg);
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
apply_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
}
#endif
} }
break; break;
......
...@@ -135,7 +135,6 @@ void schedule_ue_spec(module_id_t module_idP,frame_t frameP,sub_frame_t subframe ...@@ -135,7 +135,6 @@ void schedule_ue_spec(module_id_t module_idP,frame_t frameP,sub_frame_t subframe
//To be used by the agent //To be used by the agent
void schedule_ue_spec_default(mid_t mod_id, uint32_t frame, uint32_t subframe, void schedule_ue_spec_default(mid_t mod_id, uint32_t frame, uint32_t subframe,
unsigned int *nb_rb_used, unsigned int *nCCE_used,
int *mbsfn_flag, Protocol__ProgranMessage *dl_info); int *mbsfn_flag, Protocol__ProgranMessage *dl_info);
/** \brief Function for UE/PHY to compute PUSCH transmit power in power-control procedure. /** \brief Function for UE/PHY to compute PUSCH transmit power in power-control procedure.
......
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