From 0aec0d91c620a3cdfefa78f2263ab86f40335abe Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 6 Jun 2022 11:52:12 +0200 Subject: [PATCH 1/9] temporary workaround for RRC passing CG to MAC (forced encoding of message at MAC) --- openair1/PHY/INIT/nr_init.c | 4 +-- openair2/LAYER2/NR_MAC_gNB/config.c | 18 ++++++++++++- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 10 +++++++- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 2 ++ openair2/RRC/NR/rrc_gNB.c | 25 ++++++++++--------- 5 files changed, 43 insertions(+), 16 deletions(-) diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 56327a9b0f..ab2a9ee74e 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -544,8 +544,8 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, gNB->nr_gold_pdsch_dmrs = (uint32_t ****)malloc16(fp->slots_per_frame*sizeof(uint32_t ***)); uint32_t ****pdsch_dmrs = gNB->nr_gold_pdsch_dmrs; - // ceil(((NB_RB*6(k)*2(QPSK)/32) // 3 RE *2(QPSK) - int pdsch_dmrs_init_length = ((fp->N_RB_DL*12)>>5)+1; + // ceil(((NB_RB*12(k)*2(QPSK)/32) // 3 RE *2(QPSK) + int pdsch_dmrs_init_length = ((fp->N_RB_DL*24)>>5)+1; for (int slot=0; slotslots_per_frame; slot++) { pdsch_dmrs[slot] = (uint32_t ***)malloc16(fp->symbols_per_slot*sizeof(uint32_t **)); AssertFatal(pdsch_dmrs[slot]!=NULL, "NR init: pdsch_dmrs for slot %d - malloc failed\n", slot); diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 19845c708b..791c1e3204 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -654,7 +654,23 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, } int target_ss; - UE->CellGroup = CellGroup; + /* copy CellGroup by calling asn1c encode + this is a temporary hack to avoid the gNB having + a pointer to RRC CellGroup structure + (otherwise it would be applied to early) + TODO remove once we have a proper implementation */ + UE->enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, + NULL, + (void *)CellGroup, + UE->cg_buf, + 32768); + + if(UE->enc_rval.encoded == -1) { + LOG_E(NR_MAC, "ASN1 message CellGroupConfig encoding failed (%s, %lu)!\n", + UE->enc_rval.failed_type->name, UE->enc_rval.encoded); + exit(1); + } + LOG_I(NR_MAC,"Modified rnti %04x with CellGroup\n",rnti); process_CellGroup(CellGroup,&UE->UE_sched_ctrl); NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 295d81bcd6..2ed7e9c9e1 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2910,7 +2910,15 @@ void nr_mac_update_timers(module_id_t module_id, LOG_I(NR_MAC, "(%d.%d) De-activating RRC processing timer for UE %04x\n", frame, slot, UE->rnti); const NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL; - NR_CellGroupConfig_t *cg = UE->CellGroup; + + NR_CellGroupConfig_t *cg = NULL; + uper_decode(NULL, + &asn_DEF_NR_CellGroupConfig, //might be added prefix later + (void **)&cg, + (uint8_t *)UE->cg_buf, + (UE->enc_rval.encoded+7)/8, 0, 0); + UE->CellGroup = cg; + NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon; const NR_ServingCellConfig_t *spCellConfigDedicated = cg && cg->spCellConfig ? cg->spCellConfig->spCellConfigDedicated : NULL; diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 974d6dff4a..1d0d9750e6 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -710,6 +710,8 @@ typedef struct { NR_UE_sched_ctrl_t UE_sched_ctrl; NR_mac_stats_t mac_stats; NR_CellGroupConfig_t *CellGroup; + char cg_buf[32768]; /* arbitrary size */ + asn_enc_rval_t enc_rval; /// CCE indexing int m; // UE selected beam index diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 9c4eba15a7..a17d7f06bc 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -734,6 +734,19 @@ rrc_gNB_generate_defaultRRCReconfiguration( NULL, ue_p->masterCellGroup); + rrc_mac_config_req_gNB(rrc->module_id, + rrc->configuration.ssb_SubcarrierOffset, + rrc->configuration.pdsch_AntennaPorts, + rrc->configuration.pusch_AntennaPorts, + rrc->configuration.sib1_tda, + rrc->configuration.minRXTXTIME, + NULL, + NULL, + NULL, + 0, + ue_p->rnti, + ue_p->masterCellGroup); + free(ue_context_pP->ue_context.nas_pdu.buffer); LOG_DUMPMSG(NR_RRC, DEBUG_RRC,(char *)buffer, size, "[MSG] RRC Reconfiguration\n"); @@ -1435,18 +1448,6 @@ rrc_gNB_process_RRCReconfigurationComplete( /* Refresh SRBs/DRBs */ if (!NODE_IS_CU(RC.nrrrc[ctxt_pP->module_id]->node_type)) { - rrc_mac_config_req_gNB(rrc->module_id, - rrc->configuration.ssb_SubcarrierOffset, - rrc->configuration.pdsch_AntennaPorts, - rrc->configuration.pusch_AntennaPorts, - rrc->configuration.sib1_tda, - rrc->configuration.minRXTXTIME, - NULL, - NULL, - NULL, - 0, - ue_context_pP->ue_context.rnti, - ue_context_pP->ue_context.masterCellGroup); LOG_D(NR_RRC,"Configuring RLC DRBs/SRBs for UE %x\n",ue_context_pP->ue_context.rnti); nr_rrc_rlc_config_asn1_req(ctxt_pP, SRB_configList, // NULL, From e7a491415c2bf1cf3b63dae871342a1555d586b4 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Thu, 9 Jun 2022 10:08:28 +0100 Subject: [PATCH 2/9] Improvements on RRC passing CellGroup to MAC to get COTS UE working --- openair2/LAYER2/NR_MAC_gNB/config.c | 54 +-------- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 111 ++++++++++++------ openair2/RRC/NR/rrc_gNB.c | 27 +++++ 3 files changed, 105 insertions(+), 87 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 791c1e3204..1b33f6c6a4 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -588,10 +588,6 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, if (CellGroup) { - const NR_ServingCellConfig_t *servingCellConfig = NULL; - if(CellGroup->spCellConfig && CellGroup->spCellConfig->spCellConfigDedicated) - servingCellConfig = CellGroup->spCellConfig->spCellConfigDedicated; - if (add_ue == 1 && get_softmodem_params()->phy_test) { NR_UE_info_t* UE = add_new_nr_ue(RC.nrmac[Mod_idP], rnti, CellGroup); if (UE) { @@ -646,13 +642,11 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, ra->msg3_dcch_dtch = false; LOG_I(NR_MAC,"Added new RA process for UE RNTI %04x with initial CellGroup\n", rnti); } else { // CellGroup has been updated - NR_ServingCellConfigCommon_t *scc = RC.nrmac[Mod_idP]->common_channels[0].ServingCellConfigCommon; - NR_UE_info_t * UE = find_nr_UE(&RC.nrmac[Mod_idP]->UE_info,rnti); + NR_UE_info_t *UE = find_nr_UE(&RC.nrmac[Mod_idP]->UE_info, rnti); if (!UE) { LOG_E(NR_MAC, "Can't find UE %04x\n", rnti); return -1; } - int target_ss; /* copy CellGroup by calling asn1c encode this is a temporary hack to avoid the gNB having @@ -661,57 +655,15 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, TODO remove once we have a proper implementation */ UE->enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, NULL, - (void *)CellGroup, + (void *) CellGroup, UE->cg_buf, 32768); - if(UE->enc_rval.encoded == -1) { + if (UE->enc_rval.encoded == -1) { LOG_E(NR_MAC, "ASN1 message CellGroupConfig encoding failed (%s, %lu)!\n", UE->enc_rval.failed_type->name, UE->enc_rval.encoded); exit(1); } - - LOG_I(NR_MAC,"Modified rnti %04x with CellGroup\n",rnti); - process_CellGroup(CellGroup,&UE->UE_sched_ctrl); - NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; - - const NR_PDSCH_ServingCellConfig_t *pdsch = servingCellConfig ? servingCellConfig->pdsch_ServingCellConfig->choice.setup : NULL; - if (get_softmodem_params()->sa) { - // add all available DL HARQ processes for this UE in SA - create_dl_harq_list(sched_ctrl, pdsch); - } - // update coreset/searchspace - void *bwpd = NULL; - NR_BWP_t *genericParameters = NULL; - target_ss = NR_SearchSpace__searchSpaceType_PR_common; - if ((sched_ctrl->active_bwp)) { - target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific; - bwpd = (void*)sched_ctrl->active_bwp->bwp_Dedicated; - genericParameters = &sched_ctrl->active_bwp->bwp_Common->genericParameters; - } - else if (CellGroup->spCellConfig && - CellGroup->spCellConfig->spCellConfigDedicated && - (CellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP)) { - target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific; - bwpd = (void*)CellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP; - genericParameters = &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters; - } - sched_ctrl->search_space = get_searchspace(sib1 ? sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL, scc, bwpd, target_ss); - sched_ctrl->coreset = get_coreset(RC.nrmac[Mod_idP], scc, bwpd, sched_ctrl->search_space, target_ss); - sched_ctrl->sched_pdcch = set_pdcch_structure(RC.nrmac[Mod_idP], - sched_ctrl->search_space, - sched_ctrl->coreset, - scc, - genericParameters, - RC.nrmac[Mod_idP]->type0_PDCCH_CSS_config); - sched_ctrl->maxL = 2; - - if (CellGroup->spCellConfig && - CellGroup->spCellConfig->spCellConfigDedicated && - CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig && - CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup) { - compute_csi_bitlen(CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup, UE); - } } } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 2ed7e9c9e1..49cd9f180f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -596,26 +596,6 @@ void nr_set_pdsch_semi_static(const NR_SIB1_t *sib1, bwpd = (NR_BWP_DownlinkDedicated_t*)bwpd0; } - // Prevent gNB to enable 256QAM table while the RRCProcessing timer is running. - // For example, after the RRC created RRC Reconfiguration message we need to prevent gNB to apply another MCS table - // before the RRC Reconfiguration being received by the UE, otherwise UE will not be able to decode PDSCH - // and the connection will drop. - if (sched_ctrl->rrc_processing_timer == 0) { - if (bwpd && - bwpd->pdsch_Config && - bwpd->pdsch_Config->choice.setup && - bwpd->pdsch_Config->choice.setup->mcs_Table) { - if (*bwpd->pdsch_Config->choice.setup->mcs_Table == 0) { - ps->mcsTableIdx = 1; - } else { - ps->mcsTableIdx = 2; - } - } else { - ps->mcsTableIdx = 0; - } - } - LOG_D(NR_MAC,"MCS Table Index: %d\n",ps->mcsTableIdx); - NR_PDSCH_Config_t *pdsch_Config = NULL; if (bwpd && bwpd->pdsch_Config) pdsch_Config = bwpd->pdsch_Config->choice.setup; LOG_D(NR_MAC,"tda %d, ps->time_domain_allocation %d,layers %d, ps->nrOfLayers %d, pdsch_config %p\n",tda,ps->time_domain_allocation,layers,ps->nrOfLayers,pdsch_Config); @@ -2919,37 +2899,93 @@ void nr_mac_update_timers(module_id_t module_id, (UE->enc_rval.encoded+7)/8, 0, 0); UE->CellGroup = cg; + if (LOG_DEBUGFLAG(DEBUG_ASN1)) { + xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void *) UE->CellGroup); + } + NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon; const NR_ServingCellConfig_t *spCellConfigDedicated = cg && cg->spCellConfig ? cg->spCellConfig->spCellConfigDedicated : NULL; + LOG_I(NR_MAC,"Modified rnti %04x with CellGroup\n", UE->rnti); + process_CellGroup(cg,&UE->UE_sched_ctrl); + NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; + + const NR_PDSCH_ServingCellConfig_t *pdsch = spCellConfigDedicated ? spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup : NULL; + if (get_softmodem_params()->sa) { + // add all available DL HARQ processes for this UE in SA + create_dl_harq_list(sched_ctrl, pdsch); + } + // If needed, update the Dedicated BWP const int current_bwp_id = sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0; const int current_ubwp_id = sched_ctrl->active_ubwp ? sched_ctrl->active_ubwp->bwp_Id : 0; if (spCellConfigDedicated && - spCellConfigDedicated->downlinkBWP_ToAddModList && - spCellConfigDedicated->uplinkConfig && - spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList) { + spCellConfigDedicated->downlinkBWP_ToAddModList && + spCellConfigDedicated->uplinkConfig && + spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList) { + sched_ctrl->active_bwp = spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[*spCellConfigDedicated->firstActiveDownlinkBWP_Id - 1]; if (*spCellConfigDedicated->firstActiveDownlinkBWP_Id != current_bwp_id) { - sched_ctrl->active_bwp = spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[*spCellConfigDedicated->firstActiveDownlinkBWP_Id - 1]; LOG_I(NR_MAC, "Changing to DL-BWP %li\n", sched_ctrl->active_bwp->bwp_Id); } + sched_ctrl->active_ubwp = spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[*spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id - 1]; if (*spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id != current_ubwp_id) { - sched_ctrl->active_ubwp = spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[*spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id - 1]; LOG_I(NR_MAC, "Changing to UL-BWP %li\n", sched_ctrl->active_ubwp->bwp_Id); } } + // Update coreset/searchspace NR_BWP_Downlink_t *bwp = sched_ctrl->active_bwp; - NR_BWP_DownlinkDedicated_t *bwpd = cg && - cg->spCellConfig && - cg->spCellConfig->spCellConfigDedicated ? - cg->spCellConfig->spCellConfigDedicated->initialDownlinkBWP : NULL; + NR_BWP_DownlinkDedicated_t *bwpd = NULL; + NR_BWP_t *genericParameters = NULL; + int target_ss = NR_SearchSpace__searchSpaceType_PR_common; + if (bwp) { + target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific; + bwpd = sched_ctrl->active_bwp->bwp_Dedicated; + genericParameters = &sched_ctrl->active_bwp->bwp_Common->genericParameters; + } else if (cg && + cg->spCellConfig && + cg->spCellConfig->spCellConfigDedicated && + (cg->spCellConfig->spCellConfigDedicated->initialDownlinkBWP)) { + target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific; + bwpd = cg->spCellConfig->spCellConfigDedicated->initialDownlinkBWP; + genericParameters = &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters; + } + sched_ctrl->search_space = get_searchspace(sib1, scc, (void*)bwpd, target_ss); + sched_ctrl->coreset = get_coreset(RC.nrmac[module_id], scc, (void*)bwpd, sched_ctrl->search_space, target_ss); + sched_ctrl->sched_pdcch = set_pdcch_structure(RC.nrmac[module_id], + sched_ctrl->search_space, + sched_ctrl->coreset, + scc, + genericParameters, + RC.nrmac[module_id]->type0_PDCCH_CSS_config); + sched_ctrl->maxL = 2; + if (cg && + cg->spCellConfig && + cg->spCellConfig->spCellConfigDedicated && + cg->spCellConfig->spCellConfigDedicated->csi_MeasConfig && + cg->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup) { + compute_csi_bitlen (cg->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup, UE); + } NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static; - const uint8_t layers = set_dl_nrOfLayers(sched_ctrl); const int tda = get_dl_tda(RC.nrmac[module_id], scc, slot); + // Update downlink MCS table + if (bwpd && + bwpd->pdsch_Config && + bwpd->pdsch_Config->choice.setup && + bwpd->pdsch_Config->choice.setup->mcs_Table) { + if (*bwpd->pdsch_Config->choice.setup->mcs_Table == 0) { + ps->mcsTableIdx = 1; + } else { + ps->mcsTableIdx = 2; + } + } else { + ps->mcsTableIdx = 0; + } + LOG_D(NR_MAC,"MCS Table Index: %d\n",ps->mcsTableIdx); + nr_set_pdsch_semi_static(sib1, scc, cg, @@ -2961,14 +2997,17 @@ void nr_mac_update_timers(module_id_t module_id, ps); NR_BWP_Uplink_t *ubwp = sched_ctrl->active_ubwp; - NR_BWP_UplinkDedicated_t *ubwpd = cg && - cg->spCellConfig && - cg->spCellConfig->spCellConfigDedicated && - cg->spCellConfig->spCellConfigDedicated->uplinkConfig ? - cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP : NULL; + NR_BWP_UplinkDedicated_t *ubwpd = NULL; + if (ubwp) { + ubwpd = sched_ctrl->active_ubwp->bwp_Dedicated; + } else if (cg && + cg->spCellConfig && + cg->spCellConfig->spCellConfigDedicated && + (cg->spCellConfig->spCellConfigDedicated->initialDownlinkBWP)) { + ubwpd = cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP; + } NR_pusch_semi_static_t *ups = &sched_ctrl->pusch_semi_static; - int dci_format = get_dci_format(sched_ctrl); const uint8_t num_dmrs_cdm_grps_no_data = (ubwp || ubwpd) ? 1 : 2; const uint8_t nrOfLayers = 1; diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index a17d7f06bc..9e600b253f 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1036,6 +1036,19 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( cellGroupConfig); LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size,"[MSG] RRC Reconfiguration\n"); + rrc_mac_config_req_gNB(rrc->module_id, + rrc->configuration.ssb_SubcarrierOffset, + rrc->configuration.pdsch_AntennaPorts, + rrc->configuration.pusch_AntennaPorts, + rrc->configuration.sib1_tda, + rrc->configuration.minRXTXTIME, + NULL, + NULL, + NULL, + 0, + ue_context_pP->ue_context.rnti, + ue_context_pP->ue_context.masterCellGroup); + /* Free all NAS PDUs */ for (i = 0; i < ue_context_pP->ue_context.nb_of_pdusessions; i++) { if (ue_context_pP->ue_context.pduSession[i].param.nas_pdu.buffer != NULL) { @@ -1981,6 +1994,20 @@ int nr_rrc_reconfiguration_req(rrc_gNB_ue_context_t *const ue_context_pP NULL, masterCellGroup); + gNB_RrcConfigurationReq *configuration = &RC.nrrrc[ctxt_pP->module_id]->configuration; + rrc_mac_config_req_gNB(ctxt_pP->module_id, + configuration->ssb_SubcarrierOffset, + configuration->pdsch_AntennaPorts, + configuration->pusch_AntennaPorts, + configuration->sib1_tda, + configuration->minRXTXTIME, + NULL, + NULL, + NULL, + 0, + ue_context_pP->ue_context.rnti, + masterCellGroup); + nr_rrc_data_req(ctxt_pP, DCCH, rrc_gNB_mui++, From e850a8ece7d4da08ca68ab14fc735a98195d54d9 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Fri, 10 Jun 2022 23:18:18 +0100 Subject: [PATCH 3/9] Fix initial connection setup when there is Msg4 retransmissions and UE comes with a new RA with Msg3 carrying DCCH or DTCH message --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 15 +++++++++++++++ .../LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 14 +++++++++++++- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 1 + 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index eb05ec5e83..b2ab03ba59 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -1954,6 +1954,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra // If the UE used MSG3 to transfer a DCCH or DTCH message, then contention resolution is successful upon transmission of PDCCH LOG_I(NR_MAC, "(ue rnti 0x%04x) CBRA procedure succeeded!\n", ra->rnti); nr_clear_ra_proc(module_idP, CC_id, frameP, ra); + UE->Msg3_dcch_dtch = true; UE->Msg4_ACKed = true; remove_front_nr_list(&sched_ctrl->feedback_dl_harq); @@ -1962,6 +1963,20 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra add_tail_nr_list(&sched_ctrl->available_dl_harq, current_harq_pid); harq->round = 0; harq->ndi ^= 1; + + // Pause scheduling according to: + // 3GPP TS 38.331 Section 12 Table 12.1-1: UE performance requirements for RRC procedures for UEs + const NR_COMMON_channels_t *common_channels = &RC.nrmac[module_idP]->common_channels[0]; + const NR_SIB1_t *sib1 = common_channels->sib1 ? common_channels->sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL; + const NR_ServingCellConfig_t *servingCellConfig = UE->CellGroup ? UE->CellGroup->spCellConfig->spCellConfigDedicated : NULL; + NR_BWP_t *genericParameters = get_dl_bwp_genericParameters(sched_ctrl->active_bwp, + common_channels->ServingCellConfigCommon, + sib1); + uint32_t delay_ms = servingCellConfig && servingCellConfig->downlinkBWP_ToAddModList ? + NR_RRC_SETUP_DELAY_MS + NR_RRC_BWP_SWITCHING_DELAY_MS : NR_RRC_SETUP_DELAY_MS; + + sched_ctrl->rrc_processing_timer = (delay_ms << genericParameters->subcarrierSpacing); + LOG_I(NR_MAC, "(%d.%d) Activating RRC processing timer for UE %04x with %d ms\n", frameP, slotP, UE->rnti, delay_ms); } else { ra->state = WAIT_Msg4_ACK; LOG_D(NR_MAC,"[gNB %d][RAPROC] Frame %d, Subframe %d: RA state %d\n", module_idP, frameP, slotP, ra->state); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 49cd9f180f..0733e84147 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2919,7 +2919,19 @@ void nr_mac_update_timers(module_id_t module_id, // If needed, update the Dedicated BWP const int current_bwp_id = sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0; const int current_ubwp_id = sched_ctrl->active_ubwp ? sched_ctrl->active_ubwp->bwp_Id : 0; - if (spCellConfigDedicated && + if (UE->Msg3_dcch_dtch) { + // Must use Initial Downlink BWP when there is RA with Msg3 through DCCH + sched_ctrl->active_bwp = NULL; + if (current_bwp_id != 0) { + LOG_I(NR_MAC, "Changing to Initial DL-BWP\n"); + } + // Must use Initial Uplink BWP when there is RA with Msg3 through DCCH + sched_ctrl->active_ubwp = NULL; + if (current_ubwp_id != 0) { + LOG_I(NR_MAC, "Changing to Initial UL-BWP\n"); + } + UE->Msg3_dcch_dtch = false; + } else if (spCellConfigDedicated && spCellConfigDedicated->downlinkBWP_ToAddModList && spCellConfigDedicated->uplinkConfig && spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList) { diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 1d0d9750e6..3425b3a391 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -717,6 +717,7 @@ typedef struct { // UE selected beam index uint8_t UE_beam_index; bool Msg4_ACKed; + bool Msg3_dcch_dtch; /// Sched CSI-RS: scheduling decisions NR_gNB_UCI_STATS_t uci_statS; float ul_thr_ue; From 983760e9a4336ae5c868978e04fadaf2e09cc8a5 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Mon, 13 Jun 2022 08:21:05 +0100 Subject: [PATCH 4/9] Fix after merge with develop --- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 24 ------------------- 1 file changed, 24 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 3f24f91bfc..f13922d5fb 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2946,30 +2946,6 @@ void nr_mac_update_timers(module_id_t module_id, compute_csi_bitlen (cg->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup, UE); } - // update coreset/searchspace - int target_ss = NR_SearchSpace__searchSpaceType_PR_common; - NR_BWP_t *genericParameters = NULL; - if (sched_ctrl->active_bwp) { - target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific; - bwpd = (void*)sched_ctrl->active_bwp->bwp_Dedicated; - genericParameters = &sched_ctrl->active_bwp->bwp_Common->genericParameters; - } - else if (cg->spCellConfig && - cg->spCellConfig->spCellConfigDedicated && - (cg->spCellConfig->spCellConfigDedicated->initialDownlinkBWP)) { - target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific; - genericParameters = &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters; - } - NR_BCCH_DL_SCH_Message_t *SIB1 = RC.nrmac[module_id]->common_channels[0].sib1; - sched_ctrl->search_space = get_searchspace(SIB1 ? SIB1->message.choice.c1->choice.systemInformationBlockType1 : NULL, scc, bwpd, target_ss); - sched_ctrl->coreset = get_coreset(RC.nrmac[module_id], scc, bwpd, sched_ctrl->search_space, target_ss); - sched_ctrl->sched_pdcch = set_pdcch_structure(RC.nrmac[module_id], - sched_ctrl->search_space, - sched_ctrl->coreset, - scc, - genericParameters, - RC.nrmac[module_id]->type0_PDCCH_CSS_config); - NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static; const uint8_t layers = set_dl_nrOfLayers(sched_ctrl); const int tda = get_dl_tda(RC.nrmac[module_id], scc, slot); From 7cee46777fa9c09a3db3f9d14a9c11ba6b7b6833 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Mon, 13 Jun 2022 23:20:37 +0100 Subject: [PATCH 5/9] Cosmetic changes --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 14 ++++++++------ openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index f13922d5fb..43ad09f45e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2887,15 +2887,17 @@ void nr_mac_update_timers(module_id_t module_id, const int current_bwp_id = sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0; const int current_ubwp_id = sched_ctrl->active_ubwp ? sched_ctrl->active_ubwp->bwp_Id : 0; if (UE->Msg3_dcch_dtch) { - // Must use Initial Downlink BWP when there is RA with Msg3 through DCCH + // 3GPP TS 38.321 Section 5.15 Bandwidth Part (BWP) operation + // Currently there are no PRACH occasions configured for any Dedicated BWP, so UE will switch to the initialDownlinkBWP sched_ctrl->active_bwp = NULL; if (current_bwp_id != 0) { - LOG_I(NR_MAC, "Changing to Initial DL-BWP\n"); + LOG_I(NR_MAC, "(%d.%d) Switching to initialDownlinkBWP\n", frame, slot); } - // Must use Initial Uplink BWP when there is RA with Msg3 through DCCH + // 3GPP TS 38.321 Section 5.15 Bandwidth Part (BWP) operation + // Currently there are no PRACH occasions configured for any Dedicated BWP, so UE will switch to the initialUplinkBWP sched_ctrl->active_ubwp = NULL; if (current_ubwp_id != 0) { - LOG_I(NR_MAC, "Changing to Initial UL-BWP\n"); + LOG_I(NR_MAC, "(%d.%d) Switching to initialUplinkBWP\n", frame, slot); } UE->Msg3_dcch_dtch = false; } else if (spCellConfigDedicated && @@ -2904,11 +2906,11 @@ void nr_mac_update_timers(module_id_t module_id, spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList) { sched_ctrl->active_bwp = spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[*spCellConfigDedicated->firstActiveDownlinkBWP_Id - 1]; if (*spCellConfigDedicated->firstActiveDownlinkBWP_Id != current_bwp_id) { - LOG_I(NR_MAC, "Changing to DL-BWP %li\n", sched_ctrl->active_bwp->bwp_Id); + LOG_I(NR_MAC, "(%d.%d) Switching to DL-BWP %li\n", frame, slot, sched_ctrl->active_bwp->bwp_Id); } sched_ctrl->active_ubwp = spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[*spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id - 1]; if (*spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id != current_ubwp_id) { - LOG_I(NR_MAC, "Changing to UL-BWP %li\n", sched_ctrl->active_ubwp->bwp_Id); + LOG_I(NR_MAC, "(%d.%d) Switching to UL-BWP %li\n", frame, slot, sched_ctrl->active_ubwp->bwp_Id); } } diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index ad441a31ad..7658441aed 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -716,8 +716,8 @@ typedef struct { int m; // UE selected beam index uint8_t UE_beam_index; - bool Msg4_ACKed; bool Msg3_dcch_dtch; + bool Msg4_ACKed; /// Sched CSI-RS: scheduling decisions NR_gNB_UCI_STATS_t uci_statS; float ul_thr_ue; From ed748750254b78691d2ee965567e325dd3c6147a Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Tue, 14 Jun 2022 11:29:56 +0100 Subject: [PATCH 6/9] Call rrc_mac_config_req_gNB function only when running nr-softmodem as a DU or in monolithic mode --- openair2/RRC/NR/rrc_gNB.c | 52 +++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 9e600b253f..d03e00f8c6 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -734,19 +734,6 @@ rrc_gNB_generate_defaultRRCReconfiguration( NULL, ue_p->masterCellGroup); - rrc_mac_config_req_gNB(rrc->module_id, - rrc->configuration.ssb_SubcarrierOffset, - rrc->configuration.pdsch_AntennaPorts, - rrc->configuration.pusch_AntennaPorts, - rrc->configuration.sib1_tda, - rrc->configuration.minRXTXTIME, - NULL, - NULL, - NULL, - 0, - ue_p->rnti, - ue_p->masterCellGroup); - free(ue_context_pP->ue_context.nas_pdu.buffer); LOG_DUMPMSG(NR_RRC, DEBUG_RRC,(char *)buffer, size, "[MSG] RRC Reconfiguration\n"); @@ -821,6 +808,19 @@ rrc_gNB_generate_defaultRRCReconfiguration( } if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) { + rrc_mac_config_req_gNB(rrc->module_id, + rrc->configuration.ssb_SubcarrierOffset, + rrc->configuration.pdsch_AntennaPorts, + rrc->configuration.pusch_AntennaPorts, + rrc->configuration.sib1_tda, + rrc->configuration.minRXTXTIME, + NULL, + NULL, + NULL, + 0, + ue_p->rnti, + ue_p->masterCellGroup); + uint32_t delay_ms = ue_context_pP->ue_context.masterCellGroup && ue_context_pP->ue_context.masterCellGroup->spCellConfig && ue_context_pP->ue_context.masterCellGroup->spCellConfig->spCellConfigDedicated && @@ -1036,19 +1036,6 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( cellGroupConfig); LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size,"[MSG] RRC Reconfiguration\n"); - rrc_mac_config_req_gNB(rrc->module_id, - rrc->configuration.ssb_SubcarrierOffset, - rrc->configuration.pdsch_AntennaPorts, - rrc->configuration.pusch_AntennaPorts, - rrc->configuration.sib1_tda, - rrc->configuration.minRXTXTIME, - NULL, - NULL, - NULL, - 0, - ue_context_pP->ue_context.rnti, - ue_context_pP->ue_context.masterCellGroup); - /* Free all NAS PDUs */ for (i = 0; i < ue_context_pP->ue_context.nb_of_pdusessions; i++) { if (ue_context_pP->ue_context.pduSession[i].param.nas_pdu.buffer != NULL) { @@ -1087,6 +1074,19 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( #endif if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) { + rrc_mac_config_req_gNB(rrc->module_id, + rrc->configuration.ssb_SubcarrierOffset, + rrc->configuration.pdsch_AntennaPorts, + rrc->configuration.pusch_AntennaPorts, + rrc->configuration.sib1_tda, + rrc->configuration.minRXTXTIME, + NULL, + NULL, + NULL, + 0, + ue_context_pP->ue_context.rnti, + ue_context_pP->ue_context.masterCellGroup); + uint32_t delay_ms = ue_context_pP->ue_context.masterCellGroup && ue_context_pP->ue_context.masterCellGroup->spCellConfig && ue_context_pP->ue_context.masterCellGroup->spCellConfig->spCellConfigDedicated && From 527003492df6ee1e2bc6f57c560ec253feebc748 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Wed, 15 Jun 2022 09:34:55 +0100 Subject: [PATCH 7/9] Revert call to process_CellGroup function in rrc_mac_config_req_gNB to fix F1 user plane working --- openair2/LAYER2/NR_MAC_gNB/config.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 1b33f6c6a4..493a058e13 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -664,6 +664,8 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, UE->enc_rval.failed_type->name, UE->enc_rval.encoded); exit(1); } + + process_CellGroup(CellGroup,&UE->UE_sched_ctrl); } } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT); From cc33856ba863bba69372a5c25945a2fad8b7dec1 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Wed, 15 Jun 2022 17:24:47 +0100 Subject: [PATCH 8/9] Reset HARQ processes after RA when Msg3 carries a DCCH or DTCH message. Reset ul_failure flag only after sending Msg4 otherwise gNB starts scheduling too early --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 4 +++ .../NR_MAC_gNB/gNB_scheduler_primitives.c | 34 +++++++++++++++++++ .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 8 +++-- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 4 +++ 4 files changed, 47 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 2486887fd2..6daa68afed 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -1975,6 +1975,10 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra sched_ctrl->rrc_processing_timer = (delay_ms << genericParameters->subcarrierSpacing); LOG_I(NR_MAC, "(%d.%d) Activating RRC processing timer for UE %04x with %d ms\n", frameP, slotP, UE->rnti, delay_ms); + + // Reset uplink failure flags/counters/timers at MAC so gNB will resume again scheduling resources for this UE + UE->UE_sched_ctrl.pusch_consecutive_dtx_cnt = 0; + UE->UE_sched_ctrl.ul_failure = 0; } else { ra->state = WAIT_Msg4_ACK; LOG_D(NR_MAC,"[gNB %d][RAPROC] Frame %d, Subframe %d: RA state %d\n", module_idP, frameP, slotP, ra->state); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 43ad09f45e..ed9e6b2450 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2492,6 +2492,40 @@ void create_dl_harq_list(NR_UE_sched_ctrl_t *sched_ctrl, } } +void reset_dl_harq_list(NR_UE_sched_ctrl_t *sched_ctrl) { + int harq; + while ((harq = sched_ctrl->feedback_dl_harq.head) >= 0) { + remove_front_nr_list(&sched_ctrl->feedback_dl_harq); + add_tail_nr_list(&sched_ctrl->available_dl_harq, harq); + } + + while ((harq = sched_ctrl->retrans_dl_harq.head) >= 0) { + remove_front_nr_list(&sched_ctrl->retrans_dl_harq); + add_tail_nr_list(&sched_ctrl->available_dl_harq, harq); + } + + for (int i = 0; i < NR_MAX_NB_HARQ_PROCESSES; i++) { + sched_ctrl->harq_processes[i].is_waiting = false; + } +} + +void reset_ul_harq_list(NR_UE_sched_ctrl_t *sched_ctrl) { + int harq; + while ((harq = sched_ctrl->feedback_ul_harq.head) >= 0) { + remove_front_nr_list(&sched_ctrl->feedback_ul_harq); + add_tail_nr_list(&sched_ctrl->available_ul_harq, harq); + } + + while ((harq = sched_ctrl->retrans_ul_harq.head) >= 0) { + remove_front_nr_list(&sched_ctrl->retrans_ul_harq); + add_tail_nr_list(&sched_ctrl->available_ul_harq, harq); + } + + for (int i = 0; i < NR_MAX_NB_HARQ_PROCESSES; i++) { + sched_ctrl->ul_harq_processes[i].is_waiting = false; + } +} + void mac_remove_nr_ue(gNB_MAC_INST *nr_mac, rnti_t rnti) { NR_UEs_t *UE_info = &nr_mac->UE_info; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 495ca765e6..fe921a6d2a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -710,10 +710,12 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, return; } else { // The UE identified by C-RNTI still exists at the gNB - // Reset uplink failure flags/counters/timers at MAC and at RRC so gNB will resume again scheduling resources for this UE - UE_C->UE_sched_ctrl.pusch_consecutive_dtx_cnt = 0; - UE_C->UE_sched_ctrl.ul_failure = 0; + // Reset uplink failure flags/counters/timers at RRC nr_mac_gNB_rrc_ul_failure_reset(gnb_mod_idP, frameP, slotP, ra->crnti); + + // Reset HARQ processes + reset_dl_harq_list(&UE_C->UE_sched_ctrl); + reset_ul_harq_list(&UE_C->UE_sched_ctrl); } } LOG_I(NR_MAC, "Scheduling RA-Msg4 for TC_RNTI 0x%04x (state %d, frame %d, slot %d)\n", diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index b6774756c9..7911275f70 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -472,6 +472,10 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, void create_dl_harq_list(NR_UE_sched_ctrl_t *sched_ctrl, const NR_PDSCH_ServingCellConfig_t *pdsch); +void reset_dl_harq_list(NR_UE_sched_ctrl_t *sched_ctrl); + +void reset_ul_harq_list(NR_UE_sched_ctrl_t *sched_ctrl); + void handle_nr_ul_harq(const int CC_idP, module_id_t mod_id, frame_t frame, From 9e27394ecc6afcc1ca2826f6abbf9466d82a69e9 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Fri, 17 Jun 2022 10:33:36 +0100 Subject: [PATCH 9/9] Reset feedback_slot and round values when resetting HARQ processes --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index ed9e6b2450..84bd2891bf 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2505,6 +2505,8 @@ void reset_dl_harq_list(NR_UE_sched_ctrl_t *sched_ctrl) { } for (int i = 0; i < NR_MAX_NB_HARQ_PROCESSES; i++) { + sched_ctrl->harq_processes[i].feedback_slot = -1; + sched_ctrl->harq_processes[i].round = 0; sched_ctrl->harq_processes[i].is_waiting = false; } } @@ -2522,6 +2524,8 @@ void reset_ul_harq_list(NR_UE_sched_ctrl_t *sched_ctrl) { } for (int i = 0; i < NR_MAX_NB_HARQ_PROCESSES; i++) { + sched_ctrl->ul_harq_processes[i].feedback_slot = -1; + sched_ctrl->ul_harq_processes[i].round = 0; sched_ctrl->ul_harq_processes[i].is_waiting = false; } }