From 6e7c06158662e39ac2a5e1c02bf2aa5698a8f975 Mon Sep 17 00:00:00 2001 From: francescomani Date: Tue, 16 Nov 2021 18:31:45 +0100 Subject: [PATCH 1/3] fix rsrp meas report on screen --- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 3 ++- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 2 +- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 2 +- openair2/LAYER2/NR_MAC_gNB/main.c | 11 ++++++----- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index cfa8b88f32..cf5afbf105 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -2095,7 +2095,8 @@ void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, in } // CSI - if (mac->ra.ra_state == RA_SUCCEEDED) + if (mac->ra.ra_state == RA_SUCCEEDED || + get_softmodem_params()->phy_test == 1) O_CSI = nr_get_csi_measurements(mac, frameP, slotP, pucch); // ACKNACK diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index b62f8e0282..4c0e9dab9f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -347,7 +347,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, if ((slot == 0) && (frame & 127) == 0) { stats_output[0]='\0'; - dump_mac_stats(RC.nrmac[module_idP],stats_output,16384); + dump_mac_stats(RC.nrmac[module_idP],stats_output,16384,true); LOG_I(NR_MAC,"Frame.Slot %d.%d\n%s\n",frame,slot,stats_output); } diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 3b275ca8a0..62d70f4f2c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -442,5 +442,5 @@ bool nr_find_nb_rb(uint16_t Qm, void nr_sr_reporting(int Mod_idP, frame_t frameP, sub_frame_t slotP); -void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen); +void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen, bool reset_rsrp); #endif /*__LAYER2_NR_MAC_PROTO_H__*/ diff --git a/openair2/LAYER2/NR_MAC_gNB/main.c b/openair2/LAYER2/NR_MAC_gNB/main.c index 0089263620..6e2b09cc4f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/main.c +++ b/openair2/LAYER2/NR_MAC_gNB/main.c @@ -57,7 +57,7 @@ void *nrmac_stats_thread(void *arg) { AssertFatal(fd!=NULL,"Cannot open nrMAC_stats.log, error %s\n",strerror(errno)); while (oai_exit == 0) { - dump_mac_stats(gNB,output,MACSTATSSTRLEN); + dump_mac_stats(gNB,output,MACSTATSSTRLEN,false); fprintf(fd,"%s\n",output); fflush(fd); usleep(200000); @@ -71,7 +71,7 @@ void clear_mac_stats(gNB_MAC_INST *gNB) { memset((void*)gNB->UE_info.mac_stats,0,MAX_MOBILES_PER_GNB*sizeof(NR_mac_stats_t)); } -void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen) +void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen, bool reset_rsrp) { NR_UE_info_t *UE_info = &gNB->UE_info; int num = 1; @@ -102,9 +102,10 @@ void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen) stats->pucch0_DTX, sched_ctrl->dl_bler_stats.bler, sched_ctrl->dl_bler_stats.mcs); - - stats->num_rsrp_meas = 0; - stats->cumul_rsrp = 0 ; + if (reset_rsrp) { + stats->num_rsrp_meas = 0; + stats->cumul_rsrp = 0; + } stroff+=sprintf(output+stroff,"UE %d: dlsch_total_bytes %d\n", UE_id, stats->dlsch_total_bytes); stroff+=sprintf(output+stroff,"UE %d: ulsch_rounds %d/%d/%d/%d, ulsch_DTX %d, ulsch_errors %d\n", UE_id, From 72f6489f67cdc6b7eb9d02f17c5403f59763f203 Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 17 Nov 2021 12:17:47 +0100 Subject: [PATCH 2/3] minor log improvement --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index e226a2992d..f60bf1bd37 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -872,12 +872,12 @@ uint8_t pickandreverse_bits(uint8_t *payload, uint16_t bitlen, uint8_t start_bit void evaluate_rsrp_report(NR_UE_info_t *UE_info, - NR_UE_sched_ctrl_t *sched_ctrl, - int UE_id, - uint8_t csi_report_id, - uint8_t *payload, - int *cumul_bits, - NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type){ + NR_UE_sched_ctrl_t *sched_ctrl, + int UE_id, + uint8_t csi_report_id, + uint8_t *payload, + int *cumul_bits, + NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type){ uint8_t cri_ssbri_bitlen = UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen; uint16_t curr_payload; @@ -907,14 +907,17 @@ void evaluate_rsrp_report(NR_UE_info_t *UE_info, curr_payload = pickandreverse_bits(payload, cri_ssbri_bitlen, *cumul_bits); if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI[csi_ssb_idx] = *(UE_info->csi_report_template[UE_id][csi_report_id].SSB_Index_list[cri_ssbri_bitlen>0?((curr_payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); else - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI[csi_ssb_idx] = *(UE_info->csi_report_template[UE_id][csi_report_id].CSI_Index_list[cri_ssbri_bitlen>0?((curr_payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); *cumul_bits += cri_ssbri_bitlen; - LOG_D(MAC,"SSB_index = %d\n",sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx]); + if(UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type == NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP) + LOG_D(MAC,"CSI-RS Resource Indicator = %d\n",sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI[csi_ssb_idx]); + else + LOG_D(MAC,"SSB Resource Indicator = %d\n",sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI[csi_ssb_idx]); } curr_payload = pickandreverse_bits(payload, 7, *cumul_bits); @@ -1156,7 +1159,7 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, } if ((uci_234->pduBitmap >> 2) & 0x01) { //API to parse the csi report and store it into sched_ctrl - extract_pucch_csi_report (csi_MeasConfig, uci_234, frame, slot, UE_id, mod_id); + extract_pucch_csi_report(csi_MeasConfig, uci_234, frame, slot, UE_id, mod_id); //TCI handling function tci_handling(mod_id, UE_id,frame, slot); } From 710b24968e27514a47b5d6f437a43a1e3bf8dbca Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 17 Nov 2021 14:33:45 +0100 Subject: [PATCH 3/3] move rsrp stats to evaluate_rsrp_report --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index f60bf1bd37..1ec0dfbc10 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -702,7 +702,6 @@ void tci_handling(module_id_t Mod_idP, int UE_id, frame_t frame, slot_t slot) { uint8_t diff_rsrp_idx = 0; uint8_t i, j; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; - NR_mac_stats_t *stats = &UE_info->mac_stats[UE_id]; if (n_dl_bwp < 4) pdsch_bwp_id = bwp_id; @@ -728,9 +727,6 @@ void tci_handling(module_id_t Mod_idP, int UE_id, frame_t frame, slot_t slot) { //if strongest measured RSRP is configured strongest_ssb_rsrp = get_measured_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP); - // including ssb rsrp in mac stats - stats->cumul_rsrp += strongest_ssb_rsrp; - stats->num_rsrp_meas++; ssb_rsrp[idx * nb_of_csi_ssb_report] = strongest_ssb_rsrp; LOG_D(NR_MAC,"ssb_rsrp = %d\n",strongest_ssb_rsrp); @@ -930,9 +926,14 @@ void evaluate_rsrp_report(NR_UE_info_t *UE_info, *cumul_bits += 4; } UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report++; + int strongest_ssb_rsrp = get_measured_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP); + NR_mac_stats_t *stats = &UE_info->mac_stats[UE_id]; + // including ssb rsrp in mac stats + stats->cumul_rsrp += strongest_ssb_rsrp; + stats->num_rsrp_meas++; LOG_D(MAC,"rsrp_id = %d rsrp = %d\n", sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP, - get_measured_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP)); + strongest_ssb_rsrp); }