From 1a089a0d6795183f52ad4c53d3fd33cc36aa642c Mon Sep 17 00:00:00 2001 From: Abhijith <abhijitha@iisc.ac.in> Date: Tue, 6 Jul 2021 16:37:46 +0530 Subject: [PATCH] Fixed errors with initialBWP and SA --- openair1/SCHED_NR_UE/pucch_uci_ue_nr.c | 88 +++++----- openair2/LAYER2/NR_MAC_UE/config_ue.c | 22 +-- .../NR_MAC_UE/nr_ue_dci_configuration.c | 20 +-- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 151 +++++++++--------- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 80 +++++----- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 2 +- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 8 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 4 +- 8 files changed, 187 insertions(+), 188 deletions(-) diff --git a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c index 9af50d28e03..e7f51bfa697 100644 --- a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c +++ b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c @@ -420,7 +420,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ NR_UE_MAC_INST_t *mac = get_mac_inst(0); NR_PUCCH_Resource_t *pucch_resource = NULL; uint16_t crnti = mac->crnti; - NR_BWP_Id_t bwp_id = mac->UL_BWP_Id; + NR_BWP_Id_t bwp_id = get_softmodem_params()->sa ? 0 : mac->UL_BWP_Id ;//SA uses initial BWP /* update current context */ @@ -504,7 +504,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ if (pucch_resource_set != MAX_NB_OF_PUCCH_RESOURCE_SETS) { pucch_resource_indicator = 0; /* get the first resource of the set */ - pucch_resource_id = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set]->resourceList.list.array[pucch_resource_indicator][0]; + pucch_resource_id = mac->ULbwp[bwp_id]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set]->resourceList.list.array[pucch_resource_indicator][0]; } else { LOG_W(PHY,"PUCCH no resource set found for CSI at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME); @@ -616,11 +616,11 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ } NR_PUCCH_Config_t *pucch_Config; if (bwp_id>0 && - mac->ULbwp[bwp_id-1] && - mac->ULbwp[bwp_id-1]->bwp_Dedicated && - mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config && - mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup) - pucch_Config = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup; + mac->ULbwp[bwp_id] && + mac->ULbwp[bwp_id]->bwp_Dedicated && + mac->ULbwp[bwp_id]->bwp_Dedicated->pucch_Config && + mac->ULbwp[bwp_id]->bwp_Dedicated->pucch_Config->choice.setup) + pucch_Config = mac->ULbwp[bwp_id]->bwp_Dedicated->pucch_Config->choice.setup; else if (bwp_id==0 && mac->cg && mac->cg->spCellConfig && @@ -651,12 +651,12 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ m_0 = get_ics_pucch(pucch_resource, format); AssertFatal(m_0 >= 0, "Invalid m_0\n"); if (format == pucch_format3_nr) { - if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format3->choice.setup->additionalDMRS[0] == 1) { + if (mac->ULbwp[bwp_id]->bwp_Dedicated->pucch_Config->choice.setup->format3->choice.setup->additionalDMRS[0] == 1) { index_additional_dmrs = I_PUCCH_ADDITIONAL_DMRS; } } else if (format == pucch_format4_nr) { - if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format4->choice.setup->additionalDMRS[0] == 1) { + if (mac->ULbwp[bwp_id]->bwp_Dedicated->pucch_Config->choice.setup->format4->choice.setup->additionalDMRS[0] == 1) { index_additional_dmrs = I_PUCCH_ADDITIONAL_DMRS; } } @@ -704,7 +704,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ case pucch_format3_nr: { nb_of_prbs = pucch_resource->format.choice.format3->nrofPRBs; - //if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format3->choice.setup->pi2BPSK[0] == 1) { + //if (mac->ULbwp[bwp_id]->bwp_Dedicated->pucch_Config->choice.setup->format3->choice.setup->pi2BPSK[0] == 1) { // Q_m = BITS_PER_SYMBOL_BPSK; /* set bpsk modulation type with 1 bit per modulation symbol */ //} N_sc_ctrl_RB = N_SC_RB; @@ -713,7 +713,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ } case pucch_format4_nr: { - //if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format4->choice.setup->pi2BPSK[0] == 1) { + //if (mac->ULbwp[bwp_id]->bwp_Dedicated->pucch_Config->choice.setup->format4->choice.setup->pi2BPSK[0] == 1) { // Q_m = BITS_PER_SYMBOL_BPSK; /* set bpsk modulation type with 1 bit per modulation symbol */ //} nb_symbols = nb_symbols_excluding_dmrs[nb_symbols_total-4][index_additional_dmrs][index_hopping]; @@ -730,10 +730,10 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ /* drop CSI report if simultaneous HARQ-ACK/SR and periodic/semi-periodic CSI cannot be transmitted at the same time */ if (format != pucch_format0_nr) { - if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format1 != NULL) { - //max_code_rate = code_rate_r_time_100[mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format1->choice.setup->maxCodeRate[0]]; /* it is code rate * 10 */ + if (mac->ULbwp[bwp_id]->bwp_Dedicated->pucch_Config->choice.setup->format1 != NULL) { + //max_code_rate = code_rate_r_time_100[mac->ULbwp[bwp_id]->bwp_Dedicated->pucch_Config->choice.setup->format1->choice.setup->maxCodeRate[0]]; /* it is code rate * 10 */ - if ((O_ACK != 0) && (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format1->choice.setup->simultaneousHARQ_ACK_CSI[0] == 0)) { + if ((O_ACK != 0) && (mac->ULbwp[bwp_id]->bwp_Dedicated->pucch_Config->choice.setup->format1->choice.setup->simultaneousHARQ_ACK_CSI[0] == 0)) { N_UCI = N_UCI - O_CSI; O_CSI = cqi_status = ri_status = 0; csi_payload = 0; /* csi should be dropped in this case */ @@ -858,11 +858,11 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ switch(format) { case pucch_format0_nr: { - int pucch_GroupHopping = mac->ULbwp[bwp_id-1] ? - mac->ULbwp[bwp_id-1]->bwp_Common->pucch_ConfigCommon->choice.setup->pucch_GroupHopping: + int pucch_GroupHopping = mac->ULbwp[bwp_id] ? + mac->ULbwp[bwp_id]->bwp_Common->pucch_ConfigCommon->choice.setup->pucch_GroupHopping: mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pucch_ConfigCommon->choice.setup->pucch_GroupHopping; - int hoppingId = mac->ULbwp[bwp_id-1] ? - mac->ULbwp[bwp_id-1]->bwp_Common->pucch_ConfigCommon->choice.setup->hoppingId[0]: + int hoppingId = mac->ULbwp[bwp_id] ? + mac->ULbwp[bwp_id]->bwp_Common->pucch_ConfigCommon->choice.setup->hoppingId[0]: (mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pucch_ConfigCommon->choice.setup->hoppingId? mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pucch_ConfigCommon->choice.setup->hoppingId[0]: mac->physCellId); @@ -988,14 +988,14 @@ uint8_t get_downlink_ack(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t int N_m_c_rx = 0; int V_DAI_m_DL = 0; NR_UE_MAC_INST_t *mac = get_mac_inst(0); - NR_BWP_Id_t dl_bwp_id = mac->DL_BWP_Id; - if (mac->DLbwp[dl_bwp_id-1] == NULL) return 0; - - if (mac->DLbwp[dl_bwp_id-1] && - mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated && - mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated->pdsch_Config && - mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated->pdsch_Config->choice.setup && - mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI[0] == 2) { + NR_BWP_Id_t dl_bwp_id = get_softmodem_params()->sa ? 0 : mac->DL_BWP_Id ; //SA uses initial BWP + if (mac->DLbwp[dl_bwp_id] == NULL) return 0; + + if (mac->DLbwp[dl_bwp_id] && + mac->DLbwp[dl_bwp_id]->bwp_Dedicated && + mac->DLbwp[dl_bwp_id]->bwp_Dedicated->pdsch_Config && + mac->DLbwp[dl_bwp_id]->bwp_Dedicated->pdsch_Config->choice.setup && + mac->DLbwp[dl_bwp_id]->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI[0] == 2) { two_transport_blocks = TRUE; number_of_code_word = 2; } @@ -1075,7 +1075,7 @@ uint8_t get_downlink_ack(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t if (mac->cg != NULL && mac->cg->physicalCellGroupConfig != NULL && mac->cg->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUCCH != NULL) { - int N_TB_max_DL = mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI[0]; + int N_TB_max_DL = mac->DLbwp[dl_bwp_id]->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI[0]; *n_HARQ_ACK = (((V_DAI_m_DL - U_DAI_c)%4) * N_TB_max_DL) + N_m_c_rx + N_SPS_c; NR_TST_PHY_PRINTF("PUCCH power n(%d) = ( V(%d) - U(%d) )mod4 * N_TB(%d) + N(%d) \n", *n_HARQ_ACK, V_DAI_m_DL, U_DAI_c, N_TB_max_DL, N_m_c_rx); } @@ -1180,7 +1180,7 @@ boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, NR_UE_MAC_INST_t *mac, uint8 pucch_format_nr_t format_pucch; int ready_pucch_resource_id = FALSE; /* in the case that it is already given */ NR_PUCCH_Resource_t *pucch_resource = NULL; - NR_BWP_Id_t bwp_id = mac->UL_BWP_Id; + NR_BWP_Id_t bwp_id = get_softmodem_params()->sa ? 0 : mac->UL_BWP_Id ;//SA uses initial BWP /* ini values to unset */ *initial_pucch_id = NB_INITIAL_PUCCH_RESOURCE; @@ -1199,12 +1199,12 @@ boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, NR_UE_MAC_INST_t *mac, uint8 mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup && mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup->resourceSetToAddModList && mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup->resourceSetToAddModList->list.array[0] == NULL) || - (mac->ULbwp[bwp_id-1] && - mac->ULbwp[bwp_id-1]->bwp_Dedicated && - mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config && - mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup && - mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList && - mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[0] == NULL) + (mac->ULbwp[bwp_id] && + mac->ULbwp[bwp_id]->bwp_Dedicated && + mac->ULbwp[bwp_id]->bwp_Dedicated->pucch_Config && + mac->ULbwp[bwp_id]->bwp_Dedicated->pucch_Config->choice.setup && + mac->ULbwp[bwp_id]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList && + mac->ULbwp[bwp_id]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[0] == NULL) ){ /* No resource set has been already configured so pucch_configCommon from Sib1 should be used in this case */ @@ -1272,10 +1272,10 @@ boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, NR_UE_MAC_INST_t *mac, uint8 // Verify that the value of pucch_resource_indicator is valid struct NR_PUCCH_Config__resourceSetToAddModList *resourceSetToAddModList = NULL; struct NR_PUCCH_Config__resourceToAddModList *resourceToAddModList = NULL; - if (bwp_id > 0 && mac->ULbwp[bwp_id-1]) { - AssertFatal(mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList!=NULL,"mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList is null\n"); - resourceSetToAddModList = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList; - resourceToAddModList = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceToAddModList; + if (bwp_id > 0 && mac->ULbwp[bwp_id]) { + AssertFatal(mac->ULbwp[bwp_id]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList!=NULL,"mac->ULbwp[bwp_id]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList is null\n"); + resourceSetToAddModList = mac->ULbwp[bwp_id]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList; + resourceToAddModList = mac->ULbwp[bwp_id]->bwp_Dedicated->pucch_Config->choice.setup->resourceToAddModList; } else if (bwp_id == 0 && mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup->resourceSetToAddModList!=NULL) { resourceSetToAddModList = mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup->resourceSetToAddModList; resourceToAddModList = mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup->resourceToAddModList; @@ -1389,12 +1389,12 @@ int find_pucch_resource_set(NR_UE_MAC_INST_t *mac, uint8_t gNB_id, int uci_size) /* look for the first resource set which supports uci_size number of bits for payload */ while (pucch_resource_set_id < MAX_NB_OF_PUCCH_RESOURCE_SETS) { if ((bwp_id>0 && - mac->ULbwp[bwp_id-1] && - mac->ULbwp[bwp_id-1]->bwp_Dedicated && - mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config && - mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup && - mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList && - mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set_id] != NULL) || + mac->ULbwp[bwp_id] && + mac->ULbwp[bwp_id]->bwp_Dedicated && + mac->ULbwp[bwp_id]->bwp_Dedicated->pucch_Config && + mac->ULbwp[bwp_id]->bwp_Dedicated->pucch_Config->choice.setup && + mac->ULbwp[bwp_id]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList && + mac->ULbwp[bwp_id]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set_id] != NULL) || (bwp_id==0 && mac->cg && mac->cg->spCellConfig && diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index bfa5d6a93f6..5e158df5f02 100755 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -601,8 +601,8 @@ void config_control_ue(NR_UE_MAC_INST_t *mac){ AssertFatal(scd->downlinkBWP_ToAddModList->list.count <= 4, "downlinkBWP_ToAddModList->list->count is %d\n", scd->downlinkBWP_ToAddModList->list.count); config_bwp_ue(mac, NULL, NULL); - NR_BWP_Id_t dl_bwp_id = mac->DL_BWP_Id; - NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id; + NR_BWP_Id_t dl_bwp_id = get_softmodem_params()->sa ? 0 : mac->DL_BWP_Id ; //SA uses initial BWP + NR_BWP_Id_t ul_bwp_id = get_softmodem_params()->sa ? 0 : mac->UL_BWP_Id ;//SA uses initial BWP AssertFatal(dl_bwp_id != 0, "DL_BWP_Id is 0!"); AssertFatal(ul_bwp_id != 0, "UL_BWP_Id is 0!"); @@ -639,17 +639,17 @@ void config_control_ue(NR_UE_MAC_INST_t *mac){ // check pdcch_Config, pdcch_ConfigCommon and DL BWP // Check dedicated UL BWP and pass to MAC - for (int num_BWP = 0; num_BWP <4 ;num_BWP++) + for (int num_BWP = 1; num_BWP < MAX_NUM_BWP ;num_BWP++) { - mac->DLbwp[num_BWP] = scd->downlinkBWP_ToAddModList->list.array[num_BWP]; - mac->ULbwp[num_BWP] = uplinkBWP_ToAddModList->list.array[num_BWP]; + mac->DLbwp[num_BWP] = scd->downlinkBWP_ToAddModList->list.array[num_BWP-1]; + mac->ULbwp[num_BWP] = uplinkBWP_ToAddModList->list.array[num_BWP-1]; } - mac->coreset[dl_bwp_id - 1][coreset_id - 1] = controlResourceSetToAddModList->list.array[0]; + mac->coreset[dl_bwp_id][coreset_id - 1] = controlResourceSetToAddModList->list.array[0]; - AssertFatal(mac->ULbwp[0]->bwp_Dedicated != NULL, "UL bwp_Dedicated is null\n"); + AssertFatal(mac->ULbwp[ul_bwp_id]->bwp_Dedicated != NULL, "UL bwp_Dedicated is null\n"); // check available Search Spaces in the searchSpacesToAddModList and pass to MAC // note: the network configures at most 10 Search Spaces per BWP per cell (including UE-specific and common Search Spaces). @@ -657,10 +657,10 @@ void config_control_ue(NR_UE_MAC_INST_t *mac){ NR_SearchSpace_t *ss = searchSpacesToAddModList->list.array[ss_id]; AssertFatal(ss->controlResourceSetId != NULL, "ss->controlResourceSetId is null\n"); AssertFatal(ss->searchSpaceType != NULL, "ss->searchSpaceType is null\n"); - AssertFatal(*ss->controlResourceSetId == mac->coreset[dl_bwp_id - 1][coreset_id - 1]->controlResourceSetId, "ss->controlResourceSetId is unknown\n"); + AssertFatal(*ss->controlResourceSetId == mac->coreset[dl_bwp_id][coreset_id - 1]->controlResourceSetId, "ss->controlResourceSetId is unknown\n"); AssertFatal(ss->monitoringSymbolsWithinSlot != NULL, "NR_SearchSpace->monitoringSymbolsWithinSlot is null\n"); AssertFatal(ss->monitoringSymbolsWithinSlot->buf != NULL, "NR_SearchSpace->monitoringSymbolsWithinSlot->buf is null\n"); - mac->SSpace[dl_bwp_id-1][0][ss_id] = ss; + mac->SSpace[dl_bwp_id][0][ss_id] = ss; } // Check available CSSs in the commonSearchSpaceList (list of additional common search spaces) @@ -668,11 +668,11 @@ void config_control_ue(NR_UE_MAC_INST_t *mac){ for (int css_id = 0; css_id < commonSearchSpaceList->list.count; css_id++) { NR_SearchSpace_t *css = commonSearchSpaceList->list.array[css_id]; AssertFatal(css->controlResourceSetId != NULL, "ss->controlResourceSetId is null\n"); - AssertFatal(*css->controlResourceSetId == mac->coreset[dl_bwp_id - 1][coreset_id - 1]->controlResourceSetId, "ss->controlResourceSetId is unknown\n"); + AssertFatal(*css->controlResourceSetId == mac->coreset[dl_bwp_id][coreset_id - 1]->controlResourceSetId, "ss->controlResourceSetId is unknown\n"); AssertFatal(css->searchSpaceType != NULL, "css->searchSpaceType is null\n"); AssertFatal(css->monitoringSymbolsWithinSlot != NULL, "css->monitoringSymbolsWithinSlot is null\n"); AssertFatal(css->monitoringSymbolsWithinSlot->buf != NULL, "css->monitoringSymbolsWithinSlot->buf is null\n"); - mac->SSpace[dl_bwp_id -1][coreset_id -1][ss_id] = css; + mac->SSpace[dl_bwp_id][coreset_id -1][ss_id] = css; ss_id++; } 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 037287e8750..008b9365040 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c @@ -73,7 +73,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t AssertFatal(mac->scc == NULL || mac->scc_SIB == NULL, "both scc and scc_SIB cannot be non-null\n"); - NR_BWP_Id_t bwp_id = mac->DL_BWP_Id; + NR_BWP_Id_t dl_bwp_id = get_softmodem_params()->sa ? 0 : mac->DL_BWP_Id ; //SA uses initial BWP NR_ServingCellConfigCommon_t *scc = mac->scc; NR_ServingCellConfigCommonSIB_t *scc_SIB = mac->scc_SIB; NR_BWP_DownlinkCommon_t *bwp_Common=NULL; @@ -84,14 +84,14 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t initialDownlinkBWP = scc!=NULL ? scc->downlinkConfigCommon->initialDownlinkBWP : &scc_SIB->downlinkConfigCommon.initialDownlinkBWP; initialUplinkBWP = scc!=NULL ? scc->uplinkConfigCommon->initialUplinkBWP : &scc_SIB->uplinkConfigCommon->initialUplinkBWP; - bwp_Common = bwp_id>0 ? mac->DLbwp[bwp_id-1]->bwp_Common : NULL; + bwp_Common = dl_bwp_id>0 ? mac->DLbwp[dl_bwp_id]->bwp_Common : NULL; } NR_SearchSpace_t *ss; NR_ControlResourceSet_t *coreset; if(ss_id>=0) { - ss = mac->SSpace[bwp_id - 1][coreset_id - 1][ss_id]; - coreset = mac->coreset[bwp_id - 1][coreset_id - 1]; + ss = mac->SSpace[dl_bwp_id][coreset_id - 1][ss_id]; + coreset = mac->coreset[dl_bwp_id][coreset_id - 1]; rel15->coreset.CoreSetType = NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG; } else { ss = mac->search_space_zero; @@ -154,7 +154,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(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(initialUplinkBWP, mac->cg, &mac->def_dci_pdu_rel15[rel15->dci_format_options[i]], rel15->dci_format_options[i], NR_RNTI_C, rel15->BWPSize, dl_bwp_id); } break; case NR_RNTI_RA: @@ -169,7 +169,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(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(initialUplinkBWP, mac->cg, &mac->def_dci_pdu_rel15[rel15->dci_format_options[0]], rel15->dci_format_options[0], NR_RNTI_RA, rel15->BWPSize, dl_bwp_id); break; case NR_RNTI_P: break; @@ -183,7 +183,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t rel15->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); rel15->BWPStart = NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); rel15->SubcarrierSpacing = initialDownlinkBWP->genericParameters.subcarrierSpacing; - rel15->dci_length_options[0] = nr_dci_size(initialUplinkBWP, mac->cg, &mac->def_dci_pdu_rel15[rel15->dci_format_options[0]], rel15->dci_format_options[0], NR_RNTI_TC, rel15->BWPSize, bwp_id); + rel15->dci_length_options[0] = nr_dci_size(initialUplinkBWP, mac->cg, &mac->def_dci_pdu_rel15[rel15->dci_format_options[0]], rel15->dci_format_options[0], NR_RNTI_TC, rel15->BWPSize, dl_bwp_id); break; case NR_RNTI_SP_CSI: break; @@ -246,16 +246,16 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl uint8_t bwp_id = (mac->cg) ? mac->DL_BWP_Id : 0, coreset_id = (mac->cg) ? 1 : 0; //NR_ServingCellConfig_t *scd = mac->scg->spCellConfig->spCellConfigDedicated; - NR_BWP_Downlink_t *bwp = (mac->cg) ? mac->DLbwp[bwp_id - 1] : NULL; + NR_BWP_Downlink_t *bwp = (mac->cg) ? mac->DLbwp[bwp_id] : NULL; LOG_D(MAC, "[DCI_CONFIG] ra_rnti %p (%x) crnti %p (%x) t_crnti %p (%x)\n", &ra->ra_rnti, ra->ra_rnti, &mac->crnti, mac->crnti, &ra->t_crnti, ra->t_crnti); if (mac->cg) { // do this only after we have a Master or Secondary Cell group // loop over all available SS for BWP ID 1, CORESET ID 1 if (bwp) { - for (ss_id = 0; ss_id < FAPI_NR_MAX_SS_PER_CORESET && mac->SSpace[bwp_id - 1][coreset_id - 1][ss_id] != NULL; ss_id++){ + for (ss_id = 0; ss_id < FAPI_NR_MAX_SS_PER_CORESET && mac->SSpace[bwp_id][coreset_id - 1][ss_id] != NULL; ss_id++){ LOG_D(MAC, "[DCI_CONFIG] ss_id %d\n",ss_id); - NR_SearchSpace_t *ss = mac->SSpace[bwp_id - 1][coreset_id - 1][ss_id]; + NR_SearchSpace_t *ss = mac->SSpace[bwp_id][coreset_id - 1][ss_id]; fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15; NR_BWP_DownlinkCommon_t *bwp_Common = bwp->bwp_Common; NR_SetupRelease_PDCCH_ConfigCommon_t *pdcch_ConfigCommon = bwp_Common->pdcch_ConfigCommon; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index d27c13565a8..9e1f9debcd4 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -280,8 +280,8 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, uint8_t sliv_S=0; uint8_t sliv_L=0; uint8_t mu_pusch = 1; - NR_BWP_Id_t dl_bwp_id = mac->UL_BWP_Id; - NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id; + NR_BWP_Id_t dl_bwp_id = get_softmodem_params()->sa ? 0 : mac->DL_BWP_Id ; //SA uses initial BWP + NR_BWP_Id_t ul_bwp_id = get_softmodem_params()->sa ? 0 : mac->UL_BWP_Id ;//SA uses initial BWP // definition table j Table 6.1.2.1.1-4 uint8_t j = (mu_pusch==3)?3:(mu_pusch==2)?2:1; @@ -327,13 +327,13 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, */ if(dlsch_config_pdu != NULL){ NR_PDSCH_TimeDomainResourceAllocationList_t *pdsch_TimeDomainAllocationList = NULL; - if (mac->DLbwp[dl_bwp_id-1] && - mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated && - mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated->pdsch_Config && - mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList) - pdsch_TimeDomainAllocationList = mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList->choice.setup; - else if (mac->DLbwp[dl_bwp_id-1] && mac->DLbwp[dl_bwp_id-1]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList) - pdsch_TimeDomainAllocationList = mac->DLbwp[dl_bwp_id-1]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + if (mac->DLbwp[dl_bwp_id] && + mac->DLbwp[dl_bwp_id]->bwp_Dedicated && + mac->DLbwp[dl_bwp_id]->bwp_Dedicated->pdsch_Config && + mac->DLbwp[dl_bwp_id]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList) + pdsch_TimeDomainAllocationList = mac->DLbwp[dl_bwp_id]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList->choice.setup; + else if (mac->DLbwp[dl_bwp_id] && mac->DLbwp[dl_bwp_id]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList) + pdsch_TimeDomainAllocationList = mac->DLbwp[dl_bwp_id]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; else if (mac->scc_SIB && mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.pdsch_ConfigCommon->choice.setup) pdsch_TimeDomainAllocationList = mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; @@ -386,19 +386,19 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, */ if(pusch_config_pdu != NULL){ NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = NULL; - if (mac->ULbwp[ul_bwp_id-1] && - mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated && - mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pusch_Config && - mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pusch_Config->choice.setup && - mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pusch_Config->choice.setup->pusch_TimeDomainAllocationList) { - pusch_TimeDomainAllocationList = mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pusch_Config->choice.setup->pusch_TimeDomainAllocationList->choice.setup; + if (mac->ULbwp[ul_bwp_id] && + mac->ULbwp[ul_bwp_id]->bwp_Dedicated && + mac->ULbwp[ul_bwp_id]->bwp_Dedicated->pusch_Config && + mac->ULbwp[ul_bwp_id]->bwp_Dedicated->pusch_Config->choice.setup && + mac->ULbwp[ul_bwp_id]->bwp_Dedicated->pusch_Config->choice.setup->pusch_TimeDomainAllocationList) { + pusch_TimeDomainAllocationList = mac->ULbwp[ul_bwp_id]->bwp_Dedicated->pusch_Config->choice.setup->pusch_TimeDomainAllocationList->choice.setup; } - else if (mac->ULbwp[ul_bwp_id-1] && - mac->ULbwp[ul_bwp_id-1]->bwp_Common && - mac->ULbwp[ul_bwp_id-1]->bwp_Common->pusch_ConfigCommon && - mac->ULbwp[ul_bwp_id-1]->bwp_Common->pusch_ConfigCommon->choice.setup && - mac->ULbwp[ul_bwp_id-1]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) { - pusch_TimeDomainAllocationList = mac->ULbwp[ul_bwp_id-1]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; + else if (mac->ULbwp[ul_bwp_id] && + mac->ULbwp[ul_bwp_id]->bwp_Common && + mac->ULbwp[ul_bwp_id]->bwp_Common->pusch_ConfigCommon && + mac->ULbwp[ul_bwp_id]->bwp_Common->pusch_ConfigCommon->choice.setup && + mac->ULbwp[ul_bwp_id]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) { + pusch_TimeDomainAllocationList = mac->ULbwp[ul_bwp_id]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; } else pusch_TimeDomainAllocationList = mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; @@ -459,11 +459,11 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr RA_config_t *ra = &mac->ra; fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request; uint8_t is_Msg3 = 0; - NR_BWP_Id_t dl_bwp_id = mac->DL_BWP_Id; - NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id; + NR_BWP_Id_t dl_bwp_id = get_softmodem_params()->sa ? 0 : mac->DL_BWP_Id ; //SA uses initial BWP + NR_BWP_Id_t ul_bwp_id = get_softmodem_params()->sa ? 0 : mac->UL_BWP_Id ;//SA uses initial BWP uint16_t n_RB_DLBWP; - if (mac->DLbwp[dl_bwp_id-1]) n_RB_DLBWP = NRRIV2BW(mac->DLbwp[dl_bwp_id-1]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + if (mac->DLbwp[dl_bwp_id]) n_RB_DLBWP = NRRIV2BW(mac->DLbwp[dl_bwp_id]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); else if (mac->scc_SIB) n_RB_DLBWP = NRRIV2BW(mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth,MAX_BWP_SIZE); else n_RB_DLBWP = mac->type0_PDCCH_CSS_config.num_rbs; @@ -629,7 +629,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.rnti = rnti; fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu_1_0 = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; - NR_PDSCH_Config_t *pdsch_config= (mac->DLbwp[dl_bwp_id-1]) ? mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated->pdsch_Config->choice.setup : NULL; + NR_PDSCH_Config_t *pdsch_config= (mac->DLbwp[dl_bwp_id]) ? mac->DLbwp[dl_bwp_id]->bwp_Dedicated->pdsch_Config->choice.setup : NULL; uint16_t BWPSize = n_RB_DLBWP; if(rnti == SI_RNTI) { @@ -655,15 +655,15 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); } if (!get_softmodem_params()->sa) { // NSA mode is not using the Initial BWP - dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[dl_bwp_id-1]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - pdsch_config = mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated->pdsch_Config->choice.setup; + dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[dl_bwp_id]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + pdsch_config = mac->DLbwp[dl_bwp_id]->bwp_Dedicated->pdsch_Config->choice.setup; BWPSize = dlsch_config_pdu_1_0->BWPSize; } - } else if (mac->DLbwp[dl_bwp_id-1]) { - dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->DLbwp[dl_bwp_id-1]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[dl_bwp_id-1]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - dlsch_config_pdu_1_0->SubcarrierSpacing = mac->DLbwp[dl_bwp_id-1]->bwp_Common->genericParameters.subcarrierSpacing; - pdsch_config = mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated->pdsch_Config->choice.setup; + } else if (mac->DLbwp[dl_bwp_id]) { + dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->DLbwp[dl_bwp_id]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[dl_bwp_id]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + dlsch_config_pdu_1_0->SubcarrierSpacing = mac->DLbwp[dl_bwp_id]->bwp_Common->genericParameters.subcarrierSpacing; + pdsch_config = mac->DLbwp[dl_bwp_id]->bwp_Dedicated->pdsch_Config->choice.setup; } else if (mac->scc_SIB) { dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE); dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE); @@ -685,13 +685,13 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr } NR_PDSCH_TimeDomainResourceAllocationList_t *pdsch_TimeDomainAllocationList = NULL; - if (mac->DLbwp[dl_bwp_id-1] && - mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated && - mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated->pdsch_Config && - mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList) - pdsch_TimeDomainAllocationList = mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList->choice.setup; - else if (mac->DLbwp[dl_bwp_id-1] && mac->DLbwp[dl_bwp_id-1]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList) - pdsch_TimeDomainAllocationList = mac->DLbwp[dl_bwp_id-1]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + if (mac->DLbwp[dl_bwp_id] && + mac->DLbwp[dl_bwp_id]->bwp_Dedicated && + mac->DLbwp[dl_bwp_id]->bwp_Dedicated->pdsch_Config && + mac->DLbwp[dl_bwp_id]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList) + pdsch_TimeDomainAllocationList = mac->DLbwp[dl_bwp_id]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList->choice.setup; + else if (mac->DLbwp[dl_bwp_id] && mac->DLbwp[dl_bwp_id]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList) + pdsch_TimeDomainAllocationList = mac->DLbwp[dl_bwp_id]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; else if (mac->scc_SIB && mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.pdsch_ConfigCommon->choice.setup) pdsch_TimeDomainAllocationList = mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; @@ -703,7 +703,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr dlsch_config_pdu_1_0->number_symbols, dlsch_config_pdu_1_0->start_symbol, mappingtype); - dlsch_config_pdu_1_0->dmrsConfigType = (mac->DLbwp[dl_bwp_id-1] != NULL) ? (mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1) : 0; + dlsch_config_pdu_1_0->dmrsConfigType = (mac->DLbwp[dl_bwp_id] != NULL) ? (mac->DLbwp[dl_bwp_id]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1) : 0; /* number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214 version 15.9.0 Release 15 */ if (dlsch_config_pdu_1_0->number_symbols == 2) dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 1; @@ -752,14 +752,14 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr dlsch_config_pdu_1_0->pucch_resource_id = dci->pucch_resource_indicator; // Sanity check for pucch_resource_indicator value received to check for false DCI. valid = 0; - if (mac->ULbwp[ul_bwp_id-1] && - mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated && - mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pucch_Config && - mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup&& - mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList) { - pucch_res_set_cnt = mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.count; + if (mac->ULbwp[ul_bwp_id] && + mac->ULbwp[ul_bwp_id]->bwp_Dedicated && + mac->ULbwp[ul_bwp_id]->bwp_Dedicated->pucch_Config && + mac->ULbwp[ul_bwp_id]->bwp_Dedicated->pucch_Config->choice.setup&& + mac->ULbwp[ul_bwp_id]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList) { + pucch_res_set_cnt = mac->ULbwp[ul_bwp_id]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.count; for (int id = 0; id < pucch_res_set_cnt; id++) { - if (dlsch_config_pdu_1_0->pucch_resource_id < mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[id]->resourceList.list.count) { + if (dlsch_config_pdu_1_0->pucch_resource_id < mac->ULbwp[ul_bwp_id]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[id]->resourceList.list.count) { valid = 1; break; } @@ -855,16 +855,16 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr config_bwp_ue(mac, &dci->bwp_indicator.val, &dci_format); - NR_PDSCH_Config_t *pdsch_config=mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated->pdsch_Config->choice.setup; + NR_PDSCH_Config_t *pdsch_config=mac->DLbwp[dl_bwp_id]->bwp_Dedicated->pdsch_Config->choice.setup; dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH; dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.rnti = rnti; fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu_1_1 = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; - dlsch_config_pdu_1_1->BWPSize = NRRIV2BW(mac->DLbwp[dl_bwp_id-1]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - dlsch_config_pdu_1_1->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[dl_bwp_id-1]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - dlsch_config_pdu_1_1->SubcarrierSpacing = mac->DLbwp[dl_bwp_id-1]->bwp_Common->genericParameters.subcarrierSpacing; + dlsch_config_pdu_1_1->BWPSize = NRRIV2BW(mac->DLbwp[dl_bwp_id]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + dlsch_config_pdu_1_1->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[dl_bwp_id]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + dlsch_config_pdu_1_1->SubcarrierSpacing = mac->DLbwp[dl_bwp_id]->bwp_Common->genericParameters.subcarrierSpacing; /* IDENTIFIER_DCI_FORMATS */ /* CARRIER_IND */ @@ -882,13 +882,13 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr } NR_PDSCH_TimeDomainResourceAllocationList_t *pdsch_TimeDomainAllocationList = NULL; - if (mac->DLbwp[dl_bwp_id-1] && - mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated && - mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated->pdsch_Config && - mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList) - pdsch_TimeDomainAllocationList = mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList->choice.setup; - else if (mac->DLbwp[dl_bwp_id-1] && mac->DLbwp[dl_bwp_id-1]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList) - pdsch_TimeDomainAllocationList = mac->DLbwp[dl_bwp_id-1]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + if (mac->DLbwp[dl_bwp_id] && + mac->DLbwp[dl_bwp_id]->bwp_Dedicated && + mac->DLbwp[dl_bwp_id]->bwp_Dedicated->pdsch_Config && + mac->DLbwp[dl_bwp_id]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList) + pdsch_TimeDomainAllocationList = mac->DLbwp[dl_bwp_id]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList->choice.setup; + else if (mac->DLbwp[dl_bwp_id] && mac->DLbwp[dl_bwp_id]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList) + pdsch_TimeDomainAllocationList = mac->DLbwp[dl_bwp_id]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; else if (mac->scc_SIB && mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.pdsch_ConfigCommon->choice.setup) pdsch_TimeDomainAllocationList = mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; @@ -900,7 +900,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr dlsch_config_pdu_1_1->number_symbols, dlsch_config_pdu_1_1->start_symbol, mappingtype); - dlsch_config_pdu_1_1->dmrsConfigType = mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1; + dlsch_config_pdu_1_1->dmrsConfigType = mac->DLbwp[dl_bwp_id]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1; /* TODO: fix number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214, using tables 7.3.1.2.2-1, 7.3.1.2.2-2, 7.3.1.2.2-3, 7.3.1.2.2-4 of 3GPP TS 38.212 */ dlsch_config_pdu_1_1->n_dmrs_cdm_groups = 1; @@ -949,9 +949,9 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr dlsch_config_pdu_1_1->pucch_resource_id = dci->pucch_resource_indicator; // Sanity check for pucch_resource_indicator value received to check for false DCI. valid = 0; - pucch_res_set_cnt = mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.count; + pucch_res_set_cnt = mac->ULbwp[ul_bwp_id]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.count; for (int id = 0; id < pucch_res_set_cnt; id++) { - if (dlsch_config_pdu_1_1->pucch_resource_id < mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[id]->resourceList.list.count) { + if (dlsch_config_pdu_1_1->pucch_resource_id < mac->ULbwp[ul_bwp_id]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[id]->resourceList.list.count) { valid = 1; break; } @@ -965,7 +965,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr // according to TS 38.213 Table 9.2.3-1 dlsch_config_pdu_1_1->pdsch_to_harq_feedback_time_ind = - mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->dl_DataToUL_ACK->list.array[dci->pdsch_to_harq_feedback_timing_indicator.val][0]; + mac->ULbwp[ul_bwp_id]->bwp_Dedicated->pucch_Config->choice.setup->dl_DataToUL_ACK->list.array[dci->pdsch_to_harq_feedback_timing_indicator.val][0]; /* ANTENNA_PORTS */ uint8_t n_codewords = 1; // FIXME!!! @@ -1077,8 +1077,8 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr /* TODO same calculation for MCS table as done in UL */ dlsch_config_pdu_1_1->mcs_table = (pdsch_config->mcs_Table) ? (*pdsch_config->mcs_Table + 1) : 0; /*PTRS configuration */ - if(mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS != NULL) { - valid_ptrs_setup = set_dl_ptrs_values(mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup, + if(mac->DLbwp[dl_bwp_id]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS != NULL) { + valid_ptrs_setup = set_dl_ptrs_values(mac->DLbwp[dl_bwp_id]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup, dlsch_config_pdu_1_1->number_rbs, dlsch_config_pdu_1_1->mcs, dlsch_config_pdu_1_1->mcs_table, &dlsch_config_pdu_1_1->PTRSFreqDensity,&dlsch_config_pdu_1_1->PTRSTimeDensity, &dlsch_config_pdu_1_1->PTRSPortIndex,&dlsch_config_pdu_1_1->nEpreRatioOfPDSCHToPTRS, @@ -1169,15 +1169,14 @@ void nr_ue_send_sdu(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t *u int get_n_rb(NR_UE_MAC_INST_t *mac, int rnti_type){ int N_RB = 0, start_RB; - NR_BWP_Id_t dl_bwp_id = mac->DL_BWP_Id; + NR_BWP_Id_t dl_bwp_id = get_softmodem_params()->sa ? 0 : mac->DL_BWP_Id ; //SA uses initial BWP switch(rnti_type) { case NR_RNTI_RA: case NR_RNTI_TC: case NR_RNTI_P: { - NR_BWP_Id_t dl_bwp_id = mac->DL_BWP_Id; - if (mac->DLbwp[dl_bwp_id-1]->bwp_Common->pdcch_ConfigCommon->choice.setup->controlResourceSetZero) { + if (mac->DLbwp[dl_bwp_id]->bwp_Common->pdcch_ConfigCommon->choice.setup->controlResourceSetZero) { uint8_t coreset_id = 0; // assuming controlResourceSetId is 0 for controlResourceSetZero - NR_ControlResourceSet_t *coreset = mac->coreset[dl_bwp_id-1][coreset_id]; + NR_ControlResourceSet_t *coreset = mac->coreset[dl_bwp_id][coreset_id]; get_coreset_rballoc(coreset->frequencyDomainResources.buf,&N_RB,&start_RB); } else { N_RB = NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); @@ -1188,7 +1187,7 @@ int get_n_rb(NR_UE_MAC_INST_t *mac, int rnti_type){ N_RB = mac->type0_PDCCH_CSS_config.num_rbs; break; case NR_RNTI_C: - N_RB = NRRIV2BW(mac->DLbwp[dl_bwp_id-1]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + N_RB = NRRIV2BW(mac->DLbwp[dl_bwp_id]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); break; } return N_RB; @@ -1207,14 +1206,14 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, int fsize = 0; int rnti_type = get_rnti_type(mac, rnti); - NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id; - NR_BWP_Id_t dl_bwp_id = mac->DL_BWP_Id; + NR_BWP_Id_t ul_bwp_id = get_softmodem_params()->sa ? 0 : mac->UL_BWP_Id ; //SA uses initial BWP + NR_BWP_Id_t dl_bwp_id = get_softmodem_params()->sa ? 0 : mac->DL_BWP_Id ; //SA uses initial BWP int N_RB_UL = 0; if(mac->scc_SIB) { N_RB_UL = NRRIV2BW(mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - } else if(mac->ULbwp[ul_bwp_id-1]) { - N_RB_UL = NRRIV2BW(mac->ULbwp[ul_bwp_id-1]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + } else if(mac->ULbwp[ul_bwp_id]) { + N_RB_UL = NRRIV2BW(mac->ULbwp[ul_bwp_id]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); } else if(mac->scc) { N_RB_UL = NRRIV2BW(mac->scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); } @@ -1279,7 +1278,7 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, #endif // check BWP id - if (mac->DLbwp[dl_bwp_id-1]) N_RB=NRRIV2BW(mac->DLbwp[dl_bwp_id-1]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + if (mac->DLbwp[dl_bwp_id]) N_RB=NRRIV2BW(mac->DLbwp[dl_bwp_id]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); else N_RB=NRRIV2BW(mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE); // Freq domain assignment (275rb >> fsize = 16) @@ -1462,7 +1461,7 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, case NR_RNTI_TC: // check BWP id - if (mac->DLbwp[dl_bwp_id-1]) N_RB=NRRIV2BW(mac->DLbwp[dl_bwp_id-1]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + if (mac->DLbwp[dl_bwp_id]) N_RB=NRRIV2BW(mac->DLbwp[dl_bwp_id]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); else N_RB=NRRIV2BW(mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE); // indicating a DL DCI format - 1 bit @@ -1537,7 +1536,7 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, break; case NR_UL_DCI_FORMAT_0_0: - if (mac->ULbwp[ul_bwp_id-1]) N_RB_UL=NRRIV2BW(mac->ULbwp[ul_bwp_id-1]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + if (mac->ULbwp[ul_bwp_id]) N_RB_UL=NRRIV2BW(mac->ULbwp[ul_bwp_id]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); else N_RB_UL=NRRIV2BW(mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE); switch(rnti_type) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 5e8774d118e..995916b35a4 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -94,19 +94,20 @@ void fill_scheduled_response(nr_scheduled_response_t *scheduled_response, */ long get_k2(NR_UE_MAC_INST_t *mac, uint8_t time_domain_ind) { long k2 = -1; - NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id; + + NR_BWP_Id_t ul_bwp_id = get_softmodem_params()->sa ? 0 : mac->UL_BWP_Id ;//SA uses initial BWP // Get K2 from RRC configuration - NR_PUSCH_Config_t *pusch_config=mac->ULbwp[ul_bwp_id-1] ? mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pusch_Config->choice.setup : NULL; + NR_PUSCH_Config_t *pusch_config=mac->ULbwp[ul_bwp_id] ? mac->ULbwp[ul_bwp_id]->bwp_Dedicated->pusch_Config->choice.setup : NULL; NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = NULL; if (pusch_config && pusch_config->pusch_TimeDomainAllocationList) { pusch_TimeDomainAllocationList = pusch_config->pusch_TimeDomainAllocationList->choice.setup; } - else if (mac->ULbwp[ul_bwp_id-1] && - mac->ULbwp[ul_bwp_id-1]->bwp_Common&& - mac->ULbwp[ul_bwp_id-1]->bwp_Common->pusch_ConfigCommon&& - mac->ULbwp[ul_bwp_id-1]->bwp_Common->pusch_ConfigCommon->choice.setup && - mac->ULbwp[ul_bwp_id-1]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) { - pusch_TimeDomainAllocationList = mac->ULbwp[ul_bwp_id-1]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; + else if (mac->ULbwp[ul_bwp_id] && + mac->ULbwp[ul_bwp_id]->bwp_Common&& + mac->ULbwp[ul_bwp_id]->bwp_Common->pusch_ConfigCommon&& + mac->ULbwp[ul_bwp_id]->bwp_Common->pusch_ConfigCommon->choice.setup && + mac->ULbwp[ul_bwp_id]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) { + pusch_TimeDomainAllocationList = mac->ULbwp[ul_bwp_id]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; } else if (mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) pusch_TimeDomainAllocationList=mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; @@ -147,8 +148,8 @@ fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int sl // Calculate the index of the UL slot in mac->ul_config_request list. This is // based on the TDD pattern (slot configuration period) and number of UL+mixed // slots in the period. TS 38.213 Sec 11.1 - int mu = mac->ULbwp[ul_bwp_id-1] ? - mac->ULbwp[ul_bwp_id-1]->bwp_Common->genericParameters.subcarrierSpacing : + int mu = mac->ULbwp[ul_bwp_id] ? + mac->ULbwp[ul_bwp_id]->bwp_Common->genericParameters.subcarrierSpacing : mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.subcarrierSpacing; NR_TDD_UL_DL_Pattern_t *tdd_pattern = &tdd_config->pattern1; const int num_slots_per_tdd = nr_slots_per_frame[mu] >> (7 - tdd_pattern->dl_UL_TransmissionPeriodicity); @@ -166,8 +167,8 @@ fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int sl void ul_layers_config(NR_UE_MAC_INST_t * mac, nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu, dci_pdu_rel15_t *dci) { NR_ServingCellConfigCommon_t *scc = mac->scc; - NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id; - NR_PUSCH_Config_t *pusch_Config = mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pusch_Config->choice.setup; + NR_BWP_Id_t ul_bwp_id = get_softmodem_params()->sa ? 0 : mac->UL_BWP_Id ;//SA uses initial BWP + NR_PUSCH_Config_t *pusch_Config = mac->ULbwp[ul_bwp_id]->bwp_Dedicated->pusch_Config->choice.setup; long transformPrecoder; if (pusch_Config->transformPrecoder) @@ -307,7 +308,7 @@ void ul_ports_config(NR_UE_MAC_INST_t * mac, nfapi_nr_ue_pusch_pdu_t *pusch_conf uint8_t rank = 0; // We need to initialize rank FIXME!!! NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id; NR_ServingCellConfigCommon_t *scc = mac->scc; - NR_PUSCH_Config_t *pusch_Config = mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pusch_Config->choice.setup; + NR_PUSCH_Config_t *pusch_Config = mac->ULbwp[ul_bwp_id]->bwp_Dedicated->pusch_Config->choice.setup; long transformPrecoder; if (pusch_Config->transformPrecoder) @@ -512,7 +513,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, int N_PRB_oh = 0; int rnti_type = get_rnti_type(mac, rnti); - NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id; + NR_BWP_Id_t ul_bwp_id = get_softmodem_params()->sa ? 0 : mac->UL_BWP_Id ;//SA uses initial BWP // Common configuration pusch_config_pdu->dmrs_config_type = pusch_dmrs_type1; @@ -529,7 +530,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, if (rar_grant) { // Note: for Msg3 or MsgA PUSCH transmission the N_PRB_oh is always set to 0 - NR_BWP_Uplink_t *ubwp = mac->ULbwp[ul_bwp_id-1]; + NR_BWP_Uplink_t *ubwp = mac->ULbwp[ul_bwp_id]; NR_BWP_UplinkDedicated_t *ibwp; int scs,abwp_start,abwp_size,startSymbolAndLength,mappingtype; NR_PUSCH_Config_t *pusch_Config=NULL; @@ -634,9 +635,9 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, int target_ss; bool valid_ptrs_setup = 0; uint16_t n_RB_ULBWP; - if (mac->ULbwp[ul_bwp_id-1] && mac->ULbwp[ul_bwp_id-1]->bwp_Common) { - n_RB_ULBWP = NRRIV2BW(mac->ULbwp[ul_bwp_id-1]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - pusch_config_pdu->bwp_start = NRRIV2PRBOFFSET(mac->ULbwp[ul_bwp_id-1]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + if (mac->ULbwp[ul_bwp_id] && mac->ULbwp[ul_bwp_id]->bwp_Common) { + n_RB_ULBWP = NRRIV2BW(mac->ULbwp[ul_bwp_id]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + pusch_config_pdu->bwp_start = NRRIV2PRBOFFSET(mac->ULbwp[ul_bwp_id]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); } else { pusch_config_pdu->bwp_start = NRRIV2PRBOFFSET(mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE); @@ -645,7 +646,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, pusch_config_pdu->bwp_size = n_RB_ULBWP; - NR_PUSCH_Config_t *pusch_Config = mac->ULbwp[ul_bwp_id-1] ? mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pusch_Config->choice.setup : NULL; + NR_PUSCH_Config_t *pusch_Config = mac->ULbwp[ul_bwp_id] ? mac->ULbwp[ul_bwp_id]->bwp_Dedicated->pusch_Config->choice.setup : NULL; // Basic sanity check for MCS value to check for a false or erroneous DCI if (dci->mcs > 28) { @@ -665,12 +666,10 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, } else if (*dci_format == NR_UL_DCI_FORMAT_0_1) { - /* BANDWIDTH_PART_IND */ - // if (dci->bwp_indicator.val != 1) { - // LOG_W(NR_MAC, "bwp_indicator != 1! Possibly due to false DCI. Ignoring DCI!\n"); - // return -1; - // } config_bwp_ue(mac, &dci->bwp_indicator.val, dci_format); + + ul_bwp_id = get_softmodem_params()->sa ? 0 : mac->UL_BWP_Id ;//SA uses initial BWP + target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific; ul_layers_config(mac, pusch_config_pdu, dci); ul_ports_config(mac, pusch_config_pdu, dci); @@ -686,12 +685,12 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, if (pusch_Config && pusch_Config->pusch_TimeDomainAllocationList) { pusch_TimeDomainAllocationList = pusch_Config->pusch_TimeDomainAllocationList->choice.setup; } - else if (mac->ULbwp[mac->UL_BWP_Id-1] && - mac->ULbwp[mac->UL_BWP_Id-1]->bwp_Common&& - mac->ULbwp[mac->UL_BWP_Id-1]->bwp_Common->pusch_ConfigCommon&& - mac->ULbwp[mac->UL_BWP_Id-1]->bwp_Common->pusch_ConfigCommon->choice.setup && - mac->ULbwp[mac->UL_BWP_Id-1]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) { - pusch_TimeDomainAllocationList = mac->ULbwp[mac->UL_BWP_Id-1]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; + else if (mac->ULbwp[ul_bwp_id] && + mac->ULbwp[ul_bwp_id]->bwp_Common&& + mac->ULbwp[ul_bwp_id]->bwp_Common->pusch_ConfigCommon&& + mac->ULbwp[ul_bwp_id]->bwp_Common->pusch_ConfigCommon->choice.setup && + mac->ULbwp[ul_bwp_id]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) { + pusch_TimeDomainAllocationList = mac->ULbwp[ul_bwp_id]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; } else if (mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) pusch_TimeDomainAllocationList=mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; @@ -786,9 +785,9 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, /* DMRS */ l_prime_mask = get_l_prime(pusch_config_pdu->nr_of_symbols, mappingtype, add_pos, dmrslength, pusch_config_pdu->start_symbol_index, mac->scc ? mac->scc->dmrs_TypeA_Position : mac->mib->dmrs_TypeA_Position); - if ((mac->ULbwp[ul_bwp_id-1] && pusch_config_pdu->transform_precoding == transform_precoder_disabled)) + if ((mac->ULbwp[ul_bwp_id] && pusch_config_pdu->transform_precoding == transform_precoder_disabled)) pusch_config_pdu->num_dmrs_cdm_grps_no_data = 1; - else if (*dci_format == NR_UL_DCI_FORMAT_0_0 || (mac->ULbwp[ul_bwp_id-1] && pusch_config_pdu->transform_precoding == transform_precoder_enabled)) + else if (*dci_format == NR_UL_DCI_FORMAT_0_0 || (mac->ULbwp[ul_bwp_id] && pusch_config_pdu->transform_precoding == transform_precoder_enabled)) pusch_config_pdu->num_dmrs_cdm_grps_no_data = 2; // Num PRB Overhead from PUSCH-ServingCellConfig @@ -803,16 +802,16 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, else N_PRB_oh = 0; /* PTRS */ - if (mac->ULbwp[mac->UL_BWP_Id -1] && - mac->ULbwp[mac->UL_BWP_Id -1]->bwp_Dedicated && - mac->ULbwp[mac->UL_BWP_Id -1]->bwp_Dedicated->pusch_Config && - mac->ULbwp[mac->UL_BWP_Id -1]->bwp_Dedicated->pusch_Config->choice.setup && - mac->ULbwp[mac->UL_BWP_Id -1]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB && - mac->ULbwp[mac->UL_BWP_Id -1]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS) { + if (mac->ULbwp[ul_bwp_id] && + mac->ULbwp[ul_bwp_id]->bwp_Dedicated && + mac->ULbwp[ul_bwp_id]->bwp_Dedicated->pusch_Config && + mac->ULbwp[ul_bwp_id]->bwp_Dedicated->pusch_Config->choice.setup && + mac->ULbwp[ul_bwp_id]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB && + mac->ULbwp[ul_bwp_id]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS) { if (pusch_config_pdu->transform_precoding == transform_precoder_disabled) { nfapi_nr_ue_ptrs_ports_t ptrs_ports_list; pusch_config_pdu->pusch_ptrs.ptrs_ports_list = &ptrs_ports_list; - valid_ptrs_setup = set_ul_ptrs_values(mac->ULbwp[mac->UL_BWP_Id -1]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup, + valid_ptrs_setup = set_ul_ptrs_values(mac->ULbwp[ul_bwp_id]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup, pusch_config_pdu->rb_size, pusch_config_pdu->mcs_index, pusch_config_pdu->mcs_table, &pusch_config_pdu->pusch_ptrs.ptrs_freq_density,&pusch_config_pdu->pusch_ptrs.ptrs_time_density, &pusch_config_pdu->pusch_ptrs.ptrs_ports_list->ptrs_re_offset,&pusch_config_pdu->pusch_ptrs.num_ptrs_ports, @@ -1122,7 +1121,8 @@ int nr_ue_pusch_scheduler(NR_UE_MAC_INST_t *mac, uint8_t tda_id){ int delta = 0; - NR_BWP_Uplink_t *ubwp = mac->ULbwp[mac->UL_BWP_Id-1]; + NR_BWP_Id_t ul_bwp_id = get_softmodem_params()->sa ? 0 : mac->UL_BWP_Id ;//SA uses initial BWP + NR_BWP_Uplink_t *ubwp = mac->ULbwp[ul_bwp_id]; // Get the numerology to calculate the Tx frame and slot int mu = ubwp ? diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 79a63ceefef..d881847990f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -540,7 +540,7 @@ void nr_initiate_ra_proc(module_id_t module_idP, ra_rnti = 1 + symbol + (slotP * 14) + (freq_index * 14 * 80) + (ul_carrier_id * 14 * 80 * 8); // This should be handled differently when we use the initialBWP for RA - ra->bwp_id = 0; + ra->bwp_id = 0;//TODO NR_BWP_Downlink_t *bwp=NULL; if (ra->CellGroup && ra->CellGroup->spCellConfig && ra->CellGroup->spCellConfig->spCellConfigDedicated && ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 958ceed323c..83e96c9bb94 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -60,6 +60,7 @@ #define DEBUG_gNB_SCHEDULER 1 #include "common/ran_context.h" +#include "executables/softmodem-common.h" extern RAN_CONTEXT_t RC; @@ -657,8 +658,7 @@ void config_uldci(const NR_BWP_Uplink_t *ubwp, dci_pdu_rel15->mcs, dci_pdu_rel15->tpc, dci_pdu_rel15->ndi, - dci_pdu_rel15->rv, - dci_pdu_rel15->bwp_indicator.val); + dci_pdu_rel15->rv); } const int default_pucch_fmt[] = {0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1}; @@ -1859,7 +1859,7 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG if (bwpList) AssertFatal(bwpList->list.count <= 4, "downlinkBWP_ToAddModList has %d BWP!\n", bwpList->list.count); - const int bwp_id = *servingCellConfig->firstActiveDownlinkBWP_Id; + const int bwp_id = (get_softmodem_params()->sa ) ? 1 : *servingCellConfig->firstActiveDownlinkBWP_Id; // TODO sched_ctrl->active_bwp = bwpList ? 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->active_bwp ? sched_ctrl->active_bwp->bwp_Dedicated : NULL, target_ss); @@ -1992,9 +1992,9 @@ void get_pdsch_to_harq_feedback(int Mod_idP, NR_SearchSpace__searchSpaceType_PR ss_type, uint8_t *pdsch_to_harq_feedback) { - int bwp_id=1; NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; NR_CellGroupConfig_t *CellGroup = UE_info->CellGroup[UE_id]; + NR_BWP_Id_t bwp_id = get_softmodem_params()->sa ? 1 : *CellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id; NR_BWP_Downlink_t *bwp=NULL; NR_BWP_Uplink_t *ubwp=NULL; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index c7ee3fcff20..2bcc6a71308 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -623,7 +623,7 @@ int checkTargetSSBInTCIStates_pdcchConfig(int ssb_index_t, int Mod_idP, int UE_i int nb_tci_states = CellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list.count; NR_TCI_State_t *tci =NULL; NR_TCI_StateId_t *tci_id = NULL; - int bwp_id = 1; + int bwp_id = 1;//TODO NR_BWP_Downlink_t *bwp = CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; NR_ControlResourceSet_t *coreset = bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.array[bwp_id-1]; int i; @@ -691,7 +691,7 @@ void tci_handling(module_id_t Mod_idP, int UE_id, frame_t frame, slot_t slot) { int ssb_index[MAX_NUM_SSB] = {0}; int ssb_rsrp[MAX_NUM_SSB] = {0}; uint8_t idx = 0; - int bwp_id = 1; + int bwp_id = 1;//TODO NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; NR_CellGroupConfig_t *CellGroup = UE_info->CellGroup[UE_id]; NR_BWP_Downlink_t *bwp = CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; -- GitLab