Commit 238c83f4 authored by Raphael Defosseux's avatar Raphael Defosseux

Merge remote-tracking branch 'origin/feature-4g-sched' into develop

parents 69869810 0e4ff0ec
......@@ -110,13 +110,13 @@ void measurcmd_display_pdcpcpu(telnet_printfunc_t prnt) {
void measurcmd_display_macstats_ue(telnet_printfunc_t prnt) {
UE_list_t *UE_list = &(RC.mac[eNB_id]->UE_list);
UE_info_t *UE_info = &(RC.mac[eNB_id]->UE_info);
for (int UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) {
for (int i=0; i<UE_list->numactiveCCs[UE_id]; i++) {
int CC_id = UE_list->ordered_CCids[i][UE_id];
for (int UE_id=UE_info->list.head; UE_id>=0; UE_id=UE_info->list.next[UE_id]) {
for (int i=0; i<UE_info->numactiveCCs[UE_id]; i++) {
int CC_id = UE_info->ordered_CCids[i][UE_id];
prnt("%s UE %i Id %i CCid %i %s\n",HDR,i,UE_id,CC_id,HDR);
eNB_UE_STATS *macuestatptr = &(UE_list->eNB_UE_stats[CC_id][UE_id]);
eNB_UE_STATS *macuestatptr = &(UE_info->eNB_UE_stats[CC_id][UE_id]);
telnet_ltemeasurdef_t statsptr[]=LTEMAC_UEMEASURE;
measurcmd_display_measures(prnt, statsptr, sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t));
}
......@@ -155,7 +155,7 @@ void measurcmd_display_one_rlcstat(telnet_printfunc_t prnt, int UE_id, telnet_lt
void measurcmd_display_rlcstats(telnet_printfunc_t prnt) {
protocol_ctxt_t ctxt;
UE_list_t *UE_list = &(RC.mac[eNB_id]->UE_list);
UE_info_t *UE_info = &(RC.mac[eNB_id]->UE_info);
telnet_ltemeasurdef_t statsptr[]=LTE_RLCMEASURE;
int num_rlcmeasure = sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t );
unsigned int *rlcstats = malloc(num_rlcmeasure*sizeof(unsigned int));
......@@ -165,9 +165,9 @@ void measurcmd_display_rlcstats(telnet_printfunc_t prnt) {
statsptr[i].vptr = rlcstats + i;
}
for (int UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) {
for (int UE_id=UE_info->list.head; UE_id>=0; UE_id=UE_info->list.next[UE_id]) {
#define NB_eNB_INST 1
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt,eNB_id, ENB_FLAG_YES,UE_list->eNB_UE_stats[0][UE_id].crnti,
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt,eNB_id, ENB_FLAG_YES,UE_info->eNB_UE_stats[0][UE_id].crnti,
eNB->frame,eNB->subframe,eNB_id);
measurcmd_display_one_rlcstat(prnt, UE_id, statsptr, num_rlcmeasure, rlcstats, "DCCH", &ctxt, SRB_FLAG_YES, DCCH);
measurcmd_display_one_rlcstat(prnt, UE_id, statsptr, num_rlcmeasure, rlcstats, "DTCH", &ctxt, SRB_FLAG_NO, DTCH-2);
......
......@@ -597,7 +597,6 @@ void handle_uci_sr_pdu(PHY_VARS_eNB *eNB,
uci->subframe = subframe;
uci->rnti = ul_config_pdu->uci_sr_pdu.ue_information.ue_information_rel8.rnti;
uci->ue_id = find_ulsch(ul_config_pdu->uci_sr_pdu.ue_information.ue_information_rel8.rnti,eNB,SEARCH_EXIST_OR_FREE);
AssertFatal(uci->ue_id < MAX_MOBILES_PER_ENB, "illegal UE_id %d\n", uci->ue_id);
uci->type = SR;
uci->pucch_fmt = pucch_format1;
uci->num_antenna_ports = 1;
......@@ -624,7 +623,6 @@ void handle_uci_sr_harq_pdu(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_request_
uci->subframe = subframe;
uci->rnti = ul_config_pdu->uci_sr_harq_pdu.ue_information.ue_information_rel8.rnti;
uci->ue_id = find_ulsch(ul_config_pdu->uci_sr_harq_pdu.ue_information.ue_information_rel8.rnti,eNB,SEARCH_EXIST_OR_FREE);
AssertFatal(uci->ue_id < MAX_MOBILES_PER_ENB, "illegal UE_id %d\n", uci->ue_id);
uci->type = HARQ_SR;
uci->num_antenna_ports = 1;
uci->num_pucch_resources = 1;
......@@ -647,7 +645,6 @@ void handle_uci_harq_pdu(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_request_pdu
uci->subframe = subframe;
uci->rnti = ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.rnti;
uci->ue_id = find_ulsch(ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.rnti,eNB,SEARCH_EXIST_OR_FREE);
AssertFatal(uci->ue_id < MAX_MOBILES_PER_ENB, "illegal UE_id %d\n", uci->ue_id);
uci->type = HARQ;
uci->srs_active = srs_active;
uci->num_antenna_ports = ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel11.num_ant_ports;
......
......@@ -59,6 +59,15 @@ int next_ue_list_looped(UE_list_t* list, int UE_id) {
return list->next[UE_id] < 0 ? list->head : list->next[UE_id];
}
int get_rbg_size_last(module_id_t Mod_id, int CC_id) {
const int RBGsize = get_min_rb_unit(Mod_id, CC_id);
const int N_RB_DL = to_prb(RC.mac[Mod_id]->common_channels[CC_id].mib->message.dl_Bandwidth);
if (N_RB_DL == 15 || N_RB_DL == 25 || N_RB_DL == 50 || N_RB_DL == 75)
return RBGsize - 1;
else
return RBGsize;
}
int g_start_ue_dl = -1;
int round_robin_dl(module_id_t Mod_id,
int CC_id,
......@@ -70,7 +79,9 @@ int round_robin_dl(module_id_t Mod_id,
uint8_t *rbgalloc_mask) {
DevAssert(UE_list->head >= 0);
DevAssert(n_rbg_sched > 0);
const int N_RBG = to_rbg(RC.mac[Mod_id]->common_channels[CC_id].mib->message.dl_Bandwidth);
const int RBGsize = get_min_rb_unit(Mod_id, CC_id);
const int RBGlastsize = get_rbg_size_last(Mod_id, CC_id);
int num_ue_req = 0;
UE_info_t *UE_info = &RC.mac[Mod_id]->UE_info;
......@@ -89,14 +100,26 @@ int round_robin_dl(module_id_t Mod_id,
UE_sched_ctrl_t *ue_ctrl = &UE_info->UE_sched_ctrl[UE_id];
const uint8_t round = ue_ctrl->round[CC_id][harq_pid];
if (round != 8) { // retransmission: allocate
int nb_rb = UE_info->UE_template[CC_id][UE_id].nb_rb[harq_pid];
const int nb_rb = UE_info->UE_template[CC_id][UE_id].nb_rb[harq_pid];
if (nb_rb == 0)
continue;
if (nb_rb % RBGsize != 0)
nb_rb += nb_rb % RBGsize; // should now divide evenly
int nb_rbg = nb_rb / RBGsize;
if (nb_rbg > n_rbg_sched) // needs more RBGs than we can allocate
int nb_rbg = (nb_rb + (nb_rb % RBGsize)) / RBGsize;
// needs more RBGs than we can allocate
if (nb_rbg > n_rbg_sched) {
LOG_D(MAC,
"retransmission of UE %d needs more RBGs (%d) than we have (%d)\n",
UE_id, nb_rbg, n_rbg_sched);
continue;
}
// ensure that the number of RBs can be contained by the RBGs (!), i.e.
// if we allocate the last RBG this one should have the full RBGsize
if ((nb_rb % RBGsize) == 0 && nb_rbg == n_rbg_sched
&& rbgalloc_mask[N_RBG - 1] && RBGlastsize != RBGsize) {
LOG_D(MAC,
"retransmission of UE %d needs %d RBs, but the last RBG %d is too small (%d, normal %d)\n",
UE_id, nb_rb, N_RBG - 1, RBGlastsize, RBGsize);
continue;
}
const uint8_t cqi = ue_ctrl->dl_cqi[CC_id];
const int idx = CCE_try_allocate_dlsch(Mod_id, CC_id, subframe, UE_id, cqi);
if (idx < 0)
......@@ -186,9 +209,10 @@ int round_robin_dl(module_id_t Mod_id,
continue;
UE_sched_ctrl_t *ue_ctrl = &UE_info->UE_sched_ctrl[UE_id];
ue_ctrl->rballoc_sub_UE[CC_id][rbg] = 1;
ue_ctrl->pre_nb_available_rbs[CC_id] += RBGsize;
rb_required[UE_id] -= RBGsize;
rb_required_total -= RBGsize;
const int sRBG = rbg == N_RBG - 1 ? RBGlastsize : RBGsize;
ue_ctrl->pre_nb_available_rbs[CC_id] += sRBG;
rb_required[UE_id] -= sRBG;
rb_required_total -= sRBG;
if (rb_required_total <= 0)
break;
n_rbg_sched--;
......
This diff is collapsed.
......@@ -93,13 +93,23 @@ void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id,
nfapi_ul_config_request_pdu_t *ul_config_pdu,
uint16_t frame,uint8_t subframe,uint8_t srs_present, int index);
//int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req, nfapi_tx_request_pdu_t* tx_request_pdu_list);
int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req, module_id_t Mod_id);
void dl_config_req_UE_MAC_dci(int sfn,
int sf,
nfapi_dl_config_request_pdu_t *dci,
nfapi_dl_config_request_pdu_t *dlsch,
int num_ue);
void dl_config_req_UE_MAC_bch(int sfn,
int sf,
nfapi_dl_config_request_pdu_t *bch,
int num_ue);
int tx_req_UE_MAC(nfapi_tx_request_t* req);
int hi_dci0_req_UE_MAC(nfapi_hi_dci0_request_t* req, module_id_t Mod_id);
void hi_dci0_req_UE_MAC(int sfn,
int sf,
nfapi_hi_dci0_request_pdu_t* bch,
int num_ue);
// The following set of memcpy functions should be getting called as callback functions from
// pnf_p7_subframe_ind.
......
......@@ -1108,6 +1108,45 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
}
}
if (dl_config_req && tx_request_pdu_list) {
nfapi_dl_config_request_body_t* dl_config_req_body = &dl_config_req->dl_config_request_body;
for (int i = 0; i < dl_config_req_body->number_pdu; ++i) {
nfapi_dl_config_request_pdu_t* pdu = &dl_config_req_body->dl_config_pdu_list[i];
if (pdu->pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE) {
i += 1;
AssertFatal(i < dl_config_req->dl_config_request_body.number_pdu,
"Need PDU following DCI at index %d, but not found\n",
i);
nfapi_dl_config_request_pdu_t *dlsch = &dl_config_req_body->dl_config_pdu_list[i];
if (dlsch->pdu_type != NFAPI_DL_CONFIG_DLSCH_PDU_TYPE) {
LOG_E(MAC, "expected DLSCH PDU at index %d\n", i);
continue;
}
dl_config_req_UE_MAC_dci(NFAPI_SFNSF2SFN(dl_config_req->sfn_sf),
NFAPI_SFNSF2SF(dl_config_req->sfn_sf),
pdu,
dlsch,
ue_num);
} else if (pdu->pdu_type == NFAPI_DL_CONFIG_BCH_PDU_TYPE) {
dl_config_req_UE_MAC_bch(NFAPI_SFNSF2SFN(dl_config_req->sfn_sf),
NFAPI_SFNSF2SF(dl_config_req->sfn_sf),
pdu,
ue_num);
}
}
}
if (hi_dci0_req) {
nfapi_hi_dci0_request_body_t *hi_dci0_body = &hi_dci0_req->hi_dci0_request_body;
for (int i = 0; i < hi_dci0_body->number_of_dci + hi_dci0_body->number_of_hi; i++) {
nfapi_hi_dci0_request_pdu_t* pdu = &hi_dci0_body->hi_dci0_pdu_list[i];
hi_dci0_req_UE_MAC(NFAPI_SFNSF2SFN(hi_dci0_req->sfn_sf),
NFAPI_SFNSF2SF(hi_dci0_req->sfn_sf),
pdu,
ue_num);
}
}
//for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++) {
for (ue_index=0; ue_index < ue_num; ue_index++) {
ue_Mod_id = ue_thread_id + NB_THREAD_INST*ue_index;
......@@ -1136,15 +1175,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
phy_procedures_UE_SL_RX(UE,proc);
if (dl_config_req!=NULL && tx_request_pdu_list!=NULL) {
//if(dl_config_req!= NULL) {
dl_config_req_UE_MAC(dl_config_req, ue_Mod_id);
}
if (hi_dci0_req!=NULL && hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list!=NULL) {
hi_dci0_req_UE_MAC(hi_dci0_req, ue_Mod_id);
}
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF)
phy_procedures_UE_SL_TX(UE,proc);
}
......@@ -1183,7 +1213,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH && ue_Mod_id == next_Mod_id) {
next_ra_frame++;
if(next_ra_frame > 200) {
if(next_ra_frame > 500) {
// check if we have PRACH opportunity
if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1) {
// The one working strangely...
......@@ -1413,12 +1443,14 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg)
oai_subframe_ind(timer_frame, timer_subframe);
if(dl_config_req!= NULL) {
dl_config_req_UE_MAC(dl_config_req, Mod_id);
AssertFatal(0, "dl_config_req_UE_MAC() not handled\n");
//dl_config_req_UE_MAC(dl_config_req, Mod_id);
}
//if(UE_mac_inst[Mod_id].hi_dci0_req!= NULL){
if (hi_dci0_req!=NULL && hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list!=NULL) {
hi_dci0_req_UE_MAC(hi_dci0_req, Mod_id);
AssertFatal(0, "hi_dci0_req_UE_MAC() not handled\n");
//hi_dci0_req_UE_MAC(hi_dci0_req, Mod_id);
//if(UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list!=NULL){
free(hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list);
hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list = NULL;
......
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