From 0965e86aca07c3091eab8755f6c83f6c4d20b202 Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 15 Jun 2023 16:49:11 +0200 Subject: [PATCH] schedule CSI-RS only once per BWP --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 2 +- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 18 ++++++++++++------ openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 3 ++- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 3f1ea001b3..0d213c6826 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -60,7 +60,7 @@ const int get_dl_tda(const gNB_MAC_INST *nrmac, const NR_ServingCellConfigCommon AssertFatal(tdd || nrmac->common_channels->frame_type == FDD, "Dynamic TDD not handled yet\n"); // Use special TDA in case of CSI-RS - if(nrmac->UE_info.sched_csirs) + if(nrmac->UE_info.sched_csirs > 0) return 1; if (tdd && tdd->nrofDownlinkSymbols > 1) { // if there is a mixed slot where we can transmit DL diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index f60e79dd11..68a44fa0cf 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2552,18 +2552,23 @@ void nr_csirs_scheduling(int Mod_idP, frame_t frame, sub_frame_t slot, int n_slo uint16_t *vrb_map = gNB_mac->common_channels[CC_id].vrb_map; - UE_info->sched_csirs = false; + UE_info->sched_csirs = 0; UE_iterator(UE_info->list, UE) { + NR_UE_DL_BWP_t *dl_bwp = &UE->current_DL_BWP; + NR_UE_UL_BWP_t *ul_bwp = &UE->current_UL_BWP; + // CSI-RS is common to all UEs in a given BWP + // therefore we need to schedule only once per BWP + // the following condition verifies if CSI-RS + // has been already scheduled in this BWP + if (UE_info->sched_csirs & (1 << dl_bwp->bwp_id)) + continue; NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; if (sched_ctrl->rrc_processing_timer > 0) { continue; } - NR_UE_DL_BWP_t *dl_bwp = &UE->current_DL_BWP; - NR_UE_UL_BWP_t *ul_bwp = &UE->current_UL_BWP; - if (!ul_bwp->csi_MeasConfig) continue; NR_CSI_MeasConfig_t *csi_measconfig = ul_bwp->csi_MeasConfig; @@ -2598,8 +2603,9 @@ void nr_csirs_scheduling(int Mod_idP, frame_t frame, sub_frame_t slot, int n_slo if((frame*n_slots_frame+slot-offset)%period == 0) { - LOG_D(NR_MAC,"Scheduling CSI-RS in frame %d slot %d Resource ID %ld\n",frame,slot,nzpcsi->nzp_CSI_RS_ResourceId); - UE_info->sched_csirs = true; + LOG_D(NR_MAC,"Scheduling CSI-RS in frame %d slot %d Resource ID %ld\n", + frame, slot, nzpcsi->nzp_CSI_RS_ResourceId); + UE_info->sched_csirs |= (1 << dl_bwp->bwp_id); nfapi_nr_dl_tti_request_pdu_t *dl_tti_csirs_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; memset((void*)dl_tti_csirs_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 7db2225da8..4e30c74a5c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -691,7 +691,8 @@ typedef struct { // last element always NULL pthread_mutex_t mutex; NR_UE_info_t *list[MAX_MOBILES_PER_GNB+1]; - bool sched_csirs; + // bitmap of CSI-RS already scheduled in current slot + int sched_csirs; uid_allocator_t uid_allocator; } NR_UEs_t;