From aa9e30691b50d4c831d617ba3c8c2d238ff19375 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Wed, 2 Feb 2022 14:53:36 +0000 Subject: [PATCH 01/46] Fix DCI formats --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 16 +++++++--------- .../LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 9 +++++++-- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 13 ++++--------- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index ea298494c4..ff2e037e4c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -788,7 +788,9 @@ void pf_dl(module_id_t module_id, AssertFatal(tda>=0,"Unable to find PDSCH time domain allocation in list\n"); NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch; NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static; - const long f = (sched_ctrl->active_bwp || bwpd) ? sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats : 0; + const long f = ((sched_ctrl->active_bwp || bwpd) && sched_ctrl->search_space && + sched_ctrl->search_space->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific) ? + sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats : 0; if (ps->time_domain_allocation != tda) nr_set_pdsch_semi_static(scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, bwpd, tda, f, ps); sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, ps->mcsTableIdx); @@ -1161,14 +1163,10 @@ void nr_schedule_ue_spec(module_id_t module_id, dci_payload.tpc, pucch->timing_indicator); - const long f = sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats; - int dci_format; - if (sched_ctrl->search_space) { - dci_format = f ? NR_DL_DCI_FORMAT_1_1 : NR_DL_DCI_FORMAT_1_0; - } - else { - dci_format = NR_DL_DCI_FORMAT_1_0; - } + int dci_format = sched_ctrl->search_space && sched_ctrl->search_space->searchSpaceType && + sched_ctrl->search_space->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific ? + NR_UL_DCI_FORMAT_0_1 : NR_UL_DCI_FORMAT_0_0; + const int rnti_type = NR_RNTI_C; fill_dci_pdu_rel15(scc, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index c0107c5fc6..1ded933a62 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -374,7 +374,10 @@ void nr_preprocessor_phytest(module_id_t module_id, sched_pdsch->rbStart = rbStart; sched_pdsch->rbSize = rbSize; const int tda = sched_ctrl->active_bwp ? RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp->bwp_Id][slot] : 1; - const long f = sched_ctrl->active_bwp ? sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats : 0; + const long f = (sched_ctrl->active_bwp && sched_ctrl->search_space && + sched_ctrl->search_space->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific) ? + sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats : 0; + ps->nrOfLayers = target_dl_Nl; if (ps->time_domain_allocation != tda) nr_set_pdsch_semi_static( @@ -444,7 +447,9 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_ if (!is_xlsch_in_slot(ulsch_slot_bitmap, sched_slot)) return false; - const long f = sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats; + const long f = (sched_ctrl->active_bwp && sched_ctrl->search_space && + sched_ctrl->search_space->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific) ? + sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats : 0; const int dci_format = f ? NR_UL_DCI_FORMAT_0_1 : NR_UL_DCI_FORMAT_0_0; const uint8_t num_dmrs_cdm_grps_no_data = 1; /* we want to avoid a lengthy deduction of DMRS and other parameters in diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index bde6c6109d..fcfbc180fd 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -39,16 +39,11 @@ int get_dci_format(NR_UE_sched_ctrl_t *sched_ctrl) { - const long f = sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats; - int dci_format; - if (sched_ctrl->search_space) { - dci_format = f ? NR_UL_DCI_FORMAT_0_1 : NR_UL_DCI_FORMAT_0_0; - } - else { - dci_format = NR_UL_DCI_FORMAT_0_0; - } + int dci_format = sched_ctrl->search_space && sched_ctrl->search_space->searchSpaceType && + sched_ctrl->search_space->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific ? + NR_UL_DCI_FORMAT_0_1 : NR_UL_DCI_FORMAT_0_0; - return(dci_format); + return(dci_format); } void calculate_preferred_ul_tda(module_id_t module_id, const NR_BWP_Uplink_t *ubwp) From 5744749e9a2b8ce609f1002c207b83ac1c5dde29 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Wed, 2 Feb 2022 15:03:25 +0000 Subject: [PATCH 02/46] Make NR_BCCH_DL_SCH_Message_t (SIB1) available at MAC gNB --- openair1/SIMULATION/NR_PHY/dlsim.c | 4 +-- openair1/SIMULATION/NR_PHY/ulsim.c | 4 +-- openair2/GNB_APP/gnb_config.c | 1 + openair2/LAYER2/NR_MAC_gNB/config.c | 10 +++--- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 5 +-- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 1 + openair2/RRC/NR/rrc_gNB.c | 41 +++++++++++++------------ openair2/RRC/NR/rrc_gNB_nsa.c | 2 ++ 8 files changed, 39 insertions(+), 29 deletions(-) diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 6a2aba5944..e2135b6e21 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -796,9 +796,9 @@ int main(int argc, char **argv) AssertFatal((gNB->if_inst = NR_IF_Module_init(0))!=NULL,"Cannot register interface"); gNB->if_inst->NR_PHY_config_req = nr_phy_config_request; // common configuration - rrc_mac_config_req_gNB(0,0, n_tx, n_tx, 0, scc, NULL, 0, 0, NULL); + rrc_mac_config_req_gNB(0,0, n_tx, n_tx, 0, scc, NULL, NULL, 0, 0, NULL); // UE dedicated configuration - rrc_mac_config_req_gNB(0,0, n_tx, n_tx, 0, scc, NULL, 1, secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup); + rrc_mac_config_req_gNB(0,0, n_tx, n_tx, 0, scc, NULL, NULL, 1, secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup); // reset preprocessor to the one of DLSIM after it has been set during // rrc_mac_config_req_gNB gNB_mac->pre_processor_dl = nr_dlsim_preprocessor; diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index ac991ae940..23bc144657 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -732,9 +732,9 @@ int main(int argc, char **argv) gNB->if_inst->NR_PHY_config_req = nr_phy_config_request; // common configuration - rrc_mac_config_req_gNB(0,0, n_tx, n_rx, 0, scc, &rrc.carrier.mib,0, 0, NULL); + rrc_mac_config_req_gNB(0,0, n_tx, n_rx, 0, scc, &rrc.carrier.mib, rrc.carrier.siblock1, 0, 0, NULL); // UE dedicated configuration - rrc_mac_config_req_gNB(0,0, n_tx, n_rx, 0, scc, &rrc.carrier.mib,1, secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup); + rrc_mac_config_req_gNB(0,0, n_tx, n_rx, 0, scc, &rrc.carrier.mib, rrc.carrier.siblock1, 1, secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup); frame_parms->nb_antennas_tx = n_tx; frame_parms->nb_antennas_rx = n_rx; nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config; diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 9710dd1814..076ba4f7b4 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -2035,6 +2035,7 @@ void configure_gnb_du_mac(int inst) { rrc->configuration.sib1_tda, rrc->configuration.scc, NULL, + NULL, 0, 0, // rnti (NR_CellGroupConfig_t *)NULL diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index ae3a3bba24..2be3fc671c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -431,9 +431,10 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, int sib1_tda, NR_ServingCellConfigCommon_t *scc, NR_BCCH_BCH_Message_t *mib, - int add_ue, + NR_BCCH_DL_SCH_Message_t *sib1, + int add_ue, uint32_t rnti, - NR_CellGroupConfig_t *CellGroup) { + NR_CellGroupConfig_t *CellGroup) { if (scc != NULL ) { AssertFatal((scc->ssb_PositionsInBurst->present > 0) && (scc->ssb_PositionsInBurst->present < 4), "SSB Bitmap type %d is not valid\n",scc->ssb_PositionsInBurst->present); @@ -531,8 +532,9 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, } } - if (mib) RC.nrmac[Mod_idP]->common_channels[0].mib = mib; - + if (mib) RC.nrmac[Mod_idP]->common_channels[0].mib = mib; + if (sib1) RC.nrmac[Mod_idP]->common_channels[0].sib1 = sib1; + if (CellGroup) { const NR_ServingCellConfig_t *servingCellConfig = CellGroup->spCellConfig->spCellConfigDedicated; diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 91221276b0..e88899f539 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -52,8 +52,9 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, int sib1_tda, NR_ServingCellConfigCommon_t *scc, NR_BCCH_BCH_Message_t *mib, - int add_ue, - uint32_t rnti, + NR_BCCH_DL_SCH_Message_t *sib1, + int add_ue, + uint32_t rnti, NR_CellGroupConfig_t *CellGroup); void clear_nr_nfapi_information(gNB_MAC_INST * gNB, diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 45e0a5b52b..a7f1a2cd90 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -186,6 +186,7 @@ typedef struct { lte_frame_type_t frame_type; uint64_t dl_CarrierFreq; NR_BCCH_BCH_Message_t *mib; + NR_BCCH_DL_SCH_Message_t *sib1; NR_ServingCellConfigCommon_t *ServingCellConfigCommon; NR_ARFCN_ValueEUTRA_t ul_CarrierFreq; long ul_Bandwidth; diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 2c2020412d..43ee16e3ea 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -183,16 +183,16 @@ static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration if (NODE_IS_MONOLITHIC(rrc->node_type)){ rrc_mac_config_req_gNB(rrc->module_id, - rrc->carrier.ssb_SubcarrierOffset, - rrc->carrier.pdsch_AntennaPorts, - rrc->carrier.pusch_AntennaPorts, + rrc->carrier.ssb_SubcarrierOffset, + rrc->carrier.pdsch_AntennaPorts, + rrc->carrier.pusch_AntennaPorts, rrc->carrier.sib1_tda, - (NR_ServingCellConfigCommon_t *)rrc->carrier.servingcellconfigcommon, - &rrc->carrier.mib, - 0, - 0, // WIP hardcoded rnti - (NR_CellGroupConfig_t *)NULL - ); + (NR_ServingCellConfigCommon_t *)rrc->carrier.servingcellconfigcommon, + &rrc->carrier.mib, + rrc->carrier.siblock1, + 0, + 0, // WIP hardcoded rnti + (NR_CellGroupConfig_t *)NULL); } /* set flag to indicate that cell information is configured. This is required @@ -294,16 +294,17 @@ void apply_macrlc_config(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *const ue_context_pP, const protocol_ctxt_t *const ctxt_pP ) { - rrc_mac_config_req_gNB(rrc->module_id, - rrc->carrier.ssb_SubcarrierOffset, - rrc->carrier.pdsch_AntennaPorts, - rrc->carrier.pusch_AntennaPorts, - rrc->carrier.sib1_tda, - NULL, - NULL, - 0, - ue_context_pP->ue_context.rnti, - get_softmodem_params()->sa ? ue_context_pP->ue_context.masterCellGroup : (NR_CellGroupConfig_t *)NULL); + rrc_mac_config_req_gNB(rrc->module_id, + rrc->carrier.ssb_SubcarrierOffset, + rrc->carrier.pdsch_AntennaPorts, + rrc->carrier.pusch_AntennaPorts, + rrc->carrier.sib1_tda, + NULL, + NULL, + NULL, + 0, + ue_context_pP->ue_context.rnti, + get_softmodem_params()->sa ? ue_context_pP->ue_context.masterCellGroup : (NR_CellGroupConfig_t *)NULL); nr_rrc_rlc_config_asn1_req(ctxt_pP, ue_context_pP->ue_context.SRB_configList, @@ -494,6 +495,7 @@ rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest( rrc_instance_p->carrier.sib1_tda, (NR_ServingCellConfigCommon_t *)rrc_instance_p->carrier.servingcellconfigcommon, &rrc_instance_p->carrier.mib, + rrc_instance_p->carrier.siblock1, 0, ue_context_pP->ue_context.rnti, (NR_CellGroupConfig_t *)NULL @@ -1259,6 +1261,7 @@ rrc_gNB_process_RRCReconfigurationComplete( rrc->carrier.sib1_tda, NULL, NULL, + NULL, 0, ue_context_pP->ue_context.rnti, ue_context_pP->ue_context.masterCellGroup diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index 15caff0b4d..9a23102de1 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -384,6 +384,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ rrc->carrier.sib1_tda, rrc->carrier.servingcellconfigcommon, &rrc->carrier.mib, + NULL, 1, // add_ue flag ue_context_p->ue_id_rnti, ue_context_p->ue_context.secondaryCellGroup); @@ -395,6 +396,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ rrc->carrier.sib1_tda, NULL, NULL, + NULL, 1, // add_ue flag ue_context_p->ue_id_rnti, ue_context_p->ue_context.secondaryCellGroup); From 911b40c0c3b4022b3a0eadda830b0c69513b1197 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Wed, 2 Feb 2022 15:05:09 +0000 Subject: [PATCH 03/46] Fix DCI format --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index ff2e037e4c..2b46095e65 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -552,7 +552,9 @@ bool allocate_dl_retransmission(module_id_t module_id, int rbStart = 0; // start wrt BWPstart NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static; - const long f = (sched_ctrl->active_bwp ||bwpd) ? sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats : 0; + const long f = ((sched_ctrl->active_bwp || bwpd) && sched_ctrl->search_space && + sched_ctrl->search_space->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific) ? + sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats : 0; int rbSize = 0; const int tda = RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0][slot]; AssertFatal(tda>=0,"Unable to find PDSCH time domain allocation in list\n"); From 20e767d7b6aa77934af978e2414001039dfc7607 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Wed, 2 Feb 2022 15:08:08 +0000 Subject: [PATCH 04/46] Fix preferred DL TDA computation --- openair2/LAYER2/NR_MAC_gNB/config.c | 35 +++++++++++++++-------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 2be3fc671c..abc1a79f68 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -537,25 +537,27 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, if (CellGroup) { - const NR_ServingCellConfig_t *servingCellConfig = CellGroup->spCellConfig->spCellConfigDedicated; + calculate_preferred_dl_tda(Mod_idP, NULL); - const struct NR_ServingCellConfig__downlinkBWP_ToAddModList *bwpList = servingCellConfig->downlinkBWP_ToAddModList; - if(bwpList) { - AssertFatal(bwpList->list.count > 0, "downlinkBWP_ToAddModList has no BWPs!\n"); - for (int i = 0; i < bwpList->list.count; ++i) { - const NR_BWP_Downlink_t *bwp = bwpList->list.array[i]; - calculate_preferred_dl_tda(Mod_idP, bwp); + const NR_ServingCellConfig_t *servingCellConfig = NULL; + if(CellGroup->spCellConfig && CellGroup->spCellConfig->spCellConfigDedicated) { + servingCellConfig = CellGroup->spCellConfig->spCellConfigDedicated; + const struct NR_ServingCellConfig__downlinkBWP_ToAddModList *bwpList = servingCellConfig->downlinkBWP_ToAddModList; + if(bwpList) { + AssertFatal(bwpList->list.count > 0, "downlinkBWP_ToAddModList has no BWPs!\n"); + for (int i = 0; i < bwpList->list.count; ++i) { + const NR_BWP_Downlink_t *bwp = bwpList->list.array[i]; + calculate_preferred_dl_tda(Mod_idP, bwp); + } } - } else { - calculate_preferred_dl_tda(Mod_idP, NULL); - } - const struct NR_UplinkConfig__uplinkBWP_ToAddModList *ubwpList = servingCellConfig->uplinkConfig->uplinkBWP_ToAddModList; - if(ubwpList) { - AssertFatal(ubwpList->list.count > 0, "uplinkBWP_ToAddModList no BWPs!\n"); - for (int i = 0; i < ubwpList->list.count; ++i) { - const NR_BWP_Uplink_t *ubwp = ubwpList->list.array[i]; - calculate_preferred_ul_tda(Mod_idP, ubwp); + const struct NR_UplinkConfig__uplinkBWP_ToAddModList *ubwpList = servingCellConfig->uplinkConfig->uplinkBWP_ToAddModList; + if(ubwpList) { + AssertFatal(ubwpList->list.count > 0, "uplinkBWP_ToAddModList no BWPs!\n"); + for (int i = 0; i < ubwpList->list.count; ++i) { + const NR_BWP_Uplink_t *ubwp = ubwpList->list.array[i]; + calculate_preferred_ul_tda(Mod_idP, ubwp); + } } } @@ -614,7 +616,6 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, UE_info->CellGroup[UE_id] = CellGroup; LOG_I(NR_MAC,"Modified UE_id %d/%x with CellGroup\n",UE_id,rnti); process_CellGroup(CellGroup,&UE_info->UE_sched_ctrl[UE_id]); - const NR_ServingCellConfig_t *servingCellConfig = CellGroup ? CellGroup->spCellConfig->spCellConfigDedicated : NULL; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; const NR_PDSCH_ServingCellConfig_t *pdsch = servingCellConfig ? servingCellConfig->pdsch_ServingCellConfig->choice.setup : NULL; if (sched_ctrl->available_dl_harq.len == 0) { From 0166cd05d61c9d03b7a2cb9a317d9b97e332da84 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Wed, 2 Feb 2022 15:15:18 +0000 Subject: [PATCH 05/46] To use ServingCellConfigCommonSIB when ServingCellConfigCommon is NULL --- openair1/SIMULATION/NR_PHY/dlsim.c | 5 +- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 24 +-- openair2/LAYER2/NR_MAC_gNB/config.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 3 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 96 ++++++--- .../LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 6 +- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 151 ++++++++++----- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 34 +++- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 182 ++++++++++++++---- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 23 ++- 10 files changed, 377 insertions(+), 149 deletions(-) diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index e2135b6e21..db0bb082ac 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -261,7 +261,7 @@ void nr_dlsim_preprocessor(module_id_t module_id, /* manually set free CCE to 0 */ const int target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific; - sched_ctrl->search_space = get_searchspace(scc, sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Dedicated : NULL, target_ss); + sched_ctrl->search_space = get_searchspace(module_id, scc, sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Dedicated : NULL, target_ss); uint8_t nr_of_candidates; find_aggregation_candidates(&sched_ctrl->aggregation_level, &nr_of_candidates, @@ -276,7 +276,8 @@ void nr_dlsim_preprocessor(module_id_t module_id, int dci_format = sched_ctrl->search_space && sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats ? NR_DL_DCI_FORMAT_1_1 : NR_DL_DCI_FORMAT_1_0; - nr_set_pdsch_semi_static(scc, + nr_set_pdsch_semi_static(module_id, + scc, UE_info->CellGroup[0], sched_ctrl->active_bwp, NULL, diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 3f4be9dd58..264e86be7d 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -2536,8 +2536,8 @@ uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDownlinkBWP, const NR_CellGroupConfig_t *cg, dci_pdu_rel15_t *dci_pdu, nr_dci_format_t format, - nr_rnti_type_t rnti_type, - uint16_t N_RB, + nr_rnti_type_t rnti_type, + uint16_t N_RB, int bwp_id) { uint16_t size = 0; @@ -2568,15 +2568,17 @@ uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDownlinkBWP, srs_config = (ubwpd->srs_Config) ? ubwpd->srs_Config->choice.setup : NULL; } else if (cg){ - bwpd=cg->spCellConfig->spCellConfigDedicated->initialDownlinkBWP; - bwpc=initialDownlinkBWP; - ubwpd=cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP; - ubwpc=initialUplinkBWP; - pdsch_Config = (bwpd->pdsch_Config) ? bwpd->pdsch_Config->choice.setup : NULL; - pdcch_Config = (bwpd->pdcch_Config) ? bwpd->pdcch_Config->choice.setup : NULL; - pucch_Config = (ubwpd->pucch_Config) ? ubwpd->pucch_Config->choice.setup : NULL; - pusch_Config = (ubwpd->pusch_Config) ? ubwpd->pusch_Config->choice.setup : NULL; - srs_config = (ubwpd->srs_Config) ? ubwpd->srs_Config->choice.setup: NULL; + bwpc = initialDownlinkBWP; + ubwpc = initialUplinkBWP; + bwpd = cg->spCellConfig && cg->spCellConfig->spCellConfigDedicated ? + cg->spCellConfig->spCellConfigDedicated->initialDownlinkBWP : NULL; + ubwpd = cg->spCellConfig && cg->spCellConfig->spCellConfigDedicated && cg->spCellConfig->spCellConfigDedicated->uplinkConfig ? + cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP : NULL; + pdsch_Config = (bwpd && bwpd->pdsch_Config) ? bwpd->pdsch_Config->choice.setup : NULL; + pdcch_Config = (bwpd && bwpd->pdcch_Config) ? bwpd->pdcch_Config->choice.setup : NULL; + pucch_Config = (ubwpd && ubwpd->pucch_Config) ? ubwpd->pucch_Config->choice.setup : NULL; + pusch_Config = (ubwpd && ubwpd->pusch_Config) ? ubwpd->pusch_Config->choice.setup : NULL; + srs_config = (ubwpd && ubwpd->srs_Config) ? ubwpd->srs_Config->choice.setup: NULL; } int n_ul_bwp=1,n_dl_bwp=1; diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index abc1a79f68..3b8b5b72bf 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -641,7 +641,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific; bwpd = (void*)CellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP; } - sched_ctrl->search_space = get_searchspace(scc, bwpd, target_ss); + sched_ctrl->search_space = get_searchspace(Mod_idP, scc, bwpd, target_ss); sched_ctrl->coreset = get_coreset(Mod_idP, scc, bwpd, sched_ctrl->search_space, target_ss); sched_ctrl->maxL = 2; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 4172374ee8..f3fa6f971c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -827,7 +827,8 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t dci_pdu_rel15_t uldci_payload; memset(&uldci_payload, 0, sizeof(uldci_payload)); - config_uldci(ubwp, + config_uldci(module_idP, + ubwp, ubwpd, scc, pusch_pdu, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 2b46095e65..c8325c487a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -73,15 +73,22 @@ void calculate_preferred_dl_tda(module_id_t module_id, const NR_BWP_Downlink_t * else { target_ss = NR_SearchSpace__searchSpaceType_PR_common; } - NR_SearchSpace_t *search_space = get_searchspace(scc, bwp ? bwp->bwp_Dedicated : NULL, target_ss); + NR_SearchSpace_t *search_space = get_searchspace(module_id, scc, bwp ? bwp->bwp_Dedicated : NULL, target_ss); NR_ControlResourceSet_t *coreset = get_coreset(module_id, scc, bwp ? bwp->bwp_Dedicated : NULL, search_space, target_ss); // get coreset symbol "map" const uint16_t symb_coreset = (1 << coreset->duration) - 1; /* check that TDA index 0 fits into DL and does not overlap CORESET */ - const struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = bwp ? - bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList : - scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + NR_PDSCH_TimeDomainResourceAllocationList_t *tdaList = NULL; + if (bwp) { + tdaList = bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + } else if (scc) { + tdaList = scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + } else { + NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; + tdaList = sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + } + AssertFatal(tdaList->list.count >= 1, "need to have at least one TDA for DL slots\n"); const NR_PDSCH_TimeDomainResourceAllocation_t *tdaP_DL = tdaList->list.array[0]; AssertFatal(!tdaP_DL->k0 || *tdaP_DL->k0 == 0, @@ -541,12 +548,22 @@ bool allocate_dl_retransmission(module_id_t module_id, NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; NR_sched_pdsch_t *retInfo = &sched_ctrl->harq_processes[current_harq_pid].sched_pdsch; NR_CellGroupConfig_t *cg = UE_info->CellGroup[UE_id]; - NR_BWP_DownlinkDedicated_t *bwpd= cg ? cg->spCellConfig->spCellConfigDedicated->initialDownlinkBWP:NULL; + NR_BWP_DownlinkDedicated_t *bwpd = + cg && + cg->spCellConfig && + cg->spCellConfig->spCellConfigDedicated ? + cg->spCellConfig->spCellConfigDedicated->initialDownlinkBWP : NULL; - NR_BWP_t *genericParameters = sched_ctrl->active_bwp ? - &sched_ctrl->active_bwp->bwp_Common->genericParameters : - &RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon->downlinkConfigCommon->initialDownlinkBWP->genericParameters; + NR_BWP_t *genericParameters = NULL; + if(sched_ctrl->active_bwp) { + genericParameters = &sched_ctrl->active_bwp->bwp_Common->genericParameters; + } else if(RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon) { + genericParameters = &RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon->downlinkConfigCommon->initialDownlinkBWP->genericParameters; + } else { + NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; + genericParameters = &sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.genericParameters; + } const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); int rbStart = 0; // start wrt BWPstart @@ -575,7 +592,7 @@ bool allocate_dl_retransmission(module_id_t module_id, /* check whether we need to switch the TDA allocation since the last * (re-)transmission */ if (ps->time_domain_allocation != tda) - nr_set_pdsch_semi_static(scc, cg, sched_ctrl->active_bwp, bwpd, tda, f, ps); + nr_set_pdsch_semi_static(module_id, scc, cg, sched_ctrl->active_bwp, bwpd, tda, f, ps); } else { /* the retransmission will use a different time domain allocation, check * that we have enough resources */ @@ -585,7 +602,7 @@ bool allocate_dl_retransmission(module_id_t module_id, rbSize++; NR_pdsch_semi_static_t temp_ps; temp_ps.nrOfLayers = 1; - nr_set_pdsch_semi_static(scc, cg, sched_ctrl->active_bwp, bwpd, tda, f, &temp_ps); + nr_set_pdsch_semi_static(module_id, scc, cg, sched_ctrl->active_bwp, bwpd, tda, f, &temp_ps); uint32_t new_tbs; uint16_t new_rbSize; bool success = nr_find_nb_rb(retInfo->Qm, @@ -731,14 +748,26 @@ void pf_dl(module_id_t module_id, *max = UE_sched.next[*max]; *p = -1; NR_CellGroupConfig_t *cg = UE_info->CellGroup[UE_id]; - NR_BWP_DownlinkDedicated_t *bwpd= cg ? cg->spCellConfig->spCellConfigDedicated->initialDownlinkBWP:NULL; + + NR_BWP_DownlinkDedicated_t *bwpd = + cg && + cg->spCellConfig && + cg->spCellConfig->spCellConfigDedicated ? + cg->spCellConfig->spCellConfigDedicated->initialDownlinkBWP : NULL; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; int bwp_Id = sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0; const uint16_t rnti = UE_info->rnti[UE_id]; - NR_BWP_t *genericParameters = sched_ctrl->active_bwp ? - &sched_ctrl->active_bwp->bwp_Common->genericParameters: - &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters; + + NR_BWP_t *genericParameters = NULL; + if(sched_ctrl->active_bwp) { + genericParameters = &sched_ctrl->active_bwp->bwp_Common->genericParameters; + } else if(RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon) { + genericParameters = &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters; + } else { + NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; + genericParameters = &sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.genericParameters; + } const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); int rbStart = 0; // start wrt BWPstart @@ -794,7 +823,7 @@ void pf_dl(module_id_t module_id, sched_ctrl->search_space->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific) ? sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats : 0; if (ps->time_domain_allocation != tda) - nr_set_pdsch_semi_static(scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, bwpd, tda, f, ps); + nr_set_pdsch_semi_static(module_id, scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, bwpd, tda, f, ps); sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, ps->mcsTableIdx); sched_pdsch->R = nr_get_code_rate_dl(sched_pdsch->mcs, ps->mcsTableIdx); sched_pdsch->pucch_allocation = alloc; @@ -833,14 +862,18 @@ void nr_fr1_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t int UE_id = UE_info->list.head; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; - const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_bwp ? - sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth: - scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, - MAX_BWP_SIZE); - const uint16_t BWPStart = NRRIV2PRBOFFSET(sched_ctrl->active_bwp ? - sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth: - scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, - MAX_BWP_SIZE); + NR_BWP_t *genericParameters = NULL; + if(sched_ctrl->active_bwp) { + genericParameters = &sched_ctrl->active_bwp->bwp_Common->genericParameters; + } else if(RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon) { + genericParameters = &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters; + } else { + NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; + genericParameters = &sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.genericParameters; + } + + const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); + const uint16_t BWPStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); uint16_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map; uint8_t rballoc_mask[bwpSize]; @@ -916,7 +949,12 @@ void nr_schedule_ue_spec(module_id_t module_id, NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch; UE_info->mac_stats[UE_id].dlsch_current_bytes = 0; NR_CellGroupConfig_t *cg = UE_info->CellGroup[UE_id]; - NR_BWP_DownlinkDedicated_t *bwpd= cg ? cg->spCellConfig->spCellConfigDedicated->initialDownlinkBWP:NULL; + + NR_BWP_DownlinkDedicated_t *bwpd = + cg && + cg->spCellConfig && + cg->spCellConfig->spCellConfigDedicated ? + cg->spCellConfig->spCellConfigDedicated->initialDownlinkBWP : NULL; /* update TA and set ta_apply every 10 frames. * Possible improvement: take the periodicity from input file. @@ -1000,7 +1038,15 @@ void nr_schedule_ue_spec(module_id_t module_id, * exist, create it */ // BWP - NR_BWP_t *genericParameters = bwp ? &bwp->bwp_Common->genericParameters : &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters; + NR_BWP_t *genericParameters = NULL; + if(bwp) { + genericParameters = &sched_ctrl->active_bwp->bwp_Common->genericParameters; + } else if(RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon) { + genericParameters = &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters; + } else { + NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; + genericParameters = &sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.genericParameters; + } const int bwpid = bwp ? bwp->bwp_Id : 0; const int coresetid = (bwp||bwpd) ? sched_ctrl->coreset->controlResourceSetId : gNB_mac->sched_ctrlCommon->coreset->controlResourceSetId; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 1ded933a62..4c5780e244 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -381,7 +381,7 @@ void nr_preprocessor_phytest(module_id_t module_id, ps->nrOfLayers = target_dl_Nl; if (ps->time_domain_allocation != tda) nr_set_pdsch_semi_static( - scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, NULL, tda, f, ps); + module_id, scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, NULL, tda, f, ps); sched_pdsch->mcs = target_dl_mcs; sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, ps->mcsTableIdx); @@ -438,7 +438,7 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_ "time domain assignment %d >= %d\n", tda, tdaList->list.count); - int K2 = get_K2(scc,sched_ctrl->active_ubwp, tda, mu); + int K2 = get_K2(scc,NULL,sched_ctrl->active_ubwp, tda, mu); const int sched_frame = frame + (slot + K2 >= nr_slots_per_frame[mu]); const int sched_slot = (slot + K2) % nr_slots_per_frame[mu]; /* check if slot is UL, and that slot is 8 (assuming K2=6 because of UE @@ -459,7 +459,7 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_ if (ps->time_domain_allocation != tda || ps->dci_format != dci_format || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data) - nr_set_pusch_semi_static(scc, sched_ctrl->active_ubwp, NULL,dci_format, tda, num_dmrs_cdm_grps_no_data, ps); + nr_set_pusch_semi_static(module_id, scc, sched_ctrl->active_ubwp, NULL,dci_format, tda, num_dmrs_cdm_grps_no_data, ps); uint16_t rbStart = 0; uint16_t rbSize; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 7b7b5c771b..465a621437 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -188,17 +188,31 @@ NR_ControlResourceSet_t *get_coreset(module_id_t module_idP, } } -NR_SearchSpace_t *get_searchspace(NR_ServingCellConfigCommon_t *scc, - NR_BWP_DownlinkDedicated_t *bwp_Dedicated, - NR_SearchSpace__searchSpaceType_PR target_ss) { +NR_SearchSpace_t *get_searchspace(module_id_t module_id, + NR_ServingCellConfigCommon_t *scc, + NR_BWP_DownlinkDedicated_t *bwp_Dedicated, + NR_SearchSpace__searchSpaceType_PR target_ss) { + + int n = 0; + if(bwp_Dedicated) { + n = bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count; + } else if(scc) { + n = scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list.count; + } else { + NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; + n = sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list.count; + } - const int n = bwp_Dedicated ? - bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count: - scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list.count; for (int i=0;ipdcch_Config->choice.setup->searchSpacesToAddModList->list.array[i]: - scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list.array[i]; + NR_SearchSpace_t *ss = NULL; + if(bwp_Dedicated) { + ss = bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.array[i]; + } else if(scc) { + ss = scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list.array[i]; + } else { + NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; + ss = sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list.array[i]; + } AssertFatal(ss->controlResourceSetId != NULL, "ss->controlResourceSetId is null\n"); AssertFatal(ss->searchSpaceType != NULL, "ss->searchSpaceType is null\n"); if (ss->searchSpaceType->present == target_ss) { @@ -301,19 +315,27 @@ bool nr_find_nb_rb(uint16_t Qm, return *tbs >= bytes && *nb_rb <= nb_rb_max; } -void nr_set_pdsch_semi_static(const NR_ServingCellConfigCommon_t *scc, +void nr_set_pdsch_semi_static(module_id_t module_id, + const NR_ServingCellConfigCommon_t *scc, const NR_CellGroupConfig_t *secondaryCellGroup, const NR_BWP_Downlink_t *bwp, const NR_BWP_DownlinkDedicated_t *bwpd0, int tda, const long dci_format, - NR_pdsch_semi_static_t *ps) -{ + NR_pdsch_semi_static_t *ps) { + ps->time_domain_allocation = tda; - const struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = bwp ? - bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList : - scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + NR_PDSCH_TimeDomainResourceAllocationList_t *tdaList = NULL; + if(bwp) { + tdaList = bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + } else if(scc) { + tdaList = scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + } else { + NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; + tdaList = sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + } + AssertFatal(tda < tdaList->list.count, "time_domain_allocation %d>=%d\n", tda, tdaList->list.count); const int mapping_type = tdaList->list.array[tda]->mappingType; const int startSymbolAndLength = tdaList->list.array[tda]->startSymbolAndLength; @@ -327,7 +349,8 @@ void nr_set_pdsch_semi_static(const NR_ServingCellConfigCommon_t *scc, } ps->mcsTableIdx = 0; - if (bwpd->pdsch_Config && + if (bwpd && + bwpd->pdsch_Config && bwpd->pdsch_Config->choice.setup && bwpd->pdsch_Config->choice.setup->mcs_Table) { if (*bwpd->pdsch_Config->choice.setup->mcs_Table == 0) @@ -344,32 +367,39 @@ void nr_set_pdsch_semi_static(const NR_ServingCellConfigCommon_t *scc, ps->dmrsConfigType = bwp!=NULL ? (bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1) : 0; ps->N_PRB_DMRS = ps->numDmrsCdmGrpsNoData * (ps->dmrsConfigType == NFAPI_NR_DMRS_TYPE1 ? 6 : 4); - ps->dl_dmrs_symb_pos = fill_dmrs_mask(bwpd ? bwpd->pdsch_Config->choice.setup : NULL, scc->dmrs_TypeA_Position, ps->nrOfSymbols, ps->startSymbolIndex, mapping_type); + ps->dl_dmrs_symb_pos = fill_dmrs_mask(bwpd ? bwpd->pdsch_Config->choice.setup : NULL, scc ? scc->dmrs_TypeA_Position : 0, ps->nrOfSymbols, ps->startSymbolIndex, mapping_type); ps->N_DMRS_SLOT = get_num_dmrs(ps->dl_dmrs_symb_pos); LOG_D(NR_MAC,"bwpd0 %p, bwpd %p : Filling dmrs info, ps->N_PRB_DMRS %d, ps->dl_dmrs_symb_pos %x, ps->N_DMRS_SLOT %d\n",bwpd0,bwpd,ps->N_PRB_DMRS,ps->dl_dmrs_symb_pos,ps->N_DMRS_SLOT); } -void nr_set_pusch_semi_static(const NR_ServingCellConfigCommon_t *scc, +void nr_set_pusch_semi_static(module_id_t module_id, + const NR_ServingCellConfigCommon_t *scc, const NR_BWP_Uplink_t *ubwp, const NR_BWP_UplinkDedicated_t *ubwpd, long dci_format, int tda, uint8_t num_dmrs_cdm_grps_no_data, - NR_pusch_semi_static_t *ps) -{ + NR_pusch_semi_static_t *ps) { ps->dci_format = dci_format; ps->time_domain_allocation = tda; - const struct NR_PUSCH_TimeDomainResourceAllocationList *tdaList = - ubwp? - ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList: - scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList ; + NR_PUSCH_TimeDomainResourceAllocationList_t *tdaList = NULL; + if(ubwp) { + tdaList = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; + } else if(scc) { + tdaList = scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; + } else { + NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; + tdaList = sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; + } + const int startSymbolAndLength = tdaList->list.array[tda]->startSymbolAndLength; SLIV2SL(startSymbolAndLength, &ps->startSymbolIndex, &ps->nrOfSymbols); - ps->pusch_Config = ubwp?ubwp->bwp_Dedicated->pusch_Config->choice.setup:(ubwpd ? ubwpd->pusch_Config->choice.setup : NULL); + ps->pusch_Config = ubwp && ubwp->bwp_Dedicated && ubwp->bwp_Dedicated->pusch_Config ? + ubwp->bwp_Dedicated->pusch_Config->choice.setup : (ubwpd ? ubwpd->pusch_Config->choice.setup : NULL); if (ps->pusch_Config == NULL || !ps->pusch_Config->transformPrecoder) ps->transform_precoding = !scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder; else @@ -643,7 +673,8 @@ void nr_configure_css_dci_initial(nfapi_nr_dl_tti_pdcch_pdu_rel15_t* pdcch_pdu, } -void config_uldci(const NR_BWP_Uplink_t *ubwp, +void config_uldci(module_id_t module_id, + const NR_BWP_Uplink_t *ubwp, const NR_BWP_UplinkDedicated_t *ubwpd, const NR_ServingCellConfigCommon_t *scc, const nfapi_nr_pusch_pdu_t *pusch_pdu, @@ -654,9 +685,17 @@ void config_uldci(const NR_BWP_Uplink_t *ubwp, int n_ubwp, int bwp_id) { - const int bw = NRRIV2BW(ubwp ? - ubwp->bwp_Common->genericParameters.locationAndBandwidth : - scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + NR_BWP_t *genericParameters = NULL; + if(ubwp) { + genericParameters = &ubwp->bwp_Common->genericParameters; + } else if(scc) { + genericParameters = &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; + } else { + NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; + genericParameters = &sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.genericParameters; + } + + const int bw = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); dci_pdu_rel15->frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0(pusch_pdu->rb_size, pusch_pdu->rb_start, bw); @@ -814,7 +853,8 @@ void nr_configure_pdcch(gNB_MAC_INST *gNB_mac, // This function configures pucch pdu fapi structure -void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, +void nr_configure_pucch(module_id_t module_id, + nfapi_nr_pucch_pdu_t* pucch_pdu, NR_ServingCellConfigCommon_t *scc, NR_CellGroupConfig_t *CellGroup, NR_BWP_Uplink_t *bwp, @@ -842,7 +882,13 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, uint16_t O_uci = O_csi + O_ack; - NR_PUSCH_Config_t *pusch_Config = bwp ? bwp->bwp_Dedicated->pusch_Config->choice.setup : bwpd->pusch_Config->choice.setup; + NR_PUSCH_Config_t *pusch_Config = NULL; + if(bwp && bwp->bwp_Dedicated && bwp->bwp_Dedicated->pusch_Config) { + pusch_Config = bwp->bwp_Dedicated->pusch_Config->choice.setup; + } else if(bwpd && bwpd->pusch_Config) { + pusch_Config = bwpd->pusch_Config->choice.setup; + } + long *pusch_id = pusch_Config ? pusch_Config->dataScramblingIdentityPUSCH : NULL; if (pusch_Config && pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA != NULL) @@ -851,9 +897,16 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, id0 = pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->transformPrecodingDisabled->scramblingID0; else id0 = scc->physCellId; - NR_PUCCH_ConfigCommon_t *pucch_ConfigCommon = bwp ? - bwp->bwp_Common->pucch_ConfigCommon->choice.setup : - scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup; + NR_PUCCH_ConfigCommon_t *pucch_ConfigCommon = NULL; + if(bwp) { + pucch_ConfigCommon = bwp->bwp_Common->pucch_ConfigCommon->choice.setup; + } else if(scc) { + pucch_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup; + } else { + NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; + pucch_ConfigCommon = sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.pucch_ConfigCommon->choice.setup; + } + // hop flags and hopping id are valid for any BWP switch (pucch_ConfigCommon->pucch_GroupHopping){ case 0 : @@ -879,9 +932,17 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, pucch_pdu->hopping_id = *pucch_ConfigCommon->hoppingId; else pucch_pdu->hopping_id = *scc->physCellId; - NR_BWP_t *genericParameters = bwp ? - &bwp->bwp_Common->genericParameters: - &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; + + NR_BWP_t *genericParameters = NULL; + if (bwp) { + genericParameters = &bwp->bwp_Common->genericParameters; + } else if (scc) { + genericParameters = &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; + } else { + NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; + genericParameters = &sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.genericParameters; + } + pucch_pdu->bwp_size = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); pucch_pdu->bwp_start = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); pucch_pdu->subcarrier_spacing = genericParameters->subcarrierSpacing; @@ -890,9 +951,8 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, LOG_D(NR_MAC,"pucch_acknak: Filling dedicated configuration for PUCCH\n"); // we have either a dedicated BWP or Dedicated PUCCH configuration on InitialBWP AssertFatal(bwp!=NULL || bwpd!=NULL,"We need one dedicated configuration for a BWP (neither additional or initial BWP has a dedicated configuration)\n"); - pucch_Config = bwp ? - bwp->bwp_Dedicated->pucch_Config->choice.setup: - bwpd->pucch_Config->choice.setup; + pucch_Config = bwp && bwp->bwp_Dedicated && bwp->bwp_Dedicated->pucch_Config ? + bwp->bwp_Dedicated->pucch_Config->choice.setup : bwpd->pucch_Config->choice.setup; AssertFatal(pucch_Config->resourceSetToAddModList!=NULL, "PUCCH resourceSetToAddModList is null\n"); @@ -1964,7 +2024,7 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG /* set illegal time domain allocation to force recomputation of all fields */ sched_ctrl->pdsch_semi_static.time_domain_allocation = -1; sched_ctrl->pusch_semi_static.time_domain_allocation = -1; - const NR_ServingCellConfig_t *servingCellConfig = CellGroup ? CellGroup->spCellConfig->spCellConfigDedicated : NULL; + const NR_ServingCellConfig_t *servingCellConfig = CellGroup && CellGroup->spCellConfig ? CellGroup->spCellConfig->spCellConfigDedicated : NULL; /* Set default BWPs */ const struct NR_ServingCellConfig__downlinkBWP_ToAddModList *bwpList = servingCellConfig ? servingCellConfig->downlinkBWP_ToAddModList : NULL; @@ -1974,7 +2034,7 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG const int bwp_id = servingCellConfig ? *servingCellConfig->firstActiveDownlinkBWP_Id : 0; sched_ctrl->active_bwp = bwpList && bwp_id > 0 ? bwpList->list.array[bwp_id - 1] : NULL; const int target_ss = sched_ctrl->active_bwp ? NR_SearchSpace__searchSpaceType_PR_ue_Specific : NR_SearchSpace__searchSpaceType_PR_common; - sched_ctrl->search_space = get_searchspace(scc, + sched_ctrl->search_space = get_searchspace(mod_idP, scc, sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Dedicated : NULL, target_ss); sched_ctrl->coreset = get_coreset(mod_idP, scc, @@ -2145,12 +2205,7 @@ void get_pdsch_to_harq_feedback(int Mod_idP, bwpd = CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]->bwp_Dedicated; ubwpd = CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_id-1]->bwp_Dedicated; } - else if (CellGroup) { // this is an initialBWP - AssertFatal((bwpd=CellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP)!=NULL, - "CellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP is null\n"); - AssertFatal((ubwpd=CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP)!=NULL, - "CellGroup->spCellConfig->spCellConfigDedicated->uplnikConfig->initialUplinkBWP is null\n"); - } + NR_SearchSpace_t *ss=NULL; // common search type uses DCI format 1_0 diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index ca641ed1ba..0c474baf13 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -75,11 +75,13 @@ void nr_fill_nfapi_pucch(module_id_t mod_id, NR_ServingCellConfigCommon_t *scc = RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon; NR_CellGroupConfig_t *cg=UE_info->CellGroup[UE_id]; - NR_BWP_UplinkDedicated_t *ubwpd; - ubwpd = cg ? cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP:NULL; + NR_BWP_UplinkDedicated_t *ubwpd = cg && cg->spCellConfig && cg->spCellConfig->spCellConfigDedicated && + cg->spCellConfig->spCellConfigDedicated->uplinkConfig ? + cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP : NULL; LOG_D(NR_MAC,"pucch_acknak: %d.%d Calling nr_configure_pucch (ubwpd %p,r_pucch %d) pucch in %d.%d\n",frame,slot,ubwpd,pucch->r_pucch,pucch->frame,pucch->ul_slot); - nr_configure_pucch(pucch_pdu, + nr_configure_pucch(mod_id, + pucch_pdu, scc, UE_info->CellGroup[UE_id], UE_info->UE_sched_ctrl[UE_id].active_ubwp, @@ -521,9 +523,16 @@ void nr_csi_meas_reporting(int Mod_idP, curr_pucch->csi_bits += nr_get_csi_bitlen(Mod_idP,UE_id,csi_report_id); - NR_BWP_t *genericParameters = sched_ctrl->active_ubwp ? - &sched_ctrl->active_ubwp->bwp_Common->genericParameters: - &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; + NR_BWP_t *genericParameters = NULL; + if(sched_ctrl->active_ubwp) { + genericParameters = &sched_ctrl->active_ubwp->bwp_Common->genericParameters; + } else if(scc) { + genericParameters = &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; + } else { + NR_SIB1_t *sib1 = RC.nrmac[Mod_idP]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; + genericParameters = &sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.genericParameters; + } + int bwp_start = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); // going through the list of PUCCH resources to find the one indexed by resource_id @@ -1411,9 +1420,16 @@ int nr_acknack_scheduling(int mod_id, pucch_Config = RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup; } - NR_BWP_t *genericParameters = sched_ctrl->active_ubwp ? - &sched_ctrl->active_ubwp->bwp_Common->genericParameters: - &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; + NR_BWP_t *genericParameters = NULL; + if(sched_ctrl->active_ubwp) { + genericParameters = &sched_ctrl->active_ubwp->bwp_Common->genericParameters; + } else if(scc) { + genericParameters = &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; + } else { + NR_SIB1_t *sib1 = RC.nrmac[mod_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; + genericParameters = &sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.genericParameters; + } + int bwp_start = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); /* verify that at that slot and symbol, resources are free. We only do this diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index fcfbc180fd..d86f03d6d2 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -55,9 +55,21 @@ void calculate_preferred_ul_tda(module_id_t module_id, const NR_BWP_Uplink_t *ub /* there is a mixed slot only when in TDD */ NR_ServingCellConfigCommon_t *scc = nrmac->common_channels->ServingCellConfigCommon; - const int mu = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing; - const NR_TDD_UL_DL_Pattern_t *tdd = - scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL; + NR_ServingCellConfigCommonSIB_t *scc_sib1 = get_softmodem_params()->sa ? + RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1->servingCellConfigCommon : NULL; + + AssertFatal(scc!=NULL || scc_sib1!=NULL,"We need one serving cell config common\n"); + + const int mu = scc ? scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing : + scc_sib1->uplinkConfigCommon->initialUplinkBWP.genericParameters.subcarrierSpacing; + + NR_TDD_UL_DL_Pattern_t *tdd = NULL; + if (scc && scc->tdd_UL_DL_ConfigurationCommon) { + tdd = &scc->tdd_UL_DL_ConfigurationCommon->pattern1; + } else if (scc_sib1 && scc_sib1->tdd_UL_DL_ConfigurationCommon) { + tdd = &scc_sib1->tdd_UL_DL_ConfigurationCommon->pattern1; + } + /* Uplink symbols are at the end of the slot */ const int symb_ulMixed = tdd ? ((1 << tdd->nrofUplinkSymbols) - 1) << (14 - tdd->nrofUplinkSymbols) : 0; @@ -101,7 +113,7 @@ void calculate_preferred_ul_tda(module_id_t module_id, const NR_BWP_Uplink_t *ub /* check that TDA index 1 fits into UL slot and does not overlap with PUCCH */ const struct NR_PUSCH_TimeDomainResourceAllocationList *tdaList = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; const NR_PUSCH_TimeDomainResourceAllocation_t *tdaP_UL = tdaList->list.array[0]; - const int k2 = get_K2(scc, (NR_BWP_Uplink_t*)ubwp,0, mu); + const int k2 = get_K2(scc, scc_sib1, (NR_BWP_Uplink_t*)ubwp,0, mu); int start, len; SLIV2SL(tdaP_UL->startSymbolAndLength, &start, &len); const uint16_t symb_tda = ((1 << len) - 1) << start; @@ -114,10 +126,10 @@ void calculate_preferred_ul_tda(module_id_t module_id, const NR_BWP_Uplink_t *ub int tdaMi = -1; if(tdaList->list.count > 1) { const NR_PUSCH_TimeDomainResourceAllocation_t *tdaP_Mi = tdaList->list.array[1]; - AssertFatal(k2 == get_K2(scc, (NR_BWP_Uplink_t*)ubwp, 1, mu), + AssertFatal(k2 == get_K2(scc, scc_sib1, (NR_BWP_Uplink_t*)ubwp, 1, mu), "scheduler cannot handle different k2 for UL slot (%d) and UL Mixed slot (%ld)\n", k2, - get_K2(scc, (NR_BWP_Uplink_t*)ubwp, 1, mu)); + get_K2(scc, scc_sib1, (NR_BWP_Uplink_t*)ubwp, 1, mu)); SLIV2SL(tdaP_Mi->startSymbolAndLength, &start, &len); const uint16_t symb_tda_mi = ((1 << len) - 1) << start; // check whether PUCCH and TDA overlap: then, we cannot use it. Also, check @@ -135,7 +147,7 @@ void calculate_preferred_ul_tda(module_id_t module_id, const NR_BWP_Uplink_t *ub } } const uint8_t slots_per_frame[5] = {10, 20, 40, 80, 160}; - const int n = slots_per_frame[*scc->ssbSubcarrierSpacing]; + const int n = slots_per_frame[mu]; nrmac->preferred_ul_tda[bwp_id] = malloc(n * sizeof(*nrmac->preferred_ul_tda[bwp_id])); const int nr_mix_slots = tdd ? tdd->nrofDownlinkSymbols != 0 || tdd->nrofUplinkSymbols != 0 : 0; @@ -879,11 +891,21 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, } } -long get_K2(NR_ServingCellConfigCommon_t *scc,NR_BWP_Uplink_t *ubwp, int time_domain_assignment, int mu) { - DevAssert(scc); - const NR_PUSCH_TimeDomainResourceAllocation_t *tda_list = ubwp ? - ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[time_domain_assignment]: - scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[time_domain_assignment]; +long get_K2(NR_ServingCellConfigCommon_t *scc, + NR_ServingCellConfigCommonSIB_t *scc_sib1, + NR_BWP_Uplink_t *ubwp, + int time_domain_assignment, + int mu) { + + NR_PUSCH_TimeDomainResourceAllocation_t *tda_list = NULL; + if(ubwp) { + tda_list = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[time_domain_assignment]; + } else if(scc) { + tda_list = scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[time_domain_assignment]; + } else if(scc_sib1) { + tda_list = scc_sib1->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[time_domain_assignment]; + } + if (tda_list->k2) return *tda_list->k2; else if (mu < 2) @@ -943,8 +965,21 @@ bool allocate_ul_retransmission(module_id_t module_id, NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; NR_sched_pusch_t *retInfo = &sched_ctrl->ul_harq_processes[harq_pid].sched_pusch; NR_CellGroupConfig_t *cg = UE_info->CellGroup[UE_id]; - NR_BWP_UplinkDedicated_t *ubwpd= cg ? cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP:NULL; - NR_BWP_t *genericParameters = sched_ctrl->active_ubwp ? &sched_ctrl->active_ubwp->bwp_Common->genericParameters : &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; + + NR_BWP_UplinkDedicated_t *ubwpd = cg && cg->spCellConfig && cg->spCellConfig->spCellConfigDedicated && + cg->spCellConfig->spCellConfigDedicated->uplinkConfig ? + cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP : NULL; + + NR_BWP_t *genericParameters = NULL; + if (sched_ctrl->active_ubwp) { + genericParameters = &sched_ctrl->active_ubwp->bwp_Common->genericParameters; + } else if (scc) { + genericParameters = &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; + } else { + NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; + genericParameters = &sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.genericParameters; + } + int rbStart = 0; // wrt BWP start const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); @@ -969,7 +1004,7 @@ bool allocate_ul_retransmission(module_id_t module_id, if (ps->time_domain_allocation != tda || ps->dci_format != dci_format || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data) - nr_set_pusch_semi_static(scc, sched_ctrl->active_ubwp, ubwpd, dci_format, tda, num_dmrs_cdm_grps_no_data, ps); + nr_set_pusch_semi_static(module_id, scc, sched_ctrl->active_ubwp, ubwpd, dci_format, tda, num_dmrs_cdm_grps_no_data, ps); LOG_D(NR_MAC, "%s(): retransmission keeping TDA %d and TBS %d\n", __func__, tda, retInfo->tb_size); } else { /* the retransmission will use a different time domain allocation, check @@ -981,7 +1016,7 @@ bool allocate_ul_retransmission(module_id_t module_id, rbSize++; NR_pusch_semi_static_t temp_ps; int dci_format = get_dci_format(sched_ctrl); - nr_set_pusch_semi_static(scc, sched_ctrl->active_ubwp,ubwpd, dci_format, tda, num_dmrs_cdm_grps_no_data, &temp_ps); + nr_set_pusch_semi_static(module_id, scc, sched_ctrl->active_ubwp,ubwpd, dci_format, tda, num_dmrs_cdm_grps_no_data, &temp_ps); uint32_t new_tbs; uint16_t new_rbSize; bool success = nr_find_nb_rb(retInfo->Qm, @@ -1080,10 +1115,22 @@ void pf_ul(module_id_t module_id, LOG_D(NR_MAC,"pf_ul: preparing UL scheduling for UE %d\n",UE_id); NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; - NR_BWP_t *genericParameters = sched_ctrl->active_ubwp ? &sched_ctrl->active_ubwp->bwp_Common->genericParameters : &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; + + NR_BWP_t *genericParameters = NULL; + if (sched_ctrl->active_ubwp) { + genericParameters = &sched_ctrl->active_ubwp->bwp_Common->genericParameters; + } else if (scc) { + genericParameters = &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; + } else { + NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; + genericParameters = &sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.genericParameters; + } + int rbStart = 0; // wrt BWP start NR_CellGroupConfig_t *cg = UE_info->CellGroup[UE_id]; - NR_BWP_UplinkDedicated_t *ubwpd= cg ? cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP : NULL; + NR_BWP_UplinkDedicated_t *ubwpd = cg && cg->spCellConfig && cg->spCellConfig->spCellConfigDedicated && + cg->spCellConfig->spCellConfigDedicated->uplinkConfig ? + cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP : NULL; const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; @@ -1154,7 +1201,7 @@ void pf_ul(module_id_t module_id, if (ps->time_domain_allocation != tda || ps->dci_format != dci_format || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data) - nr_set_pusch_semi_static(scc, sched_ctrl->active_ubwp, ubwpd, dci_format, tda, num_dmrs_cdm_grps_no_data, ps); + nr_set_pusch_semi_static(module_id, scc, sched_ctrl->active_ubwp, ubwpd, dci_format, tda, num_dmrs_cdm_grps_no_data, ps); NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; sched_pusch->mcs = 9; update_ul_ue_R_Qm(sched_pusch, ps); @@ -1223,8 +1270,20 @@ void pf_ul(module_id_t module_id, NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; NR_CellGroupConfig_t *cg = UE_info->CellGroup[UE_id]; - NR_BWP_UplinkDedicated_t *ubwpd= cg ? cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP:NULL; - NR_BWP_t *genericParameters = sched_ctrl->active_ubwp ? &sched_ctrl->active_ubwp->bwp_Common->genericParameters : &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; + NR_BWP_UplinkDedicated_t *ubwpd = cg && cg->spCellConfig && cg->spCellConfig->spCellConfigDedicated + && cg->spCellConfig->spCellConfigDedicated->uplinkConfig ? + cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP : NULL; + + NR_BWP_t *genericParameters = NULL; + if (sched_ctrl->active_ubwp) { + genericParameters = &sched_ctrl->active_ubwp->bwp_Common->genericParameters; + } else if (scc) { + genericParameters = &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; + } else { + NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; + genericParameters = &sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.genericParameters; + } + int rbStart = sched_ctrl->active_ubwp ? NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE) : 0; const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; @@ -1253,7 +1312,7 @@ void pf_ul(module_id_t module_id, if (ps->time_domain_allocation != tda || ps->dci_format != dci_format || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data) - nr_set_pusch_semi_static(scc, sched_ctrl->active_ubwp, ubwpd, dci_format, tda, num_dmrs_cdm_grps_no_data, ps); + nr_set_pusch_semi_static(module_id, scc, sched_ctrl->active_ubwp, ubwpd, dci_format, tda, num_dmrs_cdm_grps_no_data, ps); update_ul_ue_R_Qm(sched_pusch, ps); /* Calculate the current scheduling bytes and the necessary RBs */ @@ -1285,7 +1344,14 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t gNB_MAC_INST *nr_mac = RC.nrmac[module_id]; NR_COMMON_channels_t *cc = nr_mac->common_channels; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; - const int mu = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing; + NR_ServingCellConfigCommonSIB_t *scc_sib1 = get_softmodem_params()->sa ? + RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1->servingCellConfigCommon : NULL; + + AssertFatal(scc!=NULL || scc_sib1!=NULL,"We need one serving cell config common\n"); + + const int mu = scc ? scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing : + scc_sib1->uplinkConfigCommon->initialUplinkBWP.genericParameters.subcarrierSpacing; + NR_UE_info_t *UE_info = &nr_mac->UE_info; if (UE_info->num_UEs == 0) @@ -1302,7 +1368,7 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t const int tda = sched_ctrl->active_ubwp ? nr_mac->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot] : 0; if (tda < 0) return false; - int K2 = get_K2(scc, sched_ctrl->active_ubwp, tda, mu); + int K2 = get_K2(scc, scc_sib1, sched_ctrl->active_ubwp, tda, mu); const int sched_frame = frame + (slot + K2 >= nr_slots_per_frame[mu]); const int sched_slot = (slot + K2) % nr_slots_per_frame[mu]; @@ -1320,8 +1386,8 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t sched_ctrl->sched_pusch.frame = sched_frame; for (UE_id = UE_info->list.next[UE_id]; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) { NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; - AssertFatal(K2 == get_K2(scc,sched_ctrl->active_ubwp, tda, mu), - "Different K2, %d(UE%d) != %ld(UE%d)\n", K2, 0, get_K2(scc,sched_ctrl->active_ubwp, tda, mu), UE_id); + AssertFatal(K2 == get_K2(scc,scc_sib1,sched_ctrl->active_ubwp, tda, mu), + "Different K2, %d(UE%d) != %ld(UE%d)\n", K2, 0, get_K2(scc,scc_sib1,sched_ctrl->active_ubwp, tda, mu), UE_id); sched_ctrl->sched_pusch.slot = sched_slot; sched_ctrl->sched_pusch.frame = sched_frame; } @@ -1331,17 +1397,30 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t * Calculate largest contiguous RBs */ uint16_t *vrb_map_UL = &RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[sched_slot * MAX_BWP_SIZE]; - const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_ubwp ? - sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth: - scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, - MAX_BWP_SIZE); - const uint16_t bwpStart = NRRIV2PRBOFFSET(sched_ctrl->active_ubwp ? - sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth: - scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, - MAX_BWP_SIZE); - const struct NR_PUSCH_TimeDomainResourceAllocationList *tdaList = sched_ctrl->active_ubwp ? - sched_ctrl->active_ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList: - scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; + + NR_BWP_t *genericParameters = NULL; + if (sched_ctrl->active_ubwp) { + genericParameters = &sched_ctrl->active_ubwp->bwp_Common->genericParameters; + } else if (scc) { + genericParameters = &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; + } else { + NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; + genericParameters = &sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.genericParameters; + } + + const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); + const uint16_t bwpStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); + + NR_PUSCH_TimeDomainResourceAllocationList_t *tdaList = NULL; + if (sched_ctrl->active_ubwp) { + tdaList = sched_ctrl->active_ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; + } else if (scc) { + tdaList = scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; + } else { + NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; + tdaList = sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; + } + const int startSymbolAndLength = tdaList->list.array[tda]->startSymbolAndLength; int startSymbolIndex, nrOfSymbols; SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); @@ -1443,7 +1522,11 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot) if (sched_ctrl->ul_failure == 1 && get_softmodem_params()->phy_test==0) continue; NR_CellGroupConfig_t *cg = UE_info->CellGroup[UE_id]; - NR_BWP_UplinkDedicated_t *ubwpd= cg ? cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP:NULL; + + NR_BWP_UplinkDedicated_t *ubwpd = cg && cg->spCellConfig && cg->spCellConfig->spCellConfigDedicated && + cg->spCellConfig->spCellConfigDedicated->uplinkConfig ? + cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP : NULL; + UE_info->mac_stats[UE_id].ulsch_current_bytes = 0; /* dynamic PUSCH values (RB alloc, MCS, hence R, Qm, TBS) that change in @@ -1564,7 +1647,16 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot) pusch_pdu->handle = 0; //not yet used /* FAPI: BWP */ - NR_BWP_t *genericParameters = sched_ctrl->active_ubwp ? &sched_ctrl->active_ubwp->bwp_Common->genericParameters:&scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; + NR_BWP_t *genericParameters = NULL; + if (sched_ctrl->active_ubwp) { + genericParameters = &sched_ctrl->active_ubwp->bwp_Common->genericParameters; + } else if (scc) { + genericParameters = &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; + } else { + NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; + genericParameters = &sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.genericParameters; + } + pusch_pdu->bwp_size = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); pusch_pdu->bwp_start = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); pusch_pdu->subcarrier_spacing = genericParameters->subcarrierSpacing; @@ -1706,10 +1798,16 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot) dci_pdu_rel15_t uldci_payload; memset(&uldci_payload, 0, sizeof(uldci_payload)); int n_ubwp=1; - if (cg->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList) - n_ubwp = cg->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count; + if (cg && + cg->spCellConfig && + cg->spCellConfig->spCellConfigDedicated && + cg->spCellConfig->spCellConfigDedicated->uplinkConfig && + cg->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList) { + n_ubwp = cg->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count; + } - config_uldci(sched_ctrl->active_ubwp, + config_uldci(module_id, + sched_ctrl->active_ubwp, ubwpd, scc, pusch_pdu, diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index e88899f539..83c4d3d950 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -176,7 +176,8 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234); -void config_uldci(const NR_BWP_Uplink_t *ubwp, +void config_uldci(module_id_t module_id, + const NR_BWP_Uplink_t *ubwp, const NR_BWP_UplinkDedicated_t *ubwpd, const NR_ServingCellConfigCommon_t *scc, const nfapi_nr_pusch_pdu_t *pusch_pdu, @@ -233,7 +234,8 @@ int nr_is_dci_opportunity(nfapi_nr_search_space_t search_space, nfapi_nr_config_request_scf_t cfg); */ -void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, +void nr_configure_pucch(module_id_t module_id, + nfapi_nr_pucch_pdu_t* pucch_pdu, NR_ServingCellConfigCommon_t *scc, NR_CellGroupConfig_t *CellGroup, NR_BWP_Uplink_t *bwp, @@ -279,13 +281,19 @@ NR_ControlResourceSet_t *get_coreset(module_id_t module_idP, NR_SearchSpace__searchSpaceType_PR ss_type); /* find a search space within a BWP */ -NR_SearchSpace_t *get_searchspace(NR_ServingCellConfigCommon_t *scc, +NR_SearchSpace_t *get_searchspace(module_id_t module_id, + NR_ServingCellConfigCommon_t *scc, NR_BWP_DownlinkDedicated_t *bwp_Dedicated, NR_SearchSpace__searchSpaceType_PR target_ss); -long get_K2(NR_ServingCellConfigCommon_t *scc, NR_BWP_Uplink_t *ubwp, int time_domain_assignment, int mu); +long get_K2(NR_ServingCellConfigCommon_t *scc, + NR_ServingCellConfigCommonSIB_t *scc_sib1, + NR_BWP_Uplink_t *ubwp, + int time_domain_assignment, + int mu); -void nr_set_pdsch_semi_static(const NR_ServingCellConfigCommon_t *scc, +void nr_set_pdsch_semi_static(module_id_t module_id, + const NR_ServingCellConfigCommon_t *scc, const NR_CellGroupConfig_t *secondaryCellGroup, const NR_BWP_Downlink_t *bwp, const NR_BWP_DownlinkDedicated_t *bwpd0, @@ -293,9 +301,10 @@ void nr_set_pdsch_semi_static(const NR_ServingCellConfigCommon_t *scc, const long dci_format, NR_pdsch_semi_static_t *ps); -void nr_set_pusch_semi_static(const NR_ServingCellConfigCommon_t *scc, +void nr_set_pusch_semi_static(module_id_t module_id, + const NR_ServingCellConfigCommon_t *scc, const NR_BWP_Uplink_t *ubwp, - const NR_BWP_UplinkDedicated_t *ubwpd, + const NR_BWP_UplinkDedicated_t *ubwpd, long dci_format, int tda, uint8_t num_dmrs_cdm_grps_no_data, From c30f478df9440a0b28524e774eb46ce65ed4bbda Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Wed, 2 Feb 2022 15:18:06 +0000 Subject: [PATCH 06/46] Improve PUCCH configuration procedures --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 8 ++------ openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 16 ++++++++++++++-- .../LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 8 +++++++- .../LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 2 +- 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index f3fa6f971c..f396f88284 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -1488,12 +1488,8 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra return; } - int n_rb=0; - for (int i=0;i<6;i++) - for (int j=0;j<8;j++) { - n_rb+=((coreset->frequencyDomainResources.buf[i]>>j)&1); - } - n_rb*=6; + int n_rb,rb_offset; + get_coreset_rballoc(coreset->frequencyDomainResources.buf,&n_rb,&rb_offset); const uint16_t N_cce = n_rb * coreset->duration / NR_NB_REG_PER_CCE; const int delta_PRI=0; int r_pucch = ((CCEIndex<<1)/N_cce)+(delta_PRI<<1); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index c8325c487a..efcccaaff0 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -635,7 +635,13 @@ bool allocate_dl_retransmission(module_id_t module_id, /* Find PUCCH occasion: if it fails, undo CCE allocation (undoing PUCCH * allocation after CCE alloc fail would be more complex) */ - const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot, -1, 0); + int n_rb,rb_offset; + get_coreset_rballoc(sched_ctrl->coreset->frequencyDomainResources.buf,&n_rb,&rb_offset); + const uint16_t N_cce = n_rb * sched_ctrl->coreset->duration / NR_NB_REG_PER_CCE; + const int delta_PRI=0; + int r_pucch = ((sched_ctrl->cce_index<<1)/N_cce)+(delta_PRI<<1); + + const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot, r_pucch, 0); if (alloc<0) { LOG_D(MAC, "%s(): could not find PUCCH for UE %d/%04x@%d.%d\n", @@ -789,7 +795,13 @@ void pf_dl(module_id_t module_id, /* Find PUCCH occasion: if it fails, undo CCE allocation (undoing PUCCH * allocation after CCE alloc fail would be more complex) */ - const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot, -1, 0); + int n_rb,rb_offset; + get_coreset_rballoc(sched_ctrl->coreset->frequencyDomainResources.buf,&n_rb,&rb_offset); + const uint16_t N_cce = n_rb * sched_ctrl->coreset->duration / NR_NB_REG_PER_CCE; + const int delta_PRI=0; + int r_pucch = ((sched_ctrl->cce_index<<1)/N_cce)+(delta_PRI<<1); + + const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot, r_pucch, 0); if (alloc<0) { LOG_D(NR_MAC, "%s(): could not find PUCCH for UE %d/%04x@%d.%d\n", diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 4c5780e244..830c672b70 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -348,7 +348,13 @@ void nr_preprocessor_phytest(module_id_t module_id, __func__, UE_id); - const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot, -1, 0); + int n_rb,rb_offset; + get_coreset_rballoc(sched_ctrl->coreset->frequencyDomainResources.buf,&n_rb,&rb_offset); + const uint16_t N_cce = n_rb * sched_ctrl->coreset->duration / NR_NB_REG_PER_CCE; + const int delta_PRI=0; + int r_pucch = ((sched_ctrl->cce_index<<1)/N_cce)+(delta_PRI<<1); + + const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot, r_pucch, 0); if (alloc < 0) { LOG_D(MAC, "%s(): could not find PUCCH for UE %d/%04x@%d.%d\n", diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 465a621437..cdf7027137 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -947,7 +947,7 @@ void nr_configure_pucch(module_id_t module_id, pucch_pdu->bwp_start = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); pucch_pdu->subcarrier_spacing = genericParameters->subcarrierSpacing; pucch_pdu->cyclic_prefix = (genericParameters->cyclicPrefix==NULL) ? 0 : *genericParameters->cyclicPrefix; - if (r_pucch<0 || bwp ){ + if (bwp || bwpd) { LOG_D(NR_MAC,"pucch_acknak: Filling dedicated configuration for PUCCH\n"); // we have either a dedicated BWP or Dedicated PUCCH configuration on InitialBWP AssertFatal(bwp!=NULL || bwpd!=NULL,"We need one dedicated configuration for a BWP (neither additional or initial BWP has a dedicated configuration)\n"); From b069dcd3c88d2095a5e1af18a4143f3af7026e4b Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Wed, 2 Feb 2022 20:22:57 +0000 Subject: [PATCH 07/46] Bug fixes --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index efcccaaff0..d98b641350 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -1225,7 +1225,7 @@ void nr_schedule_ue_spec(module_id_t module_id, int dci_format = sched_ctrl->search_space && sched_ctrl->search_space->searchSpaceType && sched_ctrl->search_space->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific ? - NR_UL_DCI_FORMAT_0_1 : NR_UL_DCI_FORMAT_0_0; + NR_DL_DCI_FORMAT_1_1 : NR_DL_DCI_FORMAT_1_0; const int rnti_type = NR_RNTI_C; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index cdf7027137..9b2db1f633 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2205,7 +2205,12 @@ void get_pdsch_to_harq_feedback(int Mod_idP, bwpd = CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]->bwp_Dedicated; ubwpd = CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_id-1]->bwp_Dedicated; } - + else if (CellGroup && CellGroup->spCellConfig && CellGroup->spCellConfig->spCellConfigDedicated) { // this is an initialBWP + AssertFatal((bwpd=CellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP)!=NULL, + "CellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP is null\n"); + AssertFatal((ubwpd=CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP)!=NULL, + "CellGroup->spCellConfig->spCellConfigDedicated->uplnikConfig->initialUplinkBWP is null\n"); + } NR_SearchSpace_t *ss=NULL; // common search type uses DCI format 1_0 From e39ad834c0b5d5934de9057b173b52d7997f2882 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Fri, 4 Feb 2022 15:20:24 +0000 Subject: [PATCH 08/46] Fix dci size for formats 1_0 and 0_0 and improve procedures when using Coreset0 --- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 15 +++++++- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h | 3 +- .../NR_MAC_UE/nr_ue_dci_configuration.c | 8 ++-- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 9 +++-- .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 3 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 37 ++++++++++++++----- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 7 ++-- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 3 +- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 3 +- 9 files changed, 62 insertions(+), 26 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 264e86be7d..1917db6f86 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -2538,7 +2538,8 @@ uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDownlinkBWP, nr_dci_format_t format, nr_rnti_type_t rnti_type, uint16_t N_RB, - int bwp_id) { + int bwp_id, + uint16_t cset0_bwp_size) { uint16_t size = 0; uint16_t numRBG = 0; @@ -2588,7 +2589,9 @@ uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDownlinkBWP, /// fixed: Format identifier 1, Hop flag 1, MCS 5, NDI 1, RV 2, HARQ PID 4, PUSCH TPC 2 Time Domain assgnmt 4 --20 size += 20; size += (uint8_t)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); // Freq domain assignment -- hopping scenario to be updated - size += nr_dci_size(initialDownlinkBWP,initialUplinkBWP,cg,dci_pdu,NR_DL_DCI_FORMAT_1_0, rnti_type, N_RB, bwp_id) - size; // Padding to match 1_0 size + int dci_10_size = nr_dci_size(initialDownlinkBWP,initialUplinkBWP,cg,dci_pdu,NR_DL_DCI_FORMAT_1_0, rnti_type, N_RB, bwp_id, cset0_bwp_size); + AssertFatal(dci_10_size >= size, "NR_UL_DCI_FORMAT_0_0 size is bigger than NR_DL_DCI_FORMAT_1_0! 3GPP TS 38.212 Section 7.3.1.0: DCI size alignment is not fully implemented"); + size += dci_10_size - size; // Padding to match 1_0 size // UL/SUL indicator assumed to be 0 break; @@ -2805,6 +2808,14 @@ uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDownlinkBWP, case NR_DL_DCI_FORMAT_1_0: /// fixed: Format identifier 1, VRB2PRB 1, MCS 5, NDI 1, RV 2, HARQ PID 4, DAI 2, PUCCH TPC 2, PUCCH RInd 3, PDSCH to HARQ TInd 3 Time Domain assgnmt 4 -- 28 + + // 3GPP TS 38.212 Section 7.3.1.0: DCI size alignment + // Size of DCI format 1_0 is given by the size of CORESET 0 if CORESET 0 is configured for the cell and the size + // of initial DL bandwidth part if CORESET 0 is not configured for the cell + if(cset0_bwp_size>0) { + N_RB = cset0_bwp_size; + } + size = 28; size += (uint8_t)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); // Freq domain assignment diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index 8182e1c930..92f9298d37 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -54,7 +54,8 @@ uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDLBWP, nr_dci_format_t format, nr_rnti_type_t rnti_type, uint16_t N_RB, - int bwp_id); + int bwp_id, + uint16_t cset0_bwp_size); void find_aggregation_candidates(uint8_t *aggregation_level, uint8_t *nr_of_candidates, diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c index 3453e071b1..0ee6f5501c 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c @@ -169,7 +169,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t rel15->SubcarrierSpacing = bwp_Common->genericParameters.subcarrierSpacing; } for (int i = 0; i < rel15->num_dci_options; i++) { - rel15->dci_length_options[i] = nr_dci_size(initialDownlinkBWP,initialUplinkBWP, mac->cg, &mac->def_dci_pdu_rel15[rel15->dci_format_options[i]], rel15->dci_format_options[i], NR_RNTI_C, rel15->BWPSize, bwp_id); + rel15->dci_length_options[i] = nr_dci_size(initialDownlinkBWP,initialUplinkBWP, mac->cg, &mac->def_dci_pdu_rel15[rel15->dci_format_options[i]], rel15->dci_format_options[i], NR_RNTI_C, rel15->BWPSize, bwp_id, mac->type0_PDCCH_CSS_config.num_rbs); } break; case NR_RNTI_RA: @@ -185,7 +185,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); } rel15->SubcarrierSpacing = initialDownlinkBWP->genericParameters.subcarrierSpacing; - rel15->dci_length_options[0] = nr_dci_size(initialDownlinkBWP,initialUplinkBWP, mac->cg, &mac->def_dci_pdu_rel15[rel15->dci_format_options[0]], rel15->dci_format_options[0], NR_RNTI_RA, rel15->BWPSize, bwp_id); + rel15->dci_length_options[0] = nr_dci_size(initialDownlinkBWP,initialUplinkBWP, mac->cg, &mac->def_dci_pdu_rel15[rel15->dci_format_options[0]], rel15->dci_format_options[0], NR_RNTI_RA, rel15->BWPSize, bwp_id, mac->type0_PDCCH_CSS_config.num_rbs); break; case NR_RNTI_P: break; @@ -200,7 +200,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t rel15->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb; rel15->SubcarrierSpacing = initialDownlinkBWP->genericParameters.subcarrierSpacing; for (int i = 0; i < rel15->num_dci_options; i++) { - rel15->dci_length_options[i] = nr_dci_size(initialDownlinkBWP,initialUplinkBWP, mac->cg, &mac->def_dci_pdu_rel15[rel15->dci_format_options[i]], rel15->dci_format_options[i], NR_RNTI_TC, rel15->BWPSize, bwp_id); + rel15->dci_length_options[i] = nr_dci_size(initialDownlinkBWP,initialUplinkBWP, mac->cg, &mac->def_dci_pdu_rel15[rel15->dci_format_options[i]], rel15->dci_format_options[i], NR_RNTI_TC, rel15->BWPSize, bwp_id, mac->type0_PDCCH_CSS_config.num_rbs); } break; case NR_RNTI_SP_CSI: @@ -223,7 +223,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t rel15->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon + 2; for (int i = 0; i < rel15->num_dci_options; i++) { - rel15->dci_length_options[i] = nr_dci_size(initialDownlinkBWP,initialUplinkBWP, mac->cg, &mac->def_dci_pdu_rel15[rel15->dci_format_options[i]], rel15->dci_format_options[i], NR_RNTI_SI, rel15->BWPSize, 0); + rel15->dci_length_options[i] = nr_dci_size(initialDownlinkBWP,initialUplinkBWP, mac->cg, &mac->def_dci_pdu_rel15[rel15->dci_format_options[i]], rel15->dci_format_options[i], NR_RNTI_SI, rel15->BWPSize, 0, mac->type0_PDCCH_CSS_config.num_rbs); } break; case NR_RNTI_SFI: diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index f396f88284..483e4be692 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -846,7 +846,8 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t NR_UL_DCI_FORMAT_0_0, NR_RNTI_TC, pusch_pdu->bwp_size, - ra->bwp_id); + ra->bwp_id, + nr_mac->cset0_bwp_size); // Mark the corresponding RBs as used for (int rb = 0; rb < ra->msg3_nb_rb; rb++) { @@ -1359,7 +1360,8 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra NR_DL_DCI_FORMAT_1_0, NR_RNTI_RA, BWPSize, - bwpid); + bwpid, + nr_mac->cset0_bwp_size); // DL TX request nfapi_nr_pdu_t *tx_req = &nr_mac->TX_req[CC_id].pdu_list[nr_mac->TX_req[CC_id].Number_of_PDUs]; @@ -1732,7 +1734,8 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra NR_DL_DCI_FORMAT_1_0, NR_RNTI_TC, pdsch_pdu_rel15->BWPSize, - bwpid); + bwpid, + nr_mac->cset0_bwp_size); // Add padding header and zero rest out if there is space left if (ra->mac_pdu_length < harq->tb_size) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index df25b085e6..d57aa43483 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -535,7 +535,8 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, dci_format, rnti_type, pdsch_pdu_rel15->BWPSize, - 0); + 0, + gNB_mac->cset0_bwp_size); LOG_D(MAC,"BWPSize: %i\n", pdcch_pdu_rel15->BWPSize); LOG_D(MAC,"BWPStart: %i\n", pdcch_pdu_rel15->BWPStart); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index d98b641350..d7d136a06c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -565,7 +565,8 @@ bool allocate_dl_retransmission(module_id_t module_id, genericParameters = &sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.genericParameters; } - const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); + const int coresetid = (sched_ctrl->active_bwp||bwpd) ? sched_ctrl->coreset->controlResourceSetId : RC.nrmac[module_id]->sched_ctrlCommon->coreset->controlResourceSetId; + const uint16_t bwpSize = coresetid == 0 ? RC.nrmac[module_id]->cset0_bwp_size : NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); int rbStart = 0; // start wrt BWPstart NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static; @@ -775,7 +776,8 @@ void pf_dl(module_id_t module_id, genericParameters = &sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.genericParameters; } - const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); + const int coresetid = (sched_ctrl->active_bwp||bwpd) ? sched_ctrl->coreset->controlResourceSetId : RC.nrmac[module_id]->sched_ctrlCommon->coreset->controlResourceSetId; + const uint16_t bwpSize = coresetid == 0 ? RC.nrmac[module_id]->cset0_bwp_size : NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); int rbStart = 0; // start wrt BWPstart if (sched_ctrl->available_dl_harq.head < 0) { @@ -884,8 +886,16 @@ void nr_fr1_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t genericParameters = &sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.genericParameters; } - const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); - const uint16_t BWPStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); + NR_BWP_DownlinkDedicated_t *bwpd = + UE_info->CellGroup[UE_id] && + UE_info->CellGroup[UE_id]->spCellConfig && + UE_info->CellGroup[UE_id]->spCellConfig->spCellConfigDedicated ? + UE_info->CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->initialDownlinkBWP : NULL; + + const int coresetid = (sched_ctrl->active_bwp||bwpd) ? sched_ctrl->coreset->controlResourceSetId : RC.nrmac[module_id]->sched_ctrlCommon->coreset->controlResourceSetId; + + const uint16_t bwpSize = coresetid == 0 ? RC.nrmac[module_id]->cset0_bwp_size : NRRIV2BW(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); + const uint16_t BWPStart = coresetid == 0 ? RC.nrmac[module_id]->cset0_bwp_start : NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); uint16_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map; uint8_t rballoc_mask[bwpSize]; @@ -1060,6 +1070,8 @@ void nr_schedule_ue_spec(module_id_t module_id, genericParameters = &sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.genericParameters; } + NR_SearchSpace_t *ss = (bwp||bwpd) ? sched_ctrl->search_space : gNB_mac->sched_ctrlCommon->search_space; + const int bwpid = bwp ? bwp->bwp_Id : 0; const int coresetid = (bwp||bwpd) ? sched_ctrl->coreset->controlResourceSetId : gNB_mac->sched_ctrlCommon->coreset->controlResourceSetId; nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu = gNB_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid]; @@ -1072,7 +1084,6 @@ void nr_schedule_ue_spec(module_id_t module_id, dl_req->nPDUs += 1; pdcch_pdu = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15; LOG_D(NR_MAC,"Trying to configure DL pdcch for UE %d, bwp %d, cs %d\n",UE_id,bwpid,coresetid); - NR_SearchSpace_t *ss = (bwp||bwpd) ? sched_ctrl->search_space:gNB_mac->sched_ctrlCommon->search_space; NR_ControlResourceSet_t *coreset = (bwp||bwpd)? sched_ctrl->coreset:gNB_mac->sched_ctrlCommon->coreset; nr_configure_pdcch(gNB_mac, pdcch_pdu, ss, coreset, scc, genericParameters, NULL); gNB_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid] = pdcch_pdu; @@ -1093,8 +1104,14 @@ void nr_schedule_ue_spec(module_id_t module_id, const int pduindex = gNB_mac->pdu_index[CC_id]++; pdsch_pdu->pduIndex = pduindex; - pdsch_pdu->BWPSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); - pdsch_pdu->BWPStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); + if (coresetid == 0) { + pdsch_pdu->BWPSize = gNB_mac->cset0_bwp_size; + pdsch_pdu->BWPStart = gNB_mac->cset0_bwp_start; + } else { + pdsch_pdu->BWPSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); + pdsch_pdu->BWPStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); + } + pdsch_pdu->SubcarrierSpacing = genericParameters->subcarrierSpacing; pdsch_pdu->CyclicPrefix = genericParameters->cyclicPrefix ? *genericParameters->cyclicPrefix : 0; @@ -1223,8 +1240,7 @@ void nr_schedule_ue_spec(module_id_t module_id, dci_payload.tpc, pucch->timing_indicator); - int dci_format = sched_ctrl->search_space && sched_ctrl->search_space->searchSpaceType && - sched_ctrl->search_space->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific ? + int dci_format = ss && ss->searchSpaceType && ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific ? NR_DL_DCI_FORMAT_1_1 : NR_DL_DCI_FORMAT_1_0; const int rnti_type = NR_RNTI_C; @@ -1236,7 +1252,8 @@ void nr_schedule_ue_spec(module_id_t module_id, dci_format, rnti_type, pdsch_pdu->BWPSize, - bwp? bwp->bwp_Id : 0); + bwp? bwp->bwp_Id : 0, + gNB_mac->cset0_bwp_size); LOG_D(NR_MAC, "coreset params: FreqDomainResource %llx, start_symbol %d n_symb %d\n", diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 9b2db1f633..51c2aa5516 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1218,12 +1218,13 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, int dci_format, int rnti_type, int N_RB, - int bwp_id) { + int bwp_id, + uint16_t cset0_bwp_size) { uint8_t fsize = 0, pos = 0; uint64_t *dci_pdu = (uint64_t *)pdcch_dci_pdu->Payload; *dci_pdu=0; - int dci_size = nr_dci_size(scc->downlinkConfigCommon->initialDownlinkBWP,scc->uplinkConfigCommon->initialUplinkBWP, CellGroup, dci_pdu_rel15, dci_format, rnti_type, N_RB, bwp_id); + int dci_size = nr_dci_size(scc->downlinkConfigCommon->initialDownlinkBWP,scc->uplinkConfigCommon->initialUplinkBWP, CellGroup, dci_pdu_rel15, dci_format, rnti_type, N_RB, bwp_id, cset0_bwp_size); pdcch_dci_pdu->PayloadSizeBits = dci_size; AssertFatal(dci_size <= 64, "DCI sizes above 64 bits not yet supported"); if (dci_format == NR_DL_DCI_FORMAT_1_1 || dci_format == NR_UL_DCI_FORMAT_0_1) @@ -1567,7 +1568,7 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, pos+=4; *dci_pdu |= ((uint64_t)dci_pdu_rel15->harq_pid & 0xf) << (dci_size - pos); // Padding bits - for (int a = pos; a < 32; a++) + for (int a = pos; a < dci_size; a++) *dci_pdu |= ((uint64_t)dci_pdu_rel15->padding & 1) << (dci_size - pos++); // UL/SUL indicator – 1 bit /* commented for now (RK): need to get this from BWP descriptor diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index d86f03d6d2..15ed27e5c7 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -1824,7 +1824,8 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot) ps->dci_format, rnti_types[0], pusch_pdu->bwp_size, - bwpid); + bwpid, + nr_mac->cset0_bwp_size); memset(sched_pusch, 0, sizeof(*sched_pusch)); } diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 83c4d3d950..4af58b3de4 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -266,7 +266,8 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, int dci_formats, int rnti_types, int N_RB, - int bwp_id); + int bwp_id, + uint16_t cset0_bwp_size); void prepare_dci(const NR_CellGroupConfig_t *CellGroup, dci_pdu_rel15_t *dci_pdu_rel15, From 3dce1171d56a1df74697bf429170072d55dcb18d Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Tue, 8 Feb 2022 19:04:43 +0000 Subject: [PATCH 09/46] Fixes after merge --- openair2/LAYER2/NR_MAC_gNB/config.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index e7fdb980b3..aaf40afbee 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -652,7 +652,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, sched_ctrl->coreset, scc, genericParameters, - NULL); + RC.nrmac[Mod_idP]->type0_PDCCH_CSS_config); sched_ctrl->maxL = 2; } } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index d33946a122..74414a00b2 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -614,7 +614,7 @@ void nr_initiate_ra_proc(module_id_t module_idP, ra->coreset, scc, genericParameters, - NULL); + &nr_mac->type0_PDCCH_CSS_config[ra->beam_id]); // retrieving ra pdcch monitoring period and offset find_monitoring_periodicity_offset_common(ra->ra_ss, &monitoring_slot_period, &monitoring_offset); From fdc2cb87166d8b7b9aed46cc66d2f7716de095f9 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Mon, 14 Feb 2022 13:11:03 +0000 Subject: [PATCH 10/46] Fix pucch resource calculation --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 8 ++---- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 28 +++++++++++-------- .../LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 7 +---- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 16 ++++++++++- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 5 ++++ 5 files changed, 40 insertions(+), 24 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 74414a00b2..97463a406f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -1535,13 +1535,11 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra return; } - int n_rb,rb_offset; - get_coreset_rballoc(coreset->frequencyDomainResources.buf,&n_rb,&rb_offset); - const uint16_t N_cce = n_rb * coreset->duration / NR_NB_REG_PER_CCE; const int delta_PRI=0; - int r_pucch = ((CCEIndex<<1)/N_cce)+(delta_PRI<<1); + int r_pucch = nr_get_pucch_resource(coreset, sched_ctrl->active_ubwp, NULL, CCEIndex); + + LOG_D(NR_MAC,"[RAPROC] Msg4 r_pucch %d (CCEIndex %d, nb_of_candidates %d, delta_PRI %d)\n", r_pucch, CCEIndex, nr_of_candidates, delta_PRI); - LOG_D(NR_MAC,"[RAPROC] Msg4 r_pucch %d (CCEIndex %d, N_cce %d, nb_of_candidates %d,delta_PRI %d)\n",r_pucch,CCEIndex,N_cce,nr_of_candidates,delta_PRI); int alloc = nr_acknack_scheduling(module_idP, UE_id, frameP, slotP, r_pucch, 1); AssertFatal(alloc>=0,"Couldn't find a pucch allocation for ack nack (msg4)\n"); NR_sched_pucch_t *pucch = &sched_ctrl->sched_pucch[alloc]; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 17277576ac..f3c366ceeb 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -557,6 +557,13 @@ bool allocate_dl_retransmission(module_id_t module_id, cg->spCellConfig->spCellConfigDedicated ? cg->spCellConfig->spCellConfigDedicated->initialDownlinkBWP : NULL; + NR_BWP_UplinkDedicated_t *ubwpd = + cg && + cg->spCellConfig && + cg->spCellConfig->spCellConfigDedicated && + cg->spCellConfig->spCellConfigDedicated->uplinkConfig ? + cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP : NULL; + NR_BWP_t *genericParameters = NULL; if(sched_ctrl->active_bwp) { genericParameters = &sched_ctrl->active_bwp->bwp_Common->genericParameters; @@ -662,12 +669,7 @@ bool allocate_dl_retransmission(module_id_t module_id, /* Find PUCCH occasion: if it fails, undo CCE allocation (undoing PUCCH * allocation after CCE alloc fail would be more complex) */ - int n_rb,rb_offset; - get_coreset_rballoc(sched_ctrl->coreset->frequencyDomainResources.buf,&n_rb,&rb_offset); - const uint16_t N_cce = n_rb * sched_ctrl->coreset->duration / NR_NB_REG_PER_CCE; - const int delta_PRI=0; - int r_pucch = ((sched_ctrl->cce_index<<1)/N_cce)+(delta_PRI<<1); - + int r_pucch = nr_get_pucch_resource(sched_ctrl->coreset, sched_ctrl->active_ubwp, ubwpd, CCEIndex); const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot, r_pucch, 0); if (alloc<0) { LOG_D(MAC, @@ -792,6 +794,13 @@ void pf_dl(module_id_t module_id, cg->spCellConfig->spCellConfigDedicated ? cg->spCellConfig->spCellConfigDedicated->initialDownlinkBWP : NULL; + NR_BWP_UplinkDedicated_t *ubwpd = + cg && + cg->spCellConfig && + cg->spCellConfig->spCellConfigDedicated && + cg->spCellConfig->spCellConfigDedicated->uplinkConfig ? + cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP : NULL; + NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; const uint16_t rnti = UE_info->rnti[UE_id]; @@ -845,12 +854,7 @@ void pf_dl(module_id_t module_id, /* Find PUCCH occasion: if it fails, undo CCE allocation (undoing PUCCH * allocation after CCE alloc fail would be more complex) */ - int n_rb,rb_offset; - get_coreset_rballoc(sched_ctrl->coreset->frequencyDomainResources.buf,&n_rb,&rb_offset); - const uint16_t N_cce = n_rb * sched_ctrl->coreset->duration / NR_NB_REG_PER_CCE; - const int delta_PRI=0; - int r_pucch = ((sched_ctrl->cce_index<<1)/N_cce)+(delta_PRI<<1); - + int r_pucch = nr_get_pucch_resource(sched_ctrl->coreset, sched_ctrl->active_ubwp, ubwpd, CCEIndex); const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot, r_pucch, 0); if (alloc<0) { LOG_D(NR_MAC, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index ce97a483e8..21248c9b9e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -361,12 +361,7 @@ void nr_preprocessor_phytest(module_id_t module_id, __func__, UE_id); - int n_rb,rb_offset; - get_coreset_rballoc(sched_ctrl->coreset->frequencyDomainResources.buf,&n_rb,&rb_offset); - const uint16_t N_cce = n_rb * sched_ctrl->coreset->duration / NR_NB_REG_PER_CCE; - const int delta_PRI=0; - int r_pucch = ((sched_ctrl->cce_index<<1)/N_cce)+(delta_PRI<<1); - + int r_pucch = nr_get_pucch_resource(sched_ctrl->coreset, sched_ctrl->active_ubwp, NULL, CCEIndex); const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot, r_pucch, 0); if (alloc < 0) { LOG_D(MAC, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index e8171ead15..111fc1197a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -930,6 +930,20 @@ void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu, pdcch_pdu->precoderGranularity = coreset->precoderGranularity; } +int nr_get_pucch_resource(NR_ControlResourceSet_t *coreset, + NR_BWP_Uplink_t *bwp, + NR_BWP_UplinkDedicated_t *bwpd, + int CCEIndex) { + int r_pucch = -1; + if(bwp == NULL && bwpd == NULL) { + int n_rb,rb_offset; + get_coreset_rballoc(coreset->frequencyDomainResources.buf,&n_rb,&rb_offset); + const uint16_t N_cce = n_rb * coreset->duration / NR_NB_REG_PER_CCE; + const int delta_PRI=0; + r_pucch = ((CCEIndex<<1)/N_cce)+(delta_PRI<<1); + } + return r_pucch; +} // This function configures pucch pdu fapi structure void nr_configure_pucch(module_id_t module_id, @@ -1026,7 +1040,7 @@ void nr_configure_pucch(module_id_t module_id, pucch_pdu->bwp_start = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); pucch_pdu->subcarrier_spacing = genericParameters->subcarrierSpacing; pucch_pdu->cyclic_prefix = (genericParameters->cyclicPrefix==NULL) ? 0 : *genericParameters->cyclicPrefix; - if (bwp || bwpd) { + if (r_pucch<0 || bwp ){ LOG_D(NR_MAC,"pucch_acknak: Filling dedicated configuration for PUCCH\n"); // we have either a dedicated BWP or Dedicated PUCCH configuration on InitialBWP AssertFatal(bwp!=NULL || bwpd!=NULL,"We need one dedicated configuration for a BWP (neither additional or initial BWP has a dedicated configuration)\n"); diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index b7a463f24f..6c6e4a7242 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -236,6 +236,11 @@ int nr_is_dci_opportunity(nfapi_nr_search_space_t search_space, nfapi_nr_config_request_scf_t cfg); */ +int nr_get_pucch_resource(NR_ControlResourceSet_t *coreset, + NR_BWP_Uplink_t *bwp, + NR_BWP_UplinkDedicated_t *bwpd, + int CCEIndex); + void nr_configure_pucch(module_id_t module_id, nfapi_nr_pucch_pdu_t* pucch_pdu, NR_ServingCellConfigCommon_t *scc, From 7e1b38db13145da2b91db5ae69dae7bec962be0b Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Mon, 14 Feb 2022 14:03:05 +0000 Subject: [PATCH 11/46] Fix segmentation fault in phy-test --- openair2/LAYER2/NR_MAC_gNB/config.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index aaf40afbee..91f50ee59d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -537,7 +537,9 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, if (CellGroup) { - calculate_preferred_dl_tda(Mod_idP, NULL); + if (!get_softmodem_params()->phy_test) { + calculate_preferred_dl_tda(Mod_idP, NULL); + } const NR_ServingCellConfig_t *servingCellConfig = NULL; if(CellGroup->spCellConfig && CellGroup->spCellConfig->spCellConfigDedicated) { From dc4a82934dead240379968cc1148060c6152a5a2 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Wed, 23 Feb 2022 11:53:57 +0000 Subject: [PATCH 12/46] Fixes after merge --- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 6 +++++- openair2/RRC/NR/rrc_gNB.c | 21 +++++++++++++++++++ .../gnb.sa.band41.fr1.106PRB.usrpb210.conf | 2 +- ...gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf | 4 ++-- ...gnb.sa.band78.fr1.162PRB.2x2.usrpn300.conf | 2 +- 5 files changed, 30 insertions(+), 5 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 99cc76c913..594f322b88 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -584,7 +584,11 @@ void nr_set_pdsch_semi_static(module_id_t module_id, SLIV2SL(startSymbolAndLength, &ps->startSymbolIndex, &ps->nrOfSymbols); } - const long f = sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats; + const long f = ((bwp || bwpd) && + sched_ctrl->search_space && + sched_ctrl->search_space->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific) ? + sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats : 0; + int dci_format; if (sched_ctrl->search_space) { dci_format = f ? NR_DL_DCI_FORMAT_1_1 : NR_DL_DCI_FORMAT_1_0; diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index a8f9df737f..1aef575f99 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -106,6 +106,27 @@ extern RAN_CONTEXT_t RC; +extern boolean_t nr_rrc_pdcp_config_asn1_req( + const protocol_ctxt_t *const ctxt_pP, + NR_SRB_ToAddModList_t *const srb2add_list, + NR_DRB_ToAddModList_t *const drb2add_list, + NR_DRB_ToReleaseList_t *const drb2release_list, + const uint8_t security_modeP, + uint8_t *const kRRCenc, + uint8_t *const kRRCint, + uint8_t *const kUPenc, + uint8_t *const kUPint + ,LTE_PMCH_InfoList_r9_t *pmch_InfoList_r9 + ,rb_id_t *const defaultDRB, + struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list); + +extern rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP, + const NR_SRB_ToAddModList_t * const srb2add_listP, + const NR_DRB_ToAddModList_t * const drb2add_listP, + const NR_DRB_ToReleaseList_t * const drb2release_listP, + const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP, + struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list); + static inline uint64_t bitStr_to_uint64(BIT_STRING_t *asn); mui_t rrc_gNB_mui = 0; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf index 9bf20b54ab..b8248b02dd 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf @@ -37,7 +37,7 @@ gNBs = pusch_AntennaPorts = 1; min_rxtxtime = 6; sib1_tda = 0; - do_SRS = 1; + do_SRS = 0; pdcch_ConfigSIB1 = ( { diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf index 9452f00eed..54016c6b0e 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf @@ -36,7 +36,7 @@ gNBs = pdsch_AntennaPorts = 1; pusch_AntennaPorts = 2; sib1_tda = 0; - do_SRS = 1; + do_SRS = 0; ul_prbblacklist = "51,52,53,54" pdcch_ConfigSIB1 = ( @@ -100,7 +100,7 @@ gNBs = prach_msg1_FDM = 0; prach_msg1_FrequencyStart = 0; zeroCorrelationZoneConfig = 12; - preambleReceivedTargetPower = -104; + preambleReceivedTargetPower = -96; #preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) preambleTransMax = 6; #powerRampingStep diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.162PRB.2x2.usrpn300.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.162PRB.2x2.usrpn300.conf index fac54a298b..546065d9b4 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.162PRB.2x2.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.162PRB.2x2.usrpn300.conf @@ -112,7 +112,7 @@ gNBs = prach_msg1_FDM = 0; prach_msg1_FrequencyStart = 0; zeroCorrelationZoneConfig = 12; - preambleReceivedTargetPower = -104; + preambleReceivedTargetPower = -96; #preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) preambleTransMax = 6; #powerRampingStep From 0e85b51f7628551c524600a84fb618609a142d74 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Fri, 4 Mar 2022 14:15:58 +0000 Subject: [PATCH 13/46] Creation of get_dl_bwp_genericParameters and get_ul_bwp_genericParameters functions to avoid replicated code --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 55 +++++------------ .../NR_MAC_gNB/gNB_scheduler_primitives.c | 52 ++++++++++------ .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 24 ++------ .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 60 +++++-------------- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 8 +++ 5 files changed, 77 insertions(+), 122 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 8e4ad8b3f6..0089d83fa5 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -573,15 +573,9 @@ bool allocate_dl_retransmission(module_id_t module_id, cg->spCellConfig->spCellConfigDedicated->uplinkConfig ? cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP : NULL; - NR_BWP_t *genericParameters = NULL; - if(sched_ctrl->active_bwp) { - genericParameters = &sched_ctrl->active_bwp->bwp_Common->genericParameters; - } else if(RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon) { - genericParameters = &RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon->downlinkConfigCommon->initialDownlinkBWP->genericParameters; - } else { - NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; - genericParameters = &sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.genericParameters; - } + NR_BWP_t *genericParameters = get_dl_bwp_genericParameters(sched_ctrl->active_bwp, + RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon, + RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL); const int coresetid = (sched_ctrl->active_bwp||bwpd) ? sched_ctrl->coreset->controlResourceSetId : RC.nrmac[module_id]->sched_ctrlCommon->coreset->controlResourceSetId; const uint16_t bwpSize = coresetid == 0 ? RC.nrmac[module_id]->cset0_bwp_size : NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); @@ -828,15 +822,9 @@ void pf_dl(module_id_t module_id, NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; const uint16_t rnti = UE_info->rnti[UE_id]; - NR_BWP_t *genericParameters = NULL; - if(sched_ctrl->active_bwp) { - genericParameters = &sched_ctrl->active_bwp->bwp_Common->genericParameters; - } else if(RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon) { - genericParameters = &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters; - } else { - NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; - genericParameters = &sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.genericParameters; - } + NR_BWP_t *genericParameters = get_dl_bwp_genericParameters(sched_ctrl->active_bwp, + RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon, + RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL); const int coresetid = (sched_ctrl->active_bwp||bwpd) ? sched_ctrl->coreset->controlResourceSetId : RC.nrmac[module_id]->sched_ctrlCommon->coreset->controlResourceSetId; const uint16_t bwpSize = coresetid == 0 ? RC.nrmac[module_id]->cset0_bwp_size : NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); @@ -975,15 +963,9 @@ void nr_fr1_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t const int startSymbolAndLength = tdaList->list.array[tda]->startSymbolAndLength; SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); - NR_BWP_t *genericParameters = NULL; - if(sched_ctrl->active_bwp) { - genericParameters = &sched_ctrl->active_bwp->bwp_Common->genericParameters; - } else if(RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon) { - genericParameters = &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters; - } else { - NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; - genericParameters = &sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.genericParameters; - } + NR_BWP_t *genericParameters = get_dl_bwp_genericParameters(sched_ctrl->active_bwp, + RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon, + RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL); NR_BWP_DownlinkDedicated_t *bwpd = UE_info->CellGroup[UE_id] && @@ -1158,25 +1140,16 @@ void nr_schedule_ue_spec(module_id_t module_id, sched_ctrl->tpc1); NR_BWP_Downlink_t *bwp = sched_ctrl->active_bwp; - - /* look up the PDCCH PDU for this CC, BWP, and CORESET. If it does not - * exist, create it */ - - // BWP - NR_BWP_t *genericParameters = NULL; - if(bwp) { - genericParameters = &sched_ctrl->active_bwp->bwp_Common->genericParameters; - } else if(RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon) { - genericParameters = &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters; - } else { - NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; - genericParameters = &sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.genericParameters; - } + NR_BWP_t *genericParameters = get_dl_bwp_genericParameters(bwp, + RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon, + RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL); NR_SearchSpace_t *ss = (bwp||bwpd) ? sched_ctrl->search_space : gNB_mac->sched_ctrlCommon->search_space; const int bwpid = bwp ? bwp->bwp_Id : 0; const int coresetid = (bwp||bwpd) ? sched_ctrl->coreset->controlResourceSetId : gNB_mac->sched_ctrlCommon->coreset->controlResourceSetId; + + /* look up the PDCCH PDU for this CC, BWP, and CORESET. If it does not exist, create it */ nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu = gNB_mac->pdcch_pdu_idx[CC_id][coresetid]; if (!pdcch_pdu) { LOG_D(NR_MAC, "creating pdcch pdu, pdcch_pdu = NULL. \n"); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index f4a4176bac..dc5ce1bd5b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -226,6 +226,34 @@ void set_dl_dmrs_ports(NR_pdsch_semi_static_t *ps) { } } +NR_BWP_t *get_dl_bwp_genericParameters(NR_BWP_Downlink_t *active_bwp, + NR_ServingCellConfigCommon_t *ServingCellConfigCommon, + NR_SIB1_t *sib1) { + NR_BWP_t *genericParameters = NULL; + if (active_bwp) { + genericParameters = &active_bwp->bwp_Common->genericParameters; + } else if (ServingCellConfigCommon) { + genericParameters = &ServingCellConfigCommon->downlinkConfigCommon->initialDownlinkBWP->genericParameters; + } else { + genericParameters = &sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.genericParameters; + } + return genericParameters; +} + +NR_BWP_t *get_ul_bwp_genericParameters(NR_BWP_Uplink_t *active_ubwp, + NR_ServingCellConfigCommon_t *ServingCellConfigCommon, + NR_SIB1_t *sib1) { + NR_BWP_t *genericParameters = NULL; + if (active_ubwp) { + genericParameters = &active_ubwp->bwp_Common->genericParameters; + } else if (ServingCellConfigCommon) { + genericParameters = &ServingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP->genericParameters; + } else { + genericParameters = &sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.genericParameters; + } + return genericParameters; +} + NR_ControlResourceSet_t *get_coreset(module_id_t module_idP, NR_ServingCellConfigCommon_t *scc, void *bwp, @@ -936,15 +964,9 @@ void config_uldci(module_id_t module_id, int n_ubwp, int bwp_id) { - NR_BWP_t *genericParameters = NULL; - if(ubwp) { - genericParameters = &ubwp->bwp_Common->genericParameters; - } else if(scc) { - genericParameters = &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; - } else { - NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; - genericParameters = &sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.genericParameters; - } + NR_BWP_t *genericParameters = get_ul_bwp_genericParameters((NR_BWP_Uplink_t *)ubwp, + (NR_ServingCellConfigCommon_t *)scc, + RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL); const int bw = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); @@ -1149,15 +1171,9 @@ void nr_configure_pucch(module_id_t module_id, else pucch_pdu->hopping_id = *scc->physCellId; - NR_BWP_t *genericParameters = NULL; - if (bwp) { - genericParameters = &bwp->bwp_Common->genericParameters; - } else if (scc) { - genericParameters = &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; - } else { - NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; - genericParameters = &sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.genericParameters; - } + NR_BWP_t *genericParameters = get_ul_bwp_genericParameters(bwp, + scc, + RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL); pucch_pdu->bwp_size = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); pucch_pdu->bwp_start = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index e05318f6f0..85ad214b41 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -742,15 +742,9 @@ void nr_csi_meas_reporting(int Mod_idP, curr_pucch->csi_bits += nr_get_csi_bitlen(Mod_idP,UE_id,csi_report_id); - NR_BWP_t *genericParameters = NULL; - if(sched_ctrl->active_ubwp) { - genericParameters = &sched_ctrl->active_ubwp->bwp_Common->genericParameters; - } else if(scc) { - genericParameters = &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; - } else { - NR_SIB1_t *sib1 = RC.nrmac[Mod_idP]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; - genericParameters = &sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.genericParameters; - } + NR_BWP_t *genericParameters = get_ul_bwp_genericParameters(sched_ctrl->active_ubwp, + scc, + RC.nrmac[Mod_idP]->common_channels[0].sib1 ? RC.nrmac[Mod_idP]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL); int bwp_start = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); @@ -1762,15 +1756,9 @@ int nr_acknack_scheduling(int mod_id, pucch_Config = RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup; } - NR_BWP_t *genericParameters = NULL; - if(sched_ctrl->active_ubwp) { - genericParameters = &sched_ctrl->active_ubwp->bwp_Common->genericParameters; - } else if(scc) { - genericParameters = &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; - } else { - NR_SIB1_t *sib1 = RC.nrmac[mod_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; - genericParameters = &sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.genericParameters; - } + NR_BWP_t *genericParameters = get_ul_bwp_genericParameters(sched_ctrl->active_ubwp, + (NR_ServingCellConfigCommon_t *)scc, + RC.nrmac[mod_id]->common_channels[0].sib1 ? RC.nrmac[mod_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL); int bwp_start = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 70f5c075ac..0df1f9d2ce 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -990,15 +990,9 @@ bool allocate_ul_retransmission(module_id_t module_id, cg->spCellConfig->spCellConfigDedicated->uplinkConfig ? cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP : NULL; - NR_BWP_t *genericParameters = NULL; - if (sched_ctrl->active_ubwp) { - genericParameters = &sched_ctrl->active_ubwp->bwp_Common->genericParameters; - } else if (scc) { - genericParameters = &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; - } else { - NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; - genericParameters = &sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.genericParameters; - } + NR_BWP_t *genericParameters = get_ul_bwp_genericParameters(sched_ctrl->active_ubwp, + (NR_ServingCellConfigCommon_t *)scc, + RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL); int rbStart = 0; // wrt BWP start const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); @@ -1163,15 +1157,9 @@ void pf_ul(module_id_t module_id, LOG_D(NR_MAC,"pf_ul: preparing UL scheduling for UE %d\n",UE_id); NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; - NR_BWP_t *genericParameters = NULL; - if (sched_ctrl->active_ubwp) { - genericParameters = &sched_ctrl->active_ubwp->bwp_Common->genericParameters; - } else if (scc) { - genericParameters = &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; - } else { - NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; - genericParameters = &sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.genericParameters; - } + NR_BWP_t *genericParameters = get_ul_bwp_genericParameters(sched_ctrl->active_ubwp, + scc, + RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL); int rbStart = 0; // wrt BWP start NR_CellGroupConfig_t *cg = UE_info->CellGroup[UE_id]; @@ -1365,15 +1353,9 @@ void pf_ul(module_id_t module_id, && cg->spCellConfig->spCellConfigDedicated->uplinkConfig ? cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP : NULL; - NR_BWP_t *genericParameters = NULL; - if (sched_ctrl->active_ubwp) { - genericParameters = &sched_ctrl->active_ubwp->bwp_Common->genericParameters; - } else if (scc) { - genericParameters = &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; - } else { - NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; - genericParameters = &sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.genericParameters; - } + NR_BWP_t *genericParameters = get_ul_bwp_genericParameters(sched_ctrl->active_ubwp, + scc, + RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL); int rbStart = sched_ctrl->active_ubwp ? NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE) : 0; const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); @@ -1513,15 +1495,9 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t uint16_t *vrb_map_UL = &RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[sched_slot * MAX_BWP_SIZE]; - NR_BWP_t *genericParameters = NULL; - if (sched_ctrl->active_ubwp) { - genericParameters = &sched_ctrl->active_ubwp->bwp_Common->genericParameters; - } else if (scc) { - genericParameters = &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; - } else { - NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; - genericParameters = &sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.genericParameters; - } + NR_BWP_t *genericParameters = get_ul_bwp_genericParameters(sched_ctrl->active_ubwp, + scc, + RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL); const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); const uint16_t bwpStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); @@ -1763,15 +1739,9 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot) pusch_pdu->handle = 0; //not yet used /* FAPI: BWP */ - NR_BWP_t *genericParameters = NULL; - if (sched_ctrl->active_ubwp) { - genericParameters = &sched_ctrl->active_ubwp->bwp_Common->genericParameters; - } else if (scc) { - genericParameters = &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; - } else { - NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; - genericParameters = &sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.genericParameters; - } + NR_BWP_t *genericParameters = get_ul_bwp_genericParameters(sched_ctrl->active_ubwp, + scc, + RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL); pusch_pdu->bwp_size = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); pusch_pdu->bwp_start = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 5db381ff50..480ddc791b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -300,6 +300,14 @@ void prepare_dci(const NR_CellGroupConfig_t *CellGroup, nr_dci_format_t format, int bwp_id); +NR_BWP_t *get_dl_bwp_genericParameters(NR_BWP_Downlink_t *active_bwp, + NR_ServingCellConfigCommon_t *ServingCellConfigCommon, + NR_SIB1_t *sib1); + +NR_BWP_t *get_ul_bwp_genericParameters(NR_BWP_Uplink_t *active_ubwp, + NR_ServingCellConfigCommon_t *ServingCellConfigCommon, + NR_SIB1_t *sib1); + /* find coreset within the search space */ NR_ControlResourceSet_t *get_coreset(module_id_t module_idP, NR_ServingCellConfigCommon_t *scc, From 11334aa45f629b167cab872a99a24d21973d42ba Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Fri, 4 Mar 2022 14:34:26 +0000 Subject: [PATCH 14/46] Delete duplicated prototype function (update to develop implementation) --- openair2/RRC/NR/rrc_gNB.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 335a126c41..1fb3541f0e 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -107,27 +107,6 @@ extern RAN_CONTEXT_t RC; -extern boolean_t nr_rrc_pdcp_config_asn1_req( - const protocol_ctxt_t *const ctxt_pP, - NR_SRB_ToAddModList_t *const srb2add_list, - NR_DRB_ToAddModList_t *const drb2add_list, - NR_DRB_ToReleaseList_t *const drb2release_list, - const uint8_t security_modeP, - uint8_t *const kRRCenc, - uint8_t *const kRRCint, - uint8_t *const kUPenc, - uint8_t *const kUPint - ,LTE_PMCH_InfoList_r9_t *pmch_InfoList_r9 - ,rb_id_t *const defaultDRB, - struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list); - -extern rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP, - const NR_SRB_ToAddModList_t * const srb2add_listP, - const NR_DRB_ToAddModList_t * const drb2add_listP, - const NR_DRB_ToReleaseList_t * const drb2release_listP, - const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP, - struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list); - static inline uint64_t bitStr_to_uint64(BIT_STRING_t *asn); mui_t rrc_gNB_mui = 0; From 3f0eee5019b2b5aff9f81d0304d9ffd59c2a1a64 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Fri, 4 Mar 2022 15:38:48 +0000 Subject: [PATCH 15/46] Replace module_id by sib1 as input parameter in some functions where only sib1 is required --- openair1/SIMULATION/NR_PHY/dlsim.c | 4 +- openair2/LAYER2/NR_MAC_gNB/config.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 2 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 41 +++++++++++++++--- .../LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 4 +- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 29 ++++++------- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 5 ++- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 43 ++++++++++++++++--- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 10 ++--- 9 files changed, 97 insertions(+), 43 deletions(-) diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 5b139a7005..4f803cc80f 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -272,7 +272,7 @@ void nr_dlsim_preprocessor(module_id_t module_id, /* manually set free CCE to 0 */ const int target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific; - sched_ctrl->search_space = get_searchspace(module_id, scc, sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Dedicated : NULL, target_ss); + sched_ctrl->search_space = get_searchspace(NULL, scc, sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Dedicated : NULL, target_ss); uint8_t nr_of_candidates; find_aggregation_candidates(&sched_ctrl->aggregation_level, &nr_of_candidates, @@ -282,7 +282,7 @@ void nr_dlsim_preprocessor(module_id_t module_id, NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static; - nr_set_pdsch_semi_static(module_id, + nr_set_pdsch_semi_static(NULL, scc, UE_info->CellGroup[0], sched_ctrl->active_bwp, diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 6307ac7394..7c699fc088 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -654,7 +654,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, bwpd = (void*)CellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP; genericParameters = &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters; } - sched_ctrl->search_space = get_searchspace(Mod_idP, scc, bwpd, target_ss); + sched_ctrl->search_space = get_searchspace(sib1 ? sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL, scc, bwpd, target_ss); sched_ctrl->coreset = get_coreset(Mod_idP, scc, bwpd, sched_ctrl->search_space, target_ss); sched_ctrl->sched_pdcch = set_pdcch_structure(RC.nrmac[Mod_idP], sched_ctrl->search_space, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 7fb518804b..25708ad5fe 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -869,7 +869,7 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t dci_pdu_rel15_t uldci_payload; memset(&uldci_payload, 0, sizeof(uldci_payload)); - config_uldci(module_idP, + config_uldci(nr_mac->common_channels[0].sib1 ? (const NR_SIB1_t *)nr_mac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL, ubwp, ubwpd, scc, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 0089d83fa5..4d16e81bd9 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -86,7 +86,11 @@ void calculate_preferred_dl_tda(module_id_t module_id, const NR_BWP_Downlink_t * else { target_ss = NR_SearchSpace__searchSpaceType_PR_common; } - NR_SearchSpace_t *search_space = get_searchspace(module_id, scc, bwp ? bwp->bwp_Dedicated : NULL, target_ss); + NR_SearchSpace_t *search_space = get_searchspace(nrmac->common_channels[0].sib1 ? nrmac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL, + scc, + bwp ? bwp->bwp_Dedicated : NULL, + target_ss); + NR_ControlResourceSet_t *coreset = get_coreset(module_id, scc, bwp ? bwp->bwp_Dedicated : NULL, search_space, target_ss); // get coreset symbol "map" const uint16_t symb_coreset = (1 << coreset->duration) - 1; @@ -554,8 +558,9 @@ bool allocate_dl_retransmission(module_id_t module_id, int UE_id, int current_harq_pid) { - const NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels->ServingCellConfigCommon; - NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info; + gNB_MAC_INST *nr_mac = RC.nrmac[module_id]; + const NR_ServingCellConfigCommon_t *scc = nr_mac->common_channels->ServingCellConfigCommon; + NR_UE_info_t *UE_info = &nr_mac->UE_info; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; NR_sched_pdsch_t *retInfo = &sched_ctrl->harq_processes[current_harq_pid].sched_pdsch; NR_CellGroupConfig_t *cg = UE_info->CellGroup[UE_id]; @@ -606,13 +611,29 @@ bool allocate_dl_retransmission(module_id_t module_id, /* check whether we need to switch the TDA allocation since the last * (re-)transmission */ if (ps->time_domain_allocation != tda) - nr_set_pdsch_semi_static(module_id, scc, cg, sched_ctrl->active_bwp, bwpd, tda, ps->nrOfLayers, sched_ctrl, ps); + nr_set_pdsch_semi_static(nr_mac->common_channels[0].sib1 ? (const NR_SIB1_t *)nr_mac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL, + scc, + cg, + sched_ctrl->active_bwp, + bwpd, + tda, + ps->nrOfLayers, + sched_ctrl, + ps); } else { /* the retransmission will use a different time domain allocation, check * that we have enough resources */ NR_pdsch_semi_static_t temp_ps = *ps; - nr_set_pdsch_semi_static(module_id, scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, bwpd, tda, ps->nrOfLayers, sched_ctrl, &temp_ps); + nr_set_pdsch_semi_static(nr_mac->common_channels[0].sib1 ? (const NR_SIB1_t *)nr_mac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL, + scc, + UE_info->CellGroup[UE_id], + sched_ctrl->active_bwp, + bwpd, + tda, + ps->nrOfLayers, + sched_ctrl, + &temp_ps); while (rbStart < bwpSize && !(rballoc_mask[rbStart]&SL_to_bitmap(temp_ps.startSymbolIndex, temp_ps.nrOfSymbols))) rbStart++; @@ -898,7 +919,15 @@ void pf_dl(module_id_t module_id, NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static; if (ps->nrOfLayers != layers[UE_id] || ps->time_domain_allocation != tda) - nr_set_pdsch_semi_static(module_id, scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, bwpd, tda, layers[UE_id], sched_ctrl, ps); + nr_set_pdsch_semi_static(mac->common_channels[0].sib1 ? (const NR_SIB1_t *)mac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL, + scc, + UE_info->CellGroup[UE_id], + sched_ctrl->active_bwp, + bwpd, + tda, + layers[UE_id], + sched_ctrl, + ps); const uint16_t slbitmap = SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols); // Freq-demain allocation diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index c1e30e8595..f8ccd2f361 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -282,7 +282,7 @@ void nr_preprocessor_phytest(module_id_t module_id, ps->nrOfLayers = target_dl_Nl; if (ps->time_domain_allocation != tda || ps->nrOfLayers != target_dl_Nl) - nr_set_pdsch_semi_static(module_id, scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, NULL, tda, target_dl_Nl, sched_ctrl, ps); + nr_set_pdsch_semi_static(NULL, scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, NULL, tda, target_dl_Nl, sched_ctrl, ps); /* find largest unallocated chunk */ const int bwpSize = NRRIV2BW(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); @@ -465,7 +465,7 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_ if (ps->time_domain_allocation != tda || ps->dci_format != dci_format || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data) - nr_set_pusch_semi_static(module_id, scc, sched_ctrl->active_ubwp, NULL,dci_format, tda, num_dmrs_cdm_grps_no_data, ps); + nr_set_pusch_semi_static(NULL, scc, sched_ctrl->active_ubwp, NULL,dci_format, tda, num_dmrs_cdm_grps_no_data, ps); uint16_t rbStart = 0; uint16_t rbSize; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index dc5ce1bd5b..2565f8f904 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -290,7 +290,7 @@ NR_ControlResourceSet_t *get_coreset(module_id_t module_idP, } } -NR_SearchSpace_t *get_searchspace(module_id_t module_id, +NR_SearchSpace_t *get_searchspace(NR_SIB1_t *sib1, NR_ServingCellConfigCommon_t *scc, NR_BWP_DownlinkDedicated_t *bwp_Dedicated, NR_SearchSpace__searchSpaceType_PR target_ss) { @@ -301,7 +301,6 @@ NR_SearchSpace_t *get_searchspace(module_id_t module_id, } else if(scc) { n = scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list.count; } else { - NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; n = sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list.count; } @@ -312,7 +311,6 @@ NR_SearchSpace_t *get_searchspace(module_id_t module_id, } else if(scc) { ss = scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list.array[i]; } else { - NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; ss = sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list.array[i]; } AssertFatal(ss->controlResourceSetId != NULL, "ss->controlResourceSetId is null\n"); @@ -546,7 +544,7 @@ bool nr_find_nb_rb(uint16_t Qm, return *tbs >= bytes && *nb_rb <= nb_rb_max; } -void nr_set_pdsch_semi_static(module_id_t module_id, +void nr_set_pdsch_semi_static(const NR_SIB1_t *sib1, const NR_ServingCellConfigCommon_t *scc, const NR_CellGroupConfig_t *secondaryCellGroup, const NR_BWP_Downlink_t *bwp, @@ -595,7 +593,6 @@ void nr_set_pdsch_semi_static(module_id_t module_id, } else if(scc) { tdaList = scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; } else { - NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; tdaList = sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; } AssertFatal(tda < tdaList->list.count, "time_domain_allocation %d>=%d\n", tda, tdaList->list.count); @@ -651,7 +648,7 @@ void nr_set_pdsch_semi_static(module_id_t module_id, LOG_D(NR_MAC,"bwpd0 %p, bwpd %p : Filling dmrs info, ps->N_PRB_DMRS %d, ps->dl_dmrs_symb_pos %x, ps->N_DMRS_SLOT %d\n",bwpd0,bwpd,ps->N_PRB_DMRS,ps->dl_dmrs_symb_pos,ps->N_DMRS_SLOT); } -void nr_set_pusch_semi_static(module_id_t module_id, +void nr_set_pusch_semi_static(const NR_SIB1_t *sib1, const NR_ServingCellConfigCommon_t *scc, const NR_BWP_Uplink_t *ubwp, const NR_BWP_UplinkDedicated_t *ubwpd, @@ -668,7 +665,6 @@ void nr_set_pusch_semi_static(module_id_t module_id, } else if(scc) { tdaList = scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; } else { - NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; tdaList = sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; } @@ -952,7 +948,7 @@ void nr_configure_css_dci_initial(nfapi_nr_dl_tti_pdcch_pdu_rel15_t* pdcch_pdu, } -void config_uldci(module_id_t module_id, +void config_uldci(const NR_SIB1_t *sib1, const NR_BWP_Uplink_t *ubwp, const NR_BWP_UplinkDedicated_t *ubwpd, const NR_ServingCellConfigCommon_t *scc, @@ -966,7 +962,7 @@ void config_uldci(module_id_t module_id, NR_BWP_t *genericParameters = get_ul_bwp_genericParameters((NR_BWP_Uplink_t *)ubwp, (NR_ServingCellConfigCommon_t *)scc, - RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL); + (NR_SIB1_t *)sib1); const int bw = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); @@ -1091,7 +1087,7 @@ int nr_get_pucch_resource(NR_ControlResourceSet_t *coreset, } // This function configures pucch pdu fapi structure -void nr_configure_pucch(module_id_t module_id, +void nr_configure_pucch(NR_SIB1_t *sib1, nfapi_nr_pucch_pdu_t* pucch_pdu, NR_ServingCellConfigCommon_t *scc, NR_CellGroupConfig_t *CellGroup, @@ -1141,7 +1137,6 @@ void nr_configure_pucch(module_id_t module_id, } else if(scc) { pucch_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup; } else { - NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; pucch_ConfigCommon = sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.pucch_ConfigCommon->choice.setup; } @@ -1171,9 +1166,7 @@ void nr_configure_pucch(module_id_t module_id, else pucch_pdu->hopping_id = *scc->physCellId; - NR_BWP_t *genericParameters = get_ul_bwp_genericParameters(bwp, - scc, - RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL); + NR_BWP_t *genericParameters = get_ul_bwp_genericParameters(bwp,scc, sib1); pucch_pdu->bwp_size = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); pucch_pdu->bwp_start = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); @@ -2247,8 +2240,9 @@ int get_ul_bwp_id(const NR_ServingCellConfig_t *servingCellConfig) //------------------------------------------------------------------------------ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellGroup) { - NR_ServingCellConfigCommon_t *scc = RC.nrmac[mod_idP]->common_channels[0].ServingCellConfigCommon; - NR_UE_info_t *UE_info = &RC.nrmac[mod_idP]->UE_info; + gNB_MAC_INST *nr_mac = RC.nrmac[mod_idP]; + NR_ServingCellConfigCommon_t *scc = nr_mac->common_channels[0].ServingCellConfigCommon; + NR_UE_info_t *UE_info = &nr_mac->UE_info; LOG_I(NR_MAC, "[gNB %d] Adding UE with rnti 0x%04x (num_UEs %d)\n", mod_idP, rntiP, @@ -2307,7 +2301,8 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG &sched_ctrl->active_bwp->bwp_Common->genericParameters: &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; const int target_ss = sched_ctrl->active_bwp ? NR_SearchSpace__searchSpaceType_PR_ue_Specific : NR_SearchSpace__searchSpaceType_PR_common; - sched_ctrl->search_space = get_searchspace(mod_idP, scc, + sched_ctrl->search_space = get_searchspace(nr_mac->common_channels[0].sib1 ? nr_mac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL, + scc, sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Dedicated : NULL, target_ss); sched_ctrl->coreset = get_coreset(mod_idP, scc, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 85ad214b41..10a21cd07d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -44,7 +44,8 @@ void nr_fill_nfapi_pucch(module_id_t mod_id, const NR_sched_pucch_t *pucch, int UE_id) { - NR_UE_info_t *UE_info = &RC.nrmac[mod_id]->UE_info; + gNB_MAC_INST *nr_mac = RC.nrmac[mod_id]; + NR_UE_info_t *UE_info = &nr_mac->UE_info; nfapi_nr_ul_tti_request_t *future_ul_tti_req = &RC.nrmac[mod_id]->UL_tti_req_ahead[0][pucch->ul_slot]; @@ -81,7 +82,7 @@ void nr_fill_nfapi_pucch(module_id_t mod_id, cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP : NULL; LOG_D(NR_MAC,"pucch_acknak: %d.%d Calling nr_configure_pucch (ubwpd %p,r_pucch %d) pucch in %d.%d\n",frame,slot,ubwpd,pucch->r_pucch,pucch->frame,pucch->ul_slot); - nr_configure_pucch(mod_id, + nr_configure_pucch(nr_mac->common_channels[0].sib1 ? nr_mac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL, pucch_pdu, scc, UE_info->CellGroup[UE_id], diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 0df1f9d2ce..019238d0f8 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -980,8 +980,9 @@ bool allocate_ul_retransmission(module_id_t module_id, int harq_pid) { const int CC_id = 0; - const NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[CC_id].ServingCellConfigCommon; - NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info; + gNB_MAC_INST *nr_mac = RC.nrmac[module_id]; + const NR_ServingCellConfigCommon_t *scc = nr_mac->common_channels[CC_id].ServingCellConfigCommon; + NR_UE_info_t *UE_info = &nr_mac->UE_info; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; NR_sched_pusch_t *retInfo = &sched_ctrl->ul_harq_processes[harq_pid].sched_pusch; NR_CellGroupConfig_t *cg = UE_info->CellGroup[UE_id]; @@ -1018,7 +1019,14 @@ bool allocate_ul_retransmission(module_id_t module_id, if (ps->time_domain_allocation != tda || ps->dci_format != dci_format || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data) - nr_set_pusch_semi_static(module_id, scc, sched_ctrl->active_ubwp, ubwpd, dci_format, tda, num_dmrs_cdm_grps_no_data, ps); + nr_set_pusch_semi_static(nr_mac->common_channels[0].sib1 ? (const NR_SIB1_t *)nr_mac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL, + scc, + sched_ctrl->active_ubwp, + ubwpd, + dci_format, + tda, + num_dmrs_cdm_grps_no_data, + ps); LOG_D(NR_MAC, "%s(): retransmission keeping TDA %d and TBS %d\n", __func__, tda, retInfo->tb_size); } else { /* the retransmission will use a different time domain allocation, check @@ -1030,7 +1038,14 @@ bool allocate_ul_retransmission(module_id_t module_id, rbSize++; NR_pusch_semi_static_t temp_ps; int dci_format = get_dci_format(sched_ctrl); - nr_set_pusch_semi_static(module_id, scc, sched_ctrl->active_ubwp,ubwpd, dci_format, tda, num_dmrs_cdm_grps_no_data, &temp_ps); + nr_set_pusch_semi_static(nr_mac->common_channels[0].sib1 ? (const NR_SIB1_t *)nr_mac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL, + scc, + sched_ctrl->active_ubwp, + ubwpd, + dci_format, + tda, + num_dmrs_cdm_grps_no_data, + &temp_ps); uint32_t new_tbs; uint16_t new_rbSize; bool success = nr_find_nb_rb(retInfo->Qm, @@ -1262,7 +1277,14 @@ void pf_ul(module_id_t module_id, if (ps->time_domain_allocation != tda || ps->dci_format != dci_format || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data) - nr_set_pusch_semi_static(module_id, scc, sched_ctrl->active_ubwp, ubwpd, dci_format, tda, num_dmrs_cdm_grps_no_data, ps); + nr_set_pusch_semi_static(nrmac->common_channels[0].sib1 ? (const NR_SIB1_t *)nrmac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL, + scc, + sched_ctrl->active_ubwp, + ubwpd, + dci_format, + tda, + num_dmrs_cdm_grps_no_data, + ps); NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; sched_pusch->mcs = 9; update_ul_ue_R_Qm(sched_pusch, ps); @@ -1385,7 +1407,14 @@ void pf_ul(module_id_t module_id, if (ps->time_domain_allocation != tda || ps->dci_format != dci_format || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data) - nr_set_pusch_semi_static(module_id, scc, sched_ctrl->active_ubwp, ubwpd, dci_format, tda, num_dmrs_cdm_grps_no_data, ps); + nr_set_pusch_semi_static(nrmac->common_channels[0].sib1 ? (const NR_SIB1_t *)nrmac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL, + scc, + sched_ctrl->active_ubwp, + ubwpd, + dci_format, + tda, + num_dmrs_cdm_grps_no_data, + ps); update_ul_ue_R_Qm(sched_pusch, ps); /* Calculate the current scheduling bytes and the necessary RBs */ @@ -1892,7 +1921,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot) n_ubwp = cg->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count; } - config_uldci(module_id, + config_uldci(nr_mac->common_channels[0].sib1 ? (const NR_SIB1_t *)nr_mac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL, sched_ctrl->active_ubwp, ubwpd, scc, diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 480ddc791b..6085b9d7ef 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -177,7 +177,7 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234); -void config_uldci(module_id_t module_id, +void config_uldci(const NR_SIB1_t *sib1, const NR_BWP_Uplink_t *ubwp, const NR_BWP_UplinkDedicated_t *ubwpd, const NR_ServingCellConfigCommon_t *scc, @@ -242,7 +242,7 @@ int nr_get_pucch_resource(NR_ControlResourceSet_t *coreset, NR_BWP_UplinkDedicated_t *bwpd, int CCEIndex); -void nr_configure_pucch(module_id_t module_id, +void nr_configure_pucch(NR_SIB1_t *sib1, nfapi_nr_pucch_pdu_t* pucch_pdu, NR_ServingCellConfigCommon_t *scc, NR_CellGroupConfig_t *CellGroup, @@ -316,7 +316,7 @@ NR_ControlResourceSet_t *get_coreset(module_id_t module_idP, NR_SearchSpace__searchSpaceType_PR ss_type); /* find a search space within a BWP */ -NR_SearchSpace_t *get_searchspace(module_id_t module_id, +NR_SearchSpace_t *get_searchspace(NR_SIB1_t *sib1, NR_ServingCellConfigCommon_t *scc, NR_BWP_DownlinkDedicated_t *bwp_Dedicated, NR_SearchSpace__searchSpaceType_PR target_ss); @@ -327,7 +327,7 @@ long get_K2(NR_ServingCellConfigCommon_t *scc, int time_domain_assignment, int mu); -void nr_set_pdsch_semi_static(module_id_t module_id, +void nr_set_pdsch_semi_static(const NR_SIB1_t *sib1, const NR_ServingCellConfigCommon_t *scc, const NR_CellGroupConfig_t *secondaryCellGroup, const NR_BWP_Downlink_t *bwp, @@ -337,7 +337,7 @@ void nr_set_pdsch_semi_static(module_id_t module_id, NR_UE_sched_ctrl_t *sched_ctrl, NR_pdsch_semi_static_t *ps); -void nr_set_pusch_semi_static(module_id_t module_id, +void nr_set_pusch_semi_static(const NR_SIB1_t *sib1, const NR_ServingCellConfigCommon_t *scc, const NR_BWP_Uplink_t *ubwp, const NR_BWP_UplinkDedicated_t *ubwpd, From 078dff03b191a4ef3f439287ad358d8bfed92ec9 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Fri, 4 Mar 2022 15:43:52 +0000 Subject: [PATCH 16/46] Revert do_SRS to develop version in config files (re-enable SRS) --- .../GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf | 2 +- .../CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf index b8248b02dd..9bf20b54ab 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf @@ -37,7 +37,7 @@ gNBs = pusch_AntennaPorts = 1; min_rxtxtime = 6; sib1_tda = 0; - do_SRS = 0; + do_SRS = 1; pdcch_ConfigSIB1 = ( { diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf index 54016c6b0e..ddc02dd932 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf @@ -36,7 +36,7 @@ gNBs = pdsch_AntennaPorts = 1; pusch_AntennaPorts = 2; sib1_tda = 0; - do_SRS = 0; + do_SRS = 1; ul_prbblacklist = "51,52,53,54" pdcch_ConfigSIB1 = ( From 9f88fe18a3674d3441a408b49c03f884947c65ad Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Fri, 4 Mar 2022 16:10:45 +0000 Subject: [PATCH 17/46] Creation of get_pdsch_TimeDomainAllocationList function to avoid replicated code --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 16 ++++--------- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 24 ++++++++++++------- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 4 ++++ 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 4d16e81bd9..208ea50fbc 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -95,18 +95,12 @@ void calculate_preferred_dl_tda(module_id_t module_id, const NR_BWP_Downlink_t * // get coreset symbol "map" const uint16_t symb_coreset = (1 << coreset->duration) - 1; - /* check that TDA index 0 fits into DL and does not overlap CORESET */ - NR_PDSCH_TimeDomainResourceAllocationList_t *tdaList = NULL; - if (bwp) { - tdaList = bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; - } else if (scc) { - tdaList = scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; - } else { - NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; - tdaList = sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; - } - + NR_PDSCH_TimeDomainResourceAllocationList_t *tdaList = get_pdsch_TimeDomainAllocationList(bwp, + scc, + nrmac->common_channels[0].sib1 ? (const NR_SIB1_t *)nrmac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL); AssertFatal(tdaList->list.count >= 1, "need to have at least one TDA for DL slots\n"); + + /* check that TDA index 0 fits into DL and does not overlap CORESET */ const NR_PDSCH_TimeDomainResourceAllocation_t *tdaP_DL = tdaList->list.array[0]; AssertFatal(!tdaP_DL->k0 || *tdaP_DL->k0 == 0, "TimeDomainAllocation at index 1: non-null k0 (%ld) is not supported by the scheduler\n", diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 2565f8f904..f2a73572dc 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -254,6 +254,21 @@ NR_BWP_t *get_ul_bwp_genericParameters(NR_BWP_Uplink_t *active_ubwp, return genericParameters; } +NR_PDSCH_TimeDomainResourceAllocationList_t *get_pdsch_TimeDomainAllocationList(const NR_BWP_Downlink_t *active_bwp, + const NR_ServingCellConfigCommon_t *ServingCellConfigCommon, + const NR_SIB1_t *sib1) { + NR_PDSCH_TimeDomainResourceAllocationList_t *tdaList = NULL; + if (active_bwp) { + tdaList = active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + } else if (ServingCellConfigCommon) { + tdaList = ServingCellConfigCommon->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + } else { + tdaList = sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + } + return tdaList; +} + + NR_ControlResourceSet_t *get_coreset(module_id_t module_idP, NR_ServingCellConfigCommon_t *scc, void *bwp, @@ -587,14 +602,7 @@ void nr_set_pdsch_semi_static(const NR_SIB1_t *sib1, if (ps->time_domain_allocation != tda) { reset_dmrs = true; ps->time_domain_allocation = tda; - NR_PDSCH_TimeDomainResourceAllocationList_t *tdaList = NULL; - if(bwp) { - tdaList = bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; - } else if(scc) { - tdaList = scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; - } else { - tdaList = sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; - } + NR_PDSCH_TimeDomainResourceAllocationList_t *tdaList = get_pdsch_TimeDomainAllocationList(bwp, scc, sib1); AssertFatal(tda < tdaList->list.count, "time_domain_allocation %d>=%d\n", tda, tdaList->list.count); ps->mapping_type = tdaList->list.array[tda]->mappingType; if (pdsch_Config) { diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 6085b9d7ef..dbe1a61404 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -308,6 +308,10 @@ NR_BWP_t *get_ul_bwp_genericParameters(NR_BWP_Uplink_t *active_ubwp, NR_ServingCellConfigCommon_t *ServingCellConfigCommon, NR_SIB1_t *sib1); +NR_PDSCH_TimeDomainResourceAllocationList_t *get_pdsch_TimeDomainAllocationList(const NR_BWP_Downlink_t *active_bwp, + const NR_ServingCellConfigCommon_t *ServingCellConfigCommon, + const NR_SIB1_t *sib1); + /* find coreset within the search space */ NR_ControlResourceSet_t *get_coreset(module_id_t module_idP, NR_ServingCellConfigCommon_t *scc, From 9b737d0985025395cbd2e3f3ee59cd011e631ad8 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Mon, 14 Mar 2022 11:48:09 +0000 Subject: [PATCH 18/46] Move ternary operators to outside of functions input parameters --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 3 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 23 +++++++++------ .../NR_MAC_gNB/gNB_scheduler_primitives.c | 11 ++++---- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 9 ++++-- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 28 +++++++++++-------- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 8 +++--- 6 files changed, 48 insertions(+), 34 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 25708ad5fe..790718e184 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -869,7 +869,8 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t dci_pdu_rel15_t uldci_payload; memset(&uldci_payload, 0, sizeof(uldci_payload)); - config_uldci(nr_mac->common_channels[0].sib1 ? (const NR_SIB1_t *)nr_mac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL, + const NR_SIB1_t *sib1 = cc->sib1 ? cc->sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL; + config_uldci(sib1, ubwp, ubwpd, scc, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 04440eb49a..28f28b62c2 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -86,7 +86,8 @@ void calculate_preferred_dl_tda(module_id_t module_id, const NR_BWP_Downlink_t * else { target_ss = NR_SearchSpace__searchSpaceType_PR_common; } - NR_SearchSpace_t *search_space = get_searchspace(nrmac->common_channels[0].sib1 ? nrmac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL, + const NR_SIB1_t *sib1 = nrmac->common_channels[0].sib1 ? nrmac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL; + NR_SearchSpace_t *search_space = get_searchspace(sib1, scc, bwp ? bwp->bwp_Dedicated : NULL, target_ss); @@ -97,7 +98,7 @@ void calculate_preferred_dl_tda(module_id_t module_id, const NR_BWP_Downlink_t * NR_PDSCH_TimeDomainResourceAllocationList_t *tdaList = get_pdsch_TimeDomainAllocationList(bwp, scc, - nrmac->common_channels[0].sib1 ? (const NR_SIB1_t *)nrmac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL); + sib1); AssertFatal(tdaList->list.count >= 1, "need to have at least one TDA for DL slots\n"); /* check that TDA index 0 fits into DL and does not overlap CORESET */ @@ -577,9 +578,10 @@ bool allocate_dl_retransmission(module_id_t module_id, cg->spCellConfig->spCellConfigDedicated->uplinkConfig ? cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP : NULL; + const NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL; NR_BWP_t *genericParameters = get_dl_bwp_genericParameters(sched_ctrl->active_bwp, RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon, - RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL); + sib1); const int coresetid = (sched_ctrl->active_bwp||bwpd) ? sched_ctrl->coreset->controlResourceSetId : RC.nrmac[module_id]->sched_ctrlCommon->coreset->controlResourceSetId; const uint16_t bwpSize = coresetid == 0 ? RC.nrmac[module_id]->cset0_bwp_size : NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); @@ -610,7 +612,7 @@ bool allocate_dl_retransmission(module_id_t module_id, /* check whether we need to switch the TDA allocation since the last * (re-)transmission */ if (ps->time_domain_allocation != tda || sched_ctrl->update_pdsch_ps) { - nr_set_pdsch_semi_static(nr_mac->common_channels[0].sib1 ? (const NR_SIB1_t *)nr_mac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL, + nr_set_pdsch_semi_static(sib1, scc, cg, sched_ctrl->active_bwp, @@ -626,7 +628,7 @@ bool allocate_dl_retransmission(module_id_t module_id, * that we have enough resources */ NR_pdsch_semi_static_t temp_ps = *ps; - nr_set_pdsch_semi_static(nr_mac->common_channels[0].sib1 ? (const NR_SIB1_t *)nr_mac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL, + nr_set_pdsch_semi_static(sib1, scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, @@ -843,10 +845,11 @@ void pf_dl(module_id_t module_id, NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; const uint16_t rnti = UE_info->rnti[UE_id]; + const NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL; NR_BWP_t *genericParameters = get_dl_bwp_genericParameters(sched_ctrl->active_bwp, RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon, - RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL); + sib1); const int coresetid = (sched_ctrl->active_bwp||bwpd) ? sched_ctrl->coreset->controlResourceSetId : RC.nrmac[module_id]->sched_ctrlCommon->coreset->controlResourceSetId; const uint16_t bwpSize = coresetid == 0 ? RC.nrmac[module_id]->cset0_bwp_size : NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); @@ -920,7 +923,7 @@ void pf_dl(module_id_t module_id, NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static; if (ps->nrOfLayers != layers[UE_id] || ps->time_domain_allocation != tda || sched_ctrl->update_pdsch_ps) { - nr_set_pdsch_semi_static(mac->common_channels[0].sib1 ? (const NR_SIB1_t *)mac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL, + nr_set_pdsch_semi_static(sib1, scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, @@ -995,9 +998,10 @@ void nr_fr1_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t const int startSymbolAndLength = tdaList->list.array[tda]->startSymbolAndLength; SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); + const NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL; NR_BWP_t *genericParameters = get_dl_bwp_genericParameters(sched_ctrl->active_bwp, RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon, - RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL); + sib1); NR_BWP_DownlinkDedicated_t *bwpd = UE_info->CellGroup[UE_id] && @@ -1172,9 +1176,10 @@ void nr_schedule_ue_spec(module_id_t module_id, sched_ctrl->tpc1); NR_BWP_Downlink_t *bwp = sched_ctrl->active_bwp; + const NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL; NR_BWP_t *genericParameters = get_dl_bwp_genericParameters(bwp, RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon, - RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL); + sib1); NR_SearchSpace_t *ss = (bwp||bwpd) ? sched_ctrl->search_space : gNB_mac->sched_ctrlCommon->search_space; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 1962dcfb97..5a6e571457 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -228,7 +228,7 @@ void set_dl_dmrs_ports(NR_pdsch_semi_static_t *ps) { NR_BWP_t *get_dl_bwp_genericParameters(NR_BWP_Downlink_t *active_bwp, NR_ServingCellConfigCommon_t *ServingCellConfigCommon, - NR_SIB1_t *sib1) { + const NR_SIB1_t *sib1) { NR_BWP_t *genericParameters = NULL; if (active_bwp) { genericParameters = &active_bwp->bwp_Common->genericParameters; @@ -242,7 +242,7 @@ NR_BWP_t *get_dl_bwp_genericParameters(NR_BWP_Downlink_t *active_bwp, NR_BWP_t *get_ul_bwp_genericParameters(NR_BWP_Uplink_t *active_ubwp, NR_ServingCellConfigCommon_t *ServingCellConfigCommon, - NR_SIB1_t *sib1) { + const NR_SIB1_t *sib1) { NR_BWP_t *genericParameters = NULL; if (active_ubwp) { genericParameters = &active_ubwp->bwp_Common->genericParameters; @@ -305,7 +305,7 @@ NR_ControlResourceSet_t *get_coreset(module_id_t module_idP, } } -NR_SearchSpace_t *get_searchspace(NR_SIB1_t *sib1, +NR_SearchSpace_t *get_searchspace(const NR_SIB1_t *sib1, NR_ServingCellConfigCommon_t *scc, NR_BWP_DownlinkDedicated_t *bwp_Dedicated, NR_SearchSpace__searchSpaceType_PR target_ss) { @@ -1096,7 +1096,7 @@ int nr_get_pucch_resource(NR_ControlResourceSet_t *coreset, } // This function configures pucch pdu fapi structure -void nr_configure_pucch(NR_SIB1_t *sib1, +void nr_configure_pucch(const NR_SIB1_t *sib1, nfapi_nr_pucch_pdu_t* pucch_pdu, NR_ServingCellConfigCommon_t *scc, NR_CellGroupConfig_t *CellGroup, @@ -2309,7 +2309,8 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG &sched_ctrl->active_bwp->bwp_Common->genericParameters: &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; const int target_ss = sched_ctrl->active_bwp ? NR_SearchSpace__searchSpaceType_PR_ue_Specific : NR_SearchSpace__searchSpaceType_PR_common; - sched_ctrl->search_space = get_searchspace(nr_mac->common_channels[0].sib1 ? nr_mac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL, + const NR_SIB1_t *sib1 = nr_mac->common_channels[0].sib1 ? nr_mac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL; + sched_ctrl->search_space = get_searchspace(sib1, scc, sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Dedicated : NULL, target_ss); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 10a21cd07d..765e01868e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -82,7 +82,8 @@ void nr_fill_nfapi_pucch(module_id_t mod_id, cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP : NULL; LOG_D(NR_MAC,"pucch_acknak: %d.%d Calling nr_configure_pucch (ubwpd %p,r_pucch %d) pucch in %d.%d\n",frame,slot,ubwpd,pucch->r_pucch,pucch->frame,pucch->ul_slot); - nr_configure_pucch(nr_mac->common_channels[0].sib1 ? nr_mac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL, + const NR_SIB1_t *sib1 = nr_mac->common_channels[0].sib1 ? nr_mac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL; + nr_configure_pucch(sib1, pucch_pdu, scc, UE_info->CellGroup[UE_id], @@ -743,9 +744,10 @@ void nr_csi_meas_reporting(int Mod_idP, curr_pucch->csi_bits += nr_get_csi_bitlen(Mod_idP,UE_id,csi_report_id); + const NR_SIB1_t *sib1 = RC.nrmac[Mod_idP]->common_channels[0].sib1 ? RC.nrmac[Mod_idP]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL; NR_BWP_t *genericParameters = get_ul_bwp_genericParameters(sched_ctrl->active_ubwp, scc, - RC.nrmac[Mod_idP]->common_channels[0].sib1 ? RC.nrmac[Mod_idP]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL); + sib1); int bwp_start = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); @@ -1757,9 +1759,10 @@ int nr_acknack_scheduling(int mod_id, pucch_Config = RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup; } + const NR_SIB1_t *sib1 = RC.nrmac[mod_id]->common_channels[0].sib1 ? RC.nrmac[mod_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL; NR_BWP_t *genericParameters = get_ul_bwp_genericParameters(sched_ctrl->active_ubwp, (NR_ServingCellConfigCommon_t *)scc, - RC.nrmac[mod_id]->common_channels[0].sib1 ? RC.nrmac[mod_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL); + sib1); int bwp_start = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 4a788d3f1c..b4749aafee 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -991,9 +991,10 @@ bool allocate_ul_retransmission(module_id_t module_id, cg->spCellConfig->spCellConfigDedicated->uplinkConfig ? cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP : NULL; + const NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL; NR_BWP_t *genericParameters = get_ul_bwp_genericParameters(sched_ctrl->active_ubwp, (NR_ServingCellConfigCommon_t *)scc, - RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL); + sib1); int rbStart = 0; // wrt BWP start const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); @@ -1020,7 +1021,7 @@ bool allocate_ul_retransmission(module_id_t module_id, || ps->dci_format != dci_format || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data || sched_ctrl->update_pusch_ps) { - nr_set_pusch_semi_static(nr_mac->common_channels[0].sib1 ? (const NR_SIB1_t *)nr_mac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL, + nr_set_pusch_semi_static(sib1, scc, sched_ctrl->active_ubwp, ubwpd, @@ -1041,7 +1042,7 @@ bool allocate_ul_retransmission(module_id_t module_id, rbSize++; NR_pusch_semi_static_t temp_ps; int dci_format = get_dci_format(sched_ctrl); - nr_set_pusch_semi_static(nr_mac->common_channels[0].sib1 ? (const NR_SIB1_t *)nr_mac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL, + nr_set_pusch_semi_static(sib1, scc, sched_ctrl->active_ubwp, ubwpd, @@ -1161,6 +1162,7 @@ void pf_ul(module_id_t module_id, gNB_MAC_INST *nrmac = RC.nrmac[module_id]; NR_ServingCellConfigCommon_t *scc = nrmac->common_channels[CC_id].ServingCellConfigCommon; NR_UE_info_t *UE_info = &nrmac->UE_info; + const NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL; const int min_rb = 5; float coeff_ue[MAX_MOBILES_PER_GNB]; // UEs that could be scheduled @@ -1177,7 +1179,7 @@ void pf_ul(module_id_t module_id, NR_BWP_t *genericParameters = get_ul_bwp_genericParameters(sched_ctrl->active_ubwp, scc, - RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL); + sib1); int rbStart = 0; // wrt BWP start NR_CellGroupConfig_t *cg = UE_info->CellGroup[UE_id]; @@ -1281,7 +1283,7 @@ void pf_ul(module_id_t module_id, || ps->dci_format != dci_format || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data || sched_ctrl->update_pusch_ps) { - nr_set_pusch_semi_static(nrmac->common_channels[0].sib1 ? (const NR_SIB1_t *)nrmac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL, + nr_set_pusch_semi_static(sib1, scc, sched_ctrl->active_ubwp, ubwpd, @@ -1383,7 +1385,7 @@ void pf_ul(module_id_t module_id, NR_BWP_t *genericParameters = get_ul_bwp_genericParameters(sched_ctrl->active_ubwp, scc, - RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL); + sib1); int rbStart = sched_ctrl->active_ubwp ? NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE) : 0; const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); @@ -1414,7 +1416,7 @@ void pf_ul(module_id_t module_id, || ps->dci_format != dci_format || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data || sched_ctrl->update_pusch_ps) { - nr_set_pusch_semi_static(nrmac->common_channels[0].sib1 ? (const NR_SIB1_t *)nrmac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL, + nr_set_pusch_semi_static(sib1, scc, sched_ctrl->active_ubwp, ubwpd, @@ -1465,8 +1467,9 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t gNB_MAC_INST *nr_mac = RC.nrmac[module_id]; NR_COMMON_channels_t *cc = nr_mac->common_channels; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; - NR_ServingCellConfigCommonSIB_t *scc_sib1 = get_softmodem_params()->sa ? - RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1->servingCellConfigCommon : NULL; + const NR_SIB1_t *sib1 = get_softmodem_params()->sa ? + RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL; + NR_ServingCellConfigCommonSIB_t *scc_sib1 = get_softmodem_params()->sa ? sib1->servingCellConfigCommon : NULL; AssertFatal(scc!=NULL || scc_sib1!=NULL,"We need one serving cell config common\n"); @@ -1535,7 +1538,7 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t NR_BWP_t *genericParameters = get_ul_bwp_genericParameters(sched_ctrl->active_ubwp, scc, - RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL); + sib1); const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); const uint16_t bwpStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); @@ -1646,6 +1649,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot) NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon; NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info; + const NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL; const NR_list_t *UE_list = &UE_info->list; for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; @@ -1779,7 +1783,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot) /* FAPI: BWP */ NR_BWP_t *genericParameters = get_ul_bwp_genericParameters(sched_ctrl->active_ubwp, scc, - RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL); + sib1); pusch_pdu->bwp_size = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); pusch_pdu->bwp_start = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); @@ -1930,7 +1934,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot) n_ubwp = cg->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count; } - config_uldci(nr_mac->common_channels[0].sib1 ? (const NR_SIB1_t *)nr_mac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL, + config_uldci(sib1, sched_ctrl->active_ubwp, ubwpd, scc, diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index dbe1a61404..7d38931051 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -242,7 +242,7 @@ int nr_get_pucch_resource(NR_ControlResourceSet_t *coreset, NR_BWP_UplinkDedicated_t *bwpd, int CCEIndex); -void nr_configure_pucch(NR_SIB1_t *sib1, +void nr_configure_pucch(const NR_SIB1_t *sib1, nfapi_nr_pucch_pdu_t* pucch_pdu, NR_ServingCellConfigCommon_t *scc, NR_CellGroupConfig_t *CellGroup, @@ -302,11 +302,11 @@ void prepare_dci(const NR_CellGroupConfig_t *CellGroup, NR_BWP_t *get_dl_bwp_genericParameters(NR_BWP_Downlink_t *active_bwp, NR_ServingCellConfigCommon_t *ServingCellConfigCommon, - NR_SIB1_t *sib1); + const NR_SIB1_t *sib1); NR_BWP_t *get_ul_bwp_genericParameters(NR_BWP_Uplink_t *active_ubwp, NR_ServingCellConfigCommon_t *ServingCellConfigCommon, - NR_SIB1_t *sib1); + const NR_SIB1_t *sib1); NR_PDSCH_TimeDomainResourceAllocationList_t *get_pdsch_TimeDomainAllocationList(const NR_BWP_Downlink_t *active_bwp, const NR_ServingCellConfigCommon_t *ServingCellConfigCommon, @@ -320,7 +320,7 @@ NR_ControlResourceSet_t *get_coreset(module_id_t module_idP, NR_SearchSpace__searchSpaceType_PR ss_type); /* find a search space within a BWP */ -NR_SearchSpace_t *get_searchspace(NR_SIB1_t *sib1, +NR_SearchSpace_t *get_searchspace(const NR_SIB1_t *sib1, NR_ServingCellConfigCommon_t *scc, NR_BWP_DownlinkDedicated_t *bwp_Dedicated, NR_SearchSpace__searchSpaceType_PR target_ss); From ed4cc7c2570ab76e2057e0fe10de318822ad07e1 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Thu, 24 Mar 2022 15:37:26 +0000 Subject: [PATCH 19/46] Fix segmentation fault when using CU-DU split --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index a356b1f773..8b3acdbddf 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -1478,9 +1478,8 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t gNB_MAC_INST *nr_mac = RC.nrmac[module_id]; NR_COMMON_channels_t *cc = nr_mac->common_channels; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; - const NR_SIB1_t *sib1 = get_softmodem_params()->sa ? - RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL; - NR_ServingCellConfigCommonSIB_t *scc_sib1 = get_softmodem_params()->sa ? sib1->servingCellConfigCommon : NULL; + const NR_SIB1_t *sib1 = nr_mac->common_channels[0].sib1 ? nr_mac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL; + NR_ServingCellConfigCommonSIB_t *scc_sib1 = sib1 ? sib1->servingCellConfigCommon : NULL; AssertFatal(scc!=NULL || scc_sib1!=NULL,"We need one serving cell config common\n"); From a020c51772714988919eab6d50e43de571a140c7 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Mon, 28 Mar 2022 10:31:50 +0100 Subject: [PATCH 20/46] Fix warning after merge --- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index f43cb6a70c..0bf119f342 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -38,12 +38,13 @@ void set_cset_offset(uint16_t); void mac_top_init_gNB(void); +void process_CellGroup(NR_CellGroupConfig_t *CellGroup, NR_UE_sched_ctrl_t *sched_ctrl); + void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts, int pusch_AntennaPorts, - NR_ServingCellConfigCommon_t *scc - ); + NR_ServingCellConfigCommon_t *scc); int rrc_mac_config_req_gNB(module_id_t Mod_idP, int ssb_SubcarrierOffset, From a87741cedadf6a4928eef15d60f35bd557596e03 Mon Sep 17 00:00:00 2001 From: Manish Date: Fri, 25 Mar 2022 10:48:15 +0000 Subject: [PATCH 21/46] Ubuntu 20.04 compilation support added in buil-oai Compilation flag updated for native architecture Signed-off-by: Manish --- cmake_targets/CMakeLists.txt | 2 +- cmake_targets/tools/build_helper | 46 ++++++++++++++++++++------------ 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 46e33e8803..506fad9a4d 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -236,7 +236,7 @@ endif() add_definitions("-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP") -set(commonOpts "-pipe -Wno-packed-bitfield-compat -fPIC -Wall -fno-strict-aliasing -rdynamic") +set(commonOpts "-pipe -Wno-packed-bitfield-compat -fPIC -Wall -fno-strict-aliasing -rdynamic -march=native") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_FLAGS_PROCESSOR} ${commonOpts} -std=gnu99 -funroll-loops") diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 55a39c6b2b..792246338d 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -103,6 +103,8 @@ get_distribution_release() { check_supported_distribution() { local distribution=$(get_distribution_release) case "$distribution" in + "ubuntu21.04") return 0 ;; + "ubuntu20.04") return 0 ;; "ubuntu18.04") return 0 ;; "ubuntu17.10") return 0 ;; "ubuntu17.04") return 0 ;; @@ -574,7 +576,16 @@ check_install_soapy () { check_install_additional_tools (){ $SUDO $INSTALLER update -y + local optional_packages="" if [[ "$OS_DISTRO" == "ubuntu" ]]; then + case "$(get_distribution_release)" in + "ubuntu14.04"| "ubuntu16.04"| "ubuntu17.04"| "ubuntu17.10"| "ubuntu18.04") + optional_packages="python-dev python-pexpect python-numpy python-scipy python-matplotlib" + ;; + "ubuntu20.04"| "ubuntu21.04") + optional_packages="python3 python3-pip python3-dev python3-scipy python3-matplotlib exuberant-ctags" + ;; + esac PACKAGE_LIST="\ check \ dialog \ @@ -584,8 +595,6 @@ check_install_additional_tools (){ libpthread-stubs0-dev \ openvpn \ pkg-config \ - python-dev \ - python-pexpect \ sshfs \ swig \ tshark \ @@ -598,13 +607,10 @@ check_install_additional_tools (){ iperf3 \ android-tools-adb \ wvdial \ - python-numpy \ sshpass \ nscd \ bc \ - ntp \ - python-scipy \ - python-matplotlib" + ntp" elif [[ "$OS_DISTRO" == "rhel" ]] || [[ "$OS_DISTRO" == "centos" ]]; then PACKAGE_LIST="\ check \ @@ -662,7 +668,7 @@ check_install_additional_tools (){ python2-scipy \ python2-matplotlib" fi - $SUDO $INSTALLER install -y $PACKAGE_LIST + $SUDO $INSTALLER install -y $PACKAGE_LIST $optional_packages $SUDO rm -fr /opt/ssh $SUDO GIT_SSL_NO_VERIFY=true git clone https://gitlab.eurecom.fr/oai/ssh.git /opt/ssh @@ -697,23 +703,33 @@ check_install_oai_software() { $SUDO apt install -y software-properties-common case "$(get_distribution_release)" in "ubuntu14.04") - specific_packages="libtasn1-3-dev libgnutls-dev libatlas-dev iproute libconfig8-dev" + specific_packages="libtasn1-3-dev libgnutls-dev libatlas-dev iproute libconfig8-dev iptables-dev libgcrypt11-de python-pip pydb" # For iperf3 $SUDO add-apt-repository "deb http://archive.ubuntu.com/ubuntu trusty-backports universe" $SUDO apt-get update ;; "ubuntu16.04") - specific_packages="libtasn1-6-dev libgnutls-dev libatlas-dev iproute libconfig8-dev" + specific_packages="libtasn1-6-dev libgnutls-dev libatlas-dev iproute libconfig8-dev iptables-dev libgcrypt11-dev python-pip pydb" ;; "ubuntu17.04") - specific_packages="libtasn1-6-dev libgnutls28-dev libatlas-dev iproute libconfig8-dev" + specific_packages="libtasn1-6-dev libgnutls28-dev libatlas-dev iproute libconfig8-dev iptables-dev libgcrypt11-dev python-pip pydb" ;; "ubuntu17.10") - specific_packages="libtasn1-6-dev libgnutls28-dev iproute libconfig8-dev" + specific_packages="libtasn1-6-dev libgnutls28-dev iproute libconfig8-dev iptables-dev libgcrypt11-dev python-pip pydb" LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu" LAPACK_TARGET="/usr/lib/x86_64-linux-gnu/atlas/liblapack.so" ;; "ubuntu18.04") + specific_packages="libtasn1-6-dev libgnutls28-dev iproute2 libconfig-dev iptables-dev libgcrypt11-dev python-pip pydb" + LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu" + LAPACK_TARGET="/usr/lib/x86_64-linux-gnu/atlas/liblapack.so" + ;; + "ubuntu20.04") + specific_packages="libtasn1-6-dev libgnutls28-dev iproute2 libconfig-dev" + LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu" + LAPACK_TARGET="/usr/lib/x86_64-linux-gnu/atlas/liblapack.so" + ;; + "ubuntu21.04") specific_packages="libtasn1-6-dev libgnutls28-dev iproute2 libconfig-dev" LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu" LAPACK_TARGET="/usr/lib/x86_64-linux-gnu/atlas/liblapack.so" @@ -741,15 +757,13 @@ check_install_oai_software() { guile-2.0-dev \ iperf \ iptables \ - iptables-dev \ libatlas-base-dev \ libblas-dev \ - liblapack-dev\ - liblapacke-dev\ + liblapack-dev \ + liblapacke-dev \ libffi-dev \ libforms-bin \ libforms-dev \ - libgcrypt11-dev \ libgmp-dev \ libgtk-3-dev \ libidn2-0-dev \ @@ -772,8 +786,6 @@ check_install_oai_software() { python \ subversion \ xmlstarlet \ - python-pip \ - pydb \ libyaml-dev \ wget \ libxpm-dev \ From 8f64e6414c02d1b9eb9820c3d4f653af3441edfd Mon Sep 17 00:00:00 2001 From: Manish Date: Fri, 25 Mar 2022 10:55:54 +0000 Subject: [PATCH 22/46] Build document updated for compilation on Ubuntu 20 using buil-oai Signed-off-by: Manish --- doc/BUILD.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/BUILD.md b/doc/BUILD.md index 852a248659..a52ce98cb5 100644 --- a/doc/BUILD.md +++ b/doc/BUILD.md @@ -77,7 +77,7 @@ cd cmake_targets/ ./build_oai -I -w USRP --eNB --UE --nrUE --gNB ``` -- The `-I` option is to install pre-requisites, you only need it the first time you build the softmodem or when some oai dependencies have changed. Note: for Ubuntu 20 use cmake_targets/install_external_packages.ubuntu20 instead! +- The `-I` option is to install pre-requisites, you only need it the first time you build the softmodem or when some oai dependencies have changed. - The `-w` option is to select the radio head support you want to include in your build. Radio head support is provided via a shared library, which is called the "oai device" The build script creates a soft link from `liboai_device.so` to the true device which will be used at run-time (here the USRP one,`liboai_usrpdevif.so` . USRP is the only hardware tested today in the Continuous Integration process. The RF simulator[RF simulator](../targets/ARCH/rfsimulator/README.md) is implemented as a specific device replacing RF hardware, it can be specifically built using `-w SIMU` option, but is also built during any softmodem build. - `--eNB` is to build the `lte-softmodem` executable and all required shared libraries - `--gNB` is to build the `nr-softmodem` executable and all required shared libraries From 08c06b96ad4c877ebe8e764a9d10f10976f0ed63 Mon Sep 17 00:00:00 2001 From: Manish Date: Fri, 25 Mar 2022 11:29:20 +0000 Subject: [PATCH 23/46] install_external_packages.ubuntu20 file removed native architecture flag removed as compilation happen on diffrent server in CI Signed-off-by: Manish --- cmake_targets/CMakeLists.txt | 2 +- .../install_external_packages.ubuntu20 | 499 ------------------ 2 files changed, 1 insertion(+), 500 deletions(-) delete mode 100755 cmake_targets/install_external_packages.ubuntu20 diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 506fad9a4d..46e33e8803 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -236,7 +236,7 @@ endif() add_definitions("-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP") -set(commonOpts "-pipe -Wno-packed-bitfield-compat -fPIC -Wall -fno-strict-aliasing -rdynamic -march=native") +set(commonOpts "-pipe -Wno-packed-bitfield-compat -fPIC -Wall -fno-strict-aliasing -rdynamic") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_FLAGS_PROCESSOR} ${commonOpts} -std=gnu99 -funroll-loops") diff --git a/cmake_targets/install_external_packages.ubuntu20 b/cmake_targets/install_external_packages.ubuntu20 deleted file mode 100755 index a2f6a9709c..0000000000 --- a/cmake_targets/install_external_packages.ubuntu20 +++ /dev/null @@ -1,499 +0,0 @@ -#!/bin/bash -#/* -# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more -# * contributor license agreements. See the NOTICE file distributed with -# * this work for additional information regarding copyright ownership. -# * The OpenAirInterface Software Alliance licenses this file to You under -# * the OAI Public License, Version 1.1 (the "License"); you may not use this file -# * except in compliance with the License. -# * You may obtain a copy of the License at -# * -# * http://www.openairinterface.org/?page_id=698 -# * -# * Unless required by applicable law or agreed to in writing, software -# * distributed under the License is distributed on an "AS IS" BASIS, -# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# * See the License for the specific language governing permissions and -# * limitations under the License. -# *------------------------------------------------------------------------------- -# * For more information about the OpenAirInterface (OAI) Software Alliance: -# * contact@openairinterface.org -# */ - -# brief -# authors Laurent Thomas -# -####################################### - -if [ ! -f /etc/os-release ]; then - echo "No /etc/os-release file found. You're likely on an unsupported distro." - exit 1 -fi -OS_DISTRO=$(grep "^ID=" /etc/os-release | sed "s/ID=//" | sed "s/\"//g") -OS_RELEASE=$(grep "^VERSION_ID=" /etc/os-release | sed "s/VERSION_ID=//" | sed "s/\"//g") -case "$OS_DISTRO" in - ubuntu) OS_BASEDISTRO="debian"; INSTALLER="apt"; CMAKE="cmake" ;; -esac - -SUDO='sudo -E' - -############################### -## echo and family -############################### -black='\E[30m' -red='\E[31m' -green='\E[32m' -yellow='\E[33m' -blue='\E[1;34m' -magenta='\E[35m' -cyan='\E[36m' -white='\E[37m' -reset_color='\E[00m' -COLORIZE=1 - -cecho() { - # Color-echo - # arg1 = message - # arg2 = color - local default_msg="No Message." - message=${1:-$default_msg} - color=${2:-$green} - [ "$COLORIZE" = "1" ] && message="$color$message$reset_color" - echo -e "$message" - return -} - -echo_error() { cecho "$* $red" ;} -echo_fatal() { cecho "$* $red"; exit 1 ;} -echo_warning() { cecho "$* $yellow" ;} -echo_success() { cecho "$* $green" ;} -echo_info() { cecho "$* $blue" ;} - -######################## -# distribution helpers # -######################## - -# This function return a string to identify the distribution we are running -# Examples: -# ubuntu16.04 -# debian8.5 -get_distribution_release() { - echo "$OS_DISTRO$OS_RELEASE" -} - -check_supported_distribution() { - case $(get_distribution_release) in - "ubuntu20.04") return 0 ;; - "ubuntu20.10") return 0 ;; - "ubuntu21.04") return 0 ;; - "ubuntu21.10") return 0 ;; - esac - return 1 -} - -################## -# Error handlers # -################## - -handler_EXIT() { - local exit_code=$? - [ "$exit_code" -eq 0 ] || echo_error "build have failed" - exit $exit_code -} - -trap handler_EXIT EXIT - -########################### -# Cleaners -########################### - -clean_kernel() { - $SUDO modprobe ip_tables - $SUDO modprobe x_tables - $SUDO iptables -P INPUT ACCEPT - $SUDO iptables -F INPUT - $SUDO iptables -P OUTPUT ACCEPT - $SUDO iptables -F OUTPUT - $SUDO iptables -P FORWARD ACCEPT - $SUDO iptables -F FORWARD - $SUDO iptables -t nat -F - $SUDO iptables -t mangle -F - $SUDO iptables -t filter -F - $SUDO iptables -t raw -F - echo_info "Flushed iptables" - $SUDO rmmod nasmesh > /dev/null 2>&1 - $SUDO rmmod oai_nw_drv > /dev/null 2>&1 - $SUDO rmmod openair_rf > /dev/null 2>&1 - $SUDO rmmod ue_ip > /dev/null 2>&1 - echo_info "removed drivers from kernel" -} - -clean_all_files() { - set_openair_env - rm -rf "$OPENAIR_DIR"/targets/bin/* - dir="$OPENAIR_DIR/cmake_targets" - rm -rf "$dir"/log/* - rm -rf "$dir"/ran_build/build - rm -rf "$dir"/ran_build_noLOG/build - rm -rf "$dir"/lte-simulators/build - rm -rf "$dir"/nas_sim_tools/build - rm -rf "$dir"/oaisim_build_oai/build - rm -rf "$dir"/oaisim_build_oai/CMakeLists.txt - rm -rf "$dir"/autotests/bin - rm -rf "$dir"/autotests/log - rm -rf "$dir"/autotests/*/build -} - -############################################ -# External packages installers -############################################ - -install_protobuf_from_source(){ - protobuf_install_log=$OPENAIR_DIR/cmake_targets/log/protobuf_install_log.txt - echo_info "\nInstalling Google Protobuf from sources. The log file for Protobuf installation is here: $protobuf_install_log " - ( - cd /tmp || exit - echo "Downloading protobuf" - #rm -rf /tmp/protobuf-2.6.1.tar.gz* /tmp/protobuf-2.6.1 - #wget https://github.com/protocolbuffers/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz - #tar -xzvf protobuf-2.6.1.tar.gz --owner $USER --group $USER --no-same-owner - #cd protobuf-2.6.1/ - rm -rf /tmp/protobuf-cpp-3.3.0.tar.gz* /tmp/protobuf-3.3.0 - wget --tries=3 --retry-connrefused https://github.com/protocolbuffers/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz - tar -xzvf protobuf-cpp-3.3.0.tar.gz --owner "$USER" --group "$(groups | cut -d" " -f1)" --no-same-owner - cd protobuf-3.3.0/ || exit - ./configure - echo "Compiling protobuf" - make -j"$(nproc)" - $SUDO make install - $SUDO ldconfig - ) >& "$protobuf_install_log" -} - -install_protobuf_c_from_source(){ - protobuf_c_install_log=$OPENAIR_DIR/cmake_targets/log/protobuf_c_install_log.txt - echo_info "\nInstalling Google Protobuf_C from sources. The log file for Protobuf_C installation is here: $protobuf_c_install_log " - ( - if [[ "$OS_DISTRO" == "rhel" ]] || [[ "$OS_DISTRO" == "centos" ]]; then - export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig - fi - cd /tmp || exit - echo "Downloading protobuf-c" - rm -rf /tmp/protobuf-c - git clone https://github.com/protobuf-c/protobuf-c.git - cd protobuf-c || exit - git checkout 2a46af42784abf86804d536f6e0122d47cfeea45 - ./autogen.sh - ./configure - echo "Compiling protobuf-c" - make -j"$(nproc)" - $SUDO make install - $SUDO ldconfig - ) >& "$protobuf_c_install_log" -} - -install_usrp_uhd_driver_from_source(){ - uhd_install_log=$OPENAIR_DIR/cmake_targets/log/uhd_install_log.txt - echo_info "\nInstalling UHD driver from sources. The log file for UHD driver installation is here: $uhd_install_log " - ( - cd /tmp || exit - echo "Downloading UHD driver" - rm -rf /tmp/uhd - git clone https://github.com/EttusResearch/uhd.git - cd uhd || exit - git checkout UHD-3.15.LTS - mkdir -p host/build - cd host/build || exit - $CMAKE ../ -GNinja - echo "Compiling UHD" - ninja - $SUDO ninja install - $SUDO ldconfig - $SUDO /usr/lib/uhd/utils/uhd_images_downloader.py - ) >& "$uhd_install_log" -} - -install_bladerf_driver_from_source(){ - bladerf_install_log=$OPENAIR_DIR/cmake_targets/log/bladerf_install_log.txt - echo_info "\nInstalling BladeRF driver from sources. The log file for BladeRF driver installation is here: $bladerf_install_log " - ( - cd /tmp || exit - echo "Downloading BladeRF driver" - rm -rf /tmp/bladeRF - git clone https://github.com/Nuand/bladeRF.git - cd bladeRF || exit - git checkout tags/2016.06 - mkdir -p build - cd build || exit - $CMAKE ../ - echo "Compiling BladeRF driver" - make -j"$(nproc)" - $SUDO make install - $SUDO ldconfig - echo "Downloading FPGA and firmware images" - cd /tmp/bladeRF || exit - wget --tries=3 --retry-connrefused https://www.nuand.com/fx3/bladeRF_fw_latest.img - wget --tries=3 --retry-connrefused https://www.nuand.com/fpga/hostedx40-latest.rbf - sudo mkdir -p /usr/share/Nuand/bladeRF - sudo mv bladeRF_fw_latest.img /usr/share/Nuand/bladeRF/bladeRF_fw.img - sudo mv hostedx40-latest.rbf /usr/share/Nuand/bladeRF/hostedx40.rbf - ) >& "$bladerf_install_log" -} - -check_install_bladerf_driver(){ - if [[ "$OS_DISTRO" == "ubuntu" ]]; then - $SUDO apt-get install -y bladerf libbladerf-dev - $SUDO apt-get install -y bladerf-firmware-fx3 - $SUDO apt-get install -y bladerf-fpga-hostedx40 - elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then - install_bladerf_driver_from_source - else - echo_error "BladeRF Installer for OAI does not support automatic build. Install BladeRF compiling sources manually from BladeRF website" - fi -} - -flash_firmware_bladerf() { - $SUDO bladeRF-cli --flash-firmware /usr/share/Nuand/bladeRF/bladeRF_fw.img -} - -install_soapy_from_source(){ - soapy_install_log=$OPENAIR_DIR/cmake_targets/log/soapy_install_log.txt - echo_info "\nInstalling Soapy EcoSystem from source. The log file for Soapy installation is here: $soapy_install_log " - ( - cd /tmp || exit - echo "Downloading SoapySDR" - rm -rf /tmp/soapysdr - git clone -b soapy-sdr-0.7.0 --single-branch https://github.com/pothosware/SoapySDR.git - cd SoapySDR || exit - #git checkout tags/release_003_010_001_001 - mkdir -p build - cd build || exit - $CMAKE ../ - echo "Compiling SoapySDR" - make -j"$(nproc)" - $SUDO make install - $SUDO ldconfig - cd /tmp || exit - echo "Downloading SoapyRemote" - rm -rf /tmp/soapyremote - git clone -b soapy-remote-0.5.0 --single-branch https://github.com/pothosware/SoapyRemote.git - cd SoapyRemote || exit - #git checkout tags/release_003_010_001_001 - mkdir -p build - cd build || exit - cmake ../ - echo "Compiling SoapyRemote" - make -j"$(nproc)" - $SUDO make install - $SUDO ldconfig - ) >& "$soapy_install_log" -} - -install_soapy_iris_from_source(){ - iris_install_log=$OPENAIR_DIR/cmake_targets/log/iris_install_log.txt - echo_info "\nInstalling Iris driver from source. The log file for Iris driver installation is here: $iris_install_log " - ( - cd /tmp || exit - echo "Downloading SoapyIris" - rm -rf /tmp/sklk-soapyiris - git clone -b soapy-iris-2018.08.0.1 --single-branch https://github.com/skylarkwireless/sklk-soapyiris.git - cd sklk-soapyiris || exit - mkdir -p build - cd build ||exit - cmake ../ - echo "Compiling SoapyIris" - make -j"$(nproc)" - $SUDO make install - $SUDO ldconfig - ) >& "$iris_install_log" -} - -check_install_soapy () { - #if [[ "$OS_DISTRO" == "ubuntu" ]]; then - #first we remove old installation - $SUDO apt-get remove -y soapysdr soapysdr-server libsoapysdr-dev python-soapysdr python3-soapysdr soapysdr-module-remote || true - #$SUDO add-apt-repository -y ppa:myriadrf/drivers - #$SUDO apt-get update - #$SUDO apt-get install -y soapysdr soapysdr-server libsoapysdr-dev python-soapysdr python3-soapysdr soapysdr-module-remote - - #elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then - # $SUDO $INSTALLER -y install software-properties-common python3-software-properties python-software-properties subversion git python3 python-numpy python3-numpy cmake swig python-dev - install_soapy_from_source - #fi - install_soapy_iris_from_source - -} - -check_install_ubuntu_packages() { - $SUDO $INSTALLER update -y - if [[ "$OS_DISTRO" == "ubuntu" ]]; then - local LAPACK_LIBNAME="liblapack.so" - local LAPACK_TARGET="/usr/lib/atlas-base/atlas/liblapack.so" - $SUDO apt install -y software-properties-common - case "$(get_distribution_release)" in - "ubuntu20.04") - specific_packages="libtasn1-6-dev libgnutls28-dev iproute2 libconfig-dev" - LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu" - LAPACK_TARGET="/usr/lib/x86_64-linux-gnu/atlas/liblapack.so" - ;; - "ubuntu21.04") - specific_packages="libtasn1-6-dev libgnutls28-dev iproute2 libconfig-dev" - LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu" - LAPACK_TARGET="/usr/lib/x86_64-linux-gnu/atlas/liblapack.so" - ;; - esac - $SUDO $INSTALLER install -y \ - $specific_packages \ - check \ - dialog \ - dkms \ - gawk \ - libboost-all-dev \ - libpthread-stubs0-dev \ - openvpn \ - pkg-config \ - python3-dev \ - sshfs \ - swig \ - tshark \ - uml-utilities \ - unzip \ - valgrind \ - vlan \ - exuberant-ctags \ - ntpdate \ - iperf3 \ - android-tools-adb \ - wvdial \ - sshpass \ - nscd \ - bc \ - ntp \ - python3-scipy \ - python3-matplotlib \ - bison \ - build-essential \ - cmake \ - cmake-curses-gui \ - ninja-build \ - doxygen \ - doxygen-gui \ - texlive-latex-base \ - ethtool \ - flex \ - gdb \ - git \ - graphviz \ - gtkwave \ - iperf \ - iptables \ - libxtables-dev \ - libatlas-base-dev \ - libblas-dev \ - liblapack-dev\ - liblapacke-dev\ - libffi-dev \ - libforms-bin \ - libforms-dev \ - libgcrypt20-dev \ - libgmp-dev \ - libgtk-3-dev \ - libidn2-0-dev \ - libidn11-dev \ - libmysqlclient-dev \ - libpython2.7-dev \ - libsctp1 \ - libsctp-dev \ - libssl-dev \ - libtool \ - libusb-1.0-0-dev \ - libxml2 \ - libxml2-dev \ - libxslt1-dev \ - octave-signal \ - openssh-client \ - openssh-server \ - openssl \ - python3 \ - subversion \ - xmlstarlet \ - python3-pip \ - libyaml-dev \ - wget \ - libxpm-dev \ - libboost-all-dev \ - nettle-dev \ - nettle-bin \ - libreadline-dev - fi - - $SUDO update-alternatives --set "$LAPACK_LIBNAME" "$LAPACK_TARGET" - -} - -install_asn1c_from_source(){ - asn1_install_log=$OPENAIR_DIR/cmake_targets/log/asn1c_install_log.txt - echo_info "\nInstalling ASN1. The log file for ASN1 installation is here: $asn1_install_log " - ( - $SUDO rm -rf /tmp/asn1c - # GIT_SSL_NO_VERIFY=true git clone https://gitlab.eurecom.fr/oai/asn1c.git /tmp/asn1c - git clone https://gitlab.eurecom.fr/oai/asn1c.git /tmp/asn1c - cd /tmp/asn1c || exit - # better to use a given commit than a branch in case the branch - # is updated and requires modifications in the source of OAI - #git checkout velichkov_s1ap_plus_option_group - git checkout f12568d617dbf48497588f8e227d70388fa217c9 - autoreconf -iv - ./configure - make -j"$(nproc)" - $SUDO make install - cd - || exit - $SUDO ldconfig - ) > "$asn1_install_log" 2>&1 -} - -################################ -# set_openair_env -############################### -set_openair_env(){ - fullpath=$(readlink -f "${BASH_SOURCE[0]}") - [ -f "/.$fullpath" ] || fullpath=$(readlink -f "$PWD/$fullpath") - openair_path=${fullpath%/cmake_targets/*} - openair_path=${openair_path%/targets/*} - openair_path=${openair_path%/openair[123]/*} - export OPENAIR_DIR=$openair_path - export OPENAIR1_DIR=$openair_path/openair1 - export OPENAIR2_DIR=$openair_path/openair2 - export OPENAIR3_DIR=$openair_path/openair3 - export OPENAIR_TARGETS=$openair_path/targets -} - -if ! check_supported_distribution; then - echo_error "Your distribution $(get_distribution_release) is not supported by oai !" - exit 1 -fi -set_openair_env -echo_info "Installing packages" -check_install_ubuntu_packages - -echo_info "installing ASN.1 compiler" -install_asn1c_from_source - -echo_info "installing protobuf/protobuf-c for flexran agent support" -install_protobuf_from_source -install_protobuf_c_from_source - -if [ "$1" == "USRP" ] ; then - echo_info "installing packages for USRP support" - install_usrp_uhd_driver -fi -if [ "$1" == "BLADERF" ] ; then - echo_info "installing packages for BLADERF support" - check_install_bladerf_driver - flash_firmware_bladerf -fi -if [ "$1" == "IRIS" ] ; then - echo_info "installing packages for IRIS support" - check_install_soapy - # flash_firmware_iris -fi From 686bacabbebc7938ec07c446dc81b26db65c52a6 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 25 Mar 2022 15:00:55 +0100 Subject: [PATCH 24/46] Do not trap ^C in build_oai, and remove unused bash function --- cmake_targets/build_oai | 1 - cmake_targets/tools/build_helper | 20 -------------------- 2 files changed, 21 deletions(-) diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index c65728a41d..ecfc7d7387 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -59,7 +59,6 @@ BUILD_ECLIPSE=0 NR="False" OPTIONAL_LIBRARIES="telnetsrv enbscope uescope nrscope" RU=0 -trap handle_ctrl_c INT function print_help() { echo_info " diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 792246338d..afc0a6ae2b 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -967,23 +967,3 @@ do fi done } - - -# get from http://www.linuxjournal.com/content/validating-ip-address-bash-script -validate_ip() { - -local ip=$1 -local stat=1 - -if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - OIFS=$IFS - IFS='.' - ip=($ip) - IFS=$OIFS - [[ ${ip[0]} -le 255 && ${ip[1]} -le 255 \ - && ${ip[2]} -le 255 && ${ip[3]} -le 255 ]] - stat=$? -fi - -return $stat -} From a2e7a770c021fedff1243344352273ccc7aebea6 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 25 Mar 2022 15:05:05 +0100 Subject: [PATCH 25/46] Remove unused ssh repository --- cmake_targets/tools/build_helper | 5 ----- 1 file changed, 5 deletions(-) diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index afc0a6ae2b..adc9d6d9e9 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -670,9 +670,6 @@ check_install_additional_tools (){ fi $SUDO $INSTALLER install -y $PACKAGE_LIST $optional_packages - $SUDO rm -fr /opt/ssh - $SUDO GIT_SSL_NO_VERIFY=true git clone https://gitlab.eurecom.fr/oai/ssh.git /opt/ssh - #The packages below are already installed for Redhat distros (RHEL, CentOS, Fedora) if [[ "$OS_DISTRO" == "ubuntu" ]]; then $SUDO -H pip install paramiko @@ -872,8 +869,6 @@ check_install_oai_software() { fi install_asn1c_from_source $1 - $SUDO rm -fr /opt/ssh - $SUDO git clone https://gist.github.com/2190472.git /opt/ssh } install_asn1c_from_source(){ From 951682821c07e45031296c34da68efe485b9cd23 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 25 Mar 2022 15:19:18 +0100 Subject: [PATCH 26/46] Remove old Ubuntu releases --- cmake_targets/tools/build_helper | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index adc9d6d9e9..aa01c35e1c 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -106,10 +106,7 @@ check_supported_distribution() { "ubuntu21.04") return 0 ;; "ubuntu20.04") return 0 ;; "ubuntu18.04") return 0 ;; - "ubuntu17.10") return 0 ;; - "ubuntu17.04") return 0 ;; "ubuntu16.04") return 0 ;; - "ubuntu14.04") return 0 ;; "fedora24") return 0 ;; "rhel7") return 0 ;; "rhel7.6") return 0 ;; @@ -473,10 +470,6 @@ install_bladerf_driver_from_source(){ check_install_bladerf_driver(){ if [[ "$OS_DISTRO" == "ubuntu" ]]; then - if [ "$(get_distribution_release)" == "ubuntu14.04" ] ; then - $SUDO add-apt-repository -y ppa:bladerf/bladerf - $SUDO apt-get update - fi $SUDO apt-get install -y bladerf libbladerf-dev $SUDO apt-get install -y bladerf-firmware-fx3 $SUDO apt-get install -y bladerf-fpga-hostedx40 @@ -579,7 +572,7 @@ check_install_additional_tools (){ local optional_packages="" if [[ "$OS_DISTRO" == "ubuntu" ]]; then case "$(get_distribution_release)" in - "ubuntu14.04"| "ubuntu16.04"| "ubuntu17.04"| "ubuntu17.10"| "ubuntu18.04") + "ubuntu16.04"| "ubuntu18.04") optional_packages="python-dev python-pexpect python-numpy python-scipy python-matplotlib" ;; "ubuntu20.04"| "ubuntu21.04") @@ -699,23 +692,9 @@ check_install_oai_software() { local LAPACK_TARGET="/usr/lib/atlas-base/atlas/liblapack.so" $SUDO apt install -y software-properties-common case "$(get_distribution_release)" in - "ubuntu14.04") - specific_packages="libtasn1-3-dev libgnutls-dev libatlas-dev iproute libconfig8-dev iptables-dev libgcrypt11-de python-pip pydb" - # For iperf3 - $SUDO add-apt-repository "deb http://archive.ubuntu.com/ubuntu trusty-backports universe" - $SUDO apt-get update - ;; "ubuntu16.04") specific_packages="libtasn1-6-dev libgnutls-dev libatlas-dev iproute libconfig8-dev iptables-dev libgcrypt11-dev python-pip pydb" ;; - "ubuntu17.04") - specific_packages="libtasn1-6-dev libgnutls28-dev libatlas-dev iproute libconfig8-dev iptables-dev libgcrypt11-dev python-pip pydb" - ;; - "ubuntu17.10") - specific_packages="libtasn1-6-dev libgnutls28-dev iproute libconfig8-dev iptables-dev libgcrypt11-dev python-pip pydb" - LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu" - LAPACK_TARGET="/usr/lib/x86_64-linux-gnu/atlas/liblapack.so" - ;; "ubuntu18.04") specific_packages="libtasn1-6-dev libgnutls28-dev iproute2 libconfig-dev iptables-dev libgcrypt11-dev python-pip pydb" LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu" From 38e0bacf2661e75bf43c04394b69704a140e3226 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 25 Mar 2022 16:57:14 +0100 Subject: [PATCH 27/46] Install protobuf from repository if available --- cmake_targets/build_oai | 3 +- cmake_targets/tools/build_helper | 51 +++++++++----------------------- 2 files changed, 15 insertions(+), 39 deletions(-) diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index ecfc7d7387..8d221dd9f2 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -564,8 +564,7 @@ function main() { #fi fi echo_info "Installing protobuf/protobuf-c for flexran agent support" - install_protobuf_from_source - install_protobuf_c_from_source + install_protobuf_c echo_success "protobuf/protobuf-c installation successful" fi diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index aa01c35e1c..68ad2e18b5 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -251,43 +251,6 @@ compilations() { # External packages installers ############################################ -install_protobuf_from_source(){ - protobuf_install_log=$OPENAIR_DIR/cmake_targets/log/protobuf_install_log.txt - echo_info "\nInstalling Google Protobuf from sources. The log file for Protobuf installation is here: $protobuf_install_log " - ( - cd /tmp - echo "Downloading protobuf" - #rm -rf /tmp/protobuf-2.6.1.tar.gz* /tmp/protobuf-2.6.1 - #wget https://github.com/protocolbuffers/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz - #tar -xzvf protobuf-2.6.1.tar.gz --owner $USER --group $USER --no-same-owner - #cd protobuf-2.6.1/ - - if [ $IS_CONTAINER -eq 0 ] - then - rm -rf /tmp/protobuf-cpp-3.3.0.tar.gz* /tmp/protobuf-3.3.0 - wget --tries=3 --retry-connrefused https://github.com/protocolbuffers/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz - tar -xzvf protobuf-cpp-3.3.0.tar.gz --owner $(id -u) --group $(id -g) --no-same-owner - cd protobuf-3.3.0/ - else - export LD_LIBRARY_PATH=/usr/local/lib #protoc needs to know where toclook for shared libs - rm -rf /tmp/protobuf - git clone --depth=1 --branch=v3.3.0 https://github.com/protocolbuffers/protobuf.git /tmp/protobuf - cd /tmp/protobuf - git submodule update --init --recursive - ./autogen.sh - fi - ./configure - echo "Compiling protobuf" - make -j`nproc` - $SUDO make install - $SUDO ldconfig - if [[ -v CI_ENV ]]; then - cd /tmp - $SUDO rm -rf protobuf* - fi - ) >& $protobuf_install_log -} - install_protobuf_c_from_source(){ protobuf_c_install_log=$OPENAIR_DIR/cmake_targets/log/protobuf_c_install_log.txt echo_info "\nInstalling Google Protobuf_C from sources. The log file for Protobuf_C installation is here: $protobuf_c_install_log " @@ -314,6 +277,20 @@ install_protobuf_c_from_source(){ ) >& $protobuf_c_install_log } +install_protobuf_c() { + local protobuf_packages="" + case "$(get_distribution_release)" in + "ubuntu18.04" | "ubuntu20.04" | "ubuntu21.04") + protobuf_packages="protobuf-c-compiler libprotobuf-c1 libprotobuf-c-dev" + ;; + esac + if [[ "$protobuf_packages" == "" ]]; then + install_protobuf_c_from_source + else + $SUDO $INSTALLER -y install $protobuf_packages + fi +} + install_usrp_uhd_driver_from_source(){ uhd_install_log=$OPENAIR_DIR/cmake_targets/log/uhd_install_log.txt echo_info "\nInstalling UHD driver from sources. The log file for UHD driver installation is here: $uhd_install_log " From 51e3b6c79022d7e8113469d3ad6ace04c7bd7e92 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 25 Mar 2022 17:11:24 +0100 Subject: [PATCH 28/46] Add support for Fedora 35 and add missing gcc/g++ packages (both required) --- cmake_targets/tools/build_helper | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 68ad2e18b5..bdb96b0a83 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -107,7 +107,7 @@ check_supported_distribution() { "ubuntu20.04") return 0 ;; "ubuntu18.04") return 0 ;; "ubuntu16.04") return 0 ;; - "fedora24") return 0 ;; + "fedora35") return 0 ;; "rhel7") return 0 ;; "rhel7.6") return 0 ;; "rhel7.7") return 0 ;; @@ -284,6 +284,11 @@ install_protobuf_c() { protobuf_packages="protobuf-c-compiler libprotobuf-c1 libprotobuf-c-dev" ;; esac + case "$OS_DISTRO" in + "rhel" | "centos" | "fedora") # in EPEL and Fedora repos (at least as of 35) + protobuf_packages="protobuf-c-compiler protobuf-c protobuf-c-devel" + ;; + esac if [[ "$protobuf_packages" == "" ]]; then install_protobuf_c_from_source else @@ -703,6 +708,8 @@ check_install_oai_software() { texlive-latex-base \ ethtool \ flex \ + g++ \ + gcc \ gdb \ git \ graphviz \ @@ -756,8 +763,6 @@ check_install_oai_software() { $SUDO $INSTALLER install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm fi $SUDO $INSTALLER install -y python-epdb vim-common - else - $SUDO $INSTALLER install -y pydb fi $SUDO $INSTALLER install -y \ @@ -769,6 +774,8 @@ check_install_oai_software() { doxygen \ ethtool \ flex \ + g++ \ + gcc \ gdb \ git \ graphviz \ From 1fc659331fe0d65930dda34a5a616022d284c8f8 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 25 Mar 2022 17:32:26 +0100 Subject: [PATCH 29/46] Stop build_oai after dep installation if no compilation requested --- cmake_targets/build_oai | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 8d221dd9f2..31acd2e8fb 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -573,19 +573,6 @@ function main() { check_install_additional_tools fi - - - echo_info "3. building the compilation directives ..." - - DIR=$OPENAIR_DIR/cmake_targets - - [ "$CLEAN" = "1" ] && rm -rf $DIR/$BUILD_DIR/build - mkdir -p $DIR/$BUILD_DIR/build - - cd $DIR/$BUILD_DIR/build - echo_info "running $CMAKE_CMD" - eval $CMAKE_CMD ../.. - execlist="" if [ "$eNB" = "1" ] ; then execlist="$execlist lte-softmodem" @@ -605,10 +592,25 @@ function main() { if [ "$nrUE" = 1 ] ; then execlist="$execlist nr-uesoftmodem" fi - if [ "$ittiSIM" = "1" ] ; then execlist="$execlist nr-ittisim" fi + + if [[ "$execlist" == "" && "$SIMUS_PHY" != "1" ]]; then + echo_success "installing dependencies successful" + exit + fi + + echo_info "3. building the compilation directives ..." + + DIR=$OPENAIR_DIR/cmake_targets + + [ "$CLEAN" = "1" ] && rm -rf $DIR/$BUILD_DIR/build + mkdir -p $DIR/$BUILD_DIR/build + + cd $DIR/$BUILD_DIR/build + echo_info "running $CMAKE_CMD" + eval $CMAKE_CMD ../.. for f in $execlist ; do echo_info "Compiling $f..." From 255f4f1f402a7c0ac67c9c96bfc9737ee0043678 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 25 Mar 2022 18:18:24 +0100 Subject: [PATCH 30/46] Fix additional packages for Fedora 35 --- cmake_targets/tools/build_helper | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index bdb96b0a83..1763d681a6 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -631,17 +631,17 @@ check_install_additional_tools (){ valgrind \ vconfig \ ctags \ - ntpdate \ + ntpsec \ iperf3 \ wvdial \ python-numpy \ sshpass \ nscd \ - python2-paramiko \ + python-paramiko \ python-pyroute2 \ python-netifaces \ - python2-scipy \ - python2-matplotlib" + python-scipy \ + python-matplotlib" fi $SUDO $INSTALLER install -y $PACKAGE_LIST $optional_packages From df93c43ec45fdde023c55e2a7c8a4302e4c997c5 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 25 Mar 2022 18:30:23 +0100 Subject: [PATCH 31/46] Add support for Ubuntu 22 --- cmake_targets/tools/build_helper | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 1763d681a6..e6801902bb 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -103,6 +103,7 @@ get_distribution_release() { check_supported_distribution() { local distribution=$(get_distribution_release) case "$distribution" in + "ubuntu22.04") return 0 ;; "ubuntu21.04") return 0 ;; "ubuntu20.04") return 0 ;; "ubuntu18.04") return 0 ;; @@ -280,7 +281,7 @@ install_protobuf_c_from_source(){ install_protobuf_c() { local protobuf_packages="" case "$(get_distribution_release)" in - "ubuntu18.04" | "ubuntu20.04" | "ubuntu21.04") + "ubuntu18.04" | "ubuntu20.04" | "ubuntu21.04" | "ubuntu22.04") protobuf_packages="protobuf-c-compiler libprotobuf-c1 libprotobuf-c-dev" ;; esac @@ -555,10 +556,10 @@ check_install_additional_tools (){ if [[ "$OS_DISTRO" == "ubuntu" ]]; then case "$(get_distribution_release)" in "ubuntu16.04"| "ubuntu18.04") - optional_packages="python-dev python-pexpect python-numpy python-scipy python-matplotlib" + optional_packages="python-dev python-pexpect python-numpy python-scipy python-matplotlib ctags" ;; - "ubuntu20.04"| "ubuntu21.04") - optional_packages="python3 python3-pip python3-dev python3-scipy python3-matplotlib exuberant-ctags" + "ubuntu20.04" | "ubuntu21.04" | "ubuntu22.04" ) + optional_packages="python3 python3-pip python3-dev python3-scipy python3-matplotlib universal-ctags" ;; esac PACKAGE_LIST="\ @@ -577,7 +578,6 @@ check_install_additional_tools (){ unzip \ valgrind \ vlan \ - ctags \ ntpdate \ iperf3 \ android-tools-adb \ @@ -675,20 +675,25 @@ check_install_oai_software() { $SUDO apt install -y software-properties-common case "$(get_distribution_release)" in "ubuntu16.04") - specific_packages="libtasn1-6-dev libgnutls-dev libatlas-dev iproute libconfig8-dev iptables-dev libgcrypt11-dev python-pip pydb" + specific_packages="libtasn1-6-dev libgnutls-dev libatlas-dev iproute libconfig8-dev iptables-dev libgcrypt11-dev python-pip pydb python guile-2.0-dev" ;; "ubuntu18.04") - specific_packages="libtasn1-6-dev libgnutls28-dev iproute2 libconfig-dev iptables-dev libgcrypt11-dev python-pip pydb" + specific_packages="libtasn1-6-dev libgnutls28-dev iproute2 libconfig-dev iptables-dev libgcrypt11-dev python-pip pydb python guile-2.0-dev" LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu" LAPACK_TARGET="/usr/lib/x86_64-linux-gnu/atlas/liblapack.so" ;; "ubuntu20.04") - specific_packages="libtasn1-6-dev libgnutls28-dev iproute2 libconfig-dev" + specific_packages="libtasn1-6-dev libgnutls28-dev iproute2 libconfig-dev python guile-2.0-dev" LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu" LAPACK_TARGET="/usr/lib/x86_64-linux-gnu/atlas/liblapack.so" ;; "ubuntu21.04") - specific_packages="libtasn1-6-dev libgnutls28-dev iproute2 libconfig-dev" + specific_packages="libtasn1-6-dev libgnutls28-dev iproute2 libconfig-dev python guile-2.0-dev" + LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu" + LAPACK_TARGET="/usr/lib/x86_64-linux-gnu/atlas/liblapack.so" + ;; + "ubuntu22.04") + specific_packages="libtasn1-6-dev libgnutls28-dev iproute2 libconfig-dev python2 guile-2.2-dev" LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu" LAPACK_TARGET="/usr/lib/x86_64-linux-gnu/atlas/liblapack.so" ;; @@ -714,7 +719,6 @@ check_install_oai_software() { git \ graphviz \ gtkwave \ - guile-2.0-dev \ iperf \ iptables \ libatlas-base-dev \ @@ -743,7 +747,6 @@ check_install_oai_software() { openssh-client \ openssh-server \ openssl \ - python \ subversion \ xmlstarlet \ libyaml-dev \ From 8c8f3f8678c939c4ed47df5a71e5ab00dd1f51d3 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Sat, 26 Mar 2022 10:43:47 +0100 Subject: [PATCH 32/46] Compiling protobuf-c requires protobuf, so add it --- cmake_targets/tools/build_helper | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index e6801902bb..554f3ccfe5 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -252,6 +252,43 @@ compilations() { # External packages installers ############################################ +install_protobuf_from_source(){ + protobuf_install_log=$OPENAIR_DIR/cmake_targets/log/protobuf_install_log.txt + echo_info "\nInstalling Google Protobuf from sources. The log file for Protobuf installation is here: $protobuf_install_log " + ( + cd /tmp + echo "Downloading protobuf" + #rm -rf /tmp/protobuf-2.6.1.tar.gz* /tmp/protobuf-2.6.1 + #wget https://github.com/protocolbuffers/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz + #tar -xzvf protobuf-2.6.1.tar.gz --owner $USER --group $USER --no-same-owner + #cd protobuf-2.6.1/ + + if [ $IS_CONTAINER -eq 0 ] + then + rm -rf /tmp/protobuf-cpp-3.3.0.tar.gz* /tmp/protobuf-3.3.0 + wget --tries=3 --retry-connrefused https://github.com/protocolbuffers/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz + tar -xzvf protobuf-cpp-3.3.0.tar.gz --owner $(id -u) --group $(id -g) --no-same-owner + cd protobuf-3.3.0/ + else + export LD_LIBRARY_PATH=/usr/local/lib #protoc needs to know where toclook for shared libs + rm -rf /tmp/protobuf + git clone --depth=1 --branch=v3.3.0 https://github.com/protocolbuffers/protobuf.git /tmp/protobuf + cd /tmp/protobuf + git submodule update --init --recursive + ./autogen.sh + fi + ./configure + echo "Compiling protobuf" + make -j`nproc` + $SUDO make install + $SUDO ldconfig + if [[ -v CI_ENV ]]; then + cd /tmp + $SUDO rm -rf protobuf* + fi + ) >& $protobuf_install_log +} + install_protobuf_c_from_source(){ protobuf_c_install_log=$OPENAIR_DIR/cmake_targets/log/protobuf_c_install_log.txt echo_info "\nInstalling Google Protobuf_C from sources. The log file for Protobuf_C installation is here: $protobuf_c_install_log " @@ -291,6 +328,7 @@ install_protobuf_c() { ;; esac if [[ "$protobuf_packages" == "" ]]; then + install_protobuf_from_source install_protobuf_c_from_source else $SUDO $INSTALLER -y install $protobuf_packages From ee9ec777e643fe4a3ff521bf62a36076a94f0d2e Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Sat, 26 Mar 2022 10:50:33 +0100 Subject: [PATCH 33/46] Update libprotobuf-c docker file paths (now installed from package) --- docker/Dockerfile.eNB.rhel8.2 | 2 +- docker/Dockerfile.eNB.ubuntu18 | 2 +- docker/Dockerfile.gNB.rhel8.2 | 2 +- docker/Dockerfile.gNB.ubuntu18 | 2 +- docker/Dockerfile.lteUE.rhel8.2 | 2 +- docker/Dockerfile.lteUE.ubuntu18 | 2 +- docker/Dockerfile.nrUE.rhel8.2 | 2 +- docker/Dockerfile.nrUE.ubuntu18 | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docker/Dockerfile.eNB.rhel8.2 b/docker/Dockerfile.eNB.rhel8.2 index 7924f5bd78..5296ac2172 100644 --- a/docker/Dockerfile.eNB.rhel8.2 +++ b/docker/Dockerfile.eNB.rhel8.2 @@ -96,7 +96,7 @@ COPY --from=enb-base \ # Now we are copying from builder-image the UHD files. COPY --from=enb-base /usr/local/bin/uhd_find_devices /usr/local/bin -COPY --from=enb-base /usr/local/lib/libprotobuf-c.so.1 /usr/local/lib +COPY --from=enb-base /usr/lib64/libprotobuf-c.so.1 /usr/local/lib COPY --from=enb-base /usr/local/lib64/libuhd.so.3.15.0 /usr/local/lib64 COPY --from=enb-base /usr/local/lib64/uhd/utils/uhd_images_downloader.py /opt/oai-enb/bin diff --git a/docker/Dockerfile.eNB.ubuntu18 b/docker/Dockerfile.eNB.ubuntu18 index 222a7f42bb..f95a03398a 100644 --- a/docker/Dockerfile.eNB.ubuntu18 +++ b/docker/Dockerfile.eNB.ubuntu18 @@ -83,7 +83,7 @@ COPY --from=enb-build \ COPY --from=enb-base /usr/local/bin/uhd_find_devices /usr/local/bin COPY --from=enb-base \ /usr/local/lib/libuhd.so.3.15.0 \ - /usr/local/lib/libprotobuf-c.so.1 \ + /usr/lib/x86_64-linux-gnu/libprotobuf-c.so.1 \ /usr/local/lib/ COPY --from=enb-base /usr/local/lib/uhd/utils/uhd_images_downloader.py /opt/oai-enb/bin COPY --from=enb-base \ diff --git a/docker/Dockerfile.gNB.rhel8.2 b/docker/Dockerfile.gNB.rhel8.2 index 6a1b447a62..9ec7ee7556 100644 --- a/docker/Dockerfile.gNB.rhel8.2 +++ b/docker/Dockerfile.gNB.rhel8.2 @@ -100,7 +100,7 @@ COPY --from=gnb-base \ # Now we are copying from builder-image the UHD files. COPY --from=gnb-base /usr/local/bin/uhd_find_devices /usr/local/bin -COPY --from=gnb-base /usr/local/lib/libprotobuf-c.so.1 /usr/local/lib +COPY --from=gnb-base /usr/lib64/libprotobuf-c.so.1 /usr/local/lib COPY --from=gnb-base /usr/local/lib64/libuhd.so.3.15.0 /usr/local/lib64 COPY --from=gnb-base /usr/local/lib64/uhd/utils/uhd_images_downloader.py /opt/oai-gnb/bin diff --git a/docker/Dockerfile.gNB.ubuntu18 b/docker/Dockerfile.gNB.ubuntu18 index 6f990db833..6a98c8d3ce 100644 --- a/docker/Dockerfile.gNB.ubuntu18 +++ b/docker/Dockerfile.gNB.ubuntu18 @@ -84,7 +84,7 @@ COPY --from=gnb-build \ COPY --from=gnb-base /usr/local/bin/uhd_find_devices /usr/local/bin COPY --from=gnb-base \ /usr/local/lib/libuhd.so.3.15.0 \ - /usr/local/lib/libprotobuf-c.so.1 \ + /usr/lib/x86_64-linux-gnu/libprotobuf-c.so.1 \ /usr/local/lib/ COPY --from=gnb-base /usr/local/lib/uhd/utils/uhd_images_downloader.py /opt/oai-gnb/bin COPY --from=gnb-base \ diff --git a/docker/Dockerfile.lteUE.rhel8.2 b/docker/Dockerfile.lteUE.rhel8.2 index cc1be3d41d..ab7d224939 100644 --- a/docker/Dockerfile.lteUE.rhel8.2 +++ b/docker/Dockerfile.lteUE.rhel8.2 @@ -98,7 +98,7 @@ COPY --from=lte-ue-base \ # Now we are copying from builder-image the UHD files. COPY --from=lte-ue-base /usr/local/bin/uhd_find_devices /usr/local/bin -COPY --from=lte-ue-base /usr/local/lib/libprotobuf-c.so.1 /usr/local/lib +COPY --from=lte-ue-base /usr/lib64/libprotobuf-c.so.1 /usr/local/lib COPY --from=lte-ue-base /usr/local/lib64/libuhd.so.3.15.0 /usr/local/lib64 COPY --from=lte-ue-base /usr/local/lib64/uhd/utils/uhd_images_downloader.py /opt/oai-lte-ue/bin diff --git a/docker/Dockerfile.lteUE.ubuntu18 b/docker/Dockerfile.lteUE.ubuntu18 index 292ac37e5f..b2a0fd6e93 100644 --- a/docker/Dockerfile.lteUE.ubuntu18 +++ b/docker/Dockerfile.lteUE.ubuntu18 @@ -86,7 +86,7 @@ COPY --from=lte-ue-build \ COPY --from=lte-ue-base /usr/local/bin/uhd_find_devices /usr/local/bin COPY --from=lte-ue-base \ /usr/local/lib/libuhd.so.3.15.0 \ - /usr/local/lib/libprotobuf-c.so.1 \ + /usr/lib/x86_64-linux-gnu/libprotobuf-c.so.1 \ /usr/local/lib/ COPY --from=lte-ue-base /usr/local/lib/uhd/utils/uhd_images_downloader.py /opt/oai-lte-ue/bin diff --git a/docker/Dockerfile.nrUE.rhel8.2 b/docker/Dockerfile.nrUE.rhel8.2 index d38e81bd71..498e6bedcf 100644 --- a/docker/Dockerfile.nrUE.rhel8.2 +++ b/docker/Dockerfile.nrUE.rhel8.2 @@ -103,7 +103,7 @@ COPY --from=nr-ue-base \ # Now we are copying from builder-image the UHD files. COPY --from=nr-ue-base /usr/local/bin/uhd_find_devices /usr/local/bin -COPY --from=nr-ue-base /usr/local/lib/libprotobuf-c.so.1 /usr/local/lib +COPY --from=nr-ue-base /usr/lib64/libprotobuf-c.so.1 /usr/local/lib COPY --from=nr-ue-base /usr/local/lib64/libuhd.so.3.15.0 /usr/local/lib64 COPY --from=nr-ue-base /usr/local/lib64/uhd/utils/uhd_images_downloader.py /opt/oai-nr-ue/bin diff --git a/docker/Dockerfile.nrUE.ubuntu18 b/docker/Dockerfile.nrUE.ubuntu18 index 0fa219296b..0edfdd2160 100644 --- a/docker/Dockerfile.nrUE.ubuntu18 +++ b/docker/Dockerfile.nrUE.ubuntu18 @@ -88,7 +88,7 @@ COPY --from=nr-ue-build \ COPY --from=nr-ue-base /usr/local/bin/uhd_find_devices /usr/local/bin COPY --from=nr-ue-base \ /usr/local/lib/libuhd.so.3.15.0 \ - /usr/local/lib/libprotobuf-c.so.1 \ + /usr/lib/x86_64-linux-gnu/libprotobuf-c.so.1 \ /usr/local/lib/ COPY --from=nr-ue-base /usr/local/lib/uhd/utils/uhd_images_downloader.py /opt/oai-nr-ue/bin From 8df0cc3aa93c59f6d5d6e6fd91073934babeed83 Mon Sep 17 00:00:00 2001 From: Manish Date: Tue, 29 Mar 2022 04:13:45 +0000 Subject: [PATCH 34/46] Compile time flag added for native architecture compilation Signed-off-by: Manish --- cmake_targets/build_oai | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 31acd2e8fb..5099743be1 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -59,6 +59,8 @@ BUILD_ECLIPSE=0 NR="False" OPTIONAL_LIBRARIES="telnetsrv enbscope uescope nrscope" RU=0 +CMAKE_C_FLAGS=() +CMAKE_CXX_FLAGS=() function print_help() { echo_info " @@ -182,6 +184,10 @@ function main() { until [ -z "$1" ] do case "$1" in + --archnative) + CMAKE_C_FLAGS+=("-march=native") + CMAKE_CXX_FLAGS+=("-march=native") + shift;; -c | --clean) CLEAN=1 shift;; @@ -609,6 +615,8 @@ function main() { mkdir -p $DIR/$BUILD_DIR/build cd $DIR/$BUILD_DIR/build + if [[ ${#CMAKE_C_FLAGS[@]} > 0 ]]; then CMAKE_CMD="$CMAKE_CMD -DCMAKE_C_FLAGS=\"${CMAKE_C_FLAGS[*]}\""; fi + if [[ ${#CMAKE_CXX_FLAGS[@]} > 0 ]]; then CMAKE_CMD="$CMAKE_CMD -DCMAKE_CXX_FLAGS=\"${CMAKE_CXX_FLAGS[*]}\""; fi echo_info "running $CMAKE_CMD" eval $CMAKE_CMD ../.. From 73277172f69f65acfc8ee3fa9f635c3b8d6d909d Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 30 Mar 2022 08:00:46 +0200 Subject: [PATCH 35/46] Update build_oai -h --- cmake_targets/build_oai | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 5099743be1..9bb07ef6a4 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -64,9 +64,11 @@ CMAKE_CXX_FLAGS=() function print_help() { echo_info " -This program installs OpenAirInterface Software -You should have ubuntu 16.xx or 18.04 updated -Options +This script compiles OpenAirInterface Software, and can install dependencies +for a number of distributions (Ubuntu 18-22, Fedora, RHEL7/8). +Options: +--arch-native + Passes -march=native to the compiler. -c | --clean Erase all files to make a rebuild from start -C | --clean-all From 87c5007970190d9e5c5a13a35e51ae40c714bdd8 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Mon, 21 Mar 2022 10:14:02 +0100 Subject: [PATCH 36/46] fix(container): when running in fedora-generic-kerner container, no setting of priority Signed-off-by: Raphael Defosseux --- common/utils/system.c | 7 ++++--- executables/nr-uesoftmodem.c | 9 ++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/common/utils/system.c b/common/utils/system.c index d897063144..00839b485c 100644 --- a/common/utils/system.c +++ b/common/utils/system.c @@ -234,9 +234,10 @@ void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, ret=pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); - if (system("grep -iq 'ID_LIKE.*fedora' /etc/os-release && uname -a | grep -c rt")==0) - if (system("cat /proc/self/cgroup | egrep -c 'libpod|podman|kubepods'")==0) - settingPriority = 0; + if (checkIfFedoraDistribution()) + if (checkIfGenericKernelOnFedora()) + if (checkIfInsideContainer()) + settingPriority = 0; if (settingPriority) { ret=pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 00f019c03a..23615b2c98 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -396,7 +396,14 @@ void *rrc_enb_process_msg(void *notUsed) { int main( int argc, char **argv ) { - set_priority(79); + int set_exe_prio = 1; + if (checkIfFedoraDistribution()) + if (checkIfGenericKernelOnFedora()) + if (checkIfInsideContainer()) + set_exe_prio = 0; + if (set_exe_prio) + set_priority(79); + if (mlockall(MCL_CURRENT | MCL_FUTURE) == -1) { fprintf(stderr, "mlockall: %s\n", strerror(errno)); From 790f2802f70908dfa4d2bb1bd845e28a00fd9090 Mon Sep 17 00:00:00 2001 From: Manish Date: Fri, 1 Apr 2022 03:48:44 +0000 Subject: [PATCH 37/46] Help Menu and Argument Flag Aligned Signed-off-by: Manish --- cmake_targets/build_oai | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 9bb07ef6a4..8270e3989f 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -186,7 +186,7 @@ function main() { until [ -z "$1" ] do case "$1" in - --archnative) + --arch-native) CMAKE_C_FLAGS+=("-march=native") CMAKE_CXX_FLAGS+=("-march=native") shift;; From 1472830d097a55116cfcb0c038e99fae25293aae Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 31 Mar 2022 11:58:17 +0200 Subject: [PATCH 38/46] Correct include directories for oai_usrpdevif --- cmake_targets/CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 46e33e8803..721f78eceb 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -53,7 +53,6 @@ include_directories("/usr/local/include/") add_list2_option(RF_BOARD "None" "RF head type" "None" "OAI_USRP" "OAI_BLADERF" "OAI_LMSSDR" "OAI_SIMU" "EXMIMO") if (${RF_BOARD} STREQUAL "OAI_USRP") find_package(Boost REQUIRED) - include_directories(${LIBBOOST_INCLUDE_DIR}) elseif (${RF_BOARD} STREQUAL "OAI_IRIS") include_directories("${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/") @@ -705,11 +704,14 @@ set (SHLIB_LOADER_SOURCES # include RF devices / transport protocols library modules ###################################################################### -include_directories("${OPENAIR_TARGETS}/ARCH/USRP/USERSPACE/LIB/") set(HWLIB_USRP_SOURCE ${OPENAIR_TARGETS}/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp ) add_library(oai_usrpdevif MODULE ${HWLIB_USRP_SOURCE} ) +target_include_directories(oai_usrpdevif PRIVATE + "${OPENAIR_TARGETS}/ARCH/USRP/USERSPACE/LIB/" + ${Boost_INCLUDE_DIR} +) target_link_libraries(oai_usrpdevif uhd) include_directories("${OPENAIR_TARGETS}/ARCH/BLADERF/USERSPACE/LIB/") From 42a6136683aef0e91890a78184a958f9145e9ee8 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 1 Apr 2022 08:28:29 +0200 Subject: [PATCH 39/46] Correct caracal's USRP IP addresses --- ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf index 6d05fee692..4953620afa 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf @@ -221,7 +221,7 @@ RUs = ( ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; - sdr_addrs = "addr=192.168.20.2"; + sdr_addrs = "addr=192.168.10.2,second_addr=192.168.20.2,mgmt_addr=192.168.18.85"; } ); From cb5e9d90e467b88672df32c9324e3d02f4cede9f Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 1 Apr 2022 10:22:30 +0200 Subject: [PATCH 40/46] Create build_oai option to pass cmake params; add boost include dir caracal --- ci-scripts/xml_files/gnb_usrp_build.xml | 2 +- cmake_targets/build_oai | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ci-scripts/xml_files/gnb_usrp_build.xml b/ci-scripts/xml_files/gnb_usrp_build.xml index e2662180c5..97f85c6a33 100644 --- a/ci-scripts/xml_files/gnb_usrp_build.xml +++ b/ci-scripts/xml_files/gnb_usrp_build.xml @@ -34,7 +34,7 @@ TesteNB Build_eNB Build gNB (USRP) - --gNB -w USRP --ninja + --gNB -w USRP --ninja --cmake-opt -DBoost_INCLUDE_DIR=/usr/include/boost169 True diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index c65728a41d..fe59741456 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -72,6 +72,8 @@ Options Erase all files made by previous compilations, installations --clean-kernel Erase previously installed features in kernel: iptables, drivers, ... +--cmake-opt + Pass the supplied option verbatim to cmake. -d | --build-dir Sets build directory (will be /cmake_targets//build) -I | --install-external-packages @@ -193,6 +195,9 @@ function main() { clean_kernel echo_info "Erased iptables config and removed modules from kernel" shift;; + --cmake-opt) + CMAKE_CMD="$CMAKE_CMD $2" + shift 2;; -d | --build-dir) BUILD_DIR=$2 shift;; From e15002c86c51b629a17c4a389f0ced65a2fe1551 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 1 Apr 2022 10:22:48 +0200 Subject: [PATCH 41/46] Shift correct number of params for build_oai --build-dir --- cmake_targets/build_oai | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index fe59741456..71ed803744 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -200,7 +200,7 @@ function main() { shift 2;; -d | --build-dir) BUILD_DIR=$2 - shift;; + shift 2;; -I | --install-external-packages) INSTALL_EXTERNAL=1 echo_info "Will install external packages" From ec82ddea38fe302f6a88e0c5e5d027fbfa2fff21 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Sun, 3 Apr 2022 19:16:29 +0200 Subject: [PATCH 42/46] Don't call calculate_preferred_dl_tda() in do-ra mode In --do-ra mode, calculate_preferred_dl_tda() would be called without a BWP. Then, get_searchspace() would search in the scc, leading to a segfault. Therefore, don't call calculate_preferred_dl_tda() in do-ra mode. --- openair2/LAYER2/NR_MAC_gNB/config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 04ee5f3385..9ffec4a13b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -574,7 +574,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, if (CellGroup) { - if (!get_softmodem_params()->phy_test) { + if (!get_softmodem_params()->phy_test && !get_softmodem_params()->do_ra) { calculate_preferred_dl_tda(Mod_idP, NULL); } From b7360eee047114881cbefb642c2d7e7aebad24c9 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Mon, 4 Apr 2022 11:47:49 +0200 Subject: [PATCH 43/46] fix(ci): when running modems, forcing fast write to stdout and files Signed-off-by: Raphael Defosseux --- ci-scripts/cls_oaicitest.py | 2 +- ci-scripts/ran.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ci-scripts/cls_oaicitest.py b/ci-scripts/cls_oaicitest.py index ec1202cb21..0865d4efb5 100644 --- a/ci-scripts/cls_oaicitest.py +++ b/ci-scripts/cls_oaicitest.py @@ -535,7 +535,7 @@ class OaiCiTest(): while (doOutterLoop): SSH.command('cd ' + self.UESourceCodePath + '/cmake_targets/ran_build/build', '\$', 5) SSH.command('echo ' + self.UEPassword + ' | sudo -S rm -Rf ' + self.UESourceCodePath + '/cmake_targets/ue_' + self.testCase_id + '.log', '\$', 5) - SSH.command('echo $USER; nohup sudo -E ./my-lte-uesoftmodem-run' + str(self.UE_instance) + '.sh' + ' > ' + self.UESourceCodePath + '/cmake_targets/ue_' + self.testCase_id + '.log ' + ' 2>&1 &', self.UEUserName, 5) + SSH.command('echo $USER; nohup sudo -E stdbuf -o0 ./my-lte-uesoftmodem-run' + str(self.UE_instance) + '.sh' + ' > ' + self.UESourceCodePath + '/cmake_targets/ue_' + self.testCase_id + '.log ' + ' 2>&1 &', self.UEUserName, 5) time.sleep(6) SSH.command('cd ../..', '\$', 5) doLoop = True diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py index f95ce90c66..beb89370d2 100644 --- a/ci-scripts/ran.py +++ b/ci-scripts/ran.py @@ -485,7 +485,7 @@ class RANManagement(): mySSH.command('chmod 775 ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5) mySSH.command('echo ' + lPassWord + ' | sudo -S rm -Rf enb_' + self.testCase_id + '.log', '\$', 5) - mySSH.command('echo $USER; nohup sudo -E ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh > ' + lSourcePath + '/cmake_targets/enb_' + self.testCase_id + '.log 2>&1 &', lUserName, 10) + mySSH.command('echo $USER; nohup sudo -E stdbuf -o0 ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh > ' + lSourcePath + '/cmake_targets/enb_' + self.testCase_id + '.log 2>&1 &', lUserName, 10) #stats monitoring during runtime From 29f47c49c1898b6a4c745bc822c139060c76b3e2 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Mon, 4 Apr 2022 11:05:52 +0100 Subject: [PATCH 44/46] Fix segmentation fault for NSA --- openair2/LAYER2/NR_MAC_gNB/config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 9ffec4a13b..6ba8629718 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -574,7 +574,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, if (CellGroup) { - if (!get_softmodem_params()->phy_test && !get_softmodem_params()->do_ra) { + if (get_softmodem_params()->sa) { calculate_preferred_dl_tda(Mod_idP, NULL); } From 0c431d969f50d0a4f9eccd97a4443b6eb48504d1 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 4 Apr 2022 17:25:40 +0200 Subject: [PATCH 45/46] Further tune LTE 2x2 gains --- ci-scripts/conf_files/enb.band38.lte_2x2.100PRB.usrpn310.conf | 4 ++-- .../conf_files/enb.band38.lte_2x2_tm2.100PRB.usrpn310.conf | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ci-scripts/conf_files/enb.band38.lte_2x2.100PRB.usrpn310.conf b/ci-scripts/conf_files/enb.band38.lte_2x2.100PRB.usrpn310.conf index 24c35dedbf..2a82181f4c 100644 --- a/ci-scripts/conf_files/enb.band38.lte_2x2.100PRB.usrpn310.conf +++ b/ci-scripts/conf_files/enb.band38.lte_2x2.100PRB.usrpn310.conf @@ -231,8 +231,8 @@ RUs = ( local_rf = "yes" nb_tx = 2 nb_rx = 2 - att_tx = 0 - att_rx = 0; + att_tx = 10 + att_rx = 10; bands = [38]; max_pdschReferenceSignalPower = -27; max_rxgain = 75; diff --git a/ci-scripts/conf_files/enb.band38.lte_2x2_tm2.100PRB.usrpn310.conf b/ci-scripts/conf_files/enb.band38.lte_2x2_tm2.100PRB.usrpn310.conf index 4a16a64105..b1b58651e0 100644 --- a/ci-scripts/conf_files/enb.band38.lte_2x2_tm2.100PRB.usrpn310.conf +++ b/ci-scripts/conf_files/enb.band38.lte_2x2_tm2.100PRB.usrpn310.conf @@ -231,8 +231,8 @@ RUs = ( local_rf = "yes" nb_tx = 2 nb_rx = 2 - att_tx = 0 - att_rx = 0; + att_tx = 10 + att_rx = 10; bands = [38]; max_pdschReferenceSignalPower = -27; max_rxgain = 75; From 906b4b9c1e0745a29cb832d5a97d8db7ec984450 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 5 Apr 2022 17:31:56 +0200 Subject: [PATCH 46/46] Tune configs LTE-2x2, NSA-2x2 --- .../conf_files/enb.band38.lte_2x2.100PRB.usrpn310.conf | 6 +++--- .../conf_files/enb.band38.lte_2x2_tm2.100PRB.usrpn310.conf | 6 +++--- .../conf_files/enb.band38.nsa_2x2.100PRB.usrpn310.conf | 6 +++--- .../conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf | 5 +---- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/ci-scripts/conf_files/enb.band38.lte_2x2.100PRB.usrpn310.conf b/ci-scripts/conf_files/enb.band38.lte_2x2.100PRB.usrpn310.conf index 2a82181f4c..fe2e031acb 100644 --- a/ci-scripts/conf_files/enb.band38.lte_2x2.100PRB.usrpn310.conf +++ b/ci-scripts/conf_files/enb.band38.lte_2x2.100PRB.usrpn310.conf @@ -211,8 +211,8 @@ MACRLCs = ( bler_target_upper = 20.0; bler_target_lower = 10.0; max_ul_rb_index = 27; - puSch10xSnr = 200; - puCch10xSnr = 150; + puSch10xSnr = 190; + puCch10xSnr = 160; } ); @@ -232,7 +232,7 @@ RUs = ( nb_tx = 2 nb_rx = 2 att_tx = 10 - att_rx = 10; + att_rx = 5; bands = [38]; max_pdschReferenceSignalPower = -27; max_rxgain = 75; diff --git a/ci-scripts/conf_files/enb.band38.lte_2x2_tm2.100PRB.usrpn310.conf b/ci-scripts/conf_files/enb.band38.lte_2x2_tm2.100PRB.usrpn310.conf index b1b58651e0..a0742c57a6 100644 --- a/ci-scripts/conf_files/enb.band38.lte_2x2_tm2.100PRB.usrpn310.conf +++ b/ci-scripts/conf_files/enb.band38.lte_2x2_tm2.100PRB.usrpn310.conf @@ -211,8 +211,8 @@ MACRLCs = ( bler_target_upper = 20.0; bler_target_lower = 10.0; max_ul_rb_index = 27; - puSch10xSnr = 200; - puCch10xSnr = 150; + puSch10xSnr = 190; + puCch10xSnr = 160; } ); @@ -232,7 +232,7 @@ RUs = ( nb_tx = 2 nb_rx = 2 att_tx = 10 - att_rx = 10; + att_rx = 5; bands = [38]; max_pdschReferenceSignalPower = -27; max_rxgain = 75; diff --git a/ci-scripts/conf_files/enb.band38.nsa_2x2.100PRB.usrpn310.conf b/ci-scripts/conf_files/enb.band38.nsa_2x2.100PRB.usrpn310.conf index bccd37abe9..480ba3952a 100644 --- a/ci-scripts/conf_files/enb.band38.nsa_2x2.100PRB.usrpn310.conf +++ b/ci-scripts/conf_files/enb.band38.nsa_2x2.100PRB.usrpn310.conf @@ -211,8 +211,8 @@ MACRLCs = ( bler_target_upper = 20.0; bler_target_lower = 10.0; max_ul_rb_index = 27; - puSch10xSnr = 200; - puCch10xSnr = 150; + puSch10xSnr = 190; + puCch10xSnr = 160; } ); @@ -232,7 +232,7 @@ RUs = ( nb_tx = 2 nb_rx = 2 att_tx = 0 - att_rx = 0; + att_rx = 5; bands = [38]; max_pdschReferenceSignalPower = -27; max_rxgain = 75; diff --git a/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf index 55b1bdb24d..21863dcfc7 100644 --- a/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf @@ -22,8 +22,6 @@ gNBs = ssb_SubcarrierOffset = 31; //0; pdsch_AntennaPorts_N1 = 2; pusch_AntennaPorts = 2; - pusch_TargetSNRx10 = 200; - pucch_TargetSNRx10 = 200; ul_prbblacklist = "51,52,53,54" servingCellConfigCommon = ( @@ -239,8 +237,7 @@ RUs = ( THREAD_STRUCT = ( { #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" - parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; - //parallel_config = "PARALLEL_SINGLE_THREAD"; + parallel_config = "PARALLEL_SINGLE_THREAD"; #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" worker_config = "WORKER_ENABLE"; }