Merge remote-tracking branch 'origin/feature-4g-sched' into develop
This commit is contained in:
@@ -110,13 +110,13 @@ void measurcmd_display_pdcpcpu(telnet_printfunc_t prnt) {
|
|||||||
|
|
||||||
|
|
||||||
void measurcmd_display_macstats_ue(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 UE_id=UE_info->list.head; UE_id>=0; UE_id=UE_info->list.next[UE_id]) {
|
||||||
for (int i=0; i<UE_list->numactiveCCs[UE_id]; i++) {
|
for (int i=0; i<UE_info->numactiveCCs[UE_id]; i++) {
|
||||||
int CC_id = UE_list->ordered_CCids[i][UE_id];
|
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);
|
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;
|
telnet_ltemeasurdef_t statsptr[]=LTEMAC_UEMEASURE;
|
||||||
measurcmd_display_measures(prnt, statsptr, sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t));
|
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) {
|
void measurcmd_display_rlcstats(telnet_printfunc_t prnt) {
|
||||||
protocol_ctxt_t ctxt;
|
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;
|
telnet_ltemeasurdef_t statsptr[]=LTE_RLCMEASURE;
|
||||||
int num_rlcmeasure = sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t );
|
int num_rlcmeasure = sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t );
|
||||||
unsigned int *rlcstats = malloc(num_rlcmeasure*sizeof(unsigned int));
|
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;
|
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
|
#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);
|
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, "DCCH", &ctxt, SRB_FLAG_YES, DCCH);
|
||||||
measurcmd_display_one_rlcstat(prnt, UE_id, statsptr, num_rlcmeasure, rlcstats, "DTCH", &ctxt, SRB_FLAG_NO, DTCH-2);
|
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->subframe = subframe;
|
||||||
uci->rnti = ul_config_pdu->uci_sr_pdu.ue_information.ue_information_rel8.rnti;
|
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);
|
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->type = SR;
|
||||||
uci->pucch_fmt = pucch_format1;
|
uci->pucch_fmt = pucch_format1;
|
||||||
uci->num_antenna_ports = 1;
|
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->subframe = subframe;
|
||||||
uci->rnti = ul_config_pdu->uci_sr_harq_pdu.ue_information.ue_information_rel8.rnti;
|
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);
|
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->type = HARQ_SR;
|
||||||
uci->num_antenna_ports = 1;
|
uci->num_antenna_ports = 1;
|
||||||
uci->num_pucch_resources = 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->subframe = subframe;
|
||||||
uci->rnti = ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.rnti;
|
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);
|
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->type = HARQ;
|
||||||
uci->srs_active = srs_active;
|
uci->srs_active = srs_active;
|
||||||
uci->num_antenna_ports = ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel11.num_ant_ports;
|
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];
|
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 g_start_ue_dl = -1;
|
||||||
int round_robin_dl(module_id_t Mod_id,
|
int round_robin_dl(module_id_t Mod_id,
|
||||||
int CC_id,
|
int CC_id,
|
||||||
@@ -70,7 +79,9 @@ int round_robin_dl(module_id_t Mod_id,
|
|||||||
uint8_t *rbgalloc_mask) {
|
uint8_t *rbgalloc_mask) {
|
||||||
DevAssert(UE_list->head >= 0);
|
DevAssert(UE_list->head >= 0);
|
||||||
DevAssert(n_rbg_sched > 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 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;
|
int num_ue_req = 0;
|
||||||
UE_info_t *UE_info = &RC.mac[Mod_id]->UE_info;
|
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];
|
UE_sched_ctrl_t *ue_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||||
const uint8_t round = ue_ctrl->round[CC_id][harq_pid];
|
const uint8_t round = ue_ctrl->round[CC_id][harq_pid];
|
||||||
if (round != 8) { // retransmission: allocate
|
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)
|
if (nb_rb == 0)
|
||||||
continue;
|
continue;
|
||||||
if (nb_rb % RBGsize != 0)
|
int nb_rbg = (nb_rb + (nb_rb % RBGsize)) / RBGsize;
|
||||||
nb_rb += nb_rb % RBGsize; // should now divide evenly
|
// needs more RBGs than we can allocate
|
||||||
int nb_rbg = nb_rb / RBGsize;
|
if (nb_rbg > n_rbg_sched) {
|
||||||
if (nb_rbg > n_rbg_sched) // needs more RBGs than we can allocate
|
LOG_D(MAC,
|
||||||
|
"retransmission of UE %d needs more RBGs (%d) than we have (%d)\n",
|
||||||
|
UE_id, nb_rbg, n_rbg_sched);
|
||||||
continue;
|
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 uint8_t cqi = ue_ctrl->dl_cqi[CC_id];
|
||||||
const int idx = CCE_try_allocate_dlsch(Mod_id, CC_id, subframe, UE_id, cqi);
|
const int idx = CCE_try_allocate_dlsch(Mod_id, CC_id, subframe, UE_id, cqi);
|
||||||
if (idx < 0)
|
if (idx < 0)
|
||||||
@@ -186,9 +209,10 @@ int round_robin_dl(module_id_t Mod_id,
|
|||||||
continue;
|
continue;
|
||||||
UE_sched_ctrl_t *ue_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
UE_sched_ctrl_t *ue_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||||
ue_ctrl->rballoc_sub_UE[CC_id][rbg] = 1;
|
ue_ctrl->rballoc_sub_UE[CC_id][rbg] = 1;
|
||||||
ue_ctrl->pre_nb_available_rbs[CC_id] += RBGsize;
|
const int sRBG = rbg == N_RBG - 1 ? RBGlastsize : RBGsize;
|
||||||
rb_required[UE_id] -= RBGsize;
|
ue_ctrl->pre_nb_available_rbs[CC_id] += sRBG;
|
||||||
rb_required_total -= RBGsize;
|
rb_required[UE_id] -= sRBG;
|
||||||
|
rb_required_total -= sRBG;
|
||||||
if (rb_required_total <= 0)
|
if (rb_required_total <= 0)
|
||||||
break;
|
break;
|
||||||
n_rbg_sched--;
|
n_rbg_sched--;
|
||||||
|
|||||||
@@ -708,195 +708,142 @@ int tx_req_UE_MAC(nfapi_tx_request_t *req) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 sfn = NFAPI_SFNSF2SFN(req->sfn_sf);
|
int sf,
|
||||||
int sf = NFAPI_SFNSF2SF(req->sfn_sf);
|
nfapi_dl_config_request_pdu_t *dci,
|
||||||
|
nfapi_dl_config_request_pdu_t *dlsch,
|
||||||
|
int num_ue) {
|
||||||
|
DevAssert(dci->pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE);
|
||||||
|
DevAssert(dlsch->pdu_type == NFAPI_DL_CONFIG_DLSCH_PDU_TYPE);
|
||||||
|
|
||||||
nfapi_dl_config_request_pdu_t* dl_config_pdu_list = req->dl_config_request_body.dl_config_pdu_list;
|
const rnti_t rnti = dci->dci_dl_pdu.dci_dl_pdu_rel8.rnti;
|
||||||
|
const int rnti_type = dci->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type;
|
||||||
|
if (rnti != dlsch->dlsch_pdu.dlsch_pdu_rel8.rnti) {
|
||||||
|
LOG_E(MAC,
|
||||||
|
"%s(): sfn/sf %d.%d DLSCH PDU RNTI %x does not match DCI RNTI %x\n",
|
||||||
|
__func__, sfn, sf, rnti, dlsch->dlsch_pdu.dlsch_pdu_rel8.rnti);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < req->dl_config_request_body.number_pdu; i++) {
|
const int pdu_index = dlsch->dlsch_pdu.dlsch_pdu_rel8.pdu_index;
|
||||||
if (dl_config_pdu_list[i].pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE) {
|
if (pdu_index < 0 || pdu_index >= tx_req_num_elems) {
|
||||||
const rnti_t rnti = dl_config_pdu_list[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti;
|
LOG_E(MAC,
|
||||||
const int rnti_type = dl_config_pdu_list[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti_type;
|
"%s(): Problem with receiving data: "
|
||||||
/* We assume the DCI DL PDU is followed by the DLSCH (the standard is
|
"sfn/sf:%d.%d PDU size:%d, TX_PDU index: %d\n",
|
||||||
* more free), so advance by one more and directly process the
|
__func__,
|
||||||
* following DLSCH PDU */
|
sfn, sf, dci->pdu_size, dlsch->dlsch_pdu.dlsch_pdu_rel8.pdu_index);
|
||||||
i++;
|
return;
|
||||||
AssertFatal(i < 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 *dl_config_pdu_tmp = &dl_config_pdu_list[i];
|
|
||||||
if (dl_config_pdu_tmp->pdu_type != NFAPI_DL_CONFIG_DLSCH_PDU_TYPE) {
|
|
||||||
LOG_E(MAC, "expected DLSCH PDU at index %d\n", i);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (rnti != dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.rnti) {
|
|
||||||
LOG_I(MAC,
|
|
||||||
"%s(): sfn/sf %d DLSCH PDU RNTI %x does not match DCI RNTI %x\n",
|
|
||||||
__func__,
|
|
||||||
NFAPI_SFNSF2DEC(req->sfn_sf),
|
|
||||||
rnti,
|
|
||||||
dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.rnti);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const int pdu_index = dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index;
|
|
||||||
if (pdu_index < 0 && pdu_index >= tx_req_num_elems) {
|
|
||||||
LOG_E(MAC,
|
|
||||||
"dl_config_req_UE_MAC 2: Problem with receiving data: "
|
|
||||||
"sfn/sf:%d PDU[%d] size:%d, TX_PDU index: %d\n",
|
|
||||||
NFAPI_SFNSF2DEC(req->sfn_sf),
|
|
||||||
i,
|
|
||||||
dl_config_pdu_list[i].pdu_size,
|
|
||||||
dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (rnti_type == 1) {
|
|
||||||
// C-RNTI (Normal DLSCH case)
|
|
||||||
if (UE_mac_inst[Mod_id].crnti != rnti) {
|
|
||||||
LOG_D(MAC,
|
|
||||||
"sfn/sf %d/%d DCI not for UE %d/RNTI %x but for RNTI %x, "
|
|
||||||
"skipping\n",
|
|
||||||
sfn, sf, Mod_id, UE_mac_inst[Mod_id].crnti, rnti);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (rnti_type == 1) { // C-RNTI (Normal DLSCH case)
|
||||||
|
for (int ue_id = 0; ue_id < num_ue; ue_id++) {
|
||||||
|
if (UE_mac_inst[ue_id].crnti == rnti) {
|
||||||
LOG_D(MAC,
|
LOG_D(MAC,
|
||||||
"%s() Received data: sfn/sf:%d PDU[%d] "
|
"%s() Received data: sfn/sf:%d.%d "
|
||||||
"size:%d, TX_PDU index: %d, tx_req_num_elems: %d \n",
|
"size:%d, TX_PDU index: %d, tx_req_num_elems: %d \n",
|
||||||
__func__,
|
__func__,
|
||||||
NFAPI_SFNSF2DEC(req->sfn_sf),
|
sfn, sf, dci->pdu_size,
|
||||||
i,
|
dlsch->dlsch_pdu.dlsch_pdu_rel8.pdu_index,
|
||||||
dl_config_pdu_list[i].pdu_size,
|
|
||||||
dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index,
|
|
||||||
tx_req_num_elems);
|
tx_req_num_elems);
|
||||||
ue_send_sdu(Mod_id, 0, sfn, sf,
|
ue_send_sdu(ue_id, 0, sfn, sf,
|
||||||
tx_request_pdu_list[pdu_index].segments[0].segment_data,
|
tx_request_pdu_list[pdu_index].segments[0].segment_data,
|
||||||
tx_request_pdu_list[pdu_index].segments[0].segment_length,
|
tx_request_pdu_list[pdu_index].segments[0].segment_length,
|
||||||
0);
|
0);
|
||||||
} else if (rnti_type == 2) {
|
return;
|
||||||
if (rnti == 0xFFFF) { /* SI-RNTI */
|
|
||||||
if (UE_mac_inst[Mod_id].UE_mode[0] == NOT_SYNCHED) {
|
|
||||||
/* this check is in the code before refactoring, but I don't know
|
|
||||||
* why. Leave it in here for the moment */
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ue_decode_si(Mod_id, 0, sfn, 0,
|
|
||||||
tx_request_pdu_list[pdu_index].segments[0].segment_data,
|
|
||||||
tx_request_pdu_list[pdu_index].segments[0].segment_length);
|
|
||||||
} else if (rnti == 0xFFFE) { /* PI-RNTI */
|
|
||||||
LOG_I(MAC, "%s() Received paging message: sfn/sf:%d PDU[%d]\n",
|
|
||||||
__func__, NFAPI_SFNSF2DEC(req->sfn_sf), i);
|
|
||||||
ue_decode_p(Mod_id, 0, sfn, 0,
|
|
||||||
tx_request_pdu_list[pdu_index].segments[0].segment_data,
|
|
||||||
tx_request_pdu_list[pdu_index].segments[0].segment_length);
|
|
||||||
} else if (rnti == 0x0002) { /* RA-RNTI */
|
|
||||||
LOG_E(MAC, "%s(): Received RAR?\n", __func__);
|
|
||||||
// RNTI parameter not actually used. Provided only to comply with
|
|
||||||
// existing function definition. Not sure about parameters to fill
|
|
||||||
// the preamble index.
|
|
||||||
const rnti_t ra_rnti = UE_mac_inst[Mod_id].RA_prach_resources.ra_RNTI;
|
|
||||||
DevAssert(ra_rnti == 0x0002);
|
|
||||||
if (UE_mac_inst[Mod_id].UE_mode[0] != PUSCH
|
|
||||||
&& UE_mac_inst[Mod_id].RA_prach_resources.Msg3 != NULL
|
|
||||||
&& ra_rnti == dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.rnti) {
|
|
||||||
LOG_E(MAC,
|
|
||||||
"dl_config_req_UE_MAC 5 Received RAR, PreambleIndex: %d \n",
|
|
||||||
UE_mac_inst[Mod_id].RA_prach_resources.ra_PreambleIndex);
|
|
||||||
ue_process_rar(Mod_id, 0, sfn,
|
|
||||||
ra_rnti, //RA-RNTI
|
|
||||||
tx_request_pdu_list[pdu_index].segments[0].segment_data,
|
|
||||||
&dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.rnti, //t-crnti
|
|
||||||
UE_mac_inst[Mod_id].RA_prach_resources.ra_PreambleIndex,
|
|
||||||
tx_request_pdu_list[pdu_index].segments[0].segment_data);
|
|
||||||
UE_mac_inst[Mod_id].UE_mode[0] = RA_RESPONSE;
|
|
||||||
// Expecting an UL_CONFIG_ULSCH_PDU to enable Msg3 Txon (first
|
|
||||||
// ULSCH Txon for the UE)
|
|
||||||
UE_mac_inst[Mod_id].first_ULSCH_Tx = 1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
LOG_W(MAC, "can not handle special RNTI %x\n", rnti);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (dl_config_pdu_list[i].pdu_type == NFAPI_DL_CONFIG_BCH_PDU_TYPE) {
|
|
||||||
// BCH case: Last parameter is 1 if first time synchronization and zero
|
|
||||||
// otherwise. Not sure which value to put for our case.
|
|
||||||
if (UE_mac_inst[Mod_id].UE_mode[0] == NOT_SYNCHED){
|
|
||||||
dl_phy_sync_success(Mod_id, sfn, 0, 1);
|
|
||||||
LOG_E(MAC,
|
|
||||||
"%s(): Received MIB: UE_mode: %d, sfn/sf: %d.%d\n",
|
|
||||||
__func__,
|
|
||||||
UE_mac_inst[Mod_id].UE_mode[0],
|
|
||||||
sfn,
|
|
||||||
sf);
|
|
||||||
UE_mac_inst[Mod_id].UE_mode[0] = PRACH;
|
|
||||||
} else {
|
|
||||||
dl_phy_sync_success(Mod_id, sfn, 0, 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (rnti_type == 2) {
|
||||||
|
if (rnti == 0xFFFF) { /* SI-RNTI */
|
||||||
|
for (int ue_id = 0; ue_id < num_ue; ue_id++) {
|
||||||
|
if (UE_mac_inst[ue_id].UE_mode[0] == NOT_SYNCHED)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
ue_decode_si(ue_id, 0, sfn, 0,
|
||||||
|
tx_request_pdu_list[pdu_index].segments[0].segment_data,
|
||||||
|
tx_request_pdu_list[pdu_index].segments[0].segment_length);
|
||||||
|
}
|
||||||
|
} else if (rnti == 0xFFFE) { /* PI-RNTI */
|
||||||
|
for (int ue_id = 0; ue_id < num_ue; ue_id++) {
|
||||||
|
LOG_I(MAC, "%s() Received paging message: sfn/sf:%d.%d\n",
|
||||||
|
__func__, sfn, sf);
|
||||||
|
ue_decode_p(ue_id, 0, sfn, 0,
|
||||||
|
tx_request_pdu_list[pdu_index].segments[0].segment_data,
|
||||||
|
tx_request_pdu_list[pdu_index].segments[0].segment_length);
|
||||||
|
}
|
||||||
|
} else if (rnti == 0x0002) { /* RA-RNTI */
|
||||||
|
for (int ue_id = 0; ue_id < num_ue; ue_id++) {
|
||||||
|
if (UE_mac_inst[ue_id].UE_mode[0] != RA_RESPONSE) {
|
||||||
|
LOG_D(MAC, "UE %d not awaiting RAR, is in mode %d\n",
|
||||||
|
ue_id, UE_mac_inst[ue_id].UE_mode[0]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// RNTI parameter not actually used. Provided only to comply with
|
||||||
|
// existing function definition. Not sure about parameters to fill
|
||||||
|
// the preamble index.
|
||||||
|
const rnti_t ra_rnti = UE_mac_inst[ue_id].RA_prach_resources.ra_RNTI;
|
||||||
|
DevAssert(ra_rnti == 0x0002);
|
||||||
|
if (UE_mac_inst[ue_id].UE_mode[0] != PUSCH
|
||||||
|
&& UE_mac_inst[ue_id].RA_prach_resources.Msg3 != NULL
|
||||||
|
&& ra_rnti == dlsch->dlsch_pdu.dlsch_pdu_rel8.rnti) {
|
||||||
|
LOG_E(MAC,
|
||||||
|
"%s(): Received RAR, PreambleIndex: %d\n",
|
||||||
|
__func__, UE_mac_inst[ue_id].RA_prach_resources.ra_PreambleIndex);
|
||||||
|
ue_process_rar(ue_id, 0, sfn,
|
||||||
|
ra_rnti, //RA-RNTI
|
||||||
|
tx_request_pdu_list[pdu_index].segments[0].segment_data,
|
||||||
|
&UE_mac_inst[ue_id].crnti, //t-crnti
|
||||||
|
UE_mac_inst[ue_id].RA_prach_resources.ra_PreambleIndex,
|
||||||
|
tx_request_pdu_list[pdu_index].segments[0].segment_data);
|
||||||
|
UE_mac_inst[ue_id].UE_mode[0] = RA_RESPONSE;
|
||||||
|
// Expecting an UL_CONFIG_ULSCH_PDU to enable Msg3 Txon (first
|
||||||
|
// ULSCH Txon for the UE)
|
||||||
|
UE_mac_inst[ue_id].first_ULSCH_Tx = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LOG_W(MAC, "can not handle special RNTI %x\n", rnti);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int hi_dci0_req_UE_MAC(nfapi_hi_dci0_request_t *req, module_id_t Mod_id) {
|
void dl_config_req_UE_MAC_bch(int sfn,
|
||||||
if (req != NULL && req->hi_dci0_request_body.hi_dci0_pdu_list != NULL) {
|
int sf,
|
||||||
LOG_D(PHY,
|
nfapi_dl_config_request_pdu_t *bch,
|
||||||
"[UE-PHY_STUB] hi dci0 request sfn_sf:%d number_of_dci:%d "
|
int num_ue) {
|
||||||
"number_of_hi:%d\n",
|
DevAssert(bch->pdu_type == NFAPI_DL_CONFIG_BCH_PDU_TYPE);
|
||||||
NFAPI_SFNSF2DEC(req->sfn_sf),
|
|
||||||
req->hi_dci0_request_body.number_of_dci,
|
|
||||||
req->hi_dci0_request_body.number_of_hi);
|
|
||||||
|
|
||||||
for (int i = 0; i < req->hi_dci0_request_body.number_of_dci
|
for (int ue_id = 0; ue_id < num_ue; ue_id++) {
|
||||||
+ req->hi_dci0_request_body.number_of_hi;
|
if (UE_mac_inst[ue_id].UE_mode[0] == NOT_SYNCHED){
|
||||||
i++) {
|
dl_phy_sync_success(ue_id, sfn, 0, 1);
|
||||||
LOG_D(PHY,
|
LOG_E(MAC,
|
||||||
"[UE-PHY_STUB] HI_DCI0_REQ sfn_sf:%d PDU[%d]\n",
|
"%s(): Received MIB: UE_mode: %d, sfn/sf: %d.%d\n",
|
||||||
NFAPI_SFNSF2DEC(req->sfn_sf),
|
__func__,
|
||||||
i);
|
UE_mac_inst[ue_id].UE_mode[0],
|
||||||
|
sfn,
|
||||||
if (req->hi_dci0_request_body.hi_dci0_pdu_list[i].pdu_type
|
sf);
|
||||||
== NFAPI_HI_DCI0_DCI_PDU_TYPE) {
|
UE_mac_inst[ue_id].UE_mode[0] = PRACH;
|
||||||
LOG_D(PHY,
|
} else {
|
||||||
"[UE-PHY_STUB] HI_DCI0_REQ sfn_sf:%d PDU[%d] - "
|
dl_phy_sync_success(ue_id, sfn, 0, 0);
|
||||||
"NFAPI_HI_DCI0_DCI_PDU_TYPE\n",
|
|
||||||
NFAPI_SFNSF2DEC(req->sfn_sf),
|
|
||||||
i);
|
|
||||||
const nfapi_hi_dci0_dci_pdu_rel8_t *dci =
|
|
||||||
&req->hi_dci0_request_body.hi_dci0_pdu_list[i].dci_pdu.dci_pdu_rel8;
|
|
||||||
if (dci->rnti != UE_mac_inst[Mod_id].crnti)
|
|
||||||
continue;
|
|
||||||
const int sfn = NFAPI_SFNSF2SFN(req->sfn_sf);
|
|
||||||
const int sf = NFAPI_SFNSF2SF(req->sfn_sf);
|
|
||||||
if (dci->cqi_csi_request)
|
|
||||||
fill_ulsch_cqi_indication_UE_MAC(Mod_id, sfn, sf, UL_INFO, dci->rnti);
|
|
||||||
} else if (req->hi_dci0_request_body.hi_dci0_pdu_list[i].pdu_type
|
|
||||||
== NFAPI_HI_DCI0_HI_PDU_TYPE) {
|
|
||||||
nfapi_hi_dci0_request_pdu_t *hi_dci0_req_pdu =
|
|
||||||
&req->hi_dci0_request_body.hi_dci0_pdu_list[i];
|
|
||||||
|
|
||||||
// This is meaningful only after ACKnowledging the first ULSCH Txon
|
|
||||||
// (i.e. Msg3)
|
|
||||||
if (hi_dci0_req_pdu->hi_pdu.hi_pdu_rel8.hi_value == 1
|
|
||||||
&& UE_mac_inst[Mod_id].first_ULSCH_Tx == 1) {
|
|
||||||
// LOG_I(MAC,"[UE-PHY_STUB] HI_DCI0_REQ 2 sfn_sf:%d PDU[%d] -
|
|
||||||
// NFAPI_HI_DCI0_HI_PDU_TYPE\n", NFAPI_SFNSF2DEC(req->sfn_sf), i);
|
|
||||||
// UE_mac_inst[Mod_id].UE_mode[0] = PUSCH;
|
|
||||||
// UE_mac_inst[Mod_id].first_ULSCH_Tx = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
LOG_E(PHY,
|
|
||||||
"[UE-PHY_STUB] HI_DCI0_REQ sfn_sf:%d PDU[%d] - unknown pdu "
|
|
||||||
"type:%d\n",
|
|
||||||
NFAPI_SFNSF2DEC(req->sfn_sf),
|
|
||||||
i,
|
|
||||||
req->hi_dci0_request_body.hi_dci0_pdu_list[i].pdu_type);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
void hi_dci0_req_UE_MAC(int sfn,
|
||||||
|
int sf,
|
||||||
|
nfapi_hi_dci0_request_pdu_t* hi_dci0,
|
||||||
|
int num_ue) {
|
||||||
|
if (hi_dci0->pdu_type != NFAPI_HI_DCI0_DCI_PDU_TYPE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const nfapi_hi_dci0_dci_pdu_rel8_t *dci = &hi_dci0->dci_pdu.dci_pdu_rel8;
|
||||||
|
if (!dci->cqi_csi_request)
|
||||||
|
return;
|
||||||
|
for (int ue_id = 0; ue_id < num_ue; ue_id++) {
|
||||||
|
if (dci->rnti == UE_mac_inst[ue_id].crnti) {
|
||||||
|
fill_ulsch_cqi_indication_UE_MAC(ue_id, sfn, sf, UL_INFO, dci->rnti);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The following set of memcpy functions should be getting called as callback
|
// The following set of memcpy functions should be getting called as callback
|
||||||
|
|||||||
@@ -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,
|
nfapi_ul_config_request_pdu_t *ul_config_pdu,
|
||||||
uint16_t frame,uint8_t subframe,uint8_t srs_present, int index);
|
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);
|
void dl_config_req_UE_MAC_dci(int sfn,
|
||||||
int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req, module_id_t Mod_id);
|
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 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
|
// The following set of memcpy functions should be getting called as callback functions from
|
||||||
// pnf_p7_subframe_ind.
|
// pnf_p7_subframe_ind.
|
||||||
|
|||||||
+44
-12
@@ -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 (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++) {
|
||||||
for (ue_index=0; ue_index < ue_num; ue_index++) {
|
for (ue_index=0; ue_index < ue_num; ue_index++) {
|
||||||
ue_Mod_id = ue_thread_id + NB_THREAD_INST*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);
|
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)
|
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF)
|
||||||
phy_procedures_UE_SL_TX(UE,proc);
|
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) {
|
if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH && ue_Mod_id == next_Mod_id) {
|
||||||
next_ra_frame++;
|
next_ra_frame++;
|
||||||
|
|
||||||
if(next_ra_frame > 200) {
|
if(next_ra_frame > 500) {
|
||||||
// check if we have PRACH opportunity
|
// 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) {
|
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...
|
// 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);
|
oai_subframe_ind(timer_frame, timer_subframe);
|
||||||
|
|
||||||
if(dl_config_req!= NULL) {
|
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(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) {
|
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){
|
//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);
|
free(hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list);
|
||||||
hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list = NULL;
|
hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list = NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user