From 6f394db3a1083820d6f87c1cc2d47d179b0bcf98 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Sun, 8 Oct 2023 18:53:50 +0200 Subject: [PATCH] Respect do_precoding variable, print correct precoding stats Reformat code to properly copy memory if we skip precoding. precoding_stats timing is not part of ru->feptx_ofdm, but ru->feptx_prec, so always print it. Previously, in order to speed up processing if precoding is disabled, we just copy the pointer from txdataF to txdataF_BF, as opposed to do a full memcpy() to duplicate the data. The same happens if we cannot have precoding, i.e., in SISO. This has implications such as memory leaks, which is why this is not being done. However, the code comment is intentionally placed there. --- executables/nr-gnb.c | 5 +++- openair1/SCHED_NR/nr_ru_procedures.c | 34 ++++++++++++---------------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index 2b2c5306b8..2fec690854 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -361,8 +361,11 @@ static size_t dump_L1_meas_stats(PHY_VARS_gNB *gNB, RU_t *ru, char *output, size if (ru->feprx) output += print_meas_log(&ru->ofdm_demod_stats, "feprx", NULL, NULL, output, end - output); - if (ru->feptx_ofdm) { + if (ru->feptx_prec) { output += print_meas_log(&ru->precoding_stats,"feptx_prec",NULL,NULL, output, end - output); + } + + if (ru->feptx_ofdm) { output += print_meas_log(&ru->txdataF_copy_stats,"txdataF_copy",NULL,NULL, output, end - output); output += print_meas_log(&ru->ofdm_mod_stats,"feptx_ofdm",NULL,NULL, output, end - output); output += print_meas_log(&ru->ofdm_total_stats,"feptx_total",NULL,NULL, output, end - output); diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index 08ed56db8d..fbf89e5101 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -188,27 +188,23 @@ void nr_feptx_prec(RU_t *ru,int frame_tx,int tti_tx) { if (nr_slot_select(cfg,frame_tx,slot_tx) == NR_UPLINK_SLOT) return; - for(i=0; inb_log_antennas; ++i) { - memcpy((void*)ru->common.txdataF[i], - (void*)&gNB->common_vars.txdataF[i][txdataF_offset], - fp->samples_per_slot_wCP*sizeof(int32_t)); - if (ru->do_precoding == 1) + if (!ru->do_precoding || (ru->nb_tx == 1 && ru->nb_log_antennas == 1)) { + for (i = 0; i < ru->nb_log_antennas; ++i) { + //ru->common.txdataF_BF[i] = (int32_t *)&gNB->common_vars.txdataF[i][txdataF_offset]; + memcpy(ru->common.txdataF_BF[i], + &gNB->common_vars.txdataF[i][txdataF_offset], + fp->samples_per_slot_wCP*sizeof(int32_t)); + } + } + else { + for(i=0; inb_log_antennas; ++i) { + memcpy((void*)ru->common.txdataF[i], + (void*)&gNB->common_vars.txdataF[i][txdataF_offset], + fp->samples_per_slot_wCP*sizeof(int32_t)); memcpy((void*)&ru->common.beam_id[i][slot_tx*fp->symbols_per_slot], (void*)&gNB->common_vars.beam_id[i][slot_tx*fp->symbols_per_slot], fp->symbols_per_slot*sizeof(uint8_t)); - } - - if (ru->nb_tx == 1 && ru->nb_log_antennas == 1) { - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC , 1); - - memcpy((void*)ru->common.txdataF_BF[0], - (void*)ru->common.txdataF[0], - fp->samples_per_slot_wCP*sizeof(int32_t)); - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC , 0); - }// if (ru->nb_tx == 1) - else { + } bw = ru->beam_weights[0]; for (l=0;lsymbols_per_slot;l++) { for (aa=0;aanb_tx;aa++) { @@ -223,7 +219,7 @@ void nr_feptx_prec(RU_t *ru,int frame_tx,int tti_tx) { 0); }// for (aa=0;aanb_tx;aa++) }// for (l=0;lsymbols_per_slot;l++) - }// if (ru->nb_tx == 1) + }// ru->do_precoding }// if (ru->num_gNB == 1) stop_meas(&ru->precoding_stats); }