From 2a3a27a48f25282fa4fa0e80d5411bb8753710ed Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 15 Dec 2025 16:14:50 +0100 Subject: [PATCH] fix CORESET start PRB according to standard at OAI gNB --- openair1/PHY/NR_TRANSPORT/nr_dci.c | 12 ++++++++---- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 3 ++- .../LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index 28d22b31bb..12bff45dee 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -61,9 +61,13 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, int reg_list[MAX_DCI_CORESET][NR_MAX_PDCCH_AGG_LEVEL * NR_NB_REG_PER_CCE]; nr_fill_reg_list(reg_list, pdcch_pdu_rel15); // compute rb_offset and n_prb based on frequency allocation - int rb_offset; - int n_rb; - get_coreset_rballoc(pdcch_pdu_rel15->FreqDomainResource,&n_rb,&rb_offset); + int n_rb, cset_start; + get_coreset_rballoc(pdcch_pdu_rel15->FreqDomainResource, &n_rb, &cset_start); + int additional_offset = 0; + // first common RB of the first group of 6 PRBs has common RB index equal to 6 * ⌈BWP_start / 6⌉ + if (pdcch_pdu_rel15->CoreSetType == 1) + additional_offset = (pdcch_pdu_rel15->BWPStart + 5) / 6 * 6 - pdcch_pdu_rel15->BWPStart; + int rb_offset = cset_start + additional_offset; uint16_t cset_start_sc = frame_parms->first_carrier_offset + (pdcch_pdu_rel15->BWPStart + rb_offset) * NR_NB_SC_PER_RB; int idx1 = pdcch_pdu_rel15->StartSymbolIndex+pdcch_pdu_rel15->DurationSymbols; int idx2 = (((n_rb + rb_offset + pdcch_pdu_rel15->BWPStart) * 3) + 15) & ~15; @@ -194,7 +198,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, // dmrs index depends on reference point for k according to 38.211 7.4.1.3.2 int dmrs_idx; if (pdcch_pdu_rel15->CoreSetType == NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG) - dmrs_idx = (reg_list[d][reg_count] + pdcch_pdu_rel15->BWPStart) * 3; + dmrs_idx = (reg_list[d][reg_count] + pdcch_pdu_rel15->BWPStart + rb_offset) * 3; else dmrs_idx = (reg_list[d][reg_count] + rb_offset) * 3; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 00c41953a1..43d36f0515 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -404,7 +404,8 @@ bwp_info_t get_pdsch_bwp_start_size(gNB_MAC_INST *nr_mac, NR_UE_info_t *UE) if (sched_ctrl->coreset->controlResourceSetId == 0) { bwp_info.bwpStart = nr_mac->cset0_bwp_start; } else { - bwp_info.bwpStart = dl_bwp->BWPStart + sched_ctrl->sched_pdcch.rb_start; + int additional_offset = (dl_bwp->BWPStart + 5) / 6 * 6 - dl_bwp->BWPStart; + bwp_info.bwpStart = dl_bwp->BWPStart + sched_ctrl->sched_pdcch.rb_start + additional_offset; } if (nr_mac->cset0_bwp_size > 0) { bwp_info.bwpSize = min(dl_bwp->BWPSize, nr_mac->cset0_bwp_size); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index f9a099d79b..97feb06b81 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -454,6 +454,7 @@ static NR_SearchSpace_t *get_searchspace(NR_ServingCellConfigCommon_t *scc, /// @param rb_start Output parameter for the starting resource block index of the CORESET static void get_coreset_rb_params(const NR_ControlResourceSet_t *coreset, uint16_t *n_rb, uint16_t *rb_start) { + AssertFatal(!coreset->ext1 || !coreset->ext1->rb_Offset_r16, "rb-Offset in coreset configuration not handled\n"); *n_rb = 0; *rb_start = 0;