From c4e284a3e10819af572908a5d33c30b53f09520c Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Thu, 16 Apr 2020 15:54:27 +0200 Subject: [PATCH] fix in CCEs function --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 7 +-- .../LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 53 +++++++++++-------- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 26 ++++----- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 14 ++--- 4 files changed, 57 insertions(+), 43 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 55998e1c1b..5e8282b597 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -366,7 +366,8 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, uint64_t *ulsch_in_slot_bitmap=NULL; NR_sched_pucch *pucch_sched = (NR_sched_pucch*) malloc(sizeof(NR_sched_pucch)); - if (get_softmodem_params()->phy_test) UE_id=0; + UE_id=0; + int bwp_id = 1; gNB_MAC_INST *gNB = RC.nrmac[module_idP]; NR_UE_list_t *UE_list = &gNB->UE_list; @@ -407,8 +408,8 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, // Check if there are downlink symbols in the slot, if (is_nr_DL_slot(cc->ServingCellConfigCommon,slot_txP)) { - - memset(RC.nrmac[module_idP]->cce_list[1][0],0,MAX_NUM_CCE*sizeof(int)); + memset(RC.nrmac[module_idP]->cce_list[bwp_id][0],0,MAX_NUM_CCE*sizeof(int)); // coreset0 + memset(RC.nrmac[module_idP]->cce_list[bwp_id][1],0,MAX_NUM_CCE*sizeof(int)); // coresetid 1 for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { //mbsfn_status[CC_id] = 0; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index a158635848..834feac62c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -410,14 +410,18 @@ int configure_fapi_dl_pdu(int Mod_idP, } AssertFatal(found==1,"Couldn't find an adequate searchspace\n"); - nr_configure_pdcch(nr_mac, - pdcch_pdu_rel15, - UE_list->rnti[UE_id], - 1, // ue-specific - ss, - scc, - bwp); - + int ret = nr_configure_pdcch(nr_mac, + pdcch_pdu_rel15, + UE_list->rnti[UE_id], + 1, // ue-specific + ss, + scc, + bwp); + if (ret < 0) { + LOG_I(MAC,"CCE list not empty, couldn't schedule PDSCH\n"); + return (0); + } + int dci_formats[2]; int rnti_types[2]; @@ -569,6 +573,9 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP, dlsch_config!=NULL ? dlsch_config->mcsIndex : NULL, dlsch_config!=NULL ? &dlsch_config->rbSize : NULL, dlsch_config!=NULL ? &dlsch_config->rbStart : NULL); + + if (TBS_bytes == 0) + return; //The --NOS1 use case currently schedules DLSCH transmissions only when there is IP traffic arriving //through the LTE stack @@ -866,19 +873,23 @@ void nr_schedule_uss_ulsch_phytest(int Mod_idP, rnti_types[0] = NR_RNTI_C; LOG_D(MAC,"Configuring ULDCI/PDCCH in %d.%d\n", frameP,slotP); - nr_configure_pdcch(nr_mac, - pdcch_pdu_rel15, - UE_list->rnti[UE_id], - 1, // ue-specific, - ss, - scc, - bwp); - - dci_pdu_rel15_t dci_pdu_rel15[MAX_DCI_CORESET]; + int ret = nr_configure_pdcch(nr_mac, + pdcch_pdu_rel15, + UE_list->rnti[UE_id], + 1, // ue-specific, + ss, + scc, + bwp); - config_uldci(ubwp,pusch_pdu,pdcch_pdu_rel15, &dci_pdu_rel15[0], dci_formats, rnti_types); - - fill_dci_pdu_rel15(secondaryCellGroup,pdcch_pdu_rel15,dci_pdu_rel15,dci_formats,rnti_types,pusch_pdu->bwp_size,bwp_id); - + if (ret < 0) { + LOG_I(MAC,"CCE list not empty, couldn't schedule PUSCH\n"); + UL_tti_req->n_pdus-=1; + return; + } + else { + dci_pdu_rel15_t dci_pdu_rel15[MAX_DCI_CORESET]; + config_uldci(ubwp,pusch_pdu,pdcch_pdu_rel15, &dci_pdu_rel15[0], dci_formats, rnti_types); + fill_dci_pdu_rel15(secondaryCellGroup,pdcch_pdu_rel15,dci_pdu_rel15,dci_formats,rnti_types,pusch_pdu->bwp_size,bwp_id); + } } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 2b2c8f6491..146b3278b0 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -131,7 +131,7 @@ static inline uint8_t get_max_cces(uint8_t scs) { int allocate_nr_CCEs(gNB_MAC_INST *nr_mac, int bwp_id, - int coreset_id, + int list_id, int aggregation, int search_space, // 0 common, 1 ue-specific int UE_id, @@ -152,15 +152,15 @@ int allocate_nr_CCEs(gNB_MAC_INST *nr_mac, bwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; if (search_space == 1) { - coreset = bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.array[coreset_id]; + coreset = bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.array[list_id]; } else { coreset = bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonControlResourceSet; } + int coreset_id = coreset->controlResourceSetId; int *cce_list = nr_mac->cce_list[bwp_id][coreset_id]; - int n_rb=0; for (int i=0;i<6;i++) for (int j=0;j<8;j++) { @@ -409,16 +409,16 @@ void nr_configure_css_dci_initial(nfapi_nr_dl_tti_pdcch_pdu_rel15_t* pdcch_pdu, } -void nr_configure_pdcch(gNB_MAC_INST *nr_mac, - nfapi_nr_dl_tti_pdcch_pdu_rel15_t* pdcch_pdu, - uint16_t rnti, - int ss_type, - NR_SearchSpace_t *ss, - NR_ServingCellConfigCommon_t *scc, - NR_BWP_Downlink_t *bwp){ +int nr_configure_pdcch(gNB_MAC_INST *nr_mac, + nfapi_nr_dl_tti_pdcch_pdu_rel15_t* pdcch_pdu, + uint16_t rnti, + int ss_type, + NR_SearchSpace_t *ss, + NR_ServingCellConfigCommon_t *scc, + NR_BWP_Downlink_t *bwp){ int CCEIndex = -1; - int cid; + int cid = 0; NR_ControlResourceSet_t *coreset = NULL; if (bwp) { // This is not the InitialBWP @@ -524,7 +524,8 @@ void nr_configure_pdcch(gNB_MAC_INST *nr_mac, 0, // UE-id 0); // m - AssertFatal(CCEIndex>=0,"CCEIndex is negative \n"); + if (CCEIndex<0) + return (CCEIndex); pdcch_pdu->dci_pdu.AggregationLevel[pdcch_pdu->numDlDci] = aggregation_level; pdcch_pdu->dci_pdu.CceIndex[pdcch_pdu->numDlDci] = CCEIndex; @@ -534,6 +535,7 @@ void nr_configure_pdcch(gNB_MAC_INST *nr_mac, pdcch_pdu->dci_pdu.powerControlOffsetSS[pdcch_pdu->numDlDci]=1; pdcch_pdu->numDlDci++; + return (0); } else { // this is for InitialBWP AssertFatal(1==0,"Fill in InitialBWP PDCCH configuration\n"); diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index d22edb1fd0..cc0254cc3a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -195,13 +195,13 @@ void find_search_space(int ss_type, NR_BWP_Downlink_t *bwp, NR_SearchSpace_t *ss); -void nr_configure_pdcch(gNB_MAC_INST *nr_mac, - nfapi_nr_dl_tti_pdcch_pdu_rel15_t* pdcch_pdu, - uint16_t rnti, - int ss_type, - NR_SearchSpace_t *ss, - NR_ServingCellConfigCommon_t *scc, - NR_BWP_Downlink_t *bwp); +int nr_configure_pdcch(gNB_MAC_INST *nr_mac, + nfapi_nr_dl_tti_pdcch_pdu_rel15_t* pdcch_pdu, + uint16_t rnti, + int ss_type, + NR_SearchSpace_t *ss, + NR_ServingCellConfigCommon_t *scc, + NR_BWP_Downlink_t *bwp); void fill_dci_pdu_rel15(NR_CellGroupConfig_t *secondaryCellGroup, nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,