diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h index e0b8b40fb9..183697822d 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h @@ -577,6 +577,7 @@ typedef struct NR_UE_DL_BWP { NR_PDSCH_TimeDomainResourceAllocationList_t *tdaList; NR_PDSCH_Config_t *pdsch_Config; NR_PDSCH_ServingCellConfig_t *pdsch_servingcellconfig; + long *pdsch_HARQ_ACK_Codebook; uint8_t mcsTableIdx; nr_dci_format_t dci_format; } NR_UE_DL_BWP_t; @@ -590,13 +591,17 @@ typedef struct NR_UE_UL_BWP { uint16_t BWPStart; uint16_t initial_BWPSize; uint16_t initial_BWPStart; + NR_RACH_ConfigCommon_t *rach_ConfigCommon; NR_PUSCH_ServingCellConfig_t *pusch_servingcellconfig; NR_PUSCH_TimeDomainResourceAllocationList_t *tdaList; + NR_ConfiguredGrantConfig_t *configuredGrantConfig; NR_PUSCH_Config_t *pusch_Config; NR_PUCCH_Config_t *pucch_Config; NR_PUCCH_ConfigCommon_t *pucch_ConfigCommon; + long *harq_ACK_SpatialBundlingPUCCH; NR_CSI_MeasConfig_t *csi_MeasConfig; NR_SRS_Config_t *srs_Config; + long *msg3_DeltaPreamble; uint8_t transform_precoding; uint8_t mcs_table; nr_dci_format_t dci_format; diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index c62af96a8e..6612b78b92 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -2777,38 +2777,23 @@ uint16_t get_nr_srs_offset(NR_SRS_PeriodicityAndOffset_t periodicityAndOffset) { // Set the transform precoding status according to 6.1.3 of 3GPP TS 38.214 version 16.3.0 Release 16: // - "UE procedure for applying transform precoding on PUSCH" -uint8_t get_transformPrecoding(const NR_BWP_UplinkCommon_t *initialUplinkBWP, - const NR_PUSCH_Config_t *pusch_config, - const NR_BWP_UplinkDedicated_t *ubwp, - uint8_t *dci_format, - int rnti_type, - uint8_t configuredGrant){ +uint8_t get_transformPrecoding(const NR_UE_UL_BWP_t *current_UL_BWP, + nr_dci_format_t dci_format, + uint8_t configuredGrant) +{ - if (configuredGrant) { - if (ubwp->configuredGrantConfig) { - if (ubwp->configuredGrantConfig->choice.setup->transformPrecoder) { - return *ubwp->configuredGrantConfig->choice.setup->transformPrecoder; - } - } - } + if (configuredGrant && + current_UL_BWP->configuredGrantConfig && + current_UL_BWP->configuredGrantConfig->transformPrecoder) + return *current_UL_BWP->configuredGrantConfig->transformPrecoder; - if (rnti_type != NR_RNTI_RA && rnti_type != NR_RNTI_TC) { - if (*dci_format != NR_UL_DCI_FORMAT_0_0) { - if (pusch_config && pusch_config->transformPrecoder != NULL) { - return *pusch_config->transformPrecoder; - } - } - } - - if (initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder == NULL) { - return 1; // Transformprecoding disabled - } else { - LOG_D(PHY, "MAC_COMMON: Transform Precodig enabled through msg3_transformPrecoder\n"); - return 0; // Enabled - } - - LOG_E(MAC, "In %s: could not fetch transform precoder status...\n", __FUNCTION__); - return -1; + if (dci_format == NR_UL_DCI_FORMAT_0_1 && + current_UL_BWP && + current_UL_BWP->pusch_Config && + current_UL_BWP->pusch_Config->transformPrecoder) + return *current_UL_BWP->pusch_Config->transformPrecoder; + else + return current_UL_BWP->rach_ConfigCommon->msg3_transformPrecoder ? 0 : 1; } uint8_t get_pusch_nb_antenna_ports(NR_PUSCH_Config_t *pusch_Config, @@ -3264,9 +3249,7 @@ uint16_t get_rb_bwp_dci(nr_dci_format_t format, return N_RB; } -uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDownlinkBWP, - const NR_BWP_UplinkCommon_t *initialUplinkBWP, - const NR_UE_DL_BWP_t *DL_BWP, +uint16_t nr_dci_size(const NR_UE_DL_BWP_t *DL_BWP, const NR_UE_UL_BWP_t *UL_BWP, const NR_CellGroupConfig_t *cg, dci_pdu_rel15_t *dci_pdu, @@ -3284,26 +3267,10 @@ uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDownlinkBWP, long rbg_size_config; int num_entries = 0; - NR_UplinkConfig_t *uplinkConfig = NULL; - if (cg && cg->spCellConfig && cg->spCellConfig->spCellConfigDedicated) { - uplinkConfig = cg->spCellConfig->spCellConfigDedicated->uplinkConfig; - } - - const NR_BWP_UplinkDedicated_t *ubwpd = NULL; NR_PDSCH_Config_t *pdsch_Config = DL_BWP ? DL_BWP->pdsch_Config : NULL; NR_PUSCH_Config_t *pusch_Config = UL_BWP ? UL_BWP->pusch_Config : NULL; - NR_PUCCH_Config_t *pucch_Config = NULL; - NR_SRS_Config_t *srs_config = NULL; - if(bwp_id > 0) { - AssertFatal(cg!=NULL,"Cellgroup is null and bwp_id!=0"); - ubwpd = uplinkConfig ? uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_id-1]->bwp_Dedicated : NULL; - pucch_Config = (ubwpd->pucch_Config) ? ubwpd->pucch_Config->choice.setup : NULL; - srs_config = (ubwpd->srs_Config) ? ubwpd->srs_Config->choice.setup : NULL; - } else if (cg) { - ubwpd = uplinkConfig ? uplinkConfig->initialUplinkBWP : NULL; - pucch_Config = (ubwpd && ubwpd->pucch_Config) ? ubwpd->pucch_Config->choice.setup : NULL; - srs_config = (ubwpd && ubwpd->srs_Config) ? ubwpd->srs_Config->choice.setup: NULL; - } + NR_PUCCH_Config_t *pucch_Config = UL_BWP ? UL_BWP->pucch_Config : NULL; + NR_SRS_Config_t *srs_config = UL_BWP ? UL_BWP->srs_Config : NULL; uint16_t N_RB = cset0_bwp_size; if (DL_BWP) @@ -3315,7 +3282,6 @@ uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDownlinkBWP, UL_BWP->initial_BWPSize, DL_BWP->initial_BWPSize); - int n_ul_bwp = 1,n_dl_bwp = 1; switch(format) { case NR_UL_DCI_FORMAT_0_0: /// fixed: Format identifier 1, Hop flag 1, MCS 5, NDI 1, RV 2, HARQ PID 4, PUSCH TPC 2 Time Domain assgnmt 4 --20 @@ -3345,12 +3311,8 @@ uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDownlinkBWP, size += dci_pdu->ul_sul_indicator.nbits; } // BWP Indicator - n_ul_bwp = 0; - if (cg->spCellConfig->spCellConfigDedicated->uplinkConfig && - cg->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList) - n_ul_bwp = cg->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count; - if (n_ul_bwp < 2) - dci_pdu->bwp_indicator.nbits = n_ul_bwp; + if (UL_BWP->n_ul_bwp < 2) + dci_pdu->bwp_indicator.nbits = UL_BWP->n_ul_bwp; else dci_pdu->bwp_indicator.nbits = 2; size += dci_pdu->bwp_indicator.nbits; @@ -3389,21 +3351,19 @@ uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDownlinkBWP, size += 1; } // 1st DAI - if (cg->physicalCellGroupConfig && cg->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook == NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic) + if (DL_BWP->pdsch_HARQ_ACK_Codebook && *DL_BWP->pdsch_HARQ_ACK_Codebook == NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic) dci_pdu->dai[0].nbits = 2; else dci_pdu->dai[0].nbits = 1; size += dci_pdu->dai[0].nbits; LOG_D(NR_MAC, "DAI1 nbits %d\n", dci_pdu->dai[0].nbits); // 2nd DAI - if (cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig && cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup - && cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission != NULL) { // TODO not sure about that + if (DL_BWP->pdsch_servingcellconfig && DL_BWP->pdsch_servingcellconfig->codeBlockGroupTransmission != NULL) { // TODO not sure about that dci_pdu->dai[1].nbits = 2; size += dci_pdu->dai[1].nbits; } // SRS resource indicator - NR_PUSCH_ServingCellConfig_t *pusch_servingcellconfig = uplinkConfig && uplinkConfig->pusch_ServingCellConfig ? uplinkConfig->pusch_ServingCellConfig->choice.setup : NULL; - dci_pdu->srs_resource_indicator.nbits = compute_srs_resource_indicator(pusch_servingcellconfig, pusch_Config, srs_config, NULL, NULL); + dci_pdu->srs_resource_indicator.nbits = compute_srs_resource_indicator(UL_BWP->pusch_servingcellconfig, pusch_Config, srs_config, NULL, NULL); size += dci_pdu->srs_resource_indicator.nbits; LOG_D(NR_MAC, "dci_pdu->srs_resource_indicator.nbits %d\n", dci_pdu->srs_resource_indicator.nbits); // Precoding info and number of layers @@ -3411,7 +3371,7 @@ uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDownlinkBWP, size += dci_pdu->precoding_information.nbits; LOG_D(NR_MAC, "dci_pdu->precoding_informaiton.nbits=%d\n", dci_pdu->precoding_information.nbits); // Antenna ports - long transformPrecoder = get_transformPrecoding(initialUplinkBWP, pusch_Config, ubwpd, (uint8_t *)&format, rnti_type, 0); + long transformPrecoder = get_transformPrecoding(UL_BWP, format, 0); NR_DMRS_UplinkConfig_t *NR_DMRS_UplinkConfig = NULL; int xa = 0; int xb = 0; @@ -3437,16 +3397,16 @@ uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDownlinkBWP, dci_pdu->srs_request.nbits = 3; size += dci_pdu->srs_request.nbits; // CSI request - if (cg->spCellConfig->spCellConfigDedicated->csi_MeasConfig != NULL) { - if (cg->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup->reportTriggerSize != NULL) { - dci_pdu->csi_request.nbits = *cg->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup->reportTriggerSize; + if (UL_BWP->csi_MeasConfig != NULL) { + if (UL_BWP->csi_MeasConfig->reportTriggerSize != NULL) { + dci_pdu->csi_request.nbits = *UL_BWP->csi_MeasConfig->reportTriggerSize; size += dci_pdu->csi_request.nbits; } } // CBGTI - if (cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig && - cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->codeBlockGroupTransmission != NULL) { - int num = cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock; + if (UL_BWP->pusch_servingcellconfig && + UL_BWP->pusch_servingcellconfig->codeBlockGroupTransmission != NULL) { + int num = UL_BWP->pusch_servingcellconfig->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock; dci_pdu->cbgti.nbits = 2 + (num<<1); size += dci_pdu->cbgti.nbits; } @@ -3503,11 +3463,8 @@ uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDownlinkBWP, } // BWP Indicator - n_dl_bwp = 0; - if (cg->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList) - n_dl_bwp = cg->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count; - if (n_dl_bwp < 2) - dci_pdu->bwp_indicator.nbits = n_dl_bwp; + if (DL_BWP->n_dl_bwp < 2) + dci_pdu->bwp_indicator.nbits = DL_BWP->n_dl_bwp; else dci_pdu->bwp_indicator.nbits = 2; size += dci_pdu->bwp_indicator.nbits; @@ -3570,8 +3527,7 @@ uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDownlinkBWP, // HARQ PID size += 4; // DAI - if (cg->physicalCellGroupConfig && - cg->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook == NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic) { // FIXME in case of more than one serving cell + if (DL_BWP->pdsch_HARQ_ACK_Codebook && *DL_BWP->pdsch_HARQ_ACK_Codebook == NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic) { // FIXME in case of more than one serving cell dci_pdu->dai[0].nbits = 2; size += dci_pdu->dai[0].nbits; } @@ -3604,16 +3560,15 @@ uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDownlinkBWP, dci_pdu->srs_request.nbits = 3; size += dci_pdu->srs_request.nbits; // CBGTI - if (cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig && - cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup && - cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission != NULL) { - uint8_t maxCBGperTB = (cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock + 1) * 2; + if (DL_BWP->pdsch_servingcellconfig && + DL_BWP->pdsch_servingcellconfig->codeBlockGroupTransmission != NULL) { + uint8_t maxCBGperTB = (DL_BWP->pdsch_servingcellconfig->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock + 1) * 2; long *maxCWperDCI_rrc = pdsch_Config->maxNrofCodeWordsScheduledByDCI; uint8_t maxCW = (maxCWperDCI_rrc == NULL) ? 1 : *maxCWperDCI_rrc; dci_pdu->cbgti.nbits = maxCBGperTB * maxCW; size += dci_pdu->cbgti.nbits; // CBGFI - if (cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator) { + if (DL_BWP->pdsch_servingcellconfig->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator) { dci_pdu->cbgfi.nbits = 1; size += dci_pdu->cbgfi.nbits; } diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index a41467b3fc..dd957ed39e 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -99,9 +99,7 @@ NR_ul_tda_info_t get_ul_tda_info(NR_PUSCH_TimeDomainResourceAllocationList_t *td int scs, int normal_CP); -uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDownlinkBWP, - const NR_BWP_UplinkCommon_t *initialUplinkBWP, - const NR_UE_DL_BWP_t *DL_BWP, +uint16_t nr_dci_size(const NR_UE_DL_BWP_t *DL_BWP, const NR_UE_UL_BWP_t *UL_BWP, const NR_CellGroupConfig_t *cg, dci_pdu_rel15_t *dci_pdu, @@ -283,11 +281,8 @@ bool set_ul_ptrs_values(NR_PTRS_UplinkConfig_t *ul_ptrs_config, @param rnti_type rnti type @param configuredGrant indicates whether a configured grant was received or not @returns transformPrecoding value */ -uint8_t get_transformPrecoding(const NR_BWP_UplinkCommon_t *initialUplinkBWP, - const NR_PUSCH_Config_t *pusch_config, - const NR_BWP_UplinkDedicated_t *ubwp, - uint8_t *dci_format, - int rnti_type, +uint8_t get_transformPrecoding(const NR_UE_UL_BWP_t *current_UL_BWP, + nr_dci_format_t dci_format, uint8_t configuredGrant); void nr_mac_gNB_rrc_ul_failure(const module_id_t Mod_instP, diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 108948adb1..950c0c6d5f 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -549,6 +549,8 @@ void configure_current_BWP(NR_UE_MAC_INST_t *mac, NR_BWP_t ul_genericParameters = {0}; NR_BWP_DownlinkCommon_t *bwp_dlcommon = NULL; NR_BWP_UplinkCommon_t *bwp_ulcommon = NULL; + DL_BWP->n_dl_bwp = 1; + UL_BWP->n_ul_bwp = 1; if(scc) { DL_BWP->bwp_id = 0; @@ -564,14 +566,30 @@ void configure_current_BWP(NR_UE_MAC_INST_t *mac, DL_BWP->pdsch_Config = NULL; if(bwp_dlcommon->pdsch_ConfigCommon) DL_BWP->tdaList = bwp_dlcommon->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; - if(bwp_ulcommon->pusch_ConfigCommon) + if(bwp_ulcommon->pusch_ConfigCommon) { UL_BWP->tdaList = bwp_ulcommon->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; + UL_BWP->msg3_DeltaPreamble = bwp_ulcommon->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble; + } + if(bwp_ulcommon->pucch_ConfigCommon) + UL_BWP->pucch_ConfigCommon = bwp_ulcommon->pucch_ConfigCommon->choice.setup; + if(bwp_ulcommon->rach_ConfigCommon) + UL_BWP->rach_ConfigCommon = bwp_ulcommon->rach_ConfigCommon->choice.setup; } if(cell_group_config) { + if (cell_group_config->physicalCellGroupConfig) { + DL_BWP->pdsch_HARQ_ACK_Codebook = &cell_group_config->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook; + UL_BWP->harq_ACK_SpatialBundlingPUCCH = cell_group_config->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUCCH; + } if (cell_group_config->spCellConfig && cell_group_config->spCellConfig->spCellConfigDedicated) { + struct NR_ServingCellConfig *spCellConfigDedicated = cell_group_config->spCellConfig->spCellConfigDedicated; + UL_BWP->csi_MeasConfig = spCellConfigDedicated->csi_MeasConfig ? spCellConfigDedicated->csi_MeasConfig->choice.setup : NULL; + UL_BWP->pusch_servingcellconfig = spCellConfigDedicated->uplinkConfig && spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig ? + spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup : NULL; + DL_BWP->pdsch_servingcellconfig = spCellConfigDedicated->pdsch_ServingCellConfig ? spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup : NULL; + if (spCellConfigDedicated->firstActiveDownlinkBWP_Id) DL_BWP->bwp_id = *spCellConfigDedicated->firstActiveDownlinkBWP_Id; if (spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id) @@ -587,6 +605,8 @@ void configure_current_BWP(NR_UE_MAC_INST_t *mac, } NR_BWP_Downlink_t *bwp_downlink = NULL; const struct NR_ServingCellConfig__downlinkBWP_ToAddModList *bwpList = spCellConfigDedicated->downlinkBWP_ToAddModList; + if(bwpList) + DL_BWP->n_dl_bwp = bwpList->list.count; if (bwpList && DL_BWP->bwp_id > 0) { for (int i = 0; i < bwpList->list.count; i++) { bwp_downlink = bwpList->list.array[i]; @@ -603,9 +623,12 @@ void configure_current_BWP(NR_UE_MAC_INST_t *mac, } DL_BWP->tdaList = bwp_dlcommon->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; UL_BWP->tdaList = bwp_ulcommon->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; + UL_BWP->msg3_DeltaPreamble = bwp_ulcommon->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble; NR_BWP_Uplink_t *bwp_uplink = NULL; const struct NR_UplinkConfig__uplinkBWP_ToAddModList *ubwpList = spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList; + if (ubwpList) + UL_BWP->n_ul_bwp = ubwpList->list.count; if (ubwpList && UL_BWP->bwp_id > 0) { for (int i = 0; i < ubwpList->list.count; i++) { bwp_uplink = ubwpList->list.array[i]; @@ -615,10 +638,23 @@ void configure_current_BWP(NR_UE_MAC_INST_t *mac, AssertFatal(bwp_uplink != NULL,"Couldn't find ULBWP corresponding to BWP ID %ld\n",UL_BWP->bwp_id); ul_genericParameters = bwp_uplink->bwp_Common->genericParameters; UL_BWP->pusch_Config = bwp_uplink->bwp_Dedicated->pusch_Config->choice.setup; + UL_BWP->pucch_Config = bwp_uplink->bwp_Dedicated->pucch_Config->choice.setup; + UL_BWP->srs_Config = bwp_uplink->bwp_Dedicated->srs_Config->choice.setup; + UL_BWP->configuredGrantConfig = bwp_uplink->bwp_Dedicated->configuredGrantConfig ? bwp_uplink->bwp_Dedicated->configuredGrantConfig->choice.setup : NULL; + if(bwp_uplink->bwp_Common->pucch_ConfigCommon) + UL_BWP->pucch_ConfigCommon = bwp_uplink->bwp_Common->pucch_ConfigCommon->choice.setup; + if(bwp_uplink->bwp_Common->rach_ConfigCommon) + UL_BWP->rach_ConfigCommon = bwp_uplink->bwp_Common->rach_ConfigCommon->choice.setup; } else { UL_BWP->pusch_Config = spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pusch_Config->choice.setup; + UL_BWP->pucch_Config = spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup; + UL_BWP->srs_Config = spCellConfigDedicated->uplinkConfig->initialUplinkBWP->srs_Config->choice.setup; + UL_BWP->configuredGrantConfig = spCellConfigDedicated->uplinkConfig->initialUplinkBWP->configuredGrantConfig ? + spCellConfigDedicated->uplinkConfig->initialUplinkBWP->configuredGrantConfig->choice.setup : NULL; ul_genericParameters = bwp_ulcommon->genericParameters; + if(bwp_ulcommon->rach_ConfigCommon) + UL_BWP->rach_ConfigCommon = bwp_ulcommon->rach_ConfigCommon->choice.setup; } } else diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index deb2ceb217..b20da8bf81 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -251,14 +251,6 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl_config, frame_t frame, int slot); -void get_bwp_info(NR_UE_MAC_INST_t *mac, - int dl_bwp_id, - int ul_bwp_id, - NR_BWP_DownlinkDedicated_t **bwpd, - NR_BWP_DownlinkCommon_t **bwpc, - NR_BWP_UplinkDedicated_t **ubwpd, - NR_BWP_UplinkCommon_t **ubwpc); - NR_BWP_DownlinkCommon_t *get_bwp_downlink_common(NR_UE_MAC_INST_t *mac, NR_BWP_Id_t dl_bwp_id); int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index e4bbb546d8..da3a4777ed 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -138,7 +138,8 @@ void init_RA(module_id_t mod_id, NR_PRACH_RESOURCES_t *prach_resources, NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon, NR_RACH_ConfigGeneric_t *rach_ConfigGeneric, - NR_RACH_ConfigDedicated_t *rach_ConfigDedicated) { + NR_RACH_ConfigDedicated_t *rach_ConfigDedicated) +{ NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); @@ -280,14 +281,13 @@ void init_RA(module_id_t mod_id, /* TS 38.321 subclause 7.3 - return DELTA_PREAMBLE values in dB */ -int8_t nr_get_DELTA_PREAMBLE(module_id_t mod_id, int CC_id, uint16_t prach_format){ +int8_t nr_get_DELTA_PREAMBLE(module_id_t mod_id, int CC_id, uint16_t prach_format) +{ NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); - NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = (mac->scc!=NULL) ? - mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup: - mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup; + NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = mac->current_UL_BWP.rach_ConfigCommon; NR_SubcarrierSpacing_t scs = *nr_rach_ConfigCommon->msg1_SubcarrierSpacing; - int prach_sequence_length = (mac->scc!=NULL)?(mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present - 1) : (mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present-1); + int prach_sequence_length = nr_rach_ConfigCommon->prach_RootSequenceIndex.present - 1; uint8_t prachConfigIndex, mu; AssertFatal(CC_id == 0, "Transmission on secondary CCs is not supported yet\n"); @@ -385,13 +385,14 @@ int8_t nr_get_DELTA_PREAMBLE(module_id_t mod_id, int CC_id, uint16_t prach_forma // - RA_PREAMBLE_POWER_RAMPING_STEP dB // - POWER_OFFSET_2STEP_RA dB // returns receivedTargerPower in dBm -int nr_get_Po_NOMINAL_PUSCH(NR_PRACH_RESOURCES_t *prach_resources, module_id_t mod_id, uint8_t CC_id){ +int nr_get_Po_NOMINAL_PUSCH(NR_PRACH_RESOURCES_t *prach_resources, module_id_t mod_id, uint8_t CC_id) +{ NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); int8_t receivedTargerPower; int8_t delta_preamble; - NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = (mac->scc != NULL) ? mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup: mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup; + NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = mac->current_UL_BWP.rach_ConfigCommon; long preambleReceivedTargetPower = nr_rach_ConfigCommon->rach_ConfigGeneric.preambleReceivedTargetPower; delta_preamble = nr_get_DELTA_PREAMBLE(mod_id, CC_id, prach_resources->prach_format); @@ -402,7 +403,8 @@ int nr_get_Po_NOMINAL_PUSCH(NR_PRACH_RESOURCES_t *prach_resources, module_id_t m return receivedTargerPower; } -void ssb_rach_config(RA_config_t *ra, NR_PRACH_RESOURCES_t *prach_resources, NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon){ +void ssb_rach_config(RA_config_t *ra, NR_PRACH_RESOURCES_t *prach_resources, NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon) +{ // Determine the SSB to RACH mapping ratio // ======================================= @@ -489,14 +491,11 @@ void ra_preambles_config(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t unsigned short int *seed = (unsigned short int*)&tmp; RA_config_t *ra = &mac->ra; - NR_RACH_ConfigCommon_t *setup; - if (mac->scc) setup = mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; - else setup = mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup; + NR_RACH_ConfigCommon_t *setup = mac->current_UL_BWP.rach_ConfigCommon; NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric; - NR_BWP_UplinkCommon_t *initialUplinkBWP = (mac->scc) ? mac->scc->uplinkConfigCommon->initialUplinkBWP : &mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP; - if (initialUplinkBWP->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble){ - deltaPreamble_Msg3 = (*initialUplinkBWP->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble) * 2; // dB + if (mac->current_UL_BWP.msg3_DeltaPreamble){ + deltaPreamble_Msg3 = (*mac->current_UL_BWP.msg3_DeltaPreamble) * 2; // dB LOG_D(MAC, "In %s: deltaPreamble_Msg3 set to %ld\n", __FUNCTION__, deltaPreamble_Msg3); } @@ -661,9 +660,7 @@ void nr_get_prach_resources(module_id_t mod_id, NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); RA_config_t *ra = &mac->ra; - NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = (mac->scc)? - mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup : - mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup; + NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = mac->current_UL_BWP.rach_ConfigCommon; LOG_D(MAC, "In %s: getting PRACH resources frame (first_Msg3 %d)\n", __FUNCTION__, ra->first_Msg3); @@ -701,12 +698,8 @@ void nr_Msg3_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, slot NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); RA_config_t *ra = &mac->ra; - NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = (mac->scc) ? - mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup: - mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup; - long mu = (mac->scc) ? - mac->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing : - mac->scc_SIB->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = mac->current_UL_BWP.rach_ConfigCommon; + long mu = mac->current_UL_BWP.scs; int subframes_per_slot = nr_slots_per_frame[mu]/10; // start contention resolution timer (cnt in slots) @@ -934,9 +927,7 @@ void nr_get_RA_window(NR_UE_MAC_INST_t *mac){ uint8_t mu, ra_ResponseWindow; RA_config_t *ra = &mac->ra; - NR_RACH_ConfigCommon_t *setup; - if (mac->scc) setup = mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; - else setup = mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup; + NR_RACH_ConfigCommon_t *setup = mac->current_UL_BWP.rach_ConfigCommon; AssertFatal(&setup->rach_ConfigGeneric != NULL, "In %s: FATAL! rach_ConfigGeneric is NULL...\n", __FUNCTION__); NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric; long scs = (mac->scc) ? 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 04b7d36e5e..ff8a2de982 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c @@ -93,20 +93,9 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t uint16_t monitoringSymbolsWithinSlot = 0; int sps = 0; - AssertFatal(mac->scc == NULL || mac->scc_SIB == NULL, "both scc and scc_SIB cannot be non-null\n"); - NR_UE_DL_BWP_t *current_DL_BWP = &mac->current_DL_BWP; NR_UE_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP; NR_BWP_Id_t dl_bwp_id = current_DL_BWP ? current_DL_BWP->bwp_id : 0; - NR_ServingCellConfigCommon_t *scc = mac->scc; - NR_ServingCellConfigCommonSIB_t *scc_SIB = mac->scc_SIB; - NR_BWP_DownlinkCommon_t *initialDownlinkBWP=NULL; - NR_BWP_UplinkCommon_t *initialUplinkBWP=NULL; - - if (scc!=NULL || scc_SIB != NULL) { - initialDownlinkBWP = scc!=NULL ? scc->downlinkConfigCommon->initialDownlinkBWP : &scc_SIB->downlinkConfigCommon.initialDownlinkBWP; - initialUplinkBWP = scc!=NULL ? scc->uplinkConfigCommon->initialUplinkBWP : &scc_SIB->uplinkConfigCommon->initialUplinkBWP; - } NR_SearchSpace_t *ss; NR_ControlResourceSet_t *coreset; @@ -173,21 +162,18 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t // computing alternative size for padding dci_pdu_rel15_t temp_pdu; if(dci_format == NR_DL_DCI_FORMAT_1_0) - alt_size = nr_dci_size(initialDownlinkBWP,initialUplinkBWP, - current_DL_BWP, current_UL_BWP, + alt_size = nr_dci_size(current_DL_BWP, current_UL_BWP, mac->cg, &temp_pdu, NR_UL_DCI_FORMAT_0_0, rnti_type, coreset, dl_bwp_id, ss->searchSpaceType->present, mac->type0_PDCCH_CSS_config.num_rbs, 0); if(dci_format == NR_UL_DCI_FORMAT_0_0) - alt_size = nr_dci_size(initialDownlinkBWP,initialUplinkBWP, - current_DL_BWP, current_UL_BWP, + alt_size = nr_dci_size(current_DL_BWP, current_UL_BWP, mac->cg, &temp_pdu, NR_DL_DCI_FORMAT_1_0, rnti_type, coreset, dl_bwp_id, ss->searchSpaceType->present, mac->type0_PDCCH_CSS_config.num_rbs, 0); } - rel15->dci_length_options[i] = nr_dci_size(initialDownlinkBWP,initialUplinkBWP, - current_DL_BWP, current_UL_BWP, + rel15->dci_length_options[i] = nr_dci_size(current_DL_BWP, current_UL_BWP, mac->cg, &mac->def_dci_pdu_rel15[dci_format], dci_format, NR_RNTI_TC, coreset, dl_bwp_id, ss->searchSpaceType->present, mac->type0_PDCCH_CSS_config.num_rbs, alt_size); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index d74767f860..09ee7c6cb5 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -180,51 +180,6 @@ void nr_ue_init_mac(module_id_t module_idP) { } } -void get_bwp_info(NR_UE_MAC_INST_t *mac, - int dl_bwp_id, - int ul_bwp_id, - NR_BWP_DownlinkDedicated_t **bwpd, - NR_BWP_DownlinkCommon_t **bwpc, - NR_BWP_UplinkDedicated_t **ubwpd, - NR_BWP_UplinkCommon_t **ubwpc) { - - if (dl_bwp_id > 0) { - AssertFatal(mac->DLbwp[dl_bwp_id-1]!=NULL,"mac->DLbwp[%d] is null, shouldn't be\n", (int)dl_bwp_id-1); - *bwpd = mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated; - } else { - if (mac->cg && - mac->cg->spCellConfig && - mac->cg->spCellConfig->spCellConfigDedicated && - mac->cg->spCellConfig->spCellConfigDedicated->initialDownlinkBWP) - *bwpd = mac->cg->spCellConfig->spCellConfigDedicated->initialDownlinkBWP; - } - - *bwpc = get_bwp_downlink_common(mac, dl_bwp_id); - AssertFatal(*bwpc!=NULL,"bwpc shouldn't be null\n"); - - if (ul_bwp_id > 0) { - AssertFatal(mac->ULbwp[ul_bwp_id-1]!=NULL,"mac->ULbwp[%d] is null, shouldn't be\n", - ul_bwp_id-1); - *ubwpd = mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated; - if (mac->ULbwp[ul_bwp_id-1]->bwp_Common) *ubwpc = mac->ULbwp[ul_bwp_id-1]->bwp_Common; - else if (mac->scc) *ubwpc = mac->scc->uplinkConfigCommon->initialUplinkBWP; - else if (mac->scc_SIB) *ubwpc = &mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP; - AssertFatal(*bwpc!=NULL,"bwpc shouldn't be null\n"); - - } - else { - if (mac->cg && - mac->cg->spCellConfig && - mac->cg->spCellConfig->spCellConfigDedicated && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP) - *ubwpd = mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP; - if (mac->scc) *ubwpc = mac->scc->uplinkConfigCommon->initialUplinkBWP; - else if (mac->scc_SIB) *ubwpc = &mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP; - AssertFatal(*ubwpc!=NULL,"ubwpc shouldn't be null\n"); - } -} - NR_BWP_DownlinkCommon_t *get_bwp_downlink_common(NR_UE_MAC_INST_t *mac, NR_BWP_Id_t dl_bwp_id) { NR_BWP_DownlinkCommon_t *bwp_Common = NULL; if (dl_bwp_id > 0 && mac->cg->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList) { @@ -546,7 +501,6 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr uint8_t is_Msg3 = 0; NR_UE_DL_BWP_t *current_DL_BWP = &mac->current_DL_BWP; NR_UE_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP; - NR_BWP_Id_t ul_bwp_id = current_UL_BWP->bwp_id; int default_abc = 1; LOG_D(MAC, "In %s: Processing received DCI format %s\n", __FUNCTION__, dci_formats[dci_format]); @@ -554,6 +508,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = NULL; int normal_CP = current_UL_BWP->cyclicprefix ? 0 : 1; NR_ul_tda_info_t tda_info = {0}; + NR_PUCCH_Config_t *pucch_Config = current_UL_BWP->pucch_Config; switch(dci_format){ case NR_UL_DCI_FORMAT_0_0: { @@ -755,9 +710,9 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr } else { dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH; } - if( (ra->RA_window_cnt >= 0 && rnti == ra->ra_rnti) || (rnti == ra->t_crnti) ) { + if((ra->RA_window_cnt >= 0 && rnti == ra->ra_rnti) || (rnti == ra->t_crnti)) { if (mac->scc == NULL) // use coreset0 - is_common=1; + is_common = 1; } } @@ -869,35 +824,15 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr if (dci->tpc == 3) dlsch_config_pdu_1_0->accumulated_delta_PUCCH = 3; // Sanity check for pucch_resource_indicator value received to check for false DCI. valid = 0; - if (ul_bwp_id > 0 && - 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(pucch_Config && + pucch_Config->resourceSetToAddModList) { + pucch_res_set_cnt = pucch_Config->resourceSetToAddModList->list.count; for (int id = 0; id < pucch_res_set_cnt; id++) { - if (dci->pucch_resource_indicator < mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[id]->resourceList.list.count) { + if (dci->pucch_resource_indicator < pucch_Config->resourceSetToAddModList->list.array[id]->resourceList.list.count) { valid = 1; break; } } - } - else if (mac->cg && - mac->cg->spCellConfig && - mac->cg->spCellConfig->spCellConfigDedicated && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup->resourceSetToAddModList){ - pucch_res_set_cnt = mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup->resourceSetToAddModList->list.count; - for (int id = 0; id < pucch_res_set_cnt; id++) { - if (dci->pucch_resource_indicator < mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup->resourceSetToAddModList->list.array[id]->resourceList.list.count) { - valid = 1; - break; - } - } } else valid=1; if (!valid) { LOG_W(MAC, "[%d.%d] pucch_resource_indicator value %d is out of bounds. Possibly due to false DCI. Ignoring DCI!\n", frame, slot, dci->pucch_resource_indicator); @@ -982,14 +917,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr LOG_W(NR_MAC,"[%d.%d] bwp_indicator %d > NR_MAX_NUM_BWP Possibly due to false DCI. Ignoring DCI!\n", frame, slot,dci->bwp_indicator.val); return -1; } - NR_BWP_Id_t dl_bwp_id = current_DL_BWP->bwp_id; - NR_BWP_Id_t ul_bwp_id = current_UL_BWP->bwp_id; NR_PDSCH_Config_t *pdsch_Config = current_DL_BWP->pdsch_Config; - NR_BWP_DownlinkDedicated_t *bwpd=NULL; - NR_BWP_DownlinkCommon_t *bwpc=NULL; - NR_BWP_UplinkDedicated_t *ubwpd=NULL; - NR_BWP_UplinkCommon_t *ubwpc=NULL; - get_bwp_info(mac,dl_bwp_id,ul_bwp_id,&bwpd,&bwpc,&ubwpd,&ubwpc); 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; @@ -1092,9 +1020,9 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr // Sanity check for pucch_resource_indicator value received to check for false DCI. valid = 0; - pucch_res_set_cnt = ubwpd->pucch_Config->choice.setup->resourceSetToAddModList->list.count; + pucch_res_set_cnt = pucch_Config->resourceSetToAddModList->list.count; for (int id = 0; id < pucch_res_set_cnt; id++) { - if (dci->pucch_resource_indicator < ubwpd->pucch_Config->choice.setup->resourceSetToAddModList->list.array[id]->resourceList.list.count) { + if (dci->pucch_resource_indicator < pucch_Config->resourceSetToAddModList->list.array[id]->resourceList.list.count) { valid = 1; break; } @@ -1230,8 +1158,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr /* PDSCH_TO_HARQ_FEEDBACK_TIME_IND */ // according to TS 38.213 Table 9.2.3-1 - uint8_t feedback_ti = - ubwpd->pucch_Config->choice.setup->dl_DataToUL_ACK->list.array[dci->pdsch_to_harq_feedback_timing_indicator.val][0]; + uint8_t feedback_ti = pucch_Config->dl_DataToUL_ACK->list.array[dci->pdsch_to_harq_feedback_timing_indicator.val][0]; AssertFatal(feedback_ti>=DURATION_RX_TO_TX,"PDSCH to HARQ feedback time (%d) cannot be less than DURATION_RX_TO_TX (%d). Min feedback time set in config file (min_rxtxtime).\n", feedback_ti,DURATION_RX_TO_TX); @@ -1272,7 +1199,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr nb_rb_oh, 0, Nl); // TBS_LBRM according to section 5.4.2.1 of 38.212 - long *maxMIMO_Layers = mac->cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers; + long *maxMIMO_Layers = current_DL_BWP->pdsch_servingcellconfig->ext1->maxMIMO_Layers; AssertFatal (maxMIMO_Layers != NULL,"Option with max MIMO layers not configured is not supported\n"); int nl_tbslbrm = *maxMIMO_Layers < 4 ? *maxMIMO_Layers : 4; int bw_tbslbrm = get_dlbw_tbslbrm(current_DL_BWP->initial_BWPSize, mac->cg); @@ -1376,7 +1303,7 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac, int O_CRC = 0; //FIXME uint16_t O_uci = O_CSI + O_ACK; NR_UE_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP; - NR_BWP_Id_t bwp_id = current_UL_BWP->bwp_id; + NR_UE_DL_BWP_t *current_DL_BWP = &mac->current_DL_BWP; NR_PUCCH_FormatConfig_t *pucchfmt; long *pusch_id = NULL; long *id0 = NULL; @@ -1392,10 +1319,10 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac, // only for ack/nack if (pucch->initial_pucch_id > -1 && pucch->pucch_resource == NULL) { - - pucch_pdu->format_type = initial_pucch_resource[pucch->initial_pucch_id].format; - pucch_pdu->start_symbol_index = initial_pucch_resource[pucch->initial_pucch_id].startingSymbolIndex; - pucch_pdu->nr_of_symbols = initial_pucch_resource[pucch->initial_pucch_id].nrofSymbols; + int pucch_resourcecommon = *current_UL_BWP->pucch_ConfigCommon->pucch_ResourceCommon; + pucch_pdu->format_type = initial_pucch_resource[pucch_resourcecommon].format; + pucch_pdu->start_symbol_index = initial_pucch_resource[pucch_resourcecommon].startingSymbolIndex; + pucch_pdu->nr_of_symbols = initial_pucch_resource[pucch_resourcecommon].nrofSymbols; pucch_pdu->bwp_size = current_UL_BWP->BWPSize; pucch_pdu->bwp_start = current_UL_BWP->BWPStart; @@ -1403,19 +1330,21 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac, pucch_pdu->prb_size = 1; // format 0 or 1 int RB_BWP_offset; if (pucch->initial_pucch_id == 15) - RB_BWP_offset = pucch_pdu->bwp_size>>2; + RB_BWP_offset = pucch_pdu->bwp_size >> 2; else - RB_BWP_offset = initial_pucch_resource[pucch->initial_pucch_id].PRB_offset; + RB_BWP_offset = initial_pucch_resource[pucch_resourcecommon].PRB_offset; - int N_CS = initial_pucch_resource[pucch->initial_pucch_id].nb_CS_indexes; - pucch_pdu->prb_start = RB_BWP_offset + (pucch->initial_pucch_id/N_CS); - if (pucch->initial_pucch_id>>3 == 0) { - pucch_pdu->second_hop_prb = pucch_pdu->bwp_size - 1 - RB_BWP_offset - (pucch->initial_pucch_id/N_CS); - pucch_pdu->initial_cyclic_shift = initial_pucch_resource[pucch->initial_pucch_id].initial_CS_indexes[pucch->initial_pucch_id%N_CS]; + int N_CS = initial_pucch_resource[pucch_resourcecommon].nb_CS_indexes; + + if (pucch->initial_pucch_id >> 3 == 0) { + pucch_pdu->prb_start = RB_BWP_offset + (pucch->initial_pucch_id / N_CS); + pucch_pdu->second_hop_prb = pucch_pdu->bwp_size - 1 - RB_BWP_offset - (pucch->initial_pucch_id / N_CS); + pucch_pdu->initial_cyclic_shift = initial_pucch_resource[pucch_resourcecommon].initial_CS_indexes[pucch->initial_pucch_id % N_CS]; } else { - pucch_pdu->second_hop_prb = pucch_pdu->bwp_size - 1 - RB_BWP_offset - ((pucch->initial_pucch_id - 8)/N_CS); - pucch_pdu->initial_cyclic_shift = initial_pucch_resource[pucch->initial_pucch_id].initial_CS_indexes[(pucch->initial_pucch_id - 8)%N_CS]; + pucch_pdu->prb_start = pucch_pdu->bwp_size - 1 - RB_BWP_offset - ((pucch->initial_pucch_id - 8) / N_CS); + pucch_pdu->second_hop_prb = RB_BWP_offset + ((pucch->initial_pucch_id - 8) / N_CS); + pucch_pdu->initial_cyclic_shift = initial_pucch_resource[pucch_resourcecommon].initial_CS_indexes[(pucch->initial_pucch_id - 8) % N_CS]; } pucch_pdu->freq_hop_flag = 1; pucch_pdu->time_domain_occ_idx = 0; @@ -1431,19 +1360,14 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac, NR_PUCCH_Resource_t *pucchres = pucch->pucch_resource; - if (mac->cg && - mac->cg->physicalCellGroupConfig && - (mac->cg->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUCCH != NULL || - mac->cg->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook != 1)) { + if (current_UL_BWP->harq_ACK_SpatialBundlingPUCCH != NULL || + *current_DL_BWP->pdsch_HARQ_ACK_Codebook != 1) { LOG_E(MAC,"PUCCH Unsupported cell group configuration\n"); return; } - else if (mac->cg && - mac->cg->spCellConfig && - mac->cg->spCellConfig->spCellConfigDedicated && - mac->cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig && - mac->cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup && - mac->cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission != NULL) { + else if (current_DL_BWP && + current_DL_BWP->pdsch_servingcellconfig && + current_DL_BWP->pdsch_servingcellconfig->codeBlockGroupTransmission != NULL) { LOG_E(MAC,"PUCCH Unsupported code block group for serving cell config\n"); return; } @@ -1457,25 +1381,8 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac, id0 = pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->transformPrecodingDisabled->scramblingID0; } - 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; - } - else if (bwp_id==0 && - mac->cg && - mac->cg->spCellConfig && - mac->cg->spCellConfig->spCellConfigDedicated && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup) { - pucch_Config = mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup; - } - else AssertFatal(1==0,"no pucch_Config\n"); + NR_PUCCH_Config_t *pucch_Config = current_UL_BWP->pucch_Config; + AssertFatal(pucch_Config,"no pucch_Config\n"); pucch_pdu->bwp_size = current_UL_BWP->BWPSize; pucch_pdu->bwp_start = current_UL_BWP->BWPStart; @@ -1595,14 +1502,8 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac, } else AssertFatal(1==0,"problem with pucch configuration\n"); - NR_PUCCH_ConfigCommon_t *pucch_ConfigCommon; - if (bwp_id>0 && - mac->ULbwp[bwp_id-1] && - mac->ULbwp[bwp_id-1]->bwp_Common && - mac->ULbwp[bwp_id-1]->bwp_Common->pucch_ConfigCommon) - pucch_ConfigCommon = mac->ULbwp[bwp_id-1]->bwp_Common->pucch_ConfigCommon->choice.setup; - else if (mac->scc) pucch_ConfigCommon = mac->scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup; - else pucch_ConfigCommon = mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pucch_ConfigCommon->choice.setup; + NR_PUCCH_ConfigCommon_t *pucch_ConfigCommon = current_UL_BWP->pucch_ConfigCommon; + if (pucch_ConfigCommon->hoppingId != NULL) pucch_pdu->hopping_id = *pucch_ConfigCommon->hoppingId; else @@ -1643,10 +1544,9 @@ int16_t get_pucch_tx_power_ue(NR_UE_MAC_INST_t *mac, int O_ACK, int O_SR, int O_CSI, int O_CRC) { + NR_UE_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP; int PUCCH_POWER_DEFAULT = 0; - int16_t P_O_NOMINAL_PUCCH; - if (mac->scc) P_O_NOMINAL_PUCCH = *mac->scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->p0_nominal; - else P_O_NOMINAL_PUCCH = *mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pucch_ConfigCommon->choice.setup->p0_nominal; + int16_t P_O_NOMINAL_PUCCH = *current_UL_BWP->pucch_ConfigCommon->p0_nominal; struct NR_PUCCH_PowerControl *power_config = pucch_Config->pucch_PowerControl; @@ -1790,7 +1690,7 @@ int get_deltatf(uint16_t nb_of_prbs, int find_pucch_resource_set(NR_UE_MAC_INST_t *mac, int uci_size) { int pucch_resource_set_id = 0; - NR_BWP_Id_t bwp_id = mac->current_DL_BWP.bwp_id; + NR_PUCCH_Config_t *pucch_Config = mac->current_UL_BWP.pucch_Config; //long *pucch_max_pl_bits = NULL; @@ -1803,23 +1703,9 @@ int find_pucch_resource_set(NR_UE_MAC_INST_t *mac, 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) || - (bwp_id==0 && - mac->cg && - mac->cg->spCellConfig && - mac->cg->spCellConfig->spCellConfigDedicated && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config && - 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[pucch_resource_set_id] != NULL)) { + if (pucch_Config && + pucch_Config->resourceSetToAddModList && + pucch_Config->resourceSetToAddModList->list.array[pucch_resource_set_id] != NULL) { // PUCCH with format0 can be up to 3 bits (2 ack/nacks + 1 sr is 3 max bits) if (uci_size <= 3) { pucch_resource_set_id = 0; @@ -1859,32 +1745,16 @@ int find_pucch_resource_set(NR_UE_MAC_INST_t *mac, int uci_size) { *********************************************************************/ void select_pucch_resource(NR_UE_MAC_INST_t *mac, - PUCCH_sched_t *pucch) { + PUCCH_sched_t *pucch) +{ NR_PUCCH_ResourceId_t *current_resource_id = NULL; - NR_BWP_Id_t bwp_id = mac->current_UL_BWP.bwp_id; + NR_PUCCH_Config_t *pucch_Config = mac->current_UL_BWP.pucch_Config; int n_list; - if (pucch->is_common == 1 || - (bwp_id == 0 && - mac->cg == NULL) || - (bwp_id == 0 && - mac->cg && - mac->cg->spCellConfig && - mac->cg->spCellConfig->spCellConfigDedicated && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config && - 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) - ){ + !pucch_Config || + !pucch_Config->resourceSetToAddModList || + pucch_Config->resourceSetToAddModList->list.array[0] == NULL) { /* see TS 38.213 9.2.1 PUCCH Resource Sets */ int delta_PRI = pucch->resource_indicator; @@ -1898,19 +1768,8 @@ void select_pucch_resource(NR_UE_MAC_INST_t *mac, pucch->pucch_resource = NULL; } else { - 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; - } - 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; - } - + struct NR_PUCCH_Config__resourceSetToAddModList *resourceSetToAddModList = pucch_Config->resourceSetToAddModList; + struct NR_PUCCH_Config__resourceToAddModList *resourceToAddModList = pucch_Config->resourceToAddModList; n_list = resourceSetToAddModList->list.count; if (pucch->resource_set_id > n_list) { LOG_E(MAC,"Invalid PUCCH resource set id %d\n",pucch->resource_set_id); @@ -1990,13 +1849,6 @@ uint8_t get_downlink_ack(NR_UE_MAC_INST_t *mac, NR_UE_DL_BWP_t *current_DL_BWP = &mac->current_DL_BWP; NR_UE_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP; - NR_BWP_Id_t dl_bwp_id = current_DL_BWP->bwp_id; - NR_BWP_Id_t ul_bwp_id = current_UL_BWP->bwp_id; - NR_BWP_DownlinkDedicated_t *bwpd=NULL; - NR_BWP_DownlinkCommon_t *bwpc=NULL; - NR_BWP_UplinkDedicated_t *ubwpd=NULL; - NR_BWP_UplinkCommon_t *ubwpc=NULL; - get_bwp_info(mac,dl_bwp_id,ul_bwp_id,&bwpd,&bwpc,&ubwpd,&ubwpc); if (current_DL_BWP && current_DL_BWP->pdsch_Config && @@ -2026,8 +1878,8 @@ uint8_t get_downlink_ack(NR_UE_MAC_INST_t *mac, sched_frame = (sched_frame + 1) % 1024; } AssertFatal(sched_slot < slots_per_frame, "sched_slot was calculated incorrect %d\n", sched_slot); - LOG_D(PHY,"HARQ pid %d is active for %d.%d (dl_slot %d, feedback_to_ul %d, is_common %d\n", - dl_harq_pid, sched_frame,sched_slot,current_harq->dl_slot,current_harq->feedback_to_ul,current_harq->is_common); + LOG_D(PHY,"HARQ pid %d is active for %d.%d (dl_slot %d, feedback_to_ul %d\n", + dl_harq_pid, sched_frame,sched_slot,current_harq->dl_slot,current_harq->feedback_to_ul); /* check if current tx slot should transmit downlink acknowlegment */ if (sched_frame == frame && sched_slot == slot) { if (get_softmodem_params()->emulate_l1) { @@ -2091,9 +1943,7 @@ uint8_t get_downlink_ack(NR_UE_MAC_INST_t *mac, U_DAI_c = number_harq_feedback/number_of_code_word; N_m_c_rx = number_harq_feedback; int N_SPS_c = 0; /* FFS TODO_NR multicells and SPS are not supported at the moment */ - if (mac->cg != NULL && - mac->cg->physicalCellGroupConfig != NULL && - mac->cg->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUCCH != NULL) { + if (current_UL_BWP->harq_ACK_SpatialBundlingPUCCH != NULL) { int N_TB_max_DL = current_DL_BWP->pdsch_Config->maxNrofCodeWordsScheduledByDCI[0]; pucch->n_HARQ_ACK = (((V_DAI_m_DL - U_DAI_c)%4) * N_TB_max_DL) + N_m_c_rx + N_SPS_c; LOG_D(MAC, "PUCCH power n(%d) = ( V(%d) - U(%d) )mod4 * N_TB(%d) + N(%d) \n", pucch->n_HARQ_ACK, V_DAI_m_DL, U_DAI_c, N_TB_max_DL, N_m_c_rx); @@ -2187,28 +2037,10 @@ bool trigger_periodic_scheduling_request(NR_UE_MAC_INST_t *mac, int slot) { NR_UE_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP; - NR_BWP_Id_t bwp_id = current_UL_BWP->bwp_id; - NR_PUCCH_Config_t *pucch_Config = NULL; + NR_PUCCH_Config_t *pucch_Config = current_UL_BWP->pucch_Config; const int n_slots_frame = nr_slots_per_frame[current_UL_BWP->scs]; - 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; - } - else if (bwp_id==0 && - mac->cg && - mac->cg->spCellConfig && - mac->cg->spCellConfig->spCellConfigDedicated && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup) { - pucch_Config = mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup; - } if(!pucch_Config || !pucch_Config->schedulingRequestResourceToAddModList || pucch_Config->schedulingRequestResourceToAddModList->list.count==0) @@ -2301,15 +2133,12 @@ uint8_t nr_get_csi_measurements(NR_UE_MAC_INST_t *mac, NR_UE_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP; NR_BWP_Id_t bwp_id = current_UL_BWP->bwp_id; - NR_PUCCH_Config_t *pucch_Config = NULL; + NR_PUCCH_Config_t *pucch_Config = current_UL_BWP->pucch_Config; int csi_bits = 0; - if(mac->cg && - mac->cg->spCellConfig && - mac->cg->spCellConfig->spCellConfigDedicated && - mac->cg->spCellConfig->spCellConfigDedicated->csi_MeasConfig) { + if(current_UL_BWP->csi_MeasConfig) { - NR_CSI_MeasConfig_t *csi_measconfig = mac->cg->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; + NR_CSI_MeasConfig_t *csi_measconfig = current_UL_BWP->csi_MeasConfig; for (int csi_report_id = 0; csi_report_id < csi_measconfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){ NR_CSI_ReportConfig_t *csirep = csi_measconfig->csi_ReportConfigToAddModList->list.array[csi_report_id]; @@ -2323,21 +2152,6 @@ uint8_t nr_get_csi_measurements(NR_UE_MAC_INST_t *mac, int period, offset; csi_period_offset(csirep, NULL, &period, &offset); - 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; - } - else if (bwp_id==0 && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup) { - pucch_Config = mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup; - } - const int n_slots_frame = nr_slots_per_frame[current_UL_BWP->scs]; if (((n_slots_frame*frame + slot - offset)%period) == 0 && pucch_Config) { LOG_D(NR_MAC, "Preparing CSI report in frame %d slot %d CSI report ID %d\n", frame, slot, csi_report_id); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 84075cd337..6a96ff474b 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -136,31 +136,14 @@ fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int sl return &mac->ul_config_request[index]; } -void ul_layers_config(NR_UE_MAC_INST_t * mac, nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu, dci_pdu_rel15_t *dci) { +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_dci_format_t dci_format) +{ - NR_ServingCellConfigCommon_t *scc = mac->scc; NR_UE_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP; - NR_SRS_Config_t *srs_config = NULL; - - if (mac->cg && - mac->cg->spCellConfig && - mac->cg->spCellConfig->spCellConfigDedicated && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP) { - srs_config = mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->srs_Config->choice.setup; - } - + NR_SRS_Config_t *srs_config = current_UL_BWP->srs_Config; NR_PUSCH_Config_t *pusch_Config = current_UL_BWP->pusch_Config; - long transformPrecoder; - if (pusch_Config && pusch_Config->transformPrecoder) - transformPrecoder = *pusch_Config->transformPrecoder; - else { - if(scc && scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder) - transformPrecoder = NR_PUSCH_Config__transformPrecoder_enabled; - else - transformPrecoder = NR_PUSCH_Config__transformPrecoder_disabled; - } + long transformPrecoder = get_transformPrecoding(current_UL_BWP, dci_format, 0); pusch_config_pdu->transform_precoding = transformPrecoder; /* PRECOD_NBR_LAYERS */ @@ -287,23 +270,15 @@ void ul_layers_config(NR_UE_MAC_INST_t * mac, nfapi_nr_ue_pusch_pdu_t *pusch_con } // todo: this function shall be reviewed completely because of the many comments left by the author -void ul_ports_config(NR_UE_MAC_INST_t *mac, int *n_front_load_symb, nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu, dci_pdu_rel15_t *dci) { +void ul_ports_config(NR_UE_MAC_INST_t *mac, int *n_front_load_symb, nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu, dci_pdu_rel15_t *dci, nr_dci_format_t dci_format) +{ uint8_t rank = pusch_config_pdu->nrOfLayers; - NR_ServingCellConfigCommon_t *scc = mac->scc; NR_PUSCH_Config_t *pusch_Config = mac->current_UL_BWP.pusch_Config; AssertFatal(pusch_Config!=NULL,"pusch_Config shouldn't be null\n"); - long transformPrecoder; - if (pusch_Config->transformPrecoder) - transformPrecoder = *pusch_Config->transformPrecoder; - else { - if(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder) - transformPrecoder = NR_PUSCH_Config__transformPrecoder_enabled; - else - transformPrecoder = NR_PUSCH_Config__transformPrecoder_disabled; - } + long transformPrecoder = get_transformPrecoding(&mac->current_UL_BWP, dci_format, 0); long *max_length = NULL; long *dmrs_type = NULL; LOG_D(NR_MAC,"transformPrecoder %s\n",transformPrecoder==NR_PUSCH_Config__transformPrecoder_disabled?"disabled":"enabled"); @@ -502,9 +477,6 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, pusch_config_pdu->nrOfLayers = 1; pusch_config_pdu->Tpmi = 0; pusch_config_pdu->rnti = rnti; - NR_BWP_UplinkCommon_t *initialUplinkBWP; - if (mac->scc) initialUplinkBWP = mac->scc->uplinkConfigCommon->initialUplinkBWP; - else initialUplinkBWP = &mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP; pusch_dmrs_AdditionalPosition_t add_pos = pusch_dmrs_pos2; int dmrslength = 1; @@ -567,10 +539,10 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, pusch_config_pdu->scid = 0; // Transform precoding according to 6.1.3 UE procedure for applying transform precoding on PUSCH in 38.214 - pusch_config_pdu->transform_precoding = get_transformPrecoding(initialUplinkBWP, pusch_Config, NULL, NULL, NR_RNTI_TC, 0); // TBR fix rnti and take out + pusch_config_pdu->transform_precoding = get_transformPrecoding(current_UL_BWP, NR_UL_DCI_FORMAT_0_0, 0); // as if it was DCI 0_0 // Resource allocation in frequency domain according to 6.1.2.2 in TS 38.214 - pusch_config_pdu->resource_alloc = (mac->cg) ? pusch_Config->resourceAllocation : 1; + pusch_config_pdu->resource_alloc = 1; //// Completing PUSCH PDU pusch_config_pdu->mcs_table = 0; @@ -588,13 +560,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, pusch_config_pdu->tbslbrm = 0; } else if (dci) { - NR_BWP_Id_t dl_bwp_id = mac->current_DL_BWP.bwp_id; NR_BWP_Id_t ul_bwp_id = mac->current_UL_BWP.bwp_id; - NR_BWP_DownlinkDedicated_t *bwpd=NULL; - NR_BWP_DownlinkCommon_t *bwpc=NULL; - NR_BWP_UplinkDedicated_t *ubwpd=NULL; - NR_BWP_UplinkCommon_t *ubwpc=NULL; - get_bwp_info(mac,dl_bwp_id,ul_bwp_id,&bwpd,&bwpc,&ubwpd,&ubwpc); int target_ss; bool valid_ptrs_setup = 0; @@ -610,7 +576,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, /* Transform precoding */ if (rnti_type != NR_RNTI_CS || (rnti_type == NR_RNTI_CS && dci->ndi == 1)) { - pusch_config_pdu->transform_precoding = get_transformPrecoding(initialUplinkBWP, pusch_Config, NULL, dci_format, rnti_type, 0); + pusch_config_pdu->transform_precoding = get_transformPrecoding(current_UL_BWP, *dci_format, 0); } /*DCI format-related configuration*/ @@ -620,11 +586,9 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, } else if (*dci_format == NR_UL_DCI_FORMAT_0_1) { - get_bwp_info(mac,dl_bwp_id,ul_bwp_id,&bwpd,&bwpc,&ubwpd,&ubwpc); - target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific; - ul_layers_config(mac, pusch_config_pdu, dci); - ul_ports_config(mac, &dmrslength, pusch_config_pdu, dci); + ul_layers_config(mac, pusch_config_pdu, dci, *dci_format); + ul_ports_config(mac, &dmrslength, pusch_config_pdu, dci, *dci_format); } else { @@ -750,23 +714,15 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, } // Num PRB Overhead from PUSCH-ServingCellConfig - if (mac->cg && - mac->cg->spCellConfig && - mac->cg->spCellConfig->spCellConfigDedicated && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->xOverhead) - N_PRB_oh = *mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->xOverhead; + if (current_UL_BWP->pusch_servingcellconfig && + current_UL_BWP->pusch_servingcellconfig->xOverhead) + N_PRB_oh = *current_UL_BWP->pusch_servingcellconfig->xOverhead; + else + N_PRB_oh = 0; - else N_PRB_oh = 0; - - if (mac->cg && - mac->cg->spCellConfig && - mac->cg->spCellConfig->spCellConfigDedicated && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->rateMatching) { - long *maxMIMO_Layers = mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers; + if (current_UL_BWP->pusch_servingcellconfig && + current_UL_BWP->pusch_servingcellconfig->rateMatching) { + long *maxMIMO_Layers = current_UL_BWP->pusch_servingcellconfig->ext1->maxMIMO_Layers; if (!maxMIMO_Layers) maxMIMO_Layers = pusch_Config ? pusch_Config->maxRank : NULL; AssertFatal (maxMIMO_Layers != NULL,"Option with max MIMO layers not configured is not supported\n"); @@ -846,21 +802,8 @@ bool nr_ue_periodic_srs_scheduling(module_id_t mod_id, frame_t frame, slot_t slo NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); NR_UE_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP; - NR_BWP_Id_t ul_bwp_id = current_UL_BWP->bwp_id; - NR_SRS_Config_t *srs_config = NULL; - if (ul_bwp_id > 0 && mac->ULbwp[ul_bwp_id-1]) { - if (mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated && - mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->srs_Config) { - srs_config = mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->srs_Config->choice.setup; - } - } else if (mac->cg && - mac->cg->spCellConfig && - mac->cg->spCellConfig->spCellConfigDedicated && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP) { - srs_config = mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->srs_Config->choice.setup; - } + NR_SRS_Config_t *srs_config = current_UL_BWP->srs_Config; if (!srs_config) { return false; @@ -1554,7 +1497,7 @@ static void build_ro_list(NR_UE_MAC_INST_t *mac) { uint8_t format2 = 0xff; int nb_fdm; - uint8_t config_index, mu; + uint8_t config_index; int msg1_FDM; uint8_t prach_conf_period_idx; @@ -1562,20 +1505,16 @@ static void build_ro_list(NR_UE_MAC_INST_t *mac) { uint8_t prach_conf_period_frame_idx; int64_t *prach_config_info_p; - NR_RACH_ConfigCommon_t *setup = (mac->scc) ? - mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup: - mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup; + NR_RACH_ConfigCommon_t *setup = mac->current_UL_BWP.rach_ConfigCommon; NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric; config_index = rach_ConfigGeneric->prach_ConfigurationIndex; - if (setup->msg1_SubcarrierSpacing) { + int mu; + if (setup->msg1_SubcarrierSpacing) mu = *setup->msg1_SubcarrierSpacing; - } else if(mac->scc) { - mu = mac->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; - } else { - mu = get_softmodem_params()->numerology; - } + else + mu = mac->current_UL_BWP.scs; msg1_FDM = rach_ConfigGeneric->msg1_FDM; @@ -1810,9 +1749,7 @@ static void map_ssb_to_ro(NR_UE_MAC_INST_t *mac) { // Map SSBs to PRACH occasions // =========================== // WIP: Assumption: No PRACH occasion is rejected because of a conflict with SSBs or TDD_UL_DL_ConfigurationCommon schedule - NR_RACH_ConfigCommon_t *setup = (mac->scc) ? - mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup: - mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup; + NR_RACH_ConfigCommon_t *setup = mac->current_UL_BWP.rach_ConfigCommon; NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR ssb_perRACH_config = setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present; bool multiple_ssb_per_ro; // true if more than one or exactly one SSB per RACH occasion, false if more than one RO per SSB @@ -2222,27 +2159,7 @@ void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, vo // ACKNACK O_ACK = get_downlink_ack(mac, frameP, slotP, &pucch); - NR_BWP_Id_t bwp_id = mac->current_UL_BWP.bwp_id; - NR_PUCCH_Config_t *pucch_Config = NULL; - - 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; - } - else if (bwp_id==0 && - mac->cg && - mac->cg->spCellConfig && - mac->cg->spCellConfig->spCellConfigDedicated && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config && - mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup) { - pucch_Config = mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup; - } - + NR_PUCCH_Config_t *pucch_Config = mac->current_UL_BWP.pucch_Config; // if multiplexing of HARQ and CSI is not possible, transmit only HARQ bits if ((O_ACK != 0) && (O_CSI != 0) && @@ -2282,7 +2199,6 @@ void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, vo &pucch, pucch_pdu, O_SR, O_ACK, O_CSI); - LOG_D(NR_MAC, "Configuring pucch, is_common = %d\n", pucch.is_common); nr_scheduled_response_t scheduled_response; fill_scheduled_response(&scheduled_response, NULL, ul_config, NULL, module_idP, 0 /*TBR fix*/, frameP, slotP, phy_data); if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL) @@ -2296,13 +2212,12 @@ void nr_schedule_csi_for_im(NR_UE_MAC_INST_t *mac, int frame, int slot) { if (mac->ra.ra_state != RA_SUCCEEDED && get_softmodem_params()->phy_test == 0) return; - NR_CellGroupConfig_t *CellGroup = mac->cg; + NR_UE_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP; - if (!CellGroup || !CellGroup->spCellConfig || !CellGroup->spCellConfig->spCellConfigDedicated || - !CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig) + if (!current_UL_BWP->csi_MeasConfig) return; - NR_CSI_MeasConfig_t *csi_measconfig = CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; + NR_CSI_MeasConfig_t *csi_measconfig = current_UL_BWP->csi_MeasConfig; if (csi_measconfig->csi_IM_ResourceToAddModList == NULL) return; @@ -2354,13 +2269,12 @@ void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot) { if (mac->ra.ra_state != RA_SUCCEEDED && get_softmodem_params()->phy_test == 0) return; - NR_CellGroupConfig_t *CellGroup = mac->cg; + NR_UE_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP; - if (!CellGroup || !CellGroup->spCellConfig || !CellGroup->spCellConfig->spCellConfigDedicated || - !CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig) + if (!current_UL_BWP->csi_MeasConfig) return; - NR_CSI_MeasConfig_t *csi_measconfig = CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; + NR_CSI_MeasConfig_t *csi_measconfig = current_UL_BWP->csi_MeasConfig; if (csi_measconfig->nzp_CSI_RS_ResourceToAddModList == NULL) return; @@ -2541,9 +2455,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s NR_ServingCellConfigCommon_t *scc = mac->scc; NR_ServingCellConfigCommonSIB_t *scc_SIB = mac->scc_SIB; - NR_RACH_ConfigCommon_t *setup; - if (scc!=NULL) setup = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; - else setup = scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup; + NR_RACH_ConfigCommon_t *setup = mac->current_UL_BWP.rach_ConfigCommon; NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric; NR_TDD_UL_DL_ConfigCommon_t *tdd_config = scc==NULL ? scc_SIB->tdd_UL_DL_ConfigurationCommon : scc->tdd_UL_DL_ConfigurationCommon; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index c34d7f6316..88c3856931 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1081,7 +1081,8 @@ void prepare_dci(const NR_CellGroupConfig_t *CellGroup, const NR_UE_DL_BWP_t *current_BWP, const NR_ControlResourceSet_t *coreset, dci_pdu_rel15_t *dci_pdu_rel15, - nr_dci_format_t format) { + nr_dci_format_t format) +{ AssertFatal(CellGroup!=NULL,"CellGroup shouldn't be null here\n"); @@ -1188,16 +1189,12 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, // computing alternative size for padding dci_pdu_rel15_t temp_pdu; if(dci_format == NR_DL_DCI_FORMAT_1_0) - alt_size = nr_dci_size(scc->downlinkConfigCommon->initialDownlinkBWP, - scc->uplinkConfigCommon->initialUplinkBWP, - current_DL_BWP, current_UL_BWP, + alt_size = nr_dci_size(current_DL_BWP, current_UL_BWP, CellGroup, &temp_pdu, NR_UL_DCI_FORMAT_0_0, rnti_type, coreset, bwp_id, ss->searchSpaceType->present, cset0_bwp_size, 0); if(dci_format == NR_UL_DCI_FORMAT_0_0) - alt_size = nr_dci_size(scc->downlinkConfigCommon->initialDownlinkBWP, - scc->uplinkConfigCommon->initialUplinkBWP, - current_DL_BWP, current_UL_BWP, + alt_size = nr_dci_size(current_DL_BWP, current_UL_BWP, CellGroup, &temp_pdu, NR_DL_DCI_FORMAT_1_0, rnti_type, coreset, bwp_id, ss->searchSpaceType->present, cset0_bwp_size, 0); @@ -1205,9 +1202,7 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, else N_RB = cset0_bwp_size; - int dci_size = nr_dci_size(scc->downlinkConfigCommon->initialDownlinkBWP, - scc->uplinkConfigCommon->initialUplinkBWP, - current_DL_BWP, current_UL_BWP, + int dci_size = nr_dci_size(current_DL_BWP, current_UL_BWP, CellGroup, dci_pdu_rel15, dci_format, rnti_type, coreset, bwp_id, ss->searchSpaceType->present, cset0_bwp_size, alt_size); pdcch_dci_pdu->PayloadSizeBits = dci_size; @@ -2092,6 +2087,10 @@ void configure_UE_BWP(gNB_MAC_INST *nr_mac, int target_ss; + if(CellGroup && + CellGroup->physicalCellGroupConfig) + DL_BWP->pdsch_HARQ_ACK_Codebook = &CellGroup->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook; + if (CellGroup && CellGroup->spCellConfig && CellGroup->spCellConfig->spCellConfigDedicated) { @@ -2100,6 +2099,7 @@ void configure_UE_BWP(gNB_MAC_INST *nr_mac, DL_BWP->pdsch_servingcellconfig = servingCellConfig->pdsch_ServingCellConfig ? servingCellConfig->pdsch_ServingCellConfig->choice.setup : NULL; UL_BWP->pusch_servingcellconfig = servingCellConfig->uplinkConfig && servingCellConfig->uplinkConfig->pusch_ServingCellConfig ? servingCellConfig->uplinkConfig->pusch_ServingCellConfig->choice.setup : NULL; + target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific; if(UE && UE->Msg3_dcch_dtch) { @@ -2165,6 +2165,7 @@ void configure_UE_BWP(gNB_MAC_INST *nr_mac, ubwpd = servingCellConfig->uplinkConfig->initialUplinkBWP; DL_BWP->pdsch_Config = bwpd->pdsch_Config->choice.setup; + UL_BWP->configuredGrantConfig = ubwpd->configuredGrantConfig ? ubwpd->configuredGrantConfig->choice.setup : NULL; UL_BWP->pusch_Config = ubwpd->pusch_Config->choice.setup; UL_BWP->pucch_Config = ubwpd->pucch_Config->choice.setup; UL_BWP->srs_Config = ubwpd->srs_Config->choice.setup; @@ -2178,6 +2179,7 @@ void configure_UE_BWP(gNB_MAC_INST *nr_mac, UL_BWP->pusch_Config = NULL; UL_BWP->pucch_Config = NULL; UL_BWP->csi_MeasConfig = NULL; + UL_BWP->configuredGrantConfig = NULL; } if (old_dl_bwp_id != DL_BWP->bwp_id) @@ -2224,10 +2226,14 @@ void configure_UE_BWP(gNB_MAC_INST *nr_mac, else UL_BWP->transform_precoding = *UL_BWP->pusch_Config->transformPrecoder; - if(UL_BWP->bwp_id>0) + if(UL_BWP->bwp_id > 0) { UL_BWP->pucch_ConfigCommon = ul_bwp->bwp_Common->pucch_ConfigCommon->choice.setup; - else + UL_BWP->rach_ConfigCommon = ul_bwp->bwp_Common->rach_ConfigCommon->choice.setup; + } + else { UL_BWP->pucch_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup; + UL_BWP->rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; + } if(UE) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 5caea0c2c7..8d3d377d43 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -1015,14 +1015,13 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, } } -void set_pucch_allocation(const NR_PUCCH_Config_t *pucch_Config, - const NR_ServingCellConfigCommon_t *scc, +void set_pucch_allocation(const NR_UE_UL_BWP_t *ul_bwp, const int r_pucch, const int bwp_size, NR_sched_pucch_t *pucch) { if(r_pucch<0){ - const NR_PUCCH_Resource_t *resource = pucch_Config->resourceToAddModList->list.array[0]; + const NR_PUCCH_Resource_t *resource = ul_bwp->pucch_Config->resourceToAddModList->list.array[0]; DevAssert(resource->format.present == NR_PUCCH_Resource__format_PR_format0); pucch->second_hop_prb = resource->secondHopPRB!= NULL ? *resource->secondHopPRB : 0; pucch->nr_of_symb = resource->format.choice.format0->nrofSymbols; @@ -1030,7 +1029,7 @@ void set_pucch_allocation(const NR_PUCCH_Config_t *pucch_Config, pucch->prb_start = resource->startingPRB; } else{ - int rsetindex = *scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->pucch_ResourceCommon; + int rsetindex = *ul_bwp->pucch_ConfigCommon->pucch_ResourceCommon; set_r_pucch_parms(rsetindex, r_pucch, bwp_size, @@ -1155,7 +1154,7 @@ int nr_acknack_scheduling(gNB_MAC_INST *mac, } else { // unoccupied occasion // checking if in ul_slot the resources potentially to be assigned to this PUCCH are available - set_pucch_allocation(pucch_Config, scc, r_pucch, bwp_size, curr_pucch); + set_pucch_allocation(ul_bwp, r_pucch, bwp_size, curr_pucch); uint16_t *vrb_map_UL = &mac->common_channels[CC_id].vrb_map_UL[pucch_slot * MAX_BWP_SIZE]; bool ret = test_pucch0_vrb_occupation(curr_pucch, vrb_map_UL, @@ -1249,7 +1248,7 @@ void nr_sr_reporting(gNB_MAC_INST *nrmac, frame_t SFN, sub_frame_t slot) uint16_t *vrb_map_UL = &nrmac->common_channels[CC_id].vrb_map_UL[slot * MAX_BWP_SIZE]; const int bwp_start = ul_bwp->BWPStart; const int bwp_size = ul_bwp->BWPSize; - set_pucch_allocation(pucch_Config, scc, -1, bwp_size, curr_pucch); + set_pucch_allocation(ul_bwp, -1, bwp_size, curr_pucch); bool ret = test_pucch0_vrb_occupation(curr_pucch, vrb_map_UL, bwp_start, diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index ae93e07c36..8ddebc9118 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -278,7 +278,7 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, uint16_t cset0_bwp_size); void prepare_dci(const NR_CellGroupConfig_t *CellGroup, - const NR_UE_DL_BWP_t *dl_bwp, + const NR_UE_DL_BWP_t *current_BWP, const NR_ControlResourceSet_t *coreset, dci_pdu_rel15_t *dci_pdu_rel15, nr_dci_format_t format);