Commit cc52682b authored by Roberto Louro Magueta's avatar Roberto Louro Magueta

Fix SRS stats depending on SRS usage

parent 51c95d27
...@@ -2434,6 +2434,12 @@ void delete_nr_ue_data(NR_UE_info_t *UE, NR_COMMON_channels_t *ccPtr) ...@@ -2434,6 +2434,12 @@ void delete_nr_ue_data(NR_UE_info_t *UE, NR_COMMON_channels_t *ccPtr)
} }
} }
void reset_srs_stats(NR_UE_info_t *UE) {
if (UE) {
UE->mac_stats.srs_stats[0] = '\0';
}
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
NR_UE_info_t *add_new_nr_ue(gNB_MAC_INST *nr_mac, rnti_t rntiP, NR_CellGroupConfig_t *CellGroup) NR_UE_info_t *add_new_nr_ue(gNB_MAC_INST *nr_mac, rnti_t rntiP, NR_CellGroupConfig_t *CellGroup)
{ {
...@@ -2538,6 +2544,8 @@ NR_UE_info_t *add_new_nr_ue(gNB_MAC_INST *nr_mac, rnti_t rntiP, NR_CellGroupConf ...@@ -2538,6 +2544,8 @@ NR_UE_info_t *add_new_nr_ue(gNB_MAC_INST *nr_mac, rnti_t rntiP, NR_CellGroupConf
create_nr_list(&sched_ctrl->feedback_ul_harq, 16); create_nr_list(&sched_ctrl->feedback_ul_harq, 16);
create_nr_list(&sched_ctrl->retrans_ul_harq, 16); create_nr_list(&sched_ctrl->retrans_ul_harq, 16);
reset_srs_stats(UE);
pthread_mutex_lock(&UE_info->mutex); pthread_mutex_lock(&UE_info->mutex);
int i; int i;
for(i=0; i<MAX_MOBILES_PER_GNB; i++) for(i=0; i<MAX_MOBILES_PER_GNB; i++)
...@@ -2954,6 +2962,8 @@ void nr_mac_update_timers(module_id_t module_id, ...@@ -2954,6 +2962,8 @@ void nr_mac_update_timers(module_id_t module_id,
if (sched_ctrl->rrc_processing_timer == 0) { if (sched_ctrl->rrc_processing_timer == 0) {
LOG_I(NR_MAC, "(%d.%d) De-activating RRC processing timer for UE %04x\n", frame, slot, UE->rnti); LOG_I(NR_MAC, "(%d.%d) De-activating RRC processing timer for UE %04x\n", frame, slot, UE->rnti);
reset_srs_stats(UE);
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; 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 = UE->CellGroup;
NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon; NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon;
......
...@@ -785,6 +785,9 @@ void handle_nr_srs_measurements(const module_id_t module_id, ...@@ -785,6 +785,9 @@ void handle_nr_srs_measurements(const module_id_t module_id,
return; return;
} }
gNB_MAC_INST *nr_mac = RC.nrmac[module_id];
NR_mac_stats_t *stats = &UE->mac_stats;
switch (srs_ind->srs_usage) { switch (srs_ind->srs_usage) {
case NR_SRS_ResourceSet__usage_beamManagement: { case NR_SRS_ResourceSet__usage_beamManagement: {
...@@ -809,9 +812,7 @@ void handle_nr_srs_measurements(const module_id_t module_id, ...@@ -809,9 +812,7 @@ void handle_nr_srs_measurements(const module_id_t module_id,
} }
#endif #endif
gNB_MAC_INST *nr_mac = RC.nrmac[module_id]; sprintf(stats->srs_stats,"UL-SNR %i dB", (nr_srs_beamforming_report->wide_band_snr>>1)-64);
NR_mac_stats_t *stats = &UE->mac_stats;
stats->srs_wide_band_snr = (nr_srs_beamforming_report->wide_band_snr>>1)-64;
int ul_prbblack_SNR_threshold = nr_mac->ul_prbblack_SNR_threshold; int ul_prbblack_SNR_threshold = nr_mac->ul_prbblack_SNR_threshold;
uint16_t *ulprbbl = nr_mac->ulprbbl; uint16_t *ulprbbl = nr_mac->ulprbbl;
...@@ -836,7 +837,8 @@ void handle_nr_srs_measurements(const module_id_t module_id, ...@@ -836,7 +837,8 @@ void handle_nr_srs_measurements(const module_id_t module_id,
NR_pusch_semi_static_t *ps = &sched_ctrl->pusch_semi_static; NR_pusch_semi_static_t *ps = &sched_ctrl->pusch_semi_static;
ps->srs_feedback.sri = NR_SRS_SRI_0; ps->srs_feedback.sri = NR_SRS_SRI_0;
ps->srs_feedback.tpmi = 0; ps->srs_feedback.tpmi = 0;
uint8_t ul_ri = 0;
sprintf(stats->srs_stats,"UL-RI %d, TPMI %d", ul_ri+1, ps->srs_feedback.tpmi);
break; break;
} }
......
...@@ -84,14 +84,14 @@ void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen, bool reset_rsrp ...@@ -84,14 +84,14 @@ void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen, bool reset_rsrp
NR_mac_stats_t *stats = &UE->mac_stats; NR_mac_stats_t *stats = &UE->mac_stats;
const int avg_rsrp = stats->num_rsrp_meas > 0 ? stats->cumul_rsrp / stats->num_rsrp_meas : 0; const int avg_rsrp = stats->num_rsrp_meas > 0 ? stats->cumul_rsrp / stats->num_rsrp_meas : 0;
stroff+=sprintf(output+stroff,"UE RNTI %04x (%d) PH %d dB PCMAX %d dBm, average RSRP %d (%d meas), UL-SNR %d dB\n", stroff+=sprintf(output+stroff,"UE RNTI %04x (%d) PH %d dB PCMAX %d dBm, average RSRP %d (%d meas)\n",
UE->rnti, UE->rnti,
num++, num++,
sched_ctrl->ph, sched_ctrl->ph,
sched_ctrl->pcmax, sched_ctrl->pcmax,
avg_rsrp, avg_rsrp,
stats->num_rsrp_meas, stats->num_rsrp_meas);
stats->srs_wide_band_snr);
stroff+=sprintf(output+stroff,"UE %04x: CQI %d, RI %d, PMI (%d,%d)\n", stroff+=sprintf(output+stroff,"UE %04x: CQI %d, RI %d, PMI (%d,%d)\n",
UE->rnti, UE->rnti,
UE->UE_sched_ctrl.CSI_report.cri_ri_li_pmi_cqi_report.wb_cqi_1tb, UE->UE_sched_ctrl.CSI_report.cri_ri_li_pmi_cqi_report.wb_cqi_1tb,
...@@ -99,15 +99,19 @@ void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen, bool reset_rsrp ...@@ -99,15 +99,19 @@ void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen, bool reset_rsrp
UE->UE_sched_ctrl.CSI_report.cri_ri_li_pmi_cqi_report.pmi_x1, UE->UE_sched_ctrl.CSI_report.cri_ri_li_pmi_cqi_report.pmi_x1,
UE->UE_sched_ctrl.CSI_report.cri_ri_li_pmi_cqi_report.pmi_x2); UE->UE_sched_ctrl.CSI_report.cri_ri_li_pmi_cqi_report.pmi_x2);
if (stats->srs_stats[0] != '\0') {
stroff+=sprintf(output+stroff,"UE %04x: %s\n", UE->rnti, stats->srs_stats);
}
stroff+=sprintf(output+stroff,"UE %04x: dlsch_rounds %"PRIu64"/%"PRIu64"/%"PRIu64"/%"PRIu64", dlsch_errors %"PRIu64", pucch0_DTX %d, BLER %.5f MCS %d\n", stroff+=sprintf(output+stroff,"UE %04x: dlsch_rounds %"PRIu64"/%"PRIu64"/%"PRIu64"/%"PRIu64", dlsch_errors %"PRIu64", pucch0_DTX %d, BLER %.5f MCS %d\n",
UE->rnti, UE->rnti,
stats->dl.rounds[0], stats->dl.rounds[1], stats->dl.rounds[0], stats->dl.rounds[1],
stats->dl.rounds[2], stats->dl.rounds[3], stats->dl.rounds[2], stats->dl.rounds[3],
stats->dl.errors, stats->dl.errors,
stats->pucch0_DTX, stats->pucch0_DTX,
sched_ctrl->dl_bler_stats.bler, sched_ctrl->dl_bler_stats.bler,
sched_ctrl->dl_bler_stats.mcs); sched_ctrl->dl_bler_stats.mcs);
if (reset_rsrp) { if (reset_rsrp) {
stats->num_rsrp_meas = 0; stats->num_rsrp_meas = 0;
stats->cumul_rsrp = 0; stats->cumul_rsrp = 0;
......
...@@ -694,7 +694,7 @@ typedef struct NR_mac_stats { ...@@ -694,7 +694,7 @@ typedef struct NR_mac_stats {
uint32_t pucch0_DTX; uint32_t pucch0_DTX;
int cumul_rsrp; int cumul_rsrp;
uint8_t num_rsrp_meas; uint8_t num_rsrp_meas;
int8_t srs_wide_band_snr; char srs_stats[50]; // Statistics may differ depending on SRS usage
} NR_mac_stats_t; } NR_mac_stats_t;
typedef struct NR_bler_options { typedef struct NR_bler_options {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment