From 2070a3305f770a508587546cd1452acd74e3264e Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Mon, 22 Jul 2019 17:10:52 +0200 Subject: [PATCH 01/30] mapping each ssb to a different logical antenna port --- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index fdd8baea92..3a330756a6 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -120,19 +120,20 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) { nr_set_ssb_first_subcarrier(cfg, fp); // setting the first subcarrier + // it is supposed that each logical antenna port correspont to a different beam so each SSB is stored into its own index of txdataF LOG_D(PHY,"SS TX: frame %d, slot %d, start_symbol %d\n",frame,slot, ssb_start_symbol); - nr_generate_pss(gNB->d_pss, txdataF[0], AMP, ssb_start_symbol, cfg, fp); - nr_generate_sss(gNB->d_sss, txdataF[0], AMP, ssb_start_symbol, cfg, fp); + nr_generate_pss(gNB->d_pss, txdataF[ssb_index], AMP, ssb_start_symbol, cfg, fp); + nr_generate_sss(gNB->d_sss, txdataF[ssb_index], AMP, ssb_start_symbol, cfg, fp); if (fp->Lmax == 4) - nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[n_hf][ssb_index],txdataF[0], AMP, ssb_start_symbol, cfg, fp); + nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[n_hf][ssb_index],txdataF[ssb_index], AMP, ssb_start_symbol, cfg, fp); else - nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[0][ssb_index],txdataF[0], AMP, ssb_start_symbol, cfg, fp); + nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[0][ssb_index],txdataF[ssb_index], AMP, ssb_start_symbol, cfg, fp); nr_generate_pbch(&gNB->pbch, pbch_pdu, gNB->nr_pbch_interleaver, - txdataF[0], + txdataF[ssb_index], AMP, ssb_start_symbol, n_hf,fp->Lmax,ssb_index, @@ -186,7 +187,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, if (nfapi_mode == 0 || nfapi_mode == 1) { nr_generate_dci_top(gNB->pdcch_vars, gNB->nr_gold_pdcch_dmrs[slot], - gNB->common_vars.txdataF[0], + gNB->common_vars.txdataF[0], // hardcoded to beam 0 AMP, *fp, *cfg); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PDCCH_TX,0); if (num_pdsch_rnti) { From 4c0d814873977ab53bf5b83cf181f62201451a64 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Fri, 26 Jul 2019 15:42:48 +0200 Subject: [PATCH 02/30] CI: dummy commit to re-run CI job Signed-off-by: Raphael Defosseux --- openair1/PHY/INIT/nr_parms.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/openair1/PHY/INIT/nr_parms.c b/openair1/PHY/INIT/nr_parms.c index 548c9c0fe7..a2724d5268 100644 --- a/openair1/PHY/INIT/nr_parms.c +++ b/openair1/PHY/INIT/nr_parms.c @@ -236,14 +236,14 @@ int nr_init_frame_parms0(NR_DL_FRAME_PARMS *fp, fp->freq_range = (fp->dl_CarrierFreq < 6e9)? nr_FR1 : nr_FR2; // definition of Lmax according to ts 38.213 section 4.1 - if (fp->dl_CarrierFreq < 6e9){ - if(fp->frame_type && (fp->ssb_type==2)) - fp->Lmax = (fp->dl_CarrierFreq < 2.4e9)? 4 : 8; - else - fp->Lmax = (fp->dl_CarrierFreq < 3e9)? 4 : 8; - } - else + if (fp->dl_CarrierFreq < 6e9) { + if(fp->frame_type && (fp->ssb_type==2)) + fp->Lmax = (fp->dl_CarrierFreq < 2.4e9)? 4 : 8; + else + fp->Lmax = (fp->dl_CarrierFreq < 3e9)? 4 : 8; + } else { fp->Lmax = 64; + } fp->N_ssb = 0; for (int p=0; pLmax; p++) From 2d35c28633e703cee41daaa11310e31c76f6bcf3 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Wed, 31 Jul 2019 12:41:08 +0200 Subject: [PATCH 03/30] minor fix --- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 2 +- openair2/LAYER2/NR_MAC_gNB/nr_mac_common.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 3a330756a6..0b68036274 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -110,7 +110,7 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) { LOG_D(PHY,"common_signal_procedures: frame %d, slot %d\n",frame,slot); if(rel_slot<10 && rel_slot>=0) { - for (int i=0; i<2; i++) { // max two SSB per frame + for (int i=0; i<2; i++) { // max two SSB per slot ssb_index = i + 2*rel_slot; // computing the ssb_index if ((fp->L_ssb >> ssb_index) & 0x01) { // generating the ssb only if the bit of L_ssb at current ssb index is 1 diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_common.c b/openair2/LAYER2/NR_MAC_gNB/nr_mac_common.c index f2c2e437cc..5e1ff1a6cb 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_common.c @@ -76,7 +76,7 @@ void get_band(uint32_t downlink_frequency, uint8_t *current_band, int32_t *c ind++) { *current_band = nr_bandtable[ind].band; - LOG_I(PHY, "Scanning band %d, dl_min %"PRIu64", ul_min %"PRIu64"\n", ind, nr_bandtable[ind].dl_min,nr_bandtable[ind].ul_min); + LOG_I(PHY, "Scanning band %d, dl_min %"PRIu64", ul_min %"PRIu64"\n", nr_bandtable[ind].band, nr_bandtable[ind].dl_min,nr_bandtable[ind].ul_min); if ( nr_bandtable[ind].dl_min <= dl_freq_khz && nr_bandtable[ind].dl_max >= dl_freq_khz ) { *current_offset = (nr_bandtable[ind].ul_min - nr_bandtable[ind].dl_min)*1000; From 1d3023a5f6bc1db6ad93aa5f589e3e5a138f67bb Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Thu, 1 Aug 2019 18:08:30 +0200 Subject: [PATCH 04/30] adapting beamforming functions from LTE to NR --- executables/nr-ru.c | 8 ++-- openair1/PHY/MODULATION/beamforming.c | 32 ++++++++++++++++ openair1/PHY/MODULATION/nr_modulation.h | 11 +++++- openair1/SCHED_NR/nr_ru_procedures.c | 49 +++++++++++++++++++------ openair1/SCHED_NR/sched_nr.h | 2 +- 5 files changed, 84 insertions(+), 18 deletions(-) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index c58c9b6f70..1b82262542 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1607,7 +1607,7 @@ extern void fep_full(RU_t *ru,int slot); extern void ru_fep_full_2thread(RU_t *ru,int slot); extern void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx); extern void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx); -extern void feptx_prec(RU_t *ru, int frame_tx,int tti_tx); +extern void nr_feptx_prec(RU_t *ru, int frame_tx,int tti_tx); extern void init_fep_thread(RU_t *ru); extern void init_nr_feptx_thread(RU_t *ru); @@ -1990,7 +1990,7 @@ void set_function_spec_param(RU_t *ru) { ru->do_prach = 0; // no prach processing in RU ru->feprx = (get_nprocs()<=2) ? fep_full : ru_fep_full_2thread; // RX DFTs ru->feptx_ofdm = (get_nprocs()<=2) ? nr_feptx_ofdm : nr_feptx_ofdm_2thread; // this is fep with idft and precoding - ru->feptx_prec = feptx_prec; // this is fep with idft and precoding + ru->feptx_prec = nr_feptx_prec; // this is fep with idft and precoding ru->fh_north_in = NULL; // no incoming fronthaul from north ru->fh_north_out = NULL; // no outgoing fronthaul to north ru->start_if = NULL; // no if interface @@ -2019,7 +2019,7 @@ void set_function_spec_param(RU_t *ru) { case REMOTE_IF5: // the remote unit is IF5 RRU ru->do_prach = 0; ru->feprx = (get_nprocs()<=2) ? fep_full : fep_full; // this is frequency-shift + DFTs - ru->feptx_prec = feptx_prec; // need to do transmit Precoding + IDFTs + ru->feptx_prec = nr_feptx_prec; // need to do transmit Precoding + IDFTs ru->feptx_ofdm = (get_nprocs()<=2) ? nr_feptx_ofdm : nr_feptx_ofdm_2thread; // need to do transmit Precoding + IDFTs ru->fh_south_in = fh_if5_south_in; // synchronous IF5 reception ru->fh_south_out = fh_if5_south_out; // synchronous IF5 transmission @@ -2043,7 +2043,7 @@ void set_function_spec_param(RU_t *ru) { case REMOTE_IF4p5: ru->do_prach = 0; ru->feprx = NULL; // DFTs - ru->feptx_prec = feptx_prec; // Precoding operation + ru->feptx_prec = nr_feptx_prec; // Precoding operation ru->feptx_ofdm = NULL; // no OFDM mod ru->fh_south_in = fh_if4p5_south_in; // synchronous IF4p5 reception ru->fh_south_out = fh_if4p5_south_out; // synchronous IF4p5 transmission diff --git a/openair1/PHY/MODULATION/beamforming.c b/openair1/PHY/MODULATION/beamforming.c index 9b1563e4f5..1416ce2daa 100644 --- a/openair1/PHY/MODULATION/beamforming.c +++ b/openair1/PHY/MODULATION/beamforming.c @@ -37,6 +37,7 @@ #include "PHY/CODING/lte_interleaver_inline.h" #include "PHY/LTE_TRANSPORT/transport_eNB.h" #include "modulation_eNB.h" +#include "nr_modulation.h" #include "common/utils/LOG/vcd_signal_dumper.h" int beam_precoding(int32_t **txdataF, @@ -89,3 +90,34 @@ int beam_precoding(int32_t **txdataF, } return 0; } + + +int nr_beam_precoding(int32_t **txdataF, + int32_t **txdataF_BF, + NR_DL_FRAME_PARMS *frame_parms, + int32_t ***beam_weights, + int slot, + int symbol, + int aa) +{ + + + uint8_t p; + int slot_offset_F; + int nb_antenna_ports = 1; // TODO get the actual value + + slot_offset_F = slot*(frame_parms->ofdm_symbol_size)*(frame_parms->symbols_per_slot); + + // clear txdata_BF[aa][re] for each call of ue_spec_beamforming + memset(txdataF_BF[aa],0,sizeof(int32_t)*(frame_parms->ofdm_symbol_size)); + + for (p=0; pofdm_symbol_size], + (int16_t*)beam_weights[p][aa], + (int16_t*)&txdataF_BF[aa][symbol*frame_parms->ofdm_symbol_size], + 0, + frame_parms->ofdm_symbol_size, + 15); + } +return 0; +} diff --git a/openair1/PHY/MODULATION/nr_modulation.h b/openair1/PHY/MODULATION/nr_modulation.h index 249a92e8e3..a9c1457913 100644 --- a/openair1/PHY/MODULATION/nr_modulation.h +++ b/openair1/PHY/MODULATION/nr_modulation.h @@ -80,4 +80,13 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms, */ void nr_dft(int32_t *z,int32_t *d, uint32_t Msc_PUSCH); -#endif \ No newline at end of file + +int nr_beam_precoding(int32_t **txdataF, + int32_t **txdataF_BF, + NR_DL_FRAME_PARMS *frame_parms, + int32_t ***beam_weights, + int slot, + int symbol, + int aa); + +#endif diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index 544a8ef1dd..493527d09c 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -34,7 +34,7 @@ #include "PHY/phy_extern.h" #include "sched_nr.h" #include "PHY/MODULATION/modulation_common.h" - +#include "PHY/MODULATION/nr_modulation.h" #include "PHY/LTE_TRANSPORT/if4_tools.h" #include "PHY/LTE_TRANSPORT/if5_tools.h" @@ -125,12 +125,6 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { if (nr_slot_select(cfg,slot) == SF_UL) return; - // this copy should be done in the precoding thread (currently inactive) - for (int aa=0;aanb_tx;aa++) - memcpy((void*)ru->common.txdataF_BF[aa], - - (void*)ru->gNB_list[0]->common_vars.txdataF[aa], fp->samples_per_slot_wCP*sizeof(int32_t)); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 1 ); if (nr_slot_select(cfg,slot)==SF_DL) { @@ -227,11 +221,6 @@ void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 1 ); start_meas(&ru->ofdm_mod_stats); - // this copy should be done in the precoding thread (currently inactive) - for (int aa=0;aanb_tx;aa++) - memcpy((void*)ru->common.txdataF_BF[aa], - (void*)ru->gNB_list[0]->common_vars.txdataF[aa], fp->samples_per_slot_wCP*sizeof(int32_t)); - if ((nr_slot_select(cfg,slot)==SF_DL)|| ((nr_slot_select(cfg,slot)==SF_S))) { // LOG_D(HW,"Frame %d: Generating slot %d\n",frame,next_slot); @@ -248,3 +237,39 @@ void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx) { dB_fixed(signal_energy_nodc(ru->common.txdataF_BF[aa],2*slot_sizeF))); } + + + +void nr_feptx_prec(RU_t *ru,int frame,int tti_tx) { + + int l,aa; + NR_DL_FRAME_PARMS *fp=ru->nr_frame_parms; + int32_t ***bw; + + if (ru->nb_tx == 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->gNB_list[0]->common_vars.txdataF[0][tti_tx*fp->symbols_per_slot*fp->ofdm_symbol_size], + 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); + } + else { + bw = ru->beam_weights[0]; + for (l=0;lsymbols_per_slot;l++) { + for (aa=0;aanb_tx;aa++) { + nr_beam_precoding(ru->gNB_list[0]->common_vars.txdataF, + ru->common.txdataF_BF, + fp, + bw, + tti_tx, + l, + aa); + + } + } + } +} + diff --git a/openair1/SCHED_NR/sched_nr.h b/openair1/SCHED_NR/sched_nr.h index 1470510c5c..70ec9e104c 100644 --- a/openair1/SCHED_NR/sched_nr.h +++ b/openair1/SCHED_NR/sched_nr.h @@ -45,7 +45,7 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx); void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols); void nr_init_feptx_thread(RU_t *ru); void fep_full(RU_t *ru,int slot); -void feptx_prec(RU_t *ru,int frame_tx,int tti_tx); +void nr_feptx_prec(RU_t *ru,int frame_tx,int tti_tx); int nr_phy_init_RU(RU_t *ru); void nr_configure_css_dci_initial(nfapi_nr_dl_config_pdcch_parameters_rel15_t* pdcch_params, From c97cd87d4780513b5e0ad112dafdeb42fe2776e5 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Tue, 6 Aug 2019 18:28:09 +0200 Subject: [PATCH 05/30] nrbeam_weights and num port as SSB --- openair1/PHY/MODULATION/beamforming.c | 2 +- openair1/SCHED_NR/nr_ru_procedures.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/MODULATION/beamforming.c b/openair1/PHY/MODULATION/beamforming.c index 1416ce2daa..0aaa00da4b 100644 --- a/openair1/PHY/MODULATION/beamforming.c +++ b/openair1/PHY/MODULATION/beamforming.c @@ -104,7 +104,7 @@ int nr_beam_precoding(int32_t **txdataF, uint8_t p; int slot_offset_F; - int nb_antenna_ports = 1; // TODO get the actual value + int nb_antenna_ports = frame_parms->Lmax; // for now logical antenna ports corresponds to SSB slot_offset_F = slot*(frame_parms->ofdm_symbol_size)*(frame_parms->symbols_per_slot); diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index 493527d09c..36e4cb13f8 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -257,7 +257,8 @@ void nr_feptx_prec(RU_t *ru,int frame,int tti_tx) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC , 0); } else { - bw = ru->beam_weights[0]; + + bw = ru->nrbeam_weights[0]; for (l=0;lsymbols_per_slot;l++) { for (aa=0;aanb_tx;aa++) { nr_beam_precoding(ru->gNB_list[0]->common_vars.txdataF, From 794aac41374777d6a6eb1b59179f602444261960 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Wed, 7 Aug 2019 16:46:36 +0200 Subject: [PATCH 06/30] initializing beam_weights to I --- openair1/PHY/INIT/nr_init_ru.c | 29 +++++++++------------------ openair1/PHY/MODULATION/beamforming.c | 4 +++- openair1/PHY/defs_RU.h | 4 +--- openair1/SCHED_NR/nr_ru_procedures.c | 3 +-- 4 files changed, 15 insertions(+), 25 deletions(-) diff --git a/openair1/PHY/INIT/nr_init_ru.c b/openair1/PHY/INIT/nr_init_ru.c index 3ff24e343a..6915d26ea2 100644 --- a/openair1/PHY/INIT/nr_init_ru.c +++ b/openair1/PHY/INIT/nr_init_ru.c @@ -106,35 +106,26 @@ int nr_phy_init_RU(RU_t *ru) { LOG_E(PHY,"[INIT] %s() RC.nb_nr_L1_inst:%d \n", __FUNCTION__, RC.nb_nr_L1_inst); for (i=0; iLmax;p++) { + if ((fp->L_ssb >> p) & 0x01) { ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*)); for (j=0; jnb_tx; j++) { ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t)); - // antenna ports 0-3 are mapped on antennas 0-3 - // antenna port 4 is mapped on antenna 0 - // antenna ports 5-14 are mapped on all antennas - if (((p<4) && (p==j)) || ((p==4) && (j==0))) { + // setting identity matrix as first step for beam weights + if (p==j) { for (re=0; reofdm_symbol_size; re++) - { ru->beam_weights[i][p][j][re] = 0x00007fff; - - //LOG_D(PHY,"[INIT] lte_common_vars->beam_weights[%d][%d][%d][%d] = %d\n", i,p,j,re,ru->beam_weights[i][p][j][re]); - } } - else if (p>4) { + else { for (re=0; reofdm_symbol_size; re++) - { - ru->beam_weights[i][p][j][re] = 0x00007fff/ru->nb_tx; - //LOG_D(PHY,"[INIT] lte_common_vars->beam_weights[%d][%d][%d][%d] = %d\n", i,p,j,re,ru->beam_weights[i][p][j][re]); - } + ru->beam_weights[i][p][j][re] = 0x00000000; } - //LOG_D(PHY,"[INIT] lte_common_vars->beam_weights[%d][%d] = %p (%lu bytes)\n", i,j,ru->beam_weights[i][p][j], fp->ofdm_symbol_size*sizeof(int32_t)); - } // for (j=0 - } // if (pcommon.sync_corr = (uint32_t*)malloc16_clear( LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(uint32_t)*fp->samples_per_subframe_wCP ); return(0); diff --git a/openair1/PHY/MODULATION/beamforming.c b/openair1/PHY/MODULATION/beamforming.c index 0aaa00da4b..1f1c6702ae 100644 --- a/openair1/PHY/MODULATION/beamforming.c +++ b/openair1/PHY/MODULATION/beamforming.c @@ -105,19 +105,21 @@ int nr_beam_precoding(int32_t **txdataF, uint8_t p; int slot_offset_F; int nb_antenna_ports = frame_parms->Lmax; // for now logical antenna ports corresponds to SSB - + slot_offset_F = slot*(frame_parms->ofdm_symbol_size)*(frame_parms->symbols_per_slot); // clear txdata_BF[aa][re] for each call of ue_spec_beamforming memset(txdataF_BF[aa],0,sizeof(int32_t)*(frame_parms->ofdm_symbol_size)); for (p=0; pL_ssb >> p) & 0x01) { multadd_cpx_vector((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size], (int16_t*)beam_weights[p][aa], (int16_t*)&txdataF_BF[aa][symbol*frame_parms->ofdm_symbol_size], 0, frame_parms->ofdm_symbol_size, 15); + } } return 0; } diff --git a/openair1/PHY/defs_RU.h b/openair1/PHY/defs_RU.h index 83982fe5be..168a8af0f4 100644 --- a/openair1/PHY/defs_RU.h +++ b/openair1/PHY/defs_RU.h @@ -446,10 +446,8 @@ typedef struct RU_t_s{ time_stats_t transport; /// RX and TX buffers for precoder output RU_COMMON common; - /// beamforming weight vectors per eNB + /// beamforming weight vectors int32_t **beam_weights[NUMBER_OF_eNB_MAX+1][15]; - /// beamforming weight vectors per eNB - int32_t **nrbeam_weights[NUMBER_OF_gNB_MAX+1][16]; /// received frequency-domain signal for PRACH (IF4p5 RRU) int16_t **prach_rxsigF; /// received frequency-domain signal for PRACH BR (IF4p5 RRU) diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index 36e4cb13f8..493527d09c 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -257,8 +257,7 @@ void nr_feptx_prec(RU_t *ru,int frame,int tti_tx) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC , 0); } else { - - bw = ru->nrbeam_weights[0]; + bw = ru->beam_weights[0]; for (l=0;lsymbols_per_slot;l++) { for (aa=0;aanb_tx;aa++) { nr_beam_precoding(ru->gNB_list[0]->common_vars.txdataF, From 46adc28e08da375285b4b69e62ff2ce31dc85c2c Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Wed, 7 Aug 2019 17:24:42 +0200 Subject: [PATCH 07/30] fixing segmentation fault for 1 nb_tx --- openair1/SCHED_NR/nr_ru_procedures.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index 493527d09c..3afe8cb3f5 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -245,13 +245,15 @@ void nr_feptx_prec(RU_t *ru,int frame,int tti_tx) { int l,aa; NR_DL_FRAME_PARMS *fp=ru->nr_frame_parms; int32_t ***bw; + PHY_VARS_gNB **gNB_list = ru->gNB_list,*gNB; + gNB = gNB_list[0]; if (ru->nb_tx == 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->gNB_list[0]->common_vars.txdataF[0][tti_tx*fp->symbols_per_slot*fp->ofdm_symbol_size], + (void*)&gNB->common_vars.txdataF[0][tti_tx*fp->symbols_per_slot*fp->ofdm_symbol_size], 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); From 4fbf754de5bbaf8c5334b7ab01f97c0d44b84b02 Mon Sep 17 00:00:00 2001 From: Wang Tsu-Han Date: Fri, 9 Aug 2019 16:55:18 +0200 Subject: [PATCH 08/30] adding condition for multi L1 and TDD slot select in nr_feptx_prec --- openair1/SCHED_NR/nr_ru_procedures.c | 55 ++++++++++++++++------------ 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index 493527d09c..79756ce30f 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -243,33 +243,42 @@ void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx) { void nr_feptx_prec(RU_t *ru,int frame,int tti_tx) { int l,aa; - NR_DL_FRAME_PARMS *fp=ru->nr_frame_parms; + PHY_VARS_gNB **gNB_list = ru->gNB_list,*gNB; + NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms; + nfapi_nr_config_request_t *cfg; int32_t ***bw; - if (ru->nb_tx == 1) { + + if (ru->num_gNB == 1){ + gNB = gNB_list[0]; + cfg = &gNB->gNB_config; + if (nr_slot_select(cfg,tti_tx) == SF_UL) return; + + if (ru->nb_tx == 1) { - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC , 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->gNB_list[0]->common_vars.txdataF[0][tti_tx*fp->symbols_per_slot*fp->ofdm_symbol_size], - fp->samples_per_slot_wCP*sizeof(int32_t)); + memcpy((void*)ru->common.txdataF_BF[0], + (void*)&gNB->common_vars.txdataF[0][tti_tx*fp->symbols_per_slot*fp->ofdm_symbol_size], + 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); - } - else { - bw = ru->beam_weights[0]; - for (l=0;lsymbols_per_slot;l++) { - for (aa=0;aanb_tx;aa++) { - nr_beam_precoding(ru->gNB_list[0]->common_vars.txdataF, - ru->common.txdataF_BF, - fp, - bw, - tti_tx, - l, - aa); - - } - } - } + 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++) { + nr_beam_precoding(gNB->common_vars.txdataF, + ru->common.txdataF_BF, + fp, + bw, + tti_tx, + l, + aa); + + }// for (aa=0;aanb_tx;aa++) + }// for (l=0;lsymbols_per_slot;l++) + }// if (ru->nb_tx == 1) + }// if (ru->num_gNB == 1) } From dbc9472aaf67af644b04f08018e080a43d41fc07 Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Wed, 14 Aug 2019 11:34:02 +0200 Subject: [PATCH 09/30] fixes in beamforming --- openair1/PHY/MODULATION/beamforming.c | 7 ++----- openair1/SCHED_NR/nr_ru_procedures.c | 2 +- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/openair1/PHY/MODULATION/beamforming.c b/openair1/PHY/MODULATION/beamforming.c index 97c65cc76a..cad25c2f1b 100644 --- a/openair1/PHY/MODULATION/beamforming.c +++ b/openair1/PHY/MODULATION/beamforming.c @@ -149,17 +149,14 @@ int nr_beam_precoding(int32_t **txdataF, uint8_t p; - int slot_offset_F; int nb_antenna_ports = frame_parms->Lmax; // for now logical antenna ports corresponds to SSB - slot_offset_F = slot*(frame_parms->ofdm_symbol_size)*(frame_parms->symbols_per_slot); - // clear txdata_BF[aa][re] for each call of ue_spec_beamforming - memset(txdataF_BF[aa],0,sizeof(int32_t)*(frame_parms->ofdm_symbol_size)); + memset(&txdataF_BF[aa][symbol*frame_parms->ofdm_symbol_size],0,sizeof(int32_t)*(frame_parms->ofdm_symbol_size)); for (p=0; pL_ssb >> p) & 0x01) { - multadd_cpx_vector((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size], + multadd_cpx_vector((int16_t*)&txdataF[p][symbol*frame_parms->ofdm_symbol_size], (int16_t*)beam_weights[p][aa], (int16_t*)&txdataF_BF[aa][symbol*frame_parms->ofdm_symbol_size], 0, diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index 3afe8cb3f5..55ab62a731 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -253,7 +253,7 @@ void nr_feptx_prec(RU_t *ru,int frame,int tti_tx) { 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*)&gNB->common_vars.txdataF[0][tti_tx*fp->symbols_per_slot*fp->ofdm_symbol_size], + (void*)gNB->common_vars.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); diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 6d0e5cd53f..52c288a13f 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -165,7 +165,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, if (do_meas==1) start_meas(&gNB->phy_proc_tx); // clear the transmit data array for the current subframe - for (aa=0; aa<1/*15*/; aa++) { + for (aa=0; aaLmax; aa++) { memset(gNB->common_vars.txdataF[aa],0,fp->samples_per_slot_wCP*sizeof(int32_t)); } From 8677d44ae9aca985b35a058ddb6d033b81a87c10 Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Wed, 14 Aug 2019 14:51:38 +0200 Subject: [PATCH 10/30] fixing a bug in UE FAPI interface --- openair1/SCHED_NR_UE/fapi_nr_ue_l1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index 6802b77d8c..999a2fe5d3 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -213,7 +213,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response) int8_t nr_ue_phy_config_request(nr_phy_config_t *phy_config){ - fapi_nr_config_request_t nrUE_config = PHY_vars_UE_g[phy_config->Mod_id][phy_config->CC_id]->nrUE_config; + fapi_nr_config_request_t *nrUE_config = &PHY_vars_UE_g[phy_config->Mod_id][phy_config->CC_id]->nrUE_config; if(phy_config != NULL){ if(phy_config->config_req.config_mask & FAPI_NR_CONFIG_REQUEST_MASK_PBCH){ @@ -229,7 +229,7 @@ int8_t nr_ue_phy_config_request(nr_phy_config_t *phy_config){ LOG_I(MAC,"half frame bit: %d\n", phy_config->config_req.pbch_config.half_frame_bit); LOG_I(MAC,"-------------------------------\n"); - memcpy(&nrUE_config.pbch_config,&phy_config->config_req.pbch_config,sizeof(fapi_nr_pbch_config_t)); + memcpy(&nrUE_config->pbch_config,&phy_config->config_req.pbch_config,sizeof(fapi_nr_pbch_config_t)); } From 09d3c721447239969f8387088f14192c9da178fa Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Wed, 14 Aug 2019 16:23:32 +0200 Subject: [PATCH 11/30] fix on single beam transmission --- openair1/PHY/INIT/nr_parms.c | 3 +++ openair1/PHY/defs_nr_common.h | 2 ++ openair1/SCHED_NR/nr_ru_procedures.c | 11 ++++++++--- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/openair1/PHY/INIT/nr_parms.c b/openair1/PHY/INIT/nr_parms.c index 00b2b6a7da..548c9c0fe7 100644 --- a/openair1/PHY/INIT/nr_parms.c +++ b/openair1/PHY/INIT/nr_parms.c @@ -245,6 +245,9 @@ int nr_init_frame_parms0(NR_DL_FRAME_PARMS *fp, else fp->Lmax = 64; + fp->N_ssb = 0; + for (int p=0; pLmax; p++) + fp->N_ssb += ((fp->L_ssb >> p) & 0x01); return 0; } diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h index 3c3cb6ff41..c5c0b09ff6 100644 --- a/openair1/PHY/defs_nr_common.h +++ b/openair1/PHY/defs_nr_common.h @@ -319,6 +319,8 @@ typedef struct NR_DL_FRAME_PARMS { uint8_t Lmax; /// SS block pattern (max 64 ssb, each bit is on/off ssb) uint64_t L_ssb; + /// Total number of SSB transmitted + uint8_t N_ssb; /// PBCH polar encoder params t_nrPolar_params pbch_polar_params; diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index 55ab62a731..e71d6b86e0 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -252,9 +252,14 @@ void nr_feptx_prec(RU_t *ru,int frame,int tti_tx) { 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*)gNB->common_vars.txdataF[0], - fp->samples_per_slot_wCP*sizeof(int32_t)); + AssertFatal(fp->N_ssb==ru->nb_tx,"Attempting to transmit %d SSB while Nb_tx = %d",fp->N_ssb,ru->nb_tx); + + for (int p=0; pLmax; p++) { + if ((fp->L_ssb >> p) & 0x01) + memcpy((void*)ru->common.txdataF_BF[0], + (void*)gNB->common_vars.txdataF[p], + 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); } From dd7a65cebaf31d562aba8ff9deaf30b37f4e3e0f Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Thu, 29 Aug 2019 17:51:37 +0200 Subject: [PATCH 12/30] temporary workaround for real-time issues --- executables/nr-gnb.c | 4 ++-- openair2/GNB_APP/gnb_config.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index c610107da6..945dc9bc18 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -108,8 +108,8 @@ extern openair0_config_t openair0_cfg[MAX_CARDS]; extern int transmission_mode; -uint16_t sl_ahead=4; -uint16_t sf_ahead=4; +uint16_t sl_ahead=6; +uint16_t sf_ahead=6; //pthread_t main_gNB_thread; time_stats_t softmodem_stats_mt; // main thread diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 4c30ef9140..c1a58c723d 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -808,10 +808,10 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { } NRRRC_CONFIGURATION_REQ (msg_p).N_RB_DL[j]= N_RB_DL; - if(N_RB_DL == 217) sf_ahead = 2; - else if(N_RB_DL == 106) sf_ahead = 4; - else AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for N_RB_DL choice: 106, 217 !\n", - RC.config_file_name, i, N_RB_DL); + //if(N_RB_DL == 217) sf_ahead = 2; + //else if(N_RB_DL == 106) sf_ahead = 4; + if ((N_RB_DL != 217) && (N_RB_DL != 106)) + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for N_RB_DL choice: 106, 217 !\n", RC.config_file_name, i, N_RB_DL); /* if ((N_RB_DL!=6) && (N_RB_DL!=15) && (N_RB_DL!=25) && (N_RB_DL!=50) && (N_RB_DL!=75) && (N_RB_DL!=100)) { From 131ad5383df7fcdb563334904ff1e4364104c110 Mon Sep 17 00:00:00 2001 From: Wang Tsu-Han Date: Fri, 30 Aug 2019 15:06:16 +0200 Subject: [PATCH 13/30] adding precoding into feptx thread and having 2 threads per antenna --- executables/nr-ru.c | 11 +- openair1/PHY/INIT/nr_init_ru.c | 4 + openair1/PHY/NR_TRANSPORT/nr_dlsch.c | 1 - openair1/PHY/defs_RU.h | 56 +++- openair1/SCHED_NR/nr_ru_procedures.c | 308 +++++++++++++----- openair1/SCHED_NR/sched_nr.h | 4 +- .../CONF/gnb.band78.tm1.106PRB.usrpx300.conf | 4 +- 7 files changed, 284 insertions(+), 104 deletions(-) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index ef1d253c64..f801f7b325 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1213,6 +1213,10 @@ static void *ru_stats_thread(void *param) { sleep(1); if (opp_enabled == 1) { + if (ru->feptx_prec) { + print_meas(&ru->total_precoding_stats,"feptx_prec",NULL,NULL); + } + if (ru->feprx) print_meas(&ru->ofdm_demod_stats,"feprx",NULL,NULL); if (ru->feptx_ofdm) print_meas(&ru->ofdm_mod_stats,"feptx_ofdm",NULL,NULL); @@ -1273,7 +1277,7 @@ static void *ru_thread_tx( void *param ) { VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX0_RU, tti_tx ); // do TX front-end processing if needed (precoding and/or IDFTs) - if (ru->feptx_prec) ru->feptx_prec(ru,frame_tx,tti_tx); + //if (ru->feptx_prec) ru->feptx_prec(ru,frame_tx,tti_tx); // do OFDM if needed if ((ru->fh_north_asynch_in == NULL) && (ru->feptx_ofdm)) ru->feptx_ofdm(ru,frame_tx,tti_tx); @@ -1488,7 +1492,7 @@ static void *ru_thread( void *param ) { if(get_thread_parallel_conf() == PARALLEL_SINGLE_THREAD || ru->num_gNB==0) { // do TX front-end processing if needed (precoding and/or IDFTs) - if (ru->feptx_prec) ru->feptx_prec(ru,proc->frame_tx,proc->tti_tx); + //if (ru->feptx_prec) ru->feptx_prec(ru,proc->frame_tx,proc->tti_tx); // do OFDM if needed if ((ru->fh_north_asynch_in == NULL) && (ru->feptx_ofdm)) ru->feptx_ofdm(ru,proc->frame_tx,proc->tti_tx); @@ -1704,6 +1708,7 @@ void init_RU_proc(RU_t *ru) { if (ru->feprx) init_fep_thread(ru); if (ru->feptx_ofdm) nr_init_feptx_thread(ru); + //if (ru->feptx_prec) nr_init_feptx_prec_thread(ru); } if (opp_enabled == 1) threadCreate(&ru->ru_stats_thread,ru_stats_thread,(void *)ru, "emulateRF", -1, OAI_PRIORITY_RT_LOW); @@ -2018,7 +2023,7 @@ void set_function_spec_param(RU_t *ru) { ru->do_prach = 0; // no prach processing in RU ru->feprx = (get_thread_worker_conf() == WORKER_ENABLE) ? ru_fep_full_2thread : fep_full; // RX DFTs ru->feptx_ofdm = (get_thread_worker_conf() == WORKER_ENABLE) ? nr_feptx_ofdm_2thread : nr_feptx_ofdm; // this is fep with idft and precoding - ru->feptx_prec = nr_feptx_prec; // this is fep with idft and precoding + ru->feptx_prec = nr_feptx_prec; // this is fep with idft and precoding ru->fh_north_in = NULL; // no incoming fronthaul from north ru->fh_north_out = NULL; // no outgoing fronthaul to north ru->nr_start_if = NULL; // no if interface diff --git a/openair1/PHY/INIT/nr_init_ru.c b/openair1/PHY/INIT/nr_init_ru.c index 3a4206ec3f..f6550fff97 100644 --- a/openair1/PHY/INIT/nr_init_ru.c +++ b/openair1/PHY/INIT/nr_init_ru.c @@ -74,6 +74,10 @@ int nr_phy_init_RU(RU_t *ru) { } + // allocate precoding input buffers (TX) + ru->common.txdataF = (int32_t **)malloc16(15*sizeof(int32_t*)); + for(i=0; i< 15; ++i) ru->common.txdataF[i] = (int32_t*)malloc16_clear(fp->samples_per_frame_wCP*sizeof(int32_t)); // [hna] samples_per_frame without CP + // allocate IFFT input buffers (TX) ru->common.txdataF_BF = (int32_t **)malloc16(ru->nb_tx*sizeof(int32_t*)); LOG_I(PHY,"[INIT] common.txdata_BF= %p (%lu bytes)\n",ru->common.txdataF_BF, diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index aa75bd6555..074e30a5f9 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -205,7 +205,6 @@ for (int i=0; i>4; i++) { printf("PDSCH resource mapping started (start SC %d\tstart symbol %d\tN_PRB %d\tnb_symbols %d)\n", start_sc, rel15->start_symbol, rel15->n_prb, rel15->nb_symbols); #endif - for (int ap=0; apnb_layers; ap++) { // DMRS params for this ap diff --git a/openair1/PHY/defs_RU.h b/openair1/PHY/defs_RU.h index 6eeec696ec..13552ae2fb 100644 --- a/openair1/PHY/defs_RU.h +++ b/openair1/PHY/defs_RU.h @@ -103,6 +103,10 @@ typedef struct { /// - first index: tx antenna [0..nb_antennas_tx[ /// - second index: sample [0..] int32_t **txdataF_BF; + /// \brief holds the transmit data before beamforming in the frequency domain. + /// - first index: tx antenna [0..nb_antennas_tx[ + /// - second index: sample [0..] + int32_t **txdataF; /// \brief holds the transmit data before beamforming for epdcch/mpdcch /// - first index : tx antenna [0..nb_epdcch_antenna_ports[ /// - second index: sampl [0..] @@ -146,6 +150,41 @@ typedef struct { } RU_CALIBRATION; +typedef struct RU_prec_t_s{ + /// \internal This variable is protected by \ref mutex_feptx_prec + int instance_cnt_feptx_prec; + /// pthread struct for RU TX FEP PREC worker thread + pthread_t pthread_feptx_prec; + /// pthread attributes for worker feptx prec thread + pthread_attr_t attr_feptx_prec; + /// condition varible for RU TX FEP PREC thread + pthread_cond_t cond_feptx_prec; + /// mutex for fep PREC TX worker thread + pthread_mutex_t mutex_feptx_prec; + int symbol; + int p;//logical + int aa;//physical MAX nb_tx + struct RU_t_s *ru; + int index; +} RU_prec_t; + +typedef struct RU_feptx_t_s{ + /// \internal This variable is protected by \ref mutex_feptx_prec + int instance_cnt_feptx; + /// pthread struct for RU TX FEP PREC worker thread + pthread_t pthread_feptx; + /// pthread attributes for worker feptx prec thread + pthread_attr_t attr_feptx; + /// condition varible for RU TX FEP PREC thread + pthread_cond_t cond_feptx; + /// mutex for fep PREC TX worker thread + pthread_mutex_t mutex_feptx; + struct RU_t_s *ru; + int aa;//physical MAX nb_tx + int half_slot;//first or second half of a slot + int slot;//current slot +}RU_feptx_t; + typedef struct RU_proc_t_s { /// Pointer to associated RU descriptor struct RU_t_s *ru; @@ -205,8 +244,6 @@ typedef struct RU_proc_t_s { int instance_cnt_asynch_rxtx; /// \internal This variable is protected by \ref mutex_fep int instance_cnt_fep; - /// \internal This variable is protected by \ref mutex_feptx - int instance_cnt_feptx; /// \internal This variable is protected by \ref mutex_ru_thread int instance_cnt_ru; /// This varible is protected by \ref mutex_emulatedRF @@ -226,8 +263,6 @@ typedef struct RU_proc_t_s { pthread_t pthread_synch; /// pthread struct for RU RX FEP worker thread pthread_t pthread_fep; - /// pthread struct for RU TX FEP worker thread - pthread_t pthread_feptx; /// pthread struct for emulated RF pthread_t pthread_emulateRF; /// pthread structure for asychronous RX/TX processing thread @@ -253,8 +288,6 @@ typedef struct RU_proc_t_s { pthread_attr_t attr_asynch_rxtx; /// pthread attributes for worker fep thread pthread_attr_t attr_fep; - /// pthread attributes for worker feptx thread - pthread_attr_t attr_feptx; /// pthread attributes for emulated RF pthread_attr_t attr_emulateRF; /// scheduling parameters for RU FH thread @@ -285,8 +318,6 @@ typedef struct RU_proc_t_s { pthread_cond_t cond_asynch_rxtx; /// condition varible for RU RX FEP thread pthread_cond_t cond_fep; - /// condition varible for RU TX FEP thread - pthread_cond_t cond_feptx; /// condition varible for emulated RF pthread_cond_t cond_emulateRF; /// condition variable for eNB signal @@ -314,8 +345,6 @@ typedef struct RU_proc_t_s { pthread_mutex_t mutex_asynch_rxtx; /// mutex for fep RX worker thread pthread_mutex_t mutex_fep; - /// mutex for fep TX worker thread - pthread_mutex_t mutex_feptx; /// mutex for ru_thread pthread_mutex_t mutex_ru; /// mutex for emulated RF thread @@ -360,8 +389,11 @@ typedef struct RU_proc_t_s { int ru_rx_ready; int ru_tx_ready; int emulate_rf_busy; -} RU_proc_t; + RU_prec_t prec[16]; + /// structure for feptx thread + RU_feptx_t feptx[16]; +} RU_proc_t; typedef enum { LOCAL_RF =0, @@ -518,6 +550,8 @@ typedef struct RU_t_s{ void (*eNB_top)(struct PHY_VARS_eNB_s *eNB, int frame_rx, int subframe_rx, char *string, struct RU_t_s *ru); void (*gNB_top)(struct PHY_VARS_gNB_s *gNB, int frame_rx, int slot_rx, char *string, struct RU_t_s *ru); + /// Timing statistics (TX) + time_stats_t total_precoding_stats; /// Timing statistics time_stats_t ofdm_demod_stats; /// Timing statistics (TX) diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index 9113238cd8..01e217b183 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -56,70 +56,85 @@ extern openair0_config_t openair0_cfg[MAX_CARDS]; extern int oai_exit; -void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols) { +void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols, int aa) { NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms; - unsigned int aa,slot_offset,slot_offsetF; + unsigned int slot_offset,slot_offsetF; int slot = tti_tx; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM+(first_symbol!=0?1:0) , 1 ); + //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM+(first_symbol!=0?1:0) , 1 ); slot_offset = slot*fp->samples_per_slot; slot_offsetF = first_symbol*fp->ofdm_symbol_size; + if (first_symbol>0) slot_offset += (fp->ofdm_symbol_size*first_symbol) + (fp->nb_prefix_samples0) + (fp->nb_prefix_samples*(first_symbol-1)); LOG_D(PHY,"SFN/SF:RU:TX:%d/%d Generating slot %d (first_symbol %d num_symbols %d)\n",ru->proc.frame_tx, ru->proc.tti_tx,slot,first_symbol,num_symbols); - for (aa=0; aanb_tx; aa++) { - if (fp->Ncp == 1) { + if (fp->Ncp == 1) { + PHY_ofdm_mod(&ru->common.txdataF_BF[aa][slot_offsetF], + (int*)&ru->common.txdata[aa][slot_offset], + fp->ofdm_symbol_size, + num_symbols, + fp->nb_prefix_samples, + CYCLIC_PREFIX); + } + else { + if (first_symbol==0) { PHY_ofdm_mod(&ru->common.txdataF_BF[aa][slot_offsetF], - (int*)&ru->common.txdata[aa][slot_offset], - fp->ofdm_symbol_size, - num_symbols, - fp->nb_prefix_samples, - CYCLIC_PREFIX); + (int*)&ru->common.txdata[aa][slot_offset], + fp->ofdm_symbol_size, + 1, + fp->nb_prefix_samples0, + CYCLIC_PREFIX); + PHY_ofdm_mod(&ru->common.txdataF_BF[aa][slot_offsetF+fp->ofdm_symbol_size], + (int*)&ru->common.txdata[aa][slot_offset+fp->nb_prefix_samples0+fp->ofdm_symbol_size], + fp->ofdm_symbol_size, + num_symbols-1, + fp->nb_prefix_samples, + CYCLIC_PREFIX); } else { - if (first_symbol==0) { - PHY_ofdm_mod(&ru->common.txdataF_BF[aa][slot_offsetF], - (int*)&ru->common.txdata[aa][slot_offset], - fp->ofdm_symbol_size, - 1, - fp->nb_prefix_samples0, - CYCLIC_PREFIX); - PHY_ofdm_mod(&ru->common.txdataF_BF[aa][slot_offsetF+fp->ofdm_symbol_size], - (int*)&ru->common.txdata[aa][slot_offset+fp->nb_prefix_samples0+fp->ofdm_symbol_size], - fp->ofdm_symbol_size, - num_symbols-1, - fp->nb_prefix_samples, - CYCLIC_PREFIX); - } - else { - PHY_ofdm_mod(&ru->common.txdataF_BF[aa][slot_offsetF], - (int*)&ru->common.txdata[aa][slot_offset], - fp->ofdm_symbol_size, - num_symbols, - fp->nb_prefix_samples, - CYCLIC_PREFIX); - } + PHY_ofdm_mod(&ru->common.txdataF_BF[aa][slot_offsetF], + (int*)&ru->common.txdata[aa][slot_offset], + fp->ofdm_symbol_size, + num_symbols, + fp->nb_prefix_samples, + CYCLIC_PREFIX); } } - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM+(first_symbol!=0?1:0), 0); + //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM+(first_symbol!=0?1:0), 0); } void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { - NR_DL_FRAME_PARMS *fp=ru->nr_frame_parms; nfapi_nr_config_request_t *cfg = &ru->gNB_list[0]->gNB_config; - RU_proc_t *proc = &ru->proc; - struct timespec wait; - int slot = tti_tx; + RU_proc_t *proc = &ru->proc; + RU_feptx_t *feptx = proc->feptx; - wait.tv_sec=0; - wait.tv_nsec=5000000L; + PHY_VARS_gNB *gNB; + NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms; + + int slot = tti_tx; + int i = 0; + int ret = 0; + + + start_meas(&ru->total_precoding_stats); + if (ru->num_gNB == 1){ + gNB = ru->gNB_list[0]; + cfg = &gNB->gNB_config; + if (nr_slot_select(cfg,tti_tx) == SF_UL) return; + + for(i=0; iLmax; ++i) + memcpy((void*)ru->common.txdataF[i], + (void*)gNB->common_vars.txdataF[i], + fp->samples_per_slot_wCP*sizeof(int32_t)); + }//num_gNB == 1 + stop_meas(&ru->total_precoding_stats); start_meas(&ru->ofdm_mod_stats); @@ -129,37 +144,25 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { if (nr_slot_select(cfg,slot)==SF_DL) { // If this is not an S-tti - if (pthread_mutex_timedlock(&proc->mutex_feptx,&wait) != 0) { - printf("[RU] ERROR pthread_mutex_lock for feptx thread (IC %d)\n", proc->instance_cnt_feptx); - exit_fun( "error locking mutex_feptx" ); - return; - } - - if (proc->instance_cnt_feptx==0) { - printf("[RU] FEPtx thread busy\n"); - exit_fun("FEPtx thread busy"); - pthread_mutex_unlock( &proc->mutex_feptx ); - return; - } - - ++proc->instance_cnt_feptx; - // slot to pass to worker thread - proc->slot_feptx = slot; - pthread_mutex_unlock( &proc->mutex_feptx ); - - - if (pthread_cond_signal(&proc->cond_feptx) != 0) { - printf("[RU] ERROR pthread_cond_signal for feptx thread\n"); - exit_fun( "ERROR pthread_cond_signal" ); - return; + for(i=0; inb_tx*2; ++i){ + AssertFatal((ret=pthread_mutex_lock(&feptx[i].mutex_feptx))==0,"mutex_lock return %d\n",ret); + feptx[i].half_slot = i%2; + feptx[i].aa = i>>1; + feptx[i].ru = ru; + feptx[i].slot = slot; + feptx[i].instance_cnt_feptx = 0; + AssertFatal(pthread_cond_signal(&feptx[i].cond_feptx) == 0,"ERROR pthread_cond_signal for gNB_L1_thread\n"); + AssertFatal((ret=pthread_mutex_unlock(&feptx[i].mutex_feptx))==0,"mutex_lock returns %d\n",ret); } } // call first half-slot in this thread - nr_feptx0(ru,slot,0,fp->symbols_per_slot>>1); - wait_on_busy_condition(&proc->mutex_feptx,&proc->cond_feptx,&proc->instance_cnt_feptx,"NR feptx thread"); - + i = 0; + while(1){ + if(feptx[i].instance_cnt_feptx == -1) ++i; + if(i == 16) break; + } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 0 ); //write_output @@ -170,41 +173,64 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { static void *nr_feptx_thread(void *param) { - RU_t *ru = (RU_t *)param; - RU_proc_t *proc = &ru->proc; + RU_feptx_t *feptx = (RU_feptx_t *)param; + RU_t *ru; + int aa, slot, start, l; + int32_t ***bw; + NR_DL_FRAME_PARMS *fp; while (!oai_exit) { - if (wait_on_condition(&proc->mutex_feptx,&proc->cond_feptx,&proc->instance_cnt_feptx,"NR feptx thread")<0) break; - int slot=proc->slot_feptx; - if (release_thread(&proc->mutex_feptx,&proc->instance_cnt_feptx,"NR feptx thread")<0) break; + if (wait_on_condition(&feptx->mutex_feptx,&feptx->cond_feptx,&feptx->instance_cnt_feptx,"NR feptx thread")<0) break; + ru = feptx->ru; + slot = feptx->slot; + aa = feptx->aa; + fp = ru->nr_frame_parms; + start = (feptx->half_slot)? fp->symbols_per_slot>>1 : 0; - nr_feptx0(ru,slot,ru->nr_frame_parms->symbols_per_slot>>1,ru->nr_frame_parms->symbols_per_slot>>1); + bw = ru->beam_weights[0]; + for (l=0;lsymbols_per_slot>>1;l++) { + nr_beam_precoding(ru->common.txdataF, + ru->common.txdataF_BF, + fp, + bw, + slot, + l+start, + aa); + }// for (l=0;lsymbols_per_slot;l++) - if (pthread_cond_signal(&proc->cond_feptx) != 0) { + + nr_feptx0(ru,slot,start,fp->symbols_per_slot>>1,aa); + + if (pthread_cond_signal(&feptx->cond_feptx) != 0) { LOG_E(PHY,"[gNB] ERROR pthread_cond_signal for NR feptx thread exit\n"); exit_fun( "ERROR pthread_cond_signal" ); return NULL; } + if (release_thread(&feptx->mutex_feptx,&feptx->instance_cnt_feptx,"NR feptx thread")<0) break; } return(NULL); } void nr_init_feptx_thread(RU_t *ru) { - RU_proc_t *proc = &ru->proc; + RU_proc_t *proc = &ru->proc; + RU_feptx_t *feptx = proc->feptx; + int i = 0; - proc->instance_cnt_feptx = -1; + for(i=0; i<16; i++){ + feptx[i].instance_cnt_feptx = -1; - pthread_mutex_init( &proc->mutex_feptx, NULL); - pthread_cond_init( &proc->cond_feptx, NULL); - - threadCreate(&proc->pthread_feptx, nr_feptx_thread, (void*)ru, "feptx", -1, OAI_PRIORITY_RT); + pthread_mutex_init( &feptx[i].mutex_feptx, NULL); + pthread_cond_init( &feptx[i].cond_feptx, NULL); + threadCreate(&feptx[i].pthread_feptx, nr_feptx_thread, (void*)&feptx[i], "feptx", -1, OAI_PRIORITY_RT); + } } + // is this supposed to generate a slot or a subframe??? // seems to be hardcoded to numerology 1 (2 slots=1 subframe) void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx) { @@ -225,7 +251,7 @@ void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx) { ((nr_slot_select(cfg,slot)==SF_S))) { // LOG_D(HW,"Frame %d: Generating slot %d\n",frame,next_slot); - nr_feptx0(ru,slot,0,fp->symbols_per_slot); + nr_feptx0(ru,slot,0,fp->symbols_per_slot,aa); } @@ -239,6 +265,94 @@ void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx) { } +static void *nr_feptx_prec_thread(void *param) { + + RU_prec_t *prec = (RU_prec_t *) param; + RU_t *ru; + NR_DL_FRAME_PARMS *fp; + int symbol; + int p; + int aa; + int32_t *bw; + int32_t **txdataF; + int32_t **txdataF_BF; + + while(!oai_exit) + { + if (wait_on_condition(&prec->mutex_feptx_prec,&prec->cond_feptx_prec,&prec->instance_cnt_feptx_prec,"NR feptx prec thread")<0) break; + ru = prec->ru; + symbol = prec->symbol; + p = prec->p; + aa = prec->aa; + fp = ru->nr_frame_parms; + bw = ru->beam_weights[0][p][aa]; + txdataF = ru->common.txdataF; + txdataF_BF = ru->common.txdataF_BF; + multadd_cpx_vector((int16_t*)&txdataF[p][symbol*fp->ofdm_symbol_size], + (int16_t*)bw, + (int16_t*)&txdataF_BF[aa][symbol*fp->ofdm_symbol_size], + 0, + fp->ofdm_symbol_size, + 15); + + if (release_thread(&prec->mutex_feptx_prec,&prec->instance_cnt_feptx_prec,"NR feptx thread")<0) break; + } + return 0; +} + +void nr_feptx_prec_control(RU_t *ru,int frame,int tti_tx) { + + int ret = 0; + int i = 0; + int symbol = 0; + int p = 0; + int aa = 0; + NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms; + int nb_antenna_ports = fp->Lmax; // for now logical antenna ports corresponds to SSB + RU_prec_t *prec = ru->proc.prec; + PHY_VARS_gNB **gNB_list = ru->gNB_list,*gNB; + + gNB = gNB_list[0]; + + start_meas(&ru->total_precoding_stats); + for(i=0; icommon.txdataF[i], + (void*)gNB->common_vars.txdataF[i], + fp->samples_per_slot_wCP*sizeof(int32_t)); + + for(symbol = 0; symbol < fp->symbols_per_slot; ++symbol){ + for(p=0; pnb_tx;aa++){ + if ((fp->L_ssb >> p) & 0x01){ + while(1){ + if(prec[i].instance_cnt_feptx_prec == -1){ + AssertFatal((ret=pthread_mutex_lock(&prec[i].mutex_feptx_prec))==0,"mutex_lock return %d\n",ret); + prec[i].instance_cnt_feptx_prec = 0; + prec[i].symbol = symbol; + prec[i].p = p; + prec[i].aa = aa; + prec[i].index = i; + prec[i].ru = ru; + AssertFatal(pthread_cond_signal(&prec[i].cond_feptx_prec) == 0,"ERROR pthread_cond_signal for gNB_L1_thread\n"); + AssertFatal((ret=pthread_mutex_unlock(&prec[i].mutex_feptx_prec))==0,"mutex_lock returns %d\n",ret); + i = (i+1) % 16; + break; + } + i = (i+1) % 16; + } + }//(frame_params->Lssb >> p) & 0x01 + }//aa + }//p + }//symbol + + i = 0; + while(1){ + if(prec[i].instance_cnt_feptx_prec == -1) ++i; + if(i == 16) break; + } + + stop_meas(&ru->total_precoding_stats); +} void nr_feptx_prec(RU_t *ru,int frame,int tti_tx) { @@ -247,13 +361,19 @@ void nr_feptx_prec(RU_t *ru,int frame,int tti_tx) { NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms; nfapi_nr_config_request_t *cfg; int32_t ***bw; + int i=0; - + start_meas(&ru->total_precoding_stats); if (ru->num_gNB == 1){ gNB = gNB_list[0]; cfg = &gNB->gNB_config; if (nr_slot_select(cfg,tti_tx) == SF_UL) return; + for(i=0; iLmax; ++i) + memcpy((void*)ru->common.txdataF[i], + (void*)gNB->common_vars.txdataF[i], + fp->samples_per_slot_wCP*sizeof(int32_t)); + if (ru->nb_tx == 1) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC , 1); @@ -261,10 +381,11 @@ void nr_feptx_prec(RU_t *ru,int frame,int tti_tx) { AssertFatal(fp->N_ssb==ru->nb_tx,"Attempting to transmit %d SSB while Nb_tx = %d",fp->N_ssb,ru->nb_tx); for (int p=0; pLmax; p++) { - if ((fp->L_ssb >> p) & 0x01) - memcpy((void*)ru->common.txdataF_BF[0], - (void*)gNB->common_vars.txdataF[p], - fp->samples_per_slot_wCP*sizeof(int32_t)); + if ((fp->L_ssb >> p) & 0x01){ + memcpy((void*)ru->common.txdataF_BF[0], + (void*)ru->common.txdataF[p], + 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); @@ -273,17 +394,32 @@ void nr_feptx_prec(RU_t *ru,int frame,int tti_tx) { bw = ru->beam_weights[0]; for (l=0;lsymbols_per_slot;l++) { for (aa=0;aanb_tx;aa++) { - nr_beam_precoding(gNB->common_vars.txdataF, + nr_beam_precoding(ru->common.txdataF, ru->common.txdataF_BF, fp, bw, tti_tx, l, aa); - }// for (aa=0;aanb_tx;aa++) }// for (l=0;lsymbols_per_slot;l++) }// if (ru->nb_tx == 1) }// if (ru->num_gNB == 1) + stop_meas(&ru->total_precoding_stats); +} + +void nr_init_feptx_prec_thread(RU_t *ru){ + + RU_proc_t *proc = &ru->proc; + RU_prec_t *prec = proc->prec; + int i=0; + + for(i=0; i<16; ++i){ + prec[i].instance_cnt_feptx_prec = -1; + pthread_mutex_init( &prec[i].mutex_feptx_prec, NULL); + pthread_cond_init( &prec[i].cond_feptx_prec, NULL); + + threadCreate(&prec[i].pthread_feptx_prec, nr_feptx_prec_thread, (void*)&prec[i], "nr_feptx_prec", -1, OAI_PRIORITY_RT); + } } diff --git a/openair1/SCHED_NR/sched_nr.h b/openair1/SCHED_NR/sched_nr.h index e6c4b90c4e..c532df8241 100644 --- a/openair1/SCHED_NR/sched_nr.h +++ b/openair1/SCHED_NR/sched_nr.h @@ -42,10 +42,12 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, gNB_L1_rxtx_proc_t *proc, u void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot); void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx); void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx); -void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols); +void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols, int aa); void nr_init_feptx_thread(RU_t *ru); void fep_full(RU_t *ru,int slot); void nr_feptx_prec(RU_t *ru,int frame_tx,int tti_tx); +void nr_init_feptx_prec_thread(RU_t *ru); +void nr_feptx_prec_control(RU_t *ru,int frame,int tti_tx); int nr_phy_init_RU(RU_t *ru); void nr_configure_css_dci_initial(nfapi_nr_dl_config_pdcch_parameters_rel15_t* pdcch_params, diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf index 26f6eddf52..80d9ea10e6 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf @@ -246,7 +246,7 @@ L1s = ( RUs = ( { local_rf = "yes" - nb_tx = 1 + nb_tx = 8 nb_rx = 1 att_tx = 0 att_rx = 0; @@ -264,7 +264,7 @@ THREAD_STRUCT = ( #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" - worker_config = "WORKER_DISABLE"; + worker_config = "WORKER_ENABLE"; } ); From 009bacc8af51a89fc612b4b7e336f567fa6f5d23 Mon Sep 17 00:00:00 2001 From: Wang Tsu-Han Date: Fri, 30 Aug 2019 17:04:09 +0200 Subject: [PATCH 14/30] fixes for feptx LTE --- openair1/PHY/defs_RU.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/openair1/PHY/defs_RU.h b/openair1/PHY/defs_RU.h index 13552ae2fb..2e69944121 100644 --- a/openair1/PHY/defs_RU.h +++ b/openair1/PHY/defs_RU.h @@ -244,6 +244,8 @@ typedef struct RU_proc_t_s { int instance_cnt_asynch_rxtx; /// \internal This variable is protected by \ref mutex_fep int instance_cnt_fep; + /// \internal This variable is protected by \ref mutex_feptx + int instance_cnt_feptx; /// \internal This variable is protected by \ref mutex_ru_thread int instance_cnt_ru; /// This varible is protected by \ref mutex_emulatedRF @@ -263,6 +265,8 @@ typedef struct RU_proc_t_s { pthread_t pthread_synch; /// pthread struct for RU RX FEP worker thread pthread_t pthread_fep; + /// pthread struct for RU TX FEP worker thread + pthread_t pthread_feptx; /// pthread struct for emulated RF pthread_t pthread_emulateRF; /// pthread structure for asychronous RX/TX processing thread @@ -288,6 +292,8 @@ typedef struct RU_proc_t_s { pthread_attr_t attr_asynch_rxtx; /// pthread attributes for worker fep thread pthread_attr_t attr_fep; + /// pthread attributes for worker feptx thread + pthread_attr_t attr_feptx; /// pthread attributes for emulated RF pthread_attr_t attr_emulateRF; /// scheduling parameters for RU FH thread @@ -318,6 +324,8 @@ typedef struct RU_proc_t_s { pthread_cond_t cond_asynch_rxtx; /// condition varible for RU RX FEP thread pthread_cond_t cond_fep; + /// condition varible for RU TX FEP thread + pthread_cond_t cond_feptx; /// condition varible for emulated RF pthread_cond_t cond_emulateRF; /// condition variable for eNB signal @@ -345,6 +353,8 @@ typedef struct RU_proc_t_s { pthread_mutex_t mutex_asynch_rxtx; /// mutex for fep RX worker thread pthread_mutex_t mutex_fep; + /// mutex for fep TX worker thread + pthread_mutex_t mutex_feptx; /// mutex for ru_thread pthread_mutex_t mutex_ru; /// mutex for emulated RF thread From 9ccb93a09421201c2c138564006783ee1fe7503c Mon Sep 17 00:00:00 2001 From: Wang Tsu-Han Date: Mon, 9 Sep 2019 15:36:08 +0200 Subject: [PATCH 15/30] adding mask for feptx thread and VCD logging --- common/utils/LOG/vcd_signal_dumper.c | 10 +++- common/utils/LOG/vcd_signal_dumper.h | 8 +++ common/utils/T/T_defs.h | 4 +- common/utils/T/T_messages.txt | 40 +++++++++++++++ executables/nr-ru.c | 1 + openair1/PHY/MODULATION/beamforming.c | 6 +-- openair1/PHY/MODULATION/nr_modulation.h | 4 +- openair1/PHY/defs_RU.h | 5 ++ openair1/SCHED_NR/nr_ru_procedures.c | 51 +++++++++++++------ .../CONF/gnb.band78.tm1.106PRB.usrpx300.conf | 2 +- targets/RT/USER/gNB_usrp.gtkw | 25 ++++----- 11 files changed, 121 insertions(+), 35 deletions(-) diff --git a/common/utils/LOG/vcd_signal_dumper.c b/common/utils/LOG/vcd_signal_dumper.c index 1d80670324..49768e380c 100644 --- a/common/utils/LOG/vcd_signal_dumper.c +++ b/common/utils/LOG/vcd_signal_dumper.c @@ -247,7 +247,8 @@ const char* eurecomVariablesNames[] = { "slot_number_TX0_gNB", "slot_number_TX1_gNB", "slot_number_RX0_gNB", - "slot_number_RX1_gNB" + "slot_number_RX1_gNB", + "ru_tx_ofdm_mask" }; const char* eurecomFunctionsNames[] = { @@ -328,6 +329,13 @@ const char* eurecomFunctionsNames[] = { "phy_procedures_ru_feptx_ofdm7", "phy_procedures_ru_feptx_ofdm8", "phy_procedures_ru_feptx_ofdm9", + "phy_procedures_ru_feptx_ofdm10", + "phy_procedures_ru_feptx_ofdm11", + "phy_procedures_ru_feptx_ofdm12", + "phy_procedures_ru_feptx_ofdm13", + "phy_procedures_ru_feptx_ofdm14", + "phy_procedures_ru_feptx_ofdm15", + "phy_procedures_ru_feptx_ofdm16", "phy_procedures_ru_feptx_prec0", "phy_procedures_ru_feptx_prec1", "phy_procedures_ru_feptx_prec2", diff --git a/common/utils/LOG/vcd_signal_dumper.h b/common/utils/LOG/vcd_signal_dumper.h index 33af6cbeef..2b0619157b 100644 --- a/common/utils/LOG/vcd_signal_dumper.h +++ b/common/utils/LOG/vcd_signal_dumper.h @@ -225,6 +225,7 @@ typedef enum { VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_TX1_GNB, VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_RX0_GNB, VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_RX1_GNB, + VCD_SIGNAL_DUMPER_VARIABLES_RU_TX_OFDM_MASK, VCD_SIGNAL_DUMPER_VARIABLES_END @@ -309,6 +310,13 @@ typedef enum { VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM7, VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM8, VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM9, + VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM10, + VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM11, + VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM12, + VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM13, + VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM14, + VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM15, + VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM16, VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC, VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC1, VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC2, diff --git a/common/utils/T/T_defs.h b/common/utils/T/T_defs.h index 7d55d9b336..3bbd536687 100644 --- a/common/utils/T/T_defs.h +++ b/common/utils/T/T_defs.h @@ -73,10 +73,10 @@ typedef struct { } T_cache_t; /* number of VCD functions (to be kept up to date! see in T_messages.txt) */ -#define VCD_NUM_FUNCTIONS (231) +#define VCD_NUM_FUNCTIONS (238) /* number of VCD variables (to be kept up to date! see in T_messages.txt) */ -#define VCD_NUM_VARIABLES (185) +#define VCD_NUM_VARIABLES (186) /* first VCD function (to be kept up to date! see in T_messages.txt) */ #define VCD_FIRST_FUNCTION ((uintptr_t)T_VCD_FUNCTION_RT_SLEEP) diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt index 5af1f1232f..bd6f0a8bb6 100644 --- a/common/utils/T/T_messages.txt +++ b/common/utils/T/T_messages.txt @@ -2050,6 +2050,11 @@ ID = VCD_VARIABLE_SLOT_NUMBER_RX1_GNB GROUP = ALL:VCD:ENB:VCD_VARIABLE FORMAT = ulong,value VCD_NAME = slot_number_RX1_gNB +ID = VCD_VARIABLE_RU_TX_OFDM_MASK + DESC = VCD variable RU_TX_OFDM_MASK + GROUP = ALL:VCD:ENB:VCD_VARIABLE + FORMAT = ulong,value + VCD_NAME = ru_tx_ofdm_mask #functions @@ -2418,6 +2423,41 @@ ID = VCD_FUNCTION_PHY_PROCEDURES_RU_FEPTX_OFDM9 GROUP = ALL:VCD:ENB:VCD_FUNCTION FORMAT = int,value VCD_NAME = phy_procedures_ru_feptx_ofdm9 +ID = VCD_FUNCTION_PHY_PROCEDURES_RU_FEPTX_OFDM10 + DESC = VCD function PHY_PROCEDURES_RU_FEPTX_OFDM10 + GROUP = ALL:VCD:ENB:VCD_FUNCTION + FORMAT = int,value + VCD_NAME = phy_procedures_ru_feptx_ofdm10 +ID = VCD_FUNCTION_PHY_PROCEDURES_RU_FEPTX_OFDM11 + DESC = VCD function PHY_PROCEDURES_RU_FEPTX_OFDM11 + GROUP = ALL:VCD:ENB:VCD_FUNCTION + FORMAT = int,value + VCD_NAME = phy_procedures_ru_feptx_ofdm11 +ID = VCD_FUNCTION_PHY_PROCEDURES_RU_FEPTX_OFDM12 + DESC = VCD function PHY_PROCEDURES_RU_FEPTX_OFDM12 + GROUP = ALL:VCD:ENB:VCD_FUNCTION + FORMAT = int,value + VCD_NAME = phy_procedures_ru_feptx_ofdm12 +ID = VCD_FUNCTION_PHY_PROCEDURES_RU_FEPTX_OFDM13 + DESC = VCD function PHY_PROCEDURES_RU_FEPTX_OFDM13 + GROUP = ALL:VCD:ENB:VCD_FUNCTION + FORMAT = int,value + VCD_NAME = phy_procedures_ru_feptx_ofdm13 +ID = VCD_FUNCTION_PHY_PROCEDURES_RU_FEPTX_OFDM14 + DESC = VCD function PHY_PROCEDURES_RU_FEPTX_OFDM14 + GROUP = ALL:VCD:ENB:VCD_FUNCTION + FORMAT = int,value + VCD_NAME = phy_procedures_ru_feptx_ofdm14 +ID = VCD_FUNCTION_PHY_PROCEDURES_RU_FEPTX_OFDM15 + DESC = VCD function PHY_PROCEDURES_RU_FEPTX_OFDM15 + GROUP = ALL:VCD:ENB:VCD_FUNCTION + FORMAT = int,value + VCD_NAME = phy_procedures_ru_feptx_ofdm15 +ID = VCD_FUNCTION_PHY_PROCEDURES_RU_FEPTX_OFDM16 + DESC = VCD function PHY_PROCEDURES_RU_FEPTX_OFDM16 + GROUP = ALL:VCD:ENB:VCD_FUNCTION + FORMAT = int,value + VCD_NAME = phy_procedures_ru_feptx_ofdm16 ID = VCD_FUNCTION_PHY_PROCEDURES_RU_FEPTX_PREC DESC = VCD function PHY_PROCEDURES_RU_FEPTX_PREC GROUP = ALL:VCD:ENB:VCD_FUNCTION diff --git a/executables/nr-ru.c b/executables/nr-ru.c index f801f7b325..f394084b2d 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1663,6 +1663,7 @@ void init_RU_proc(RU_t *ru) { proc->frame_offset = 0; proc->num_slaves = 0; proc->frame_tx_unwrap = 0; + proc->feptx_mask = 0; for (i=0; i<10; i++) proc->symbol_mask[i]=0; diff --git a/openair1/PHY/MODULATION/beamforming.c b/openair1/PHY/MODULATION/beamforming.c index cad25c2f1b..79e220ac37 100644 --- a/openair1/PHY/MODULATION/beamforming.c +++ b/openair1/PHY/MODULATION/beamforming.c @@ -144,12 +144,12 @@ int nr_beam_precoding(int32_t **txdataF, int32_t ***beam_weights, int slot, int symbol, - int aa) + int aa, + int nb_antenna_ports) { uint8_t p; - int nb_antenna_ports = frame_parms->Lmax; // for now logical antenna ports corresponds to SSB // clear txdata_BF[aa][re] for each call of ue_spec_beamforming memset(&txdataF_BF[aa][symbol*frame_parms->ofdm_symbol_size],0,sizeof(int32_t)*(frame_parms->ofdm_symbol_size)); @@ -164,5 +164,5 @@ int nr_beam_precoding(int32_t **txdataF, 15); } } -return 0; + return 0; } diff --git a/openair1/PHY/MODULATION/nr_modulation.h b/openair1/PHY/MODULATION/nr_modulation.h index a9c1457913..2d026b891f 100644 --- a/openair1/PHY/MODULATION/nr_modulation.h +++ b/openair1/PHY/MODULATION/nr_modulation.h @@ -87,6 +87,8 @@ int nr_beam_precoding(int32_t **txdataF, int32_t ***beam_weights, int slot, int symbol, - int aa); + int aa, + int nb_antenna_ports +); #endif diff --git a/openair1/PHY/defs_RU.h b/openair1/PHY/defs_RU.h index 2e69944121..68531c1d84 100644 --- a/openair1/PHY/defs_RU.h +++ b/openair1/PHY/defs_RU.h @@ -183,6 +183,8 @@ typedef struct RU_feptx_t_s{ int aa;//physical MAX nb_tx int half_slot;//first or second half of a slot int slot;//current slot + int nb_antenna_ports;//number of logical port + int index; }RU_feptx_t; typedef struct RU_proc_t_s { @@ -400,9 +402,12 @@ typedef struct RU_proc_t_s { int ru_tx_ready; int emulate_rf_busy; + /// structure for precoding thread RU_prec_t prec[16]; /// structure for feptx thread RU_feptx_t feptx[16]; + /// mask for checking process finished + int feptx_mask; } RU_proc_t; typedef enum { diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index 01e217b183..b3857f6fc7 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -121,6 +121,8 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { int slot = tti_tx; int i = 0; int ret = 0; + int nb_antenna_ports = 4; + int ofdm_mask_full = (1<<(ru->nb_tx*2))-1; start_meas(&ru->total_precoding_stats); @@ -129,10 +131,11 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { cfg = &gNB->gNB_config; if (nr_slot_select(cfg,tti_tx) == SF_UL) return; - for(i=0; iLmax; ++i) + for(i=0; icommon.txdataF[i], (void*)gNB->common_vars.txdataF[i], fp->samples_per_slot_wCP*sizeof(int32_t)); + } }//num_gNB == 1 stop_meas(&ru->total_precoding_stats); @@ -148,21 +151,28 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { AssertFatal((ret=pthread_mutex_lock(&feptx[i].mutex_feptx))==0,"mutex_lock return %d\n",ret); feptx[i].half_slot = i%2; feptx[i].aa = i>>1; + feptx[i].index = i; feptx[i].ru = ru; feptx[i].slot = slot; + feptx[i].nb_antenna_ports = nb_antenna_ports; feptx[i].instance_cnt_feptx = 0; - AssertFatal(pthread_cond_signal(&feptx[i].cond_feptx) == 0,"ERROR pthread_cond_signal for gNB_L1_thread\n"); + AssertFatal(pthread_cond_signal(&feptx[i].cond_feptx) == 0,"ERROR pthread_cond_signal for feptx_ofdm_thread\n"); AssertFatal((ret=pthread_mutex_unlock(&feptx[i].mutex_feptx))==0,"mutex_lock returns %d\n",ret); } } - // call first half-slot in this thread - i = 0; - while(1){ - if(feptx[i].instance_cnt_feptx == -1) ++i; - if(i == 16) break; + // wait all process to finish + AssertFatal((ret=pthread_mutex_lock(&proc->mutex_feptx))==0,"mutex_lock return %d\n",ret); + while (proc->feptx_mask != ofdm_mask_full) { + // most of the time the thread is waiting here + // proc->instance_cnt_rxtx is -1 + pthread_cond_wait(&proc->cond_feptx,&proc->mutex_feptx); // this unlocks mutex_rxtx while waiting and then locks it again } + proc->feptx_mask = 0; + AssertFatal((ret=pthread_mutex_unlock(&proc->mutex_feptx))==0,"mutex_lock return %d\n",ret); + + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RU_TX_OFDM_MASK, proc->feptx_mask ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 0 ); //write_output @@ -175,19 +185,25 @@ static void *nr_feptx_thread(void *param) { RU_feptx_t *feptx = (RU_feptx_t *)param; RU_t *ru; - int aa, slot, start, l; + int aa, slot, start, l, nb_antenna_ports, ret; int32_t ***bw; NR_DL_FRAME_PARMS *fp; + int ofdm_mask_full; while (!oai_exit) { + ret = 0; if (wait_on_condition(&feptx->mutex_feptx,&feptx->cond_feptx,&feptx->instance_cnt_feptx,"NR feptx thread")<0) break; + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM+feptx->index+1 , 1 ); + ru = feptx->ru; slot = feptx->slot; aa = feptx->aa; fp = ru->nr_frame_parms; start = (feptx->half_slot)? fp->symbols_per_slot>>1 : 0; + nb_antenna_ports = feptx->nb_antenna_ports; + ofdm_mask_full = (1<<(ru->nb_tx*2))-1; bw = ru->beam_weights[0]; for (l=0;lsymbols_per_slot>>1;l++) { @@ -197,18 +213,22 @@ static void *nr_feptx_thread(void *param) { bw, slot, l+start, - aa); + aa, + nb_antenna_ports); }// for (l=0;lsymbols_per_slot;l++) nr_feptx0(ru,slot,start,fp->symbols_per_slot>>1,aa); - if (pthread_cond_signal(&feptx->cond_feptx) != 0) { - LOG_E(PHY,"[gNB] ERROR pthread_cond_signal for NR feptx thread exit\n"); - exit_fun( "ERROR pthread_cond_signal" ); - return NULL; - } if (release_thread(&feptx->mutex_feptx,&feptx->instance_cnt_feptx,"NR feptx thread")<0) break; + + AssertFatal((ret=pthread_mutex_lock(&ru->proc.mutex_feptx))==0,"mutex_lock return %d\n",ret); + ru->proc.feptx_mask |= 1<<(feptx->index); + if(ru->proc.feptx_mask == ofdm_mask_full) + AssertFatal(pthread_cond_signal(&ru->proc.cond_feptx) == 0,"ERROR pthread_cond_signal for precoding and ofdm finish\n"); + AssertFatal((ret=pthread_mutex_unlock(&ru->proc.mutex_feptx))==0,"mutex_lock returns %d\n",ret); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RU_TX_OFDM_MASK, ru->proc.feptx_mask ); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM+feptx->index+1 , 0 ); } return(NULL); } @@ -400,7 +420,8 @@ void nr_feptx_prec(RU_t *ru,int frame,int tti_tx) { bw, tti_tx, l, - aa); + aa, + fp->Lmax); }// for (aa=0;aanb_tx;aa++) }// for (l=0;lsymbols_per_slot;l++) }// if (ru->nb_tx == 1) diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf index 80d9ea10e6..c7a0549813 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf @@ -70,7 +70,7 @@ gNBs = UL_BWP_prefix_type = "NORMAL"; UL_timeAlignmentTimerCommon = "infinity"; ServingCellConfigCommon_n_TimingAdvanceOffset = "n0" - ServingCellConfigCommon_ssb_PositionsInBurst_PR = 0x01; + ServingCellConfigCommon_ssb_PositionsInBurst_PR = 0x0f;##### ServingCellConfigCommon_ssb_periodicityServingCell = 10; ServingCellConfigCommon_dmrs_TypeA_Position = 2; NIA_SubcarrierSpacing = "kHz15"; diff --git a/targets/RT/USER/gNB_usrp.gtkw b/targets/RT/USER/gNB_usrp.gtkw index 069d1765a9..416dd3b62b 100644 --- a/targets/RT/USER/gNB_usrp.gtkw +++ b/targets/RT/USER/gNB_usrp.gtkw @@ -1,19 +1,19 @@ [*] -[*] GTKWave Analyzer v3.3.61 (w)1999-2014 BSI -[*] Sat May 18 17:25:11 2019 +[*] GTKWave Analyzer v3.3.58 (w)1999-2014 BSI +[*] Fri Sep 6 15:01:30 2019 [*] -[dumpfile] "/tmp/openair_dump_gNB40.vcd" -[dumpfile_mtime] "Sat May 18 17:11:31 2019" -[dumpfile_size] 53148516 -[savefile] "/home/caracal/raymond/openairinterface5g/targets/RT/USER/gNB_usrp.gtkw" -[timestart] 11552775390 -[size] 1840 795 +[dumpfile] "/tmp/gNB_prec.vcd" +[dumpfile_mtime] "Fri Sep 6 14:59:50 2019" +[dumpfile_size] 13106022 +[savefile] "/homes/wangts/openairinterface5g/targets/RT/USER/gNB_usrp.gtkw" +[timestart] 2183320000 +[size] 1920 1018 [pos] -1 -1 -*-13.848083 11552814436 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 +*-18.423141 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 [sst_width] 386 [signals_width] 344 [sst_expanded] 1 -[sst_vpaned_height] 197 +[sst_vpaned_height] 267 @28 functions.trx_read functions.trx_write @@ -24,9 +24,8 @@ variables.frame_number_TX1_UE[63:0] functions.ue_gain_control @420 variables.frame_number_RX1_UE[63:0] -@25 -variables.trx_ts_ue[63:0] @24 +variables.trx_ts_ue[63:0] variables.trx_ts[63:0] variables.trx_tst[63:0] variables.frame_number_RX0_RU[63:0] @@ -63,5 +62,7 @@ functions.phy_procedures_ru_feptx_ofdm0 functions.phy_procedures_ru_feptx_ofdm1 functions.phy_procedures_ru_feptx_prec0 functions.phy_procedures_ru_feptx_prec1 +@23 +variables.ru_tx_ofdm_mask[63:0] [pattern_trace] 1 [pattern_trace] 0 From a9e07dce5f371a284abc64e8f34f928a0fe7c7c0 Mon Sep 17 00:00:00 2001 From: "Florian Kaltenberger (Italie)" Date: Wed, 11 Sep 2019 13:50:05 +0200 Subject: [PATCH 16/30] updating beamforming weights --- openair1/PHY/INIT/nr_init_ru.c | 41 ++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/openair1/PHY/INIT/nr_init_ru.c b/openair1/PHY/INIT/nr_init_ru.c index 3a4206ec3f..91baefd5ae 100644 --- a/openair1/PHY/INIT/nr_init_ru.c +++ b/openair1/PHY/INIT/nr_init_ru.c @@ -113,14 +113,47 @@ int nr_phy_init_RU(RU_t *ru) { for (j=0; jnb_tx; j++) { ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t)); // setting identity matrix as first step for beam weights - if (p==j) { + // if (p==j) { + /* if (j==0){ + for (re=0; reofdm_symbol_size; re++) + ru->beam_weights[i][p][j][re] = 0x00007fff; + } + else{ for (re=0; reofdm_symbol_size; re++) - ru->beam_weights[i][p][j][re] = 0x00007fff; - } + ru->beam_weights[i][p][j][re] = 0xb9cf6a1c; + }*/ + /* } else { for (re=0; reofdm_symbol_size; re++) ru->beam_weights[i][p][j][re] = 0x00000000; - } + }*/ + + if (j==1) { + for (re=0; reofdm_symbol_size; re++) + ru->beam_weights[i][p][j][re] = 0xb9cf6a1c; + } + else { + if (p==0) { + for (re=0; reofdm_symbol_size; re++) + ru->beam_weights[i][p][j][re] = 0x00007fff; + } + if (p==1) { + for (re=0; reofdm_symbol_size; re++) + ru->beam_weights[i][p][j][re] = 0x6b3945e6; + } + if (p==2) { + for (re=0; reofdm_symbol_size; re++) + ru->beam_weights[i][p][j][re] = 0xb817730d; + } + if (p==3) { + for (re=0; reofdm_symbol_size; re++) + ru->beam_weights[i][p][j][re] = 0xc1bbedd4; + } + if (p==4) { + for (re=0; reofdm_symbol_size; re++) + ru->beam_weights[i][p][j][re] = 0x41bbedd4; + } + } } // for j } // for p } From 046920e6bb689e0fdf9cc6e6d35d92cbd4121832 Mon Sep 17 00:00:00 2001 From: Wang Tsu-Han Date: Wed, 18 Sep 2019 16:36:50 +0200 Subject: [PATCH 17/30] changing ru process from slot base to symbol base --- executables/nr-gnb.c | 6 +- executables/nr-ru.c | 8 +- openair1/PHY/defs_RU.h | 1 + openair1/SCHED_NR/nr_ru_procedures.c | 115 +++++++++++------- .../CONF/gnb.band78.tm1.106PRB.usrpx300.conf | 4 +- .../CONF/gnb.band78.tm1.217PRB.usrpx300.conf | 6 +- 6 files changed, 85 insertions(+), 55 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index e86eaf2ada..b4d675ec58 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -419,9 +419,9 @@ int wakeup_txfh(PHY_VARS_gNB *gNB,gNB_L1_rxtx_proc_t *proc,int frame_tx,int slot // note this should depend on the numerology used by the TX L1 thread, set here for 500us slot time VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL,1); waitret=timedwait_on_condition(&proc->mutex_RUs_tx,&proc->cond_RUs,&proc->instance_cnt_RUs,"wakeup_txfh",1000000); + AssertFatal(release_thread(&proc->mutex_RUs_tx,&proc->instance_cnt_RUs,"wakeup_txfh")==0, "error releaseing gNB lock on RUs\n"); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL,0); - AssertFatal(release_thread(&proc->mutex_RUs_tx,&proc->instance_cnt_RUs,"wakeup_txfh")==0, "error releaseing gNB lock on RUs\n"); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_UE,proc->instance_cnt_RUs); if (waitret == ETIMEDOUT) { @@ -446,7 +446,7 @@ int wakeup_txfh(PHY_VARS_gNB *gNB,gNB_L1_rxtx_proc_t *proc,int frame_tx,int slot ru = gNB->RU_list[i]; ru_proc = &ru->proc; - AssertFatal((ret = pthread_mutex_lock(&ru_proc->mutex_gNBs))==0,"ERROR pthread_mutex_lock failed on mutex_gNBs L1_thread_tx with ret=%d\n",ret); + //AssertFatal((ret = pthread_mutex_lock(&ru_proc->mutex_gNBs))==0,"ERROR pthread_mutex_lock failed on mutex_gNBs L1_thread_tx with ret=%d\n",ret); if (ru_proc->instance_cnt_gNBs == 0) { VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST_UE, 1); @@ -454,7 +454,7 @@ int wakeup_txfh(PHY_VARS_gNB *gNB,gNB_L1_rxtx_proc_t *proc,int frame_tx,int slot AssertFatal((ret=pthread_mutex_lock(&gNB->proc.mutex_RU_tx))==0,"mutex_lock returns %d\n",ret); gNB->proc.RU_mask_tx = 0; AssertFatal((ret=pthread_mutex_unlock(&gNB->proc.mutex_RU_tx))==0,"mutex_unlock returns %d\n",ret); - AssertFatal((ret=pthread_mutex_unlock( &ru_proc->mutex_gNBs ))==0,"mutex_unlock return %d\n",ret); + //AssertFatal((ret=pthread_mutex_unlock( &ru_proc->mutex_gNBs ))==0,"mutex_unlock return %d\n",ret); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST_UE, 0); return(-1); diff --git a/executables/nr-ru.c b/executables/nr-ru.c index f394084b2d..6d03172de3 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1340,11 +1340,11 @@ static void *ru_thread_tx( void *param ) { AssertFatal((ret=pthread_mutex_lock(&L1_proc->mutex_RUs_tx))==0,"mutex_lock returns %d\n",ret); // the thread can now be woken up - if (L1_proc->instance_cnt_RUs==-1) { - AssertFatal(pthread_cond_signal(&L1_proc->cond_RUs) == 0, + //if (L1_proc->instance_cnt_RUs == -1) { + L1_proc->instance_cnt_RUs = 0; + AssertFatal(pthread_cond_signal(&L1_proc->cond_RUs) == 0, "ERROR pthread_cond_signal for gNB_L1_thread\n"); - } //else AssertFatal(1==0,"gNB TX thread is not ready\n"); - L1_proc->instance_cnt_RUs = 0; + //} //else AssertFatal(1==0,"gNB TX thread is not ready\n"); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_UE,L1_proc->instance_cnt_RUs); AssertFatal((ret=pthread_mutex_unlock(&L1_proc->mutex_RUs_tx))==0,"mutex_unlock returns %d\n",ret); diff --git a/openair1/PHY/defs_RU.h b/openair1/PHY/defs_RU.h index 68531c1d84..ec5b0f8fdc 100644 --- a/openair1/PHY/defs_RU.h +++ b/openair1/PHY/defs_RU.h @@ -183,6 +183,7 @@ typedef struct RU_feptx_t_s{ int aa;//physical MAX nb_tx int half_slot;//first or second half of a slot int slot;//current slot + int symbol;//current symbol int nb_antenna_ports;//number of logical port int index; }RU_feptx_t; diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index b3857f6fc7..7fbe2e6552 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -120,47 +120,75 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { int slot = tti_tx; int i = 0; + int j = 0; int ret = 0; - int nb_antenna_ports = 4; + int nb_antenna_ports = 8; int ofdm_mask_full = (1<<(ru->nb_tx*2))-1; - - start_meas(&ru->total_precoding_stats); - if (ru->num_gNB == 1){ - gNB = ru->gNB_list[0]; - cfg = &gNB->gNB_config; - if (nr_slot_select(cfg,tti_tx) == SF_UL) return; - - for(i=0; icommon.txdataF[i], - (void*)gNB->common_vars.txdataF[i], - fp->samples_per_slot_wCP*sizeof(int32_t)); - } - }//num_gNB == 1 - stop_meas(&ru->total_precoding_stats); - start_meas(&ru->ofdm_mod_stats); - if (nr_slot_select(cfg,slot) == SF_UL) return; + for(j=0; jsymbols_per_slot; ++j){ - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 1 ); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC , 1); + start_meas(&ru->total_precoding_stats); + if (ru->num_gNB == 1){ + gNB = ru->gNB_list[0]; + cfg = &gNB->gNB_config; + if (nr_slot_select(cfg,tti_tx) == SF_UL) return; - if (nr_slot_select(cfg,slot)==SF_DL) { - // If this is not an S-tti - for(i=0; inb_tx*2; ++i){ - AssertFatal((ret=pthread_mutex_lock(&feptx[i].mutex_feptx))==0,"mutex_lock return %d\n",ret); - feptx[i].half_slot = i%2; - feptx[i].aa = i>>1; - feptx[i].index = i; - feptx[i].ru = ru; - feptx[i].slot = slot; - feptx[i].nb_antenna_ports = nb_antenna_ports; - feptx[i].instance_cnt_feptx = 0; - AssertFatal(pthread_cond_signal(&feptx[i].cond_feptx) == 0,"ERROR pthread_cond_signal for feptx_ofdm_thread\n"); - AssertFatal((ret=pthread_mutex_unlock(&feptx[i].mutex_feptx))==0,"mutex_lock returns %d\n",ret); + for(i=0; icommon.txdataF[i][j], + (void*)&gNB->common_vars.txdataF[i][j], + fp->ofdm_symbol_size*sizeof(int32_t)); + } + }//num_gNB == 1 + //printf("~~~~~~~~~~~memery copy index: nb_antenna_ports = %d, samples_per_slot_wCP = %d\n", nb_antenna_ports, fp->samples_per_slot_wCP); + stop_meas(&ru->total_precoding_stats); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC , 0); + + + if (nr_slot_select(cfg,slot) == SF_UL) return; + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 1 ); + + if (nr_slot_select(cfg,slot)==SF_DL) { + // If this is not an S-tti + for(i=0; inb_tx; ++i){ + if(j%2 == 0){ + while(feptx[i].instance_cnt_feptx != -1){ + usleep(5); + } + AssertFatal((ret=pthread_mutex_lock(&feptx[i].mutex_feptx))==0,"mutex_lock return %d\n",ret); + feptx[i].aa = i; + feptx[i].index = i; + feptx[i].ru = ru; + feptx[i].symbol = j; + feptx[i].slot = slot; + feptx[i].nb_antenna_ports = nb_antenna_ports; + feptx[i].instance_cnt_feptx = 0; + AssertFatal(pthread_cond_signal(&feptx[i].cond_feptx) == 0,"ERROR pthread_cond_signal for feptx_ofdm_thread\n"); + AssertFatal((ret=pthread_mutex_unlock(&feptx[i].mutex_feptx))==0,"mutex_lock returns %d\n",ret); + //printf("~~~~~~~~~~~~waking up thread %d with physical antenna %d, slot %d, symbol %d, total logical antenna port %d \n", feptx[i].index, feptx[i].aa, feptx[i].slot, feptx[i].symbol, feptx[i].nb_antenna_ports); + } + else{ + while(feptx[i+ru->nb_tx].instance_cnt_feptx != -1){ + usleep(5); + } + AssertFatal((ret=pthread_mutex_lock(&feptx[i+ru->nb_tx].mutex_feptx))==0,"mutex_lock return %d\n",ret); + feptx[i+ru->nb_tx].aa = i; + feptx[i+ru->nb_tx].index = i+ru->nb_tx; + feptx[i+ru->nb_tx].ru = ru; + feptx[i+ru->nb_tx].symbol = j; + feptx[i+ru->nb_tx].slot = slot; + feptx[i+ru->nb_tx].nb_antenna_ports = nb_antenna_ports; + feptx[i+ru->nb_tx].instance_cnt_feptx = 0; + AssertFatal(pthread_cond_signal(&feptx[i+ru->nb_tx].cond_feptx) == 0,"ERROR pthread_cond_signal for feptx_ofdm_thread\n"); + AssertFatal((ret=pthread_mutex_unlock(&feptx[i+ru->nb_tx].mutex_feptx))==0,"mutex_lock returns %d\n",ret); + } + } + } - - } + }//jsymbols_per_slot // wait all process to finish AssertFatal((ret=pthread_mutex_lock(&proc->mutex_feptx))==0,"mutex_lock return %d\n",ret); @@ -200,14 +228,14 @@ static void *nr_feptx_thread(void *param) { ru = feptx->ru; slot = feptx->slot; aa = feptx->aa; + l = feptx->symbol; fp = ru->nr_frame_parms; - start = (feptx->half_slot)? fp->symbols_per_slot>>1 : 0; + start = feptx->symbol; nb_antenna_ports = feptx->nb_antenna_ports; ofdm_mask_full = (1<<(ru->nb_tx*2))-1; bw = ru->beam_weights[0]; - for (l=0;lsymbols_per_slot>>1;l++) { - nr_beam_precoding(ru->common.txdataF, + nr_beam_precoding(ru->common.txdataF, ru->common.txdataF_BF, fp, bw, @@ -215,18 +243,19 @@ static void *nr_feptx_thread(void *param) { l+start, aa, nb_antenna_ports); - }// for (l=0;lsymbols_per_slot;l++) - nr_feptx0(ru,slot,start,fp->symbols_per_slot>>1,aa); + nr_feptx0(ru,slot,start,1,aa); if (release_thread(&feptx->mutex_feptx,&feptx->instance_cnt_feptx,"NR feptx thread")<0) break; - AssertFatal((ret=pthread_mutex_lock(&ru->proc.mutex_feptx))==0,"mutex_lock return %d\n",ret); - ru->proc.feptx_mask |= 1<<(feptx->index); - if(ru->proc.feptx_mask == ofdm_mask_full) - AssertFatal(pthread_cond_signal(&ru->proc.cond_feptx) == 0,"ERROR pthread_cond_signal for precoding and ofdm finish\n"); - AssertFatal((ret=pthread_mutex_unlock(&ru->proc.mutex_feptx))==0,"mutex_lock returns %d\n",ret); + if(l >= fp->symbols_per_slot -2){ + AssertFatal((ret=pthread_mutex_lock(&ru->proc.mutex_feptx))==0,"mutex_lock return %d\n",ret); + ru->proc.feptx_mask |= 1<<(feptx->index); + if(ru->proc.feptx_mask == ofdm_mask_full) + AssertFatal(pthread_cond_signal(&ru->proc.cond_feptx) == 0,"ERROR pthread_cond_signal for precoding and ofdm finish\n"); + AssertFatal((ret=pthread_mutex_unlock(&ru->proc.mutex_feptx))==0,"mutex_lock returns %d\n",ret); + } VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RU_TX_OFDM_MASK, ru->proc.feptx_mask ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM+feptx->index+1 , 0 ); } diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf index c7a0549813..3228bc0487 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf @@ -70,7 +70,7 @@ gNBs = UL_BWP_prefix_type = "NORMAL"; UL_timeAlignmentTimerCommon = "infinity"; ServingCellConfigCommon_n_TimingAdvanceOffset = "n0" - ServingCellConfigCommon_ssb_PositionsInBurst_PR = 0x0f;##### + ServingCellConfigCommon_ssb_PositionsInBurst_PR = 0x0ff;##### ServingCellConfigCommon_ssb_periodicityServingCell = 10; ServingCellConfigCommon_dmrs_TypeA_Position = 2; NIA_SubcarrierSpacing = "kHz15"; @@ -246,7 +246,7 @@ L1s = ( RUs = ( { local_rf = "yes" - nb_tx = 8 + nb_tx = 8 nb_rx = 1 att_tx = 0 att_rx = 0; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpx300.conf index 73f2214baf..691224b883 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpx300.conf @@ -70,7 +70,7 @@ gNBs = UL_BWP_prefix_type = "NORMAL"; UL_timeAlignmentTimerCommon = "infinity"; ServingCellConfigCommon_n_TimingAdvanceOffset = "n0" - ServingCellConfigCommon_ssb_PositionsInBurst_PR = 0x01; + ServingCellConfigCommon_ssb_PositionsInBurst_PR = 0x0ff; ServingCellConfigCommon_ssb_periodicityServingCell = 10; ServingCellConfigCommon_dmrs_TypeA_Position = 2; NIA_SubcarrierSpacing = "kHz15"; @@ -246,7 +246,7 @@ L1s = ( RUs = ( { local_rf = "yes" - nb_tx = 1 + nb_tx = 8 nb_rx = 1 att_tx = 0 att_rx = 0; @@ -264,7 +264,7 @@ THREAD_STRUCT = ( #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" parallel_config = "PARALLEL_SINGLE_THREAD"; #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" - worker_config = "WORKER_DISABLE"; + worker_config = "WORKER_ENABLE"; } ); From b2275c7b48a598c1d61785bdc754e428aa063a7e Mon Sep 17 00:00:00 2001 From: Wang Tsu-Han Date: Fri, 20 Sep 2019 15:39:17 +0200 Subject: [PATCH 18/30] adding time stats for ru --- executables/nr-ru.c | 8 ++++++-- openair1/PHY/defs_RU.h | 6 +++++- openair1/SCHED_NR/nr_ru_procedures.c | 21 ++++++++++++--------- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 6d03172de3..2b2ae6530d 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1214,12 +1214,16 @@ static void *ru_stats_thread(void *param) { if (opp_enabled == 1) { if (ru->feptx_prec) { - print_meas(&ru->total_precoding_stats,"feptx_prec",NULL,NULL); + print_meas(&ru->precoding_stats,"feptx_prec",NULL,NULL); } if (ru->feprx) print_meas(&ru->ofdm_demod_stats,"feprx",NULL,NULL); - if (ru->feptx_ofdm) print_meas(&ru->ofdm_mod_stats,"feptx_ofdm",NULL,NULL); + if (ru->feptx_ofdm){ + print_meas(&ru->txdataF_copy_stats,"txdataF_copy",NULL,NULL); + print_meas(&ru->ofdm_mod_stats,"feptx_ofdm",NULL,NULL); + print_meas(&ru->ofdm_total_stats,"feptx_total",NULL,NULL); + } if (ru->fh_north_asynch_in) print_meas(&ru->rx_fhaul,"rx_fhaul",NULL,NULL); diff --git a/openair1/PHY/defs_RU.h b/openair1/PHY/defs_RU.h index ec5b0f8fdc..48b4ee61b6 100644 --- a/openair1/PHY/defs_RU.h +++ b/openair1/PHY/defs_RU.h @@ -566,12 +566,16 @@ typedef struct RU_t_s{ void (*eNB_top)(struct PHY_VARS_eNB_s *eNB, int frame_rx, int subframe_rx, char *string, struct RU_t_s *ru); void (*gNB_top)(struct PHY_VARS_gNB_s *gNB, int frame_rx, int slot_rx, char *string, struct RU_t_s *ru); + /// Timing data copy statistics (TX) + time_stats_t txdataF_copy_stats; /// Timing statistics (TX) - time_stats_t total_precoding_stats; + time_stats_t precoding_stats; /// Timing statistics time_stats_t ofdm_demod_stats; /// Timing statistics (TX) time_stats_t ofdm_mod_stats; + /// Timing statistics (TX) + time_stats_t ofdm_total_stats; /// Timing wait statistics time_stats_t ofdm_demod_wait_stats; /// Timing wakeup statistics diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index 7fbe2e6552..7fff0af177 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -125,12 +125,12 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { int nb_antenna_ports = 8; int ofdm_mask_full = (1<<(ru->nb_tx*2))-1; - start_meas(&ru->ofdm_mod_stats); + start_meas(&ru->ofdm_total_stats); for(j=0; jsymbols_per_slot; ++j){ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC , 1); - start_meas(&ru->total_precoding_stats); + start_meas(&ru->txdataF_copy_stats); if (ru->num_gNB == 1){ gNB = ru->gNB_list[0]; cfg = &gNB->gNB_config; @@ -143,7 +143,7 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { } }//num_gNB == 1 //printf("~~~~~~~~~~~memery copy index: nb_antenna_ports = %d, samples_per_slot_wCP = %d\n", nb_antenna_ports, fp->samples_per_slot_wCP); - stop_meas(&ru->total_precoding_stats); + stop_meas(&ru->txdataF_copy_stats); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC , 0); @@ -205,7 +205,7 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { //write_output - stop_meas(&ru->ofdm_mod_stats); + stop_meas(&ru->ofdm_total_stats); } @@ -235,6 +235,7 @@ static void *nr_feptx_thread(void *param) { ofdm_mask_full = (1<<(ru->nb_tx*2))-1; bw = ru->beam_weights[0]; + start_meas(&ru->precoding_stats); nr_beam_precoding(ru->common.txdataF, ru->common.txdataF_BF, fp, @@ -243,9 +244,11 @@ static void *nr_feptx_thread(void *param) { l+start, aa, nb_antenna_ports); + stop_meas(&ru->precoding_stats); - + start_meas(&ru->ofdm_mod_stats); nr_feptx0(ru,slot,start,1,aa); + stop_meas(&ru->ofdm_mod_stats); if (release_thread(&feptx->mutex_feptx,&feptx->instance_cnt_feptx,"NR feptx thread")<0) break; @@ -363,7 +366,7 @@ void nr_feptx_prec_control(RU_t *ru,int frame,int tti_tx) { gNB = gNB_list[0]; - start_meas(&ru->total_precoding_stats); + start_meas(&ru->precoding_stats); for(i=0; icommon.txdataF[i], (void*)gNB->common_vars.txdataF[i], @@ -400,7 +403,7 @@ void nr_feptx_prec_control(RU_t *ru,int frame,int tti_tx) { if(i == 16) break; } - stop_meas(&ru->total_precoding_stats); + stop_meas(&ru->precoding_stats); } void nr_feptx_prec(RU_t *ru,int frame,int tti_tx) { @@ -412,7 +415,7 @@ void nr_feptx_prec(RU_t *ru,int frame,int tti_tx) { int32_t ***bw; int i=0; - start_meas(&ru->total_precoding_stats); + start_meas(&ru->precoding_stats); if (ru->num_gNB == 1){ gNB = gNB_list[0]; cfg = &gNB->gNB_config; @@ -455,7 +458,7 @@ void nr_feptx_prec(RU_t *ru,int frame,int tti_tx) { }// for (l=0;lsymbols_per_slot;l++) }// if (ru->nb_tx == 1) }// if (ru->num_gNB == 1) - stop_meas(&ru->total_precoding_stats); + stop_meas(&ru->precoding_stats); } void nr_init_feptx_prec_thread(RU_t *ru){ From af4242c61f6d51aab465f62fdf51cdd2ded4b000 Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Thu, 29 Aug 2019 17:51:37 +0200 Subject: [PATCH 19/30] temporary workaround for real-time issues Conflicts: openair2/GNB_APP/gnb_config.c --- executables/nr-gnb.c | 4 ++-- openair2/GNB_APP/gnb_config.c | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index b4d675ec58..ea2b7bd287 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -108,8 +108,8 @@ extern openair0_config_t openair0_cfg[MAX_CARDS]; extern int transmission_mode; -uint16_t sl_ahead=4; -uint16_t sf_ahead=4; +uint16_t sl_ahead=6; +uint16_t sf_ahead=6; //pthread_t main_gNB_thread; time_stats_t softmodem_stats_mt; // main thread diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 25cfa3c516..c1a58c723d 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -808,11 +808,10 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { } NRRRC_CONFIGURATION_REQ (msg_p).N_RB_DL[j]= N_RB_DL; - if(N_RB_DL == 217) sf_ahead = 2; - else if(N_RB_DL == 106) sf_ahead = 4; - else sf_ahead = 4; - /*else AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for N_RB_DL choice: 106, 217 !\n", - RC.config_file_name, i, N_RB_DL);*/ + //if(N_RB_DL == 217) sf_ahead = 2; + //else if(N_RB_DL == 106) sf_ahead = 4; + if ((N_RB_DL != 217) && (N_RB_DL != 106)) + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for N_RB_DL choice: 106, 217 !\n", RC.config_file_name, i, N_RB_DL); /* if ((N_RB_DL!=6) && (N_RB_DL!=15) && (N_RB_DL!=25) && (N_RB_DL!=50) && (N_RB_DL!=75) && (N_RB_DL!=100)) { From d88ab2f9c018c99d0eb869bb2df0b348d3b040db Mon Sep 17 00:00:00 2001 From: WANG Tsu-Han Date: Tue, 8 Oct 2019 15:28:57 +0200 Subject: [PATCH 20/30] fix for having 4 physical antennas and adding timing measument for local trx write --- executables/nr-ru.c | 10 +++++++--- openair1/SCHED_NR/nr_ru_procedures.c | 3 ++- targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp | 12 ++++++------ .../CONF/gnb.band78.tm1.106PRB.usrpn300.conf | 9 +++++---- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 2b2ae6530d..e4f4408c4d 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -759,18 +759,22 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU, frame ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX0_RU, slot ); - for (i=0; inb_tx; i++) + for (i=0; inb_tx; i++){ txp[i] = (void *)&ru->common.txdata[i][(slot*fp->samples_per_slot)-sf_extension]; + } + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, (timestamp-ru->openair0_cfg.tx_sample_advance)&0xffffffff ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1 ); // prepare tx buffer pointers + start_meas(&ru->tx_fhaul); txs = ru->rfdevice.trx_write_func(&ru->rfdevice, timestamp+ru->ts_offset-ru->openair0_cfg.tx_sample_advance-sf_extension, txp, siglen+sf_extension, ru->nb_tx, flags); + stop_meas(&ru->tx_fhaul); LOG_D(PHY,"[TXPATH] RU %d tx_rf, writing to TS %llu, frame %d, unwrapped_frame %d, subframe %d\n",ru->idx, (long long unsigned int)timestamp,frame,proc->frame_tx_unwrap,slot); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 0 ); @@ -873,7 +877,7 @@ static void *ru_thread_prach( void *param ) { #endif ); } - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_RU_PRACH_RX, 0 ); */ + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_RU_PRACH_RX, 0 );*/ if (release_thread(&proc->mutex_prach,&proc->instance_cnt_prach,"ru_prach_thread") < 0) break; } @@ -1227,8 +1231,8 @@ static void *ru_stats_thread(void *param) { if (ru->fh_north_asynch_in) print_meas(&ru->rx_fhaul,"rx_fhaul",NULL,NULL); - if (ru->fh_north_out) { print_meas(&ru->tx_fhaul,"tx_fhaul",NULL,NULL); + if (ru->fh_north_out) { print_meas(&ru->compression,"compression",NULL,NULL); print_meas(&ru->transport,"transport",NULL,NULL); } diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index 7fff0af177..0cedadf065 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -122,7 +122,7 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { int i = 0; int j = 0; int ret = 0; - int nb_antenna_ports = 8; + int nb_antenna_ports = 4; int ofdm_mask_full = (1<<(ru->nb_tx*2))-1; start_meas(&ru->ofdm_total_stats); @@ -278,6 +278,7 @@ void nr_init_feptx_thread(RU_t *ru) { pthread_cond_init( &feptx[i].cond_feptx, NULL); threadCreate(&feptx[i].pthread_feptx, nr_feptx_thread, (void*)&feptx[i], "feptx", -1, OAI_PRIORITY_RT); + LOG_I(PHY,"init feptx thread %d\n", i); } } diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index 76ebd556ca..0175df9b21 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -455,14 +455,14 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp, #if defined(__x86_64) || defined(__i386__) #ifdef __AVX2__ nsamps2 = (nsamps+7)>>3; - __m256i buff_tx[2][nsamps2]; + __m256i buff_tx[8][nsamps2]; #else nsamps2 = (nsamps+3)>>2; - __m128i buff_tx[2][nsamps2]; + __m128i buff_tx[8][nsamps2]; #endif #elif defined(__arm__) nsamps2 = (nsamps+3)>>2; - int16x8_t buff_tx[2][nsamps2]; + int16x8_t buff_tx[8][nsamps2]; #else #error Unsupported CPU architecture, USRP device cannot be built #endif @@ -565,14 +565,14 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp #if defined(__x86_64) || defined(__i386__) #ifdef __AVX2__ nsamps2 = (nsamps+7)>>3; - __m256i buff_tmp[2][nsamps2]; + __m256i buff_tmp[8][nsamps2]; #else nsamps2 = (nsamps+3)>>2; - __m128i buff_tmp[2][nsamps2]; + __m128i buff_tmp[8][nsamps2]; #endif #elif defined(__arm__) nsamps2 = (nsamps+3)>>2; - int16x8_t buff_tmp[2][nsamps2]; + int16x8_t buff_tmp[8][nsamps2]; #endif if (device->type == USRP_B200_DEV) { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf index ad88a0b89f..f3a0362a44 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf @@ -246,15 +246,16 @@ L1s = ( RUs = ( { local_rf = "yes" - nb_tx = 1 - nb_rx = 1 - att_tx = 0 + nb_tx = 4; + nb_rx = 1; + att_tx = 0; att_rx = 0; bands = [7]; max_pdschReferenceSignalPower = -27; max_rxgain = 114; eNB_instances = [0]; - sdr_addrs = "addr=192.168.10.2,second_addr=192.168.20.2,mgmt_addr=192.168.10.2,clock_source=external,time_source=external"; + + sdr_addrs = "addr=192.168.50.2,second_addr=192.168.30.2,clock_source=external,time_source=external"; } ); From 57421caae52bdf6624a4fd0f0ba9e163302b61de Mon Sep 17 00:00:00 2001 From: Wang Tsu-Han Date: Mon, 4 Nov 2019 15:32:25 +0100 Subject: [PATCH 21/30] adding tracer for tx fronthaul --- common/utils/LOG/vcd_signal_dumper.c | 1 + common/utils/LOG/vcd_signal_dumper.h | 1 + common/utils/T/T_defs.h | 2 +- common/utils/T/T_messages.txt | 5 +++++ executables/nr-gnb.c | 3 +++ executables/nr-ru.c | 4 +--- openair1/PHY/INIT/nr_init_ru.c | 4 ++++ openair1/PHY/NR_TRANSPORT/nr_dlsch.c | 1 + openair1/PHY/NR_TRANSPORT/nr_tbs_tools.c | 1 + .../GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf | 2 +- 10 files changed, 19 insertions(+), 5 deletions(-) diff --git a/common/utils/LOG/vcd_signal_dumper.c b/common/utils/LOG/vcd_signal_dumper.c index 49768e380c..73857237d4 100644 --- a/common/utils/LOG/vcd_signal_dumper.c +++ b/common/utils/LOG/vcd_signal_dumper.c @@ -504,6 +504,7 @@ const char* eurecomFunctionsNames[] = { "pdcch_interleaving", "pdcch_tx", /*NR softmodem signal*/ + "wakeup_txfh" "gNB_thread_rxtx0", "gNB_thread_rxtx1" }; diff --git a/common/utils/LOG/vcd_signal_dumper.h b/common/utils/LOG/vcd_signal_dumper.h index 2b0619157b..40c7f5dcad 100644 --- a/common/utils/LOG/vcd_signal_dumper.h +++ b/common/utils/LOG/vcd_signal_dumper.h @@ -496,6 +496,7 @@ typedef enum { VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_TX, /*NR softmodem signal*/ + VCD_SIGNAL_DUMPER_FUNCTIONS_WAKEUP_TXFH, VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PROC_RXTX0, VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PROC_RXTX1, diff --git a/common/utils/T/T_defs.h b/common/utils/T/T_defs.h index 3bbd536687..3bbdc7d6ba 100644 --- a/common/utils/T/T_defs.h +++ b/common/utils/T/T_defs.h @@ -73,7 +73,7 @@ typedef struct { } T_cache_t; /* number of VCD functions (to be kept up to date! see in T_messages.txt) */ -#define VCD_NUM_FUNCTIONS (238) +#define VCD_NUM_FUNCTIONS (239) /* number of VCD variables (to be kept up to date! see in T_messages.txt) */ #define VCD_NUM_VARIABLES (186) diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt index bd6f0a8bb6..69fd7a998b 100644 --- a/common/utils/T/T_messages.txt +++ b/common/utils/T/T_messages.txt @@ -3240,6 +3240,11 @@ ID = VCD_FUNCTION_PDCCH_TX VCD_NAME = pdcch_tx #function for gNB +ID = VCD_FUNCTION_WAKEUP_TXFH + DESC = VCD function WAKEUP_TXFH + GROUP = ALL:VCD:ENB:VCD_FUNCTION + FORMAT = int,value + VCD_NAME = wakeup_txfh ID = VCD_FUNCTION_gNB_PROC_RXTX0 DESC = VCD function gNB_PROC_RXTX0 GROUP = ALL:VCD:ENB:VCD_FUNCTION diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index ea2b7bd287..ca6a2238bd 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -288,6 +288,8 @@ static void *gNB_L1_thread_tx(void *param) { VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_TX1_GNB,slot_tx); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX1_GNB,frame_tx); phy_procedures_gNB_TX(gNB, frame_tx,slot_tx, 1); + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_WAKEUP_TXFH, 1 ); pthread_mutex_lock( &L1_proc_tx->mutex ); L1_proc_tx->instance_cnt = -1; @@ -299,6 +301,7 @@ static void *gNB_L1_thread_tx(void *param) { pthread_mutex_unlock(&L1_proc_tx->mutex); wakeup_txfh(gNB,L1_proc_tx,frame_tx,slot_tx,timestamp_tx); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_WAKEUP_TXFH, 0 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PROC_RXTX1, 0 ); } diff --git a/executables/nr-ru.c b/executables/nr-ru.c index e4f4408c4d..3fd61288c5 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -680,9 +680,6 @@ void rx_rf(RU_t *ru,int *frame,int *slot) { proc->frame_rx = (proc->timestamp_rx / (fp->samples_per_slot*fp->slots_per_frame))&1023; proc->tti_rx = (proc->timestamp_rx / fp->samples_per_slot)%fp->slots_per_frame; // synchronize first reception to frame 0 subframe 0 - proc->timestamp_tx = proc->timestamp_rx+(sl_ahead*fp->samples_per_slot); - proc->tti_tx = (proc->tti_rx+sl_ahead)%fp->slots_per_frame; - proc->frame_tx = (proc->tti_rx>(fp->slots_per_frame-1-sl_ahead)) ? (proc->frame_rx+1)&1023 : proc->frame_rx; LOG_D(PHY,"RU %d/%d TS %llu (off %d), frame %d, slot %d.%d / %d\n", ru->idx, 0, @@ -783,6 +780,7 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { } + /*! * \brief The Asynchronous RX/TX FH thread of RAU/RCC/gNB/RRU. * This handles the RX FH for an asynchronous RRU/UE diff --git a/openair1/PHY/INIT/nr_init_ru.c b/openair1/PHY/INIT/nr_init_ru.c index f6550fff97..f759a008b5 100644 --- a/openair1/PHY/INIT/nr_init_ru.c +++ b/openair1/PHY/INIT/nr_init_ru.c @@ -157,6 +157,10 @@ void nr_phy_free_RU(RU_t *ru) for (i = 0; i < ru->nb_rx; i++) free_and_zero(ru->common.rxdata_7_5kHz[i]); free_and_zero(ru->common.rxdata_7_5kHz); + // free beamforming input buffers (TX) + for (i = 0; i < 15; i++) free_and_zero(ru->common.txdataF[i]); + free_and_zero(ru->common.txdataF); + // free IFFT input buffers (TX) for (i = 0; i < ru->nb_tx; i++) free_and_zero(ru->common.txdataF_BF[i]); free_and_zero(ru->common.txdataF_BF); diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index 074e30a5f9..8b8523e76d 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -90,6 +90,7 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t *dlsch, uint8_t Qm = rel15->modulation_order; uint16_t encoded_length = nb_symbols*Qm; + /// CRC, coding, interleaving and rate matching AssertFatal(harq->pdu!=NULL,"harq->pdu is null\n"); start_meas(dlsch_encoding_stats); diff --git a/openair1/PHY/NR_TRANSPORT/nr_tbs_tools.c b/openair1/PHY/NR_TRANSPORT/nr_tbs_tools.c index 07ca17cd6d..b9ea295c84 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_tbs_tools.c +++ b/openair1/PHY/NR_TRANSPORT/nr_tbs_tools.c @@ -168,6 +168,7 @@ void nr_get_tbs(nfapi_nr_dl_config_dlsch_pdu *dlsch_pdu, dlsch_rel15->nb_re_dmrs = N_PRB_DMRS; dlsch_rel15->nb_mod_symbols = N_RE_prime*dlsch_rel15->n_prb*dlsch_rel15->nb_codewords; + LOG_D(MAC, "TBS %d : N_RE %d N_PRB_DMRS %d N_sh_symb %d N_PRB_oh %d Ninfo %d Ninfo_prime %d R %d Qm %d table %d scale %d nb_symbols %d\n", TBS, N_RE, N_PRB_DMRS, N_sh_symb, N_PRB_oh, Ninfo, Ninfo_prime, R, Qm, table_idx, scale, dlsch_rel15->nb_mod_symbols); } diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf index 3228bc0487..2531f211d2 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf @@ -246,7 +246,7 @@ L1s = ( RUs = ( { local_rf = "yes" - nb_tx = 8 + nb_tx = 1 nb_rx = 1 att_tx = 0 att_rx = 0; From 1ef8aaee97e6e68fcd76d0dc9740bdc04cfe8e8b Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Wed, 6 Nov 2019 16:25:54 +0100 Subject: [PATCH 22/30] Revert "updating beamforming weights" This reverts commit a9e07dce5f371a284abc64e8f34f928a0fe7c7c0. --- openair1/PHY/INIT/nr_init_ru.c | 41 ++++------------------------------ 1 file changed, 4 insertions(+), 37 deletions(-) diff --git a/openair1/PHY/INIT/nr_init_ru.c b/openair1/PHY/INIT/nr_init_ru.c index 91baefd5ae..3a4206ec3f 100644 --- a/openair1/PHY/INIT/nr_init_ru.c +++ b/openair1/PHY/INIT/nr_init_ru.c @@ -113,47 +113,14 @@ int nr_phy_init_RU(RU_t *ru) { for (j=0; jnb_tx; j++) { ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t)); // setting identity matrix as first step for beam weights - // if (p==j) { - /* if (j==0){ - for (re=0; reofdm_symbol_size; re++) - ru->beam_weights[i][p][j][re] = 0x00007fff; - } - else{ + if (p==j) { for (re=0; reofdm_symbol_size; re++) - ru->beam_weights[i][p][j][re] = 0xb9cf6a1c; - }*/ - /* } + ru->beam_weights[i][p][j][re] = 0x00007fff; + } else { for (re=0; reofdm_symbol_size; re++) ru->beam_weights[i][p][j][re] = 0x00000000; - }*/ - - if (j==1) { - for (re=0; reofdm_symbol_size; re++) - ru->beam_weights[i][p][j][re] = 0xb9cf6a1c; - } - else { - if (p==0) { - for (re=0; reofdm_symbol_size; re++) - ru->beam_weights[i][p][j][re] = 0x00007fff; - } - if (p==1) { - for (re=0; reofdm_symbol_size; re++) - ru->beam_weights[i][p][j][re] = 0x6b3945e6; - } - if (p==2) { - for (re=0; reofdm_symbol_size; re++) - ru->beam_weights[i][p][j][re] = 0xb817730d; - } - if (p==3) { - for (re=0; reofdm_symbol_size; re++) - ru->beam_weights[i][p][j][re] = 0xc1bbedd4; - } - if (p==4) { - for (re=0; reofdm_symbol_size; re++) - ru->beam_weights[i][p][j][re] = 0x41bbedd4; - } - } + } } // for j } // for p } From 6be2d8f081eb03c6746e7cf683b17cf043b48b71 Mon Sep 17 00:00:00 2001 From: Wang Tsu-Han Date: Mon, 18 Nov 2019 12:33:48 +0100 Subject: [PATCH 23/30] using switch buffer for txdataF in L1 --- executables/nr-gnb.c | 2 +- executables/nr-ru.c | 15 ++++++++++--- openair1/PHY/MODULATION/ofdm_mod.c | 2 ++ openair1/PHY/NR_TRANSPORT/nr_dlsch.c | 16 +++++++------- openair1/PHY/NR_TRANSPORT/nr_tbs_tools.c | 1 - openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c | 2 +- openair1/SCHED_NR/nr_ru_procedures.c | 21 +++++++++---------- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 14 ++++++------- .../CONF/gnb.band78.tm1.106PRB.usrpn300.conf | 2 +- .../CONF/gnb.band78.tm1.106PRB.usrpx300.conf | 2 +- 10 files changed, 43 insertions(+), 34 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index e2ea9182b1..b219a2c790 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -425,7 +425,7 @@ int wakeup_txfh(PHY_VARS_gNB *gNB,gNB_L1_rxtx_proc_t *proc,int frame_tx,int slot // note this should depend on the numerology used by the TX L1 thread, set here for 500us slot time VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL,1); - waitret=timedwait_on_condition(&proc->mutex_RUs_tx,&proc->cond_RUs,&proc->instance_cnt_RUs,"wakeup_txfh",1000000); + waitret=wait_on_condition(&proc->mutex_RUs_tx,&proc->cond_RUs,&proc->instance_cnt_RUs,"wakeup_txfh"); AssertFatal(release_thread(&proc->mutex_RUs_tx,&proc->instance_cnt_RUs,"wakeup_txfh")==0, "error releaseing gNB lock on RUs\n"); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL,0); diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 98215e9a86..85a3dad4c9 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1291,8 +1291,17 @@ static void *ru_thread_tx( void *param ) { } else { if(proc->frame_tx == print_frame) { for (i=0; inb_tx; i++) { - sprintf(filename,"tx%ddataF_frame%d_sl%d.m", i, print_frame, proc->tti_tx); - LOG_M(filename,"txdataF_frame",&ru->common.txdataF_BF[i][0],fp->samples_per_subframe_wCP, 1, 1); + + if(proc->tti_tx == 0) { + sprintf(filename,"gNBdataF_frame%d_sl%d.m", print_frame, proc->tti_tx); + LOG_M(filename,"txdataF_frame",&ru->gNB_list[0]->common_vars.txdataF[i][0],fp->samples_per_frame_wCP, 1, 1); + + sprintf(filename,"tx%ddataF_frame%d_sl%d.m", i, print_frame, proc->tti_tx); + LOG_M(filename,"txdataF_frame",&ru->common.txdataF[i][0],fp->samples_per_frame_wCP, 1, 1); + + sprintf(filename,"tx%ddataF_BF_frame%d_sl%d.m", i, print_frame, proc->tti_tx); + LOG_M(filename,"txdataF_BF_frame",&ru->common.txdataF_BF[i][0],fp->samples_per_subframe_wCP, 1, 1); + } if(proc->tti_tx == 9) { sprintf(filename,"tx%ddata_frame%d.m", i, print_frame); @@ -1350,9 +1359,9 @@ static void *ru_thread_tx( void *param ) { AssertFatal(pthread_cond_signal(&L1_proc->cond_RUs) == 0, "ERROR pthread_cond_signal for gNB_L1_thread\n"); //} //else AssertFatal(1==0,"gNB TX thread is not ready\n"); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_UE,L1_proc->instance_cnt_RUs); ret = pthread_mutex_unlock(&L1_proc->mutex_RUs_tx); AssertFatal(ret == 0,"mutex_unlock returns %d\n",ret); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_UE,L1_proc->instance_cnt_RUs); } } } diff --git a/openair1/PHY/MODULATION/ofdm_mod.c b/openair1/PHY/MODULATION/ofdm_mod.c index b23fd2e2bf..cbeeca1327 100644 --- a/openair1/PHY/MODULATION/ofdm_mod.c +++ b/openair1/PHY/MODULATION/ofdm_mod.c @@ -86,6 +86,8 @@ void PHY_ofdm_mod(int *input, /// pointer to complex input ) { + if(nb_symbols == 0) return; + short temp[4096*4] __attribute__((aligned(32))); unsigned short i,j; short k; diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index 8b8523e76d..00523acb40 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -225,12 +225,12 @@ ap, Wt[0], Wt[1], Wf[0], Wf[1], delta, l_prime[0], l0, dmrs_symbol); k = start_sc; for (int i=0; in_prb*NR_NB_SC_PER_RB; i++) { if ((l == dmrs_symbol) && (k == ((start_sc+get_dmrs_freq_idx(n, k_prime, delta, dmrs_type))%(frame_parms->ofdm_symbol_size)))) { - ((int16_t*)txdataF[ap])[(l*frame_parms->ofdm_symbol_size + k)<<1] = (Wt[l_prime[0]]*Wf[k_prime]*amp*mod_dmrs[dmrs_idx<<1]) >> 15; - ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (Wt[l_prime[0]]*Wf[k_prime]*amp*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15; + ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + ((slot%2)*frame_parms->samples_per_slot_wCP)] = (Wt[l_prime[0]]*Wf[k_prime]*amp*mod_dmrs[dmrs_idx<<1]) >> 15; + ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + ((slot%2)*frame_parms->samples_per_slot_wCP)] = (Wt[l_prime[0]]*Wf[k_prime]*amp*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15; #ifdef DEBUG_DLSCH_MAPPING printf("dmrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t txdataF: %d %d\n", -dmrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[(l*frame_parms->ofdm_symbol_size + k)<<1], -((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1]); +dmrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + ((slot%2)*frame_parms->samples_per_slot_wCP)], +((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + ((slot%2)*frame_parms->samples_per_slot_wCP)]); #endif dmrs_idx++; k_prime++; @@ -240,12 +240,12 @@ dmrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[(l*frame_parms->ofdm_symbol_ else { - ((int16_t*)txdataF[ap])[(l*frame_parms->ofdm_symbol_size + k)<<1] = (amp * tx_layers[ap][m<<1]) >> 15; - ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (amp * tx_layers[ap][(m<<1) + 1]) >> 15; + ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + ((slot%2)*frame_parms->samples_per_slot_wCP)] = (amp * tx_layers[ap][m<<1]) >> 15; + ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + ((slot%2)*frame_parms->samples_per_slot_wCP)] = (amp * tx_layers[ap][(m<<1) + 1]) >> 15; #ifdef DEBUG_DLSCH_MAPPING printf("m %d\t l %d \t k %d \t txdataF: %d %d\n", -m, l, k, ((int16_t*)txdataF[ap])[(l*frame_parms->ofdm_symbol_size + k)<<1], -((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1]); +m, l, k, ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + ((slot%2)*frame_parms->samples_per_slot_wCP)], +((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + ((slot%2)*frame_parms->samples_per_slot_wCP)]); #endif m++; } diff --git a/openair1/PHY/NR_TRANSPORT/nr_tbs_tools.c b/openair1/PHY/NR_TRANSPORT/nr_tbs_tools.c index b9ea295c84..07ca17cd6d 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_tbs_tools.c +++ b/openair1/PHY/NR_TRANSPORT/nr_tbs_tools.c @@ -168,7 +168,6 @@ void nr_get_tbs(nfapi_nr_dl_config_dlsch_pdu *dlsch_pdu, dlsch_rel15->nb_re_dmrs = N_PRB_DMRS; dlsch_rel15->nb_mod_symbols = N_RE_prime*dlsch_rel15->n_prb*dlsch_rel15->nb_codewords; - LOG_D(MAC, "TBS %d : N_RE %d N_PRB_DMRS %d N_sh_symb %d N_PRB_oh %d Ninfo %d Ninfo_prime %d R %d Qm %d table %d scale %d nb_symbols %d\n", TBS, N_RE, N_PRB_DMRS, N_sh_symb, N_PRB_oh, Ninfo, Ninfo_prime, R, Qm, table_idx, scale, dlsch_rel15->nb_mod_symbols); } diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c index 19ca123e50..188c459402 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c @@ -50,7 +50,7 @@ //#define DEBUG_ULSCH_DECODING #define OAI_UL_LDPC_MAX_NUM_LLR 27000//26112 // NR_LDPC_NCOL_BG1*NR_LDPC_ZMAX = 68*384 -#define PRINT_CRC_CHECK +//#define PRINT_CRC_CHECK static uint64_t nb_total_decod =0; static uint64_t nb_error_decod =0; diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index e5a126d7cf..c4693bd263 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -121,11 +121,15 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { int slot = tti_tx; int i = 0; int j = 0; + int aa = 0; int ret = 0; - int nb_antenna_ports = 4; + int nb_antenna_ports = fp->N_ssb; int ofdm_mask_full = (1<<(ru->nb_tx*2))-1; - start_meas(&ru->ofdm_total_stats); + if (nr_slot_select(cfg,slot) == SF_UL) return; + for (aa=0; aaLmax; aa++) { + memset(ru->common.txdataF[aa],0,fp->samples_per_slot_wCP*sizeof(int32_t)); + } for(j=0; jsymbols_per_slot; ++j){ @@ -134,21 +138,17 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { if (ru->num_gNB == 1){ gNB = ru->gNB_list[0]; cfg = &gNB->gNB_config; - if (nr_slot_select(cfg,tti_tx) == SF_UL) return; for(i=0; icommon.txdataF[i][j], - (void*)&gNB->common_vars.txdataF[i][j], + memcpy((void*)&ru->common.txdataF[i][j*fp->ofdm_symbol_size], + (void*)&gNB->common_vars.txdataF[i][j*fp->ofdm_symbol_size + ((tti_tx%2)*fp->samples_per_slot_wCP)], fp->ofdm_symbol_size*sizeof(int32_t)); } + }//num_gNB == 1 - //printf("~~~~~~~~~~~memery copy index: nb_antenna_ports = %d, samples_per_slot_wCP = %d\n", nb_antenna_ports, fp->samples_per_slot_wCP); stop_meas(&ru->txdataF_copy_stats); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC+j , 0); - - if (nr_slot_select(cfg,slot) == SF_UL) return; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 1 ); if (nr_slot_select(cfg,slot)==SF_DL) { @@ -168,7 +168,6 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { feptx[i].instance_cnt_feptx = 0; AssertFatal(pthread_cond_signal(&feptx[i].cond_feptx) == 0,"ERROR pthread_cond_signal for feptx_ofdm_thread\n"); AssertFatal((ret=pthread_mutex_unlock(&feptx[i].mutex_feptx))==0,"mutex_lock returns %d\n",ret); - //printf("~~~~~~~~~~~~waking up thread %d with physical antenna %d, slot %d, symbol %d, total logical antenna port %d \n", feptx[i].index, feptx[i].aa, feptx[i].slot, feptx[i].symbol, feptx[i].nb_antenna_ports); } else{ while(feptx[i+ru->nb_tx].instance_cnt_feptx != -1){ @@ -244,7 +243,7 @@ static void *nr_feptx_thread(void *param) { fp, bw, slot, - l+start, + l, aa, nb_antenna_ports); stop_meas(&ru->precoding_stats); diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 176d56ebdd..2aea6a3ea1 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -125,18 +125,18 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) { // it is supposed that each logical antenna port correspont to a different beam so each SSB is stored into its own index of txdataF LOG_D(PHY,"SS TX: frame %d, slot %d, start_symbol %d\n",frame,slot, ssb_start_symbol); - nr_generate_pss(gNB->d_pss, txdataF[ssb_index], AMP, ssb_start_symbol, cfg, fp); - nr_generate_sss(gNB->d_sss, txdataF[ssb_index], AMP, ssb_start_symbol, cfg, fp); + nr_generate_pss(gNB->d_pss, &txdataF[ssb_index][((slot%2)*fp->samples_per_slot_wCP)], AMP, ssb_start_symbol, cfg, fp); + nr_generate_sss(gNB->d_sss, &txdataF[ssb_index][((slot%2)*fp->samples_per_slot_wCP)], AMP, ssb_start_symbol, cfg, fp); if (fp->Lmax == 4) - nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[n_hf][ssb_index],txdataF[ssb_index], AMP, ssb_start_symbol, cfg, fp); + nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[n_hf][ssb_index],&txdataF[ssb_index][((slot%2)*fp->samples_per_slot_wCP)], AMP, ssb_start_symbol, cfg, fp); else - nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[0][ssb_index],txdataF[ssb_index], AMP, ssb_start_symbol, cfg, fp); + nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[0][ssb_index],&txdataF[ssb_index][((slot%2)*fp->samples_per_slot_wCP)], AMP, ssb_start_symbol, cfg, fp); nr_generate_pbch(&gNB->pbch, pbch_pdu, gNB->nr_pbch_interleaver, - txdataF[ssb_index], + &txdataF[ssb_index][((slot%2)*fp->samples_per_slot_wCP)], AMP, ssb_start_symbol, n_hf,fp->Lmax,ssb_index, @@ -169,7 +169,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, // clear the transmit data array for the current subframe for (aa=0; aaLmax; aa++) { - memset(gNB->common_vars.txdataF[aa],0,fp->samples_per_slot_wCP*sizeof(int32_t)); + memset(&gNB->common_vars.txdataF[aa][((slot%2)*fp->samples_per_slot_wCP)],0,fp->samples_per_slot_wCP*sizeof(int32_t)); } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_COMMON_TX,1); @@ -190,7 +190,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, if (nfapi_mode == 0 || nfapi_mode == 1) { nr_generate_dci_top(gNB->pdcch_vars, gNB->nr_gold_pdcch_dmrs[slot], - gNB->common_vars.txdataF[0], // hardcoded to beam 0 + &gNB->common_vars.txdataF[0][((slot%2)*fp->samples_per_slot_wCP)], // hardcoded to beam 0 AMP, *fp, *cfg); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PDCCH_TX,0); if (num_pdsch_rnti) { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf index f3a0362a44..a1762187a5 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf @@ -246,7 +246,7 @@ L1s = ( RUs = ( { local_rf = "yes" - nb_tx = 4; + nb_tx = 1; nb_rx = 1; att_tx = 0; att_rx = 0; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf index 07985dc5c4..420188b80e 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf @@ -70,7 +70,7 @@ gNBs = UL_BWP_prefix_type = "NORMAL"; UL_timeAlignmentTimerCommon = "infinity"; ServingCellConfigCommon_n_TimingAdvanceOffset = "n0" - ServingCellConfigCommon_ssb_PositionsInBurst_PR = 0x0ff;##### + ServingCellConfigCommon_ssb_PositionsInBurst_PR = 0x01;##### ServingCellConfigCommon_ssb_periodicityServingCell = 10; ServingCellConfigCommon_dmrs_TypeA_Position = 2; NIA_SubcarrierSpacing = "kHz15"; From e0c80a83b89a2eeb5f34d5a297bcbfda3c03d964 Mon Sep 17 00:00:00 2001 From: Wang Tsu-Han Date: Thu, 21 Nov 2019 15:35:28 +0100 Subject: [PATCH 24/30] bug fix for buffer setting in dlsch and wakeup_rxtx --- executables/nr-gnb.c | 12 +++++++++++- openair1/PHY/NR_TRANSPORT/nr_dlsch.c | 17 +++++++++-------- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 16 +++++++++------- openair1/SIMULATION/NR_PHY/dlsim.c | 6 ++++-- 4 files changed, 33 insertions(+), 18 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index b219a2c790..43a3aa9195 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -527,6 +527,8 @@ int wakeup_rxtx(PHY_VARS_gNB *gNB,RU_t *ru) { RU_proc_t *ru_proc=&ru->proc; int ret; int i; + struct timespec abstime; + int time_ns = 10000; AssertFatal((ret=pthread_mutex_lock(&proc->mutex_RU))==0,"mutex_lock returns %d\n",ret); for (i=0;inum_RU;i++) { @@ -547,14 +549,22 @@ int wakeup_rxtx(PHY_VARS_gNB *gNB,RU_t *ru) { AssertFatal((ret=pthread_mutex_unlock(&proc->mutex_RU))==0,"muex_unlock returns %d\n",ret); } + clock_gettime(CLOCK_REALTIME, &abstime); + abstime.tv_nsec = abstime.tv_nsec + time_ns; + + if (abstime.tv_nsec >= 1000*1000*1000) { + abstime.tv_nsec -= 1000*1000*1000; + abstime.tv_sec += 1; + } // wake up TX for subframe n+sl_ahead // lock the TX mutex and make sure the thread is ready - AssertFatal((ret=pthread_mutex_lock(&L1_proc->mutex)) == 0,"mutex_lock returns %d\n", ret); + AssertFatal((ret=pthread_mutex_timedlock(&L1_proc->mutex, &abstime)) == 0,"mutex_lock returns %d\n", ret); if (L1_proc->instance_cnt == 0) { // L1_thread is busy so abort the subframe AssertFatal((ret=pthread_mutex_unlock( &L1_proc->mutex))==0,"muex_unlock return %d\n",ret); LOG_W(PHY,"L1_thread isn't ready in %d.%d, aborting RX processing\n",ru_proc->frame_rx,ru_proc->tti_rx); + return(-1); } ++L1_proc->instance_cnt; diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index 00523acb40..d81fe89d3a 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -220,17 +220,18 @@ ap, Wt[0], Wt[1], Wf[0], Wf[1], delta, l_prime[0], l0, dmrs_symbol); #endif uint8_t k_prime=0; uint16_t m=0, n=0, dmrs_idx=0, k=0; + int txdataF_offset = (slot%2)*frame_parms->samples_per_slot_wCP; for (int l=rel15->start_symbol; lstart_symbol+rel15->nb_symbols; l++) { k = start_sc; for (int i=0; in_prb*NR_NB_SC_PER_RB; i++) { if ((l == dmrs_symbol) && (k == ((start_sc+get_dmrs_freq_idx(n, k_prime, delta, dmrs_type))%(frame_parms->ofdm_symbol_size)))) { - ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + ((slot%2)*frame_parms->samples_per_slot_wCP)] = (Wt[l_prime[0]]*Wf[k_prime]*amp*mod_dmrs[dmrs_idx<<1]) >> 15; - ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + ((slot%2)*frame_parms->samples_per_slot_wCP)] = (Wt[l_prime[0]]*Wf[k_prime]*amp*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15; + ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (Wt[l_prime[0]]*Wf[k_prime]*amp*mod_dmrs[dmrs_idx<<1]) >> 15; + ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = (Wt[l_prime[0]]*Wf[k_prime]*amp*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15; #ifdef DEBUG_DLSCH_MAPPING printf("dmrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t txdataF: %d %d\n", -dmrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + ((slot%2)*frame_parms->samples_per_slot_wCP)], -((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + ((slot%2)*frame_parms->samples_per_slot_wCP)]); +dmrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)], +((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)]); #endif dmrs_idx++; k_prime++; @@ -240,12 +241,12 @@ dmrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol else { - ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + ((slot%2)*frame_parms->samples_per_slot_wCP)] = (amp * tx_layers[ap][m<<1]) >> 15; - ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + ((slot%2)*frame_parms->samples_per_slot_wCP)] = (amp * tx_layers[ap][(m<<1) + 1]) >> 15; + ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (amp * tx_layers[ap][m<<1]) >> 15; + ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = (amp * tx_layers[ap][(m<<1) + 1]) >> 15; #ifdef DEBUG_DLSCH_MAPPING printf("m %d\t l %d \t k %d \t txdataF: %d %d\n", -m, l, k, ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + ((slot%2)*frame_parms->samples_per_slot_wCP)], -((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + ((slot%2)*frame_parms->samples_per_slot_wCP)]); +m, l, k, ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)], +((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)]); #endif m++; } diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 2aea6a3ea1..5fe9d8b103 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -96,6 +96,7 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) { uint8_t *pbch_pdu=&gNB->pbch_pdu[0]; uint8_t ssb_index, n_hf; int ssb_start_symbol, rel_slot; + int txdataF_offset = (slot%2)*fp->samples_per_slot_wCP; n_hf = cfg->sch_config.half_frame_index.value; @@ -125,18 +126,18 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) { // it is supposed that each logical antenna port correspont to a different beam so each SSB is stored into its own index of txdataF LOG_D(PHY,"SS TX: frame %d, slot %d, start_symbol %d\n",frame,slot, ssb_start_symbol); - nr_generate_pss(gNB->d_pss, &txdataF[ssb_index][((slot%2)*fp->samples_per_slot_wCP)], AMP, ssb_start_symbol, cfg, fp); - nr_generate_sss(gNB->d_sss, &txdataF[ssb_index][((slot%2)*fp->samples_per_slot_wCP)], AMP, ssb_start_symbol, cfg, fp); + nr_generate_pss(gNB->d_pss, &txdataF[ssb_index][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); + nr_generate_sss(gNB->d_sss, &txdataF[ssb_index][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); if (fp->Lmax == 4) - nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[n_hf][ssb_index],&txdataF[ssb_index][((slot%2)*fp->samples_per_slot_wCP)], AMP, ssb_start_symbol, cfg, fp); + nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[n_hf][ssb_index],&txdataF[ssb_index][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); else - nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[0][ssb_index],&txdataF[ssb_index][((slot%2)*fp->samples_per_slot_wCP)], AMP, ssb_start_symbol, cfg, fp); + nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[0][ssb_index],&txdataF[ssb_index][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); nr_generate_pbch(&gNB->pbch, pbch_pdu, gNB->nr_pbch_interleaver, - &txdataF[ssb_index][((slot%2)*fp->samples_per_slot_wCP)], + &txdataF[ssb_index][txdataF_offset], AMP, ssb_start_symbol, n_hf,fp->Lmax,ssb_index, @@ -155,6 +156,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, nfapi_nr_config_request_t *cfg = &gNB->gNB_config; int offset = gNB->CC_id; uint8_t ssb_frame_periodicity; // every how many frames SSB are generated + int txdataF_offset = (slot%2)*fp->samples_per_slot_wCP; if (cfg->sch_config.ssb_periodicity.value < 20) ssb_frame_periodicity = 1; @@ -169,7 +171,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, // clear the transmit data array for the current subframe for (aa=0; aaLmax; aa++) { - memset(&gNB->common_vars.txdataF[aa][((slot%2)*fp->samples_per_slot_wCP)],0,fp->samples_per_slot_wCP*sizeof(int32_t)); + memset(&gNB->common_vars.txdataF[aa][txdataF_offset],0,fp->samples_per_slot_wCP*sizeof(int32_t)); } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_COMMON_TX,1); @@ -190,7 +192,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, if (nfapi_mode == 0 || nfapi_mode == 1) { nr_generate_dci_top(gNB->pdcch_vars, gNB->nr_gold_pdcch_dmrs[slot], - &gNB->common_vars.txdataF[0][((slot%2)*fp->samples_per_slot_wCP)], // hardcoded to beam 0 + &gNB->common_vars.txdataF[0][txdataF_offset], // hardcoded to beam 0 AMP, *fp, *cfg); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PDCCH_TX,0); if (num_pdsch_rnti) { diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index d20c954dcc..e203b5dc48 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -565,24 +565,26 @@ int main(int argc, char **argv) phy_procedures_gNB_TX(gNB,frame,slot,0); //nr_common_signal_procedures (gNB,frame,subframe); + int txdataF_offset = (slot%2) * frame_parms->samples_per_slot_wCP; LOG_M("txsigF0.m","txsF0", gNB->common_vars.txdataF[0],frame_length_complex_samples_no_prefix,1,1); if (gNB->frame_parms.nb_antennas_tx>1) LOG_M("txsigF1.m","txsF1", gNB->common_vars.txdataF[1],frame_length_complex_samples_no_prefix,1,1); int tx_offset = slot*frame_parms->samples_per_slot; + printf("samples_per_slot_wCP = %d\n", frame_parms->samples_per_slot_wCP); //TODO: loop over slots for (aa=0; aaframe_parms.nb_antennas_tx; aa++) { if (gNB_config->subframe_config.dl_cyclic_prefix_type.value == 1) { - PHY_ofdm_mod(gNB->common_vars.txdataF[aa], + PHY_ofdm_mod(&gNB->common_vars.txdataF[aa][txdataF_offset], &txdata[aa][tx_offset], frame_parms->ofdm_symbol_size, 12, frame_parms->nb_prefix_samples, CYCLIC_PREFIX); } else { - nr_normal_prefix_mod(gNB->common_vars.txdataF[aa], + nr_normal_prefix_mod(&gNB->common_vars.txdataF[aa][txdataF_offset], &txdata[aa][tx_offset], 14, frame_parms); From 63375fa13930bbfa42aafa105e6d9dea7141a4f3 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Mon, 25 Nov 2019 16:43:15 +0100 Subject: [PATCH 25/30] BF weights from config file for RU case --- executables/nr-ru.c | 11 ++- openair1/PHY/INIT/nr_init_ru.c | 27 ++++--- openair1/PHY/defs_RU.h | 4 + openair1/SCHED_NR/nr_ru_procedures.c | 1 - openair2/ENB_APP/enb_paramdef.h | 25 +++--- openair2/GNB_APP/gnb_paramdef.h | 78 +------------------ .../CONF/gnb.band78.tm1.217PRB.usrpn300.conf | 4 + 7 files changed, 48 insertions(+), 102 deletions(-) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 7ca2a15eca..d29462100d 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -91,7 +91,8 @@ unsigned short config_frames[4] = {2,9,11,13}; /* these variables have to be defined before including ENB_APP/enb_paramdef.h and GNB_APP/gnb_paramdef.h */ static int DEFBANDS[] = {7}; static int DEFENBS[] = {0}; - +static int DEFBFW[] = {0x00007fff}; + //static int DEFNRBANDS[] = {7}; //static int DEFGNBS[] = {0}; @@ -2335,6 +2336,14 @@ void RCconfig_RU(void) RC.ru[j]->nb_rx = *(RUParamList.paramarray[j][RU_NB_RX_IDX].uptr); RC.ru[j]->att_tx = *(RUParamList.paramarray[j][RU_ATT_TX_IDX].uptr); RC.ru[j]->att_rx = *(RUParamList.paramarray[j][RU_ATT_RX_IDX].uptr); + + if (config_isparamset(RUParamList.paramarray[j], RU_BF_WEIGHTS_LIST_IDX)) { + RC.ru[j]->nb_bfw = RUParamList.paramarray[j][RU_BF_WEIGHTS_LIST_IDX].numelt; + for (i=0; inum_gNB; i++) { + RC.ru[j]->bw_list[i] = (int32_t *)malloc16_clear((RC.ru[j]->nb_bfw)*sizeof(int32_t)); + for (int b=0; bnb_bfw; b++) RC.ru[j]->bw_list[i][b] = RUParamList.paramarray[j][RU_BF_WEIGHTS_LIST_IDX].iptr[b]; + } + } }// j=0..num_rus } else { RC.nb_RU = 0; diff --git a/openair1/PHY/INIT/nr_init_ru.c b/openair1/PHY/INIT/nr_init_ru.c index 3a4206ec3f..90b79c1a06 100644 --- a/openair1/PHY/INIT/nr_init_ru.c +++ b/openair1/PHY/INIT/nr_init_ru.c @@ -105,22 +105,27 @@ int nr_phy_init_RU(RU_t *ru) { RC.nb_nr_L1_inst,NUMBER_OF_gNB_MAX); LOG_E(PHY,"[INIT] %s() RC.nb_nr_L1_inst:%d \n", __FUNCTION__, RC.nb_nr_L1_inst); - + + int beam_count = 0; + if (ru->nb_tx>1) { + for (p=0;pLmax;p++) { + if ((fp->L_ssb >> p) & 0x01) + beam_count++; + } + AssertFatal(ru->nb_bfw==(beam_count*ru->nb_tx),"Number of beam weights from config file is %d while the expected number is %d",ru->nb_bfw,(beam_count*ru->nb_tx)); + } + + int l_ind = 0; for (i=0; iLmax;p++) { if ((fp->L_ssb >> p) & 0x01) { ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*)); for (j=0; jnb_tx; j++) { ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t)); - // setting identity matrix as first step for beam weights - if (p==j) { - for (re=0; reofdm_symbol_size; re++) - ru->beam_weights[i][p][j][re] = 0x00007fff; - } - else { - for (re=0; reofdm_symbol_size; re++) - ru->beam_weights[i][p][j][re] = 0x00000000; - } + for (re=0; reofdm_symbol_size; re++) + ru->beam_weights[i][p][j][re] = ru->bw_list[i][l_ind]; + //printf("Beam Weight %08x for beam %d and tx %d\n",ru->bw_list[i][l_ind],p,j); + l_ind++; } // for j } // for p } @@ -170,10 +175,8 @@ void nr_phy_free_RU(RU_t *ru) for (i = 0; i < RC.nb_nr_L1_inst; i++) { for (p = 0; p < 15; p++) { - if (p == 0 || p == 5) { for (j=0; jnb_tx; j++) free_and_zero(ru->beam_weights[i][p][j]); free_and_zero(ru->beam_weights[i][p]); - } } } } diff --git a/openair1/PHY/defs_RU.h b/openair1/PHY/defs_RU.h index dc4c709921..576a794dab 100644 --- a/openair1/PHY/defs_RU.h +++ b/openair1/PHY/defs_RU.h @@ -518,6 +518,10 @@ typedef struct RU_t_s { /// RX and TX buffers for precoder output RU_COMMON common; RU_CALIBRATION calibration; + /// beamforming weight list size + int nb_bfw; + /// beamforming weight list of values + int32_t *bw_list[NUMBER_OF_eNB_MAX+1]; /// beamforming weight vectors int32_t **beam_weights[NUMBER_OF_eNB_MAX+1][15]; /// received frequency-domain signal for PRACH (IF4p5 RRU) diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index e60e936f34..21b6d0e2dc 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -451,4 +451,3 @@ void nr_fep_full(RU_t *ru, int slot) { } ->>>>>>> develop-nr diff --git a/openair2/ENB_APP/enb_paramdef.h b/openair2/ENB_APP/enb_paramdef.h index 106a9f297e..0fedc04abd 100644 --- a/openair2/ENB_APP/enb_paramdef.h +++ b/openair2/ENB_APP/enb_paramdef.h @@ -93,6 +93,7 @@ typedef enum { #define CONFIG_STRING_RU_SF_EXTENSION "sf_extension" #define CONFIG_STRING_RU_END_OF_BURST_DELAY "end_of_burst_delay" #define CONFIG_STRING_RU_OTA_SYNC_ENABLE "ota_sync_enabled" +#define CONFIG_STRING_RU_BF_WEIGHTS_LIST "bf_weights" #define RU_LOCAL_IF_NAME_IDX 0 #define RU_LOCAL_ADDRESS_IDX 1 @@ -118,23 +119,22 @@ typedef enum { #define RU_SF_EXTENSION_IDX 21 #define RU_END_OF_BURST_DELAY_IDX 22 #define RU_OTA_SYNC_ENABLE_IDX 23 - - +#define RU_BF_WEIGHTS_LIST_IDX 24 /*-----------------------------------------------------------------------------------------------------------------------------------------*/ /* RU configuration parameters */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ /*-----------------------------------------------------------------------------------------------------------------------------------------*/ #define RUPARAMS_DESC { \ - {CONFIG_STRING_RU_LOCAL_IF_NAME, NULL, 0, strptr:NULL, defstrval:"lo", TYPE_STRING, 0}, \ - {CONFIG_STRING_RU_LOCAL_ADDRESS, NULL, 0, strptr:NULL, defstrval:"127.0.0.2", TYPE_STRING, 0}, \ - {CONFIG_STRING_RU_REMOTE_ADDRESS, NULL, 0, strptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \ + {CONFIG_STRING_RU_LOCAL_IF_NAME, NULL, 0, strptr:NULL, defstrval:"lo", TYPE_STRING, 0}, \ + {CONFIG_STRING_RU_LOCAL_ADDRESS, NULL, 0, strptr:NULL, defstrval:"127.0.0.2", TYPE_STRING, 0}, \ + {CONFIG_STRING_RU_REMOTE_ADDRESS, NULL, 0, strptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \ {CONFIG_STRING_RU_LOCAL_PORTC, NULL, 0, uptr:NULL, defuintval:50000, TYPE_UINT, 0}, \ {CONFIG_STRING_RU_REMOTE_PORTC, NULL, 0, uptr:NULL, defuintval:50000, TYPE_UINT, 0}, \ {CONFIG_STRING_RU_LOCAL_PORTD, NULL, 0, uptr:NULL, defuintval:50001, TYPE_UINT, 0}, \ {CONFIG_STRING_RU_REMOTE_PORTD, NULL, 0, uptr:NULL, defuintval:50001, TYPE_UINT, 0}, \ - {CONFIG_STRING_RU_TRANSPORT_PREFERENCE, NULL, 0, strptr:NULL, defstrval:"udp_if5", TYPE_STRING, 0}, \ - {CONFIG_STRING_RU_LOCAL_RF, NULL, 0, strptr:NULL, defstrval:"yes", TYPE_STRING, 0}, \ + {CONFIG_STRING_RU_TRANSPORT_PREFERENCE, NULL, 0, strptr:NULL, defstrval:"udp_if5", TYPE_STRING, 0}, \ + {CONFIG_STRING_RU_LOCAL_RF, NULL, 0, strptr:NULL, defstrval:"yes", TYPE_STRING, 0}, \ {CONFIG_STRING_RU_NB_TX, NULL, 0, uptr:NULL, defuintval:1, TYPE_UINT, 0}, \ {CONFIG_STRING_RU_NB_RX, NULL, 0, uptr:NULL, defuintval:1, TYPE_UINT, 0}, \ {CONFIG_STRING_RU_MAX_RS_EPRE, NULL, 0, iptr:NULL, defintval:-29, TYPE_INT, 0}, \ @@ -143,13 +143,14 @@ typedef enum { {CONFIG_STRING_RU_ENB_LIST, NULL, 0, uptr:NULL, defintarrayval:DEFENBS, TYPE_INTARRAY, 1}, \ {CONFIG_STRING_RU_ATT_TX, NULL, 0, uptr:NULL, defintval:0, TYPE_UINT, 0}, \ {CONFIG_STRING_RU_ATT_RX, NULL, 0, uptr:NULL, defintval:0, TYPE_UINT, 0}, \ - {CONFIG_STRING_RU_IS_SLAVE, NULL, 0, strptr:NULL, defstrval:"no", TYPE_STRING, 0}, \ - {CONFIG_STRING_RU_NBIOTRRC_LIST, NULL, 0, uptr:NULL, defintarrayval:DEFENBS, TYPE_INTARRAY, 1}, \ + {CONFIG_STRING_RU_IS_SLAVE, NULL, 0, strptr:NULL, defstrval:"no", TYPE_STRING, 0}, \ + {CONFIG_STRING_RU_NBIOTRRC_LIST, NULL, 0, uptr:NULL, defintarrayval:DEFENBS, TYPE_INTARRAY, 1}, \ {CONFIG_STRING_RU_SDR_ADDRS, NULL, 0, strptr:NULL, defstrval:"type=b200", TYPE_STRING, 0}, \ {CONFIG_STRING_RU_SDR_CLK_SRC, NULL, 0, strptr:NULL, defstrval:"internal", TYPE_STRING, 0}, \ - {CONFIG_STRING_RU_SF_EXTENSION, NULL, 0, uptr:NULL, defuintval:312, TYPE_UINT, 0}, \ - {CONFIG_STRING_RU_END_OF_BURST_DELAY, NULL, 0, uptr:NULL, defuintval:400, TYPE_UINT, 0}, \ - {CONFIG_STRING_RU_OTA_SYNC_ENABLE, NULL, 0, strptr:NULL, defstrval:"no", TYPE_STRING, 0}, \ + {CONFIG_STRING_RU_SF_EXTENSION, NULL, 0, uptr:NULL, defuintval:312, TYPE_UINT, 0}, \ + {CONFIG_STRING_RU_END_OF_BURST_DELAY, NULL, 0, uptr:NULL, defuintval:400, TYPE_UINT, 0}, \ + {CONFIG_STRING_RU_OTA_SYNC_ENABLE, NULL, 0, strptr:NULL, defstrval:"no", TYPE_STRING, 0}, \ + {CONFIG_STRING_RU_BF_WEIGHTS_LIST, NULL, 0, iptr:NULL, defintarrayval:DEFBFW, TYPE_INTARRAY, 0}, \ } /*---------------------------------------------------------------------------------------------------------------------------------------*/ diff --git a/openair2/GNB_APP/gnb_paramdef.h b/openair2/GNB_APP/gnb_paramdef.h index 1ca6f2d7ec..8a55c61cd7 100644 --- a/openair2/GNB_APP/gnb_paramdef.h +++ b/openair2/GNB_APP/gnb_paramdef.h @@ -67,83 +67,9 @@ typedef enum { #define CONFIG_STRING_ACTIVE_RUS "Active_RUs" /*------------------------------------------------------------------------------------------------------------------------------------------*/ -/* RUs configuration section name */ -#define CONFIG_STRING_RU_LIST "RUs" -#define CONFIG_STRING_RU_CONFIG "ru_config" -/* RUs configuration parameters name */ -#define CONFIG_STRING_RU_LOCAL_IF_NAME "local_if_name" -#define CONFIG_STRING_RU_LOCAL_ADDRESS "local_address" -#define CONFIG_STRING_RU_REMOTE_ADDRESS "remote_address" -#define CONFIG_STRING_RU_LOCAL_PORTC "local_portc" -#define CONFIG_STRING_RU_REMOTE_PORTC "remote_portc" -#define CONFIG_STRING_RU_LOCAL_PORTD "local_portd" -#define CONFIG_STRING_RU_REMOTE_PORTD "remote_portd" -#define CONFIG_STRING_RU_LOCAL_RF "local_rf" -#define CONFIG_STRING_RU_TRANSPORT_PREFERENCE "tr_preference" -#define CONFIG_STRING_RU_BAND_LIST "bands" -#define CONFIG_STRING_RU_GNB_LIST "gNB_instances" -#define CONFIG_STRING_RU_NB_TX "nb_tx" -#define CONFIG_STRING_RU_NB_RX "nb_rx" -#define CONFIG_STRING_RU_ATT_TX "att_tx" -#define CONFIG_STRING_RU_ATT_RX "att_rx" -#define CONFIG_STRING_RU_MAX_RS_EPRE "max_pdschReferenceSignalPower" -#define CONFIG_STRING_RU_MAX_RXGAIN "max_rxgain" -#define CONFIG_STRING_RU_IF_COMPRESSION "if_compression" -#define CONFIG_STRING_RU_NBIOTRRC_LIST "NbIoT_RRC_instances" -#define CONFIG_STRING_RU_SDR_ADDRS "sdr_addrs" -#define CONFIG_STRING_RU_SDR_CLK_SRC "clock_src" - -#define RU_LOCAL_IF_NAME_IDX 0 -#define RU_LOCAL_ADDRESS_IDX 1 -#define RU_REMOTE_ADDRESS_IDX 2 -#define RU_LOCAL_PORTC_IDX 3 -#define RU_REMOTE_PORTC_IDX 4 -#define RU_LOCAL_PORTD_IDX 5 -#define RU_REMOTE_PORTD_IDX 6 -#define RU_TRANSPORT_PREFERENCE_IDX 7 -#define RU_LOCAL_RF_IDX 8 -#define RU_NB_TX_IDX 9 -#define RU_NB_RX_IDX 10 -#define RU_MAX_RS_EPRE_IDX 11 -#define RU_MAX_RXGAIN_IDX 12 -#define RU_BAND_LIST_IDX 13 -#define RU_GNB_LIST_IDX 14 -#define RU_ATT_TX_IDX 15 -#define RU_ATT_RX_IDX 16 -#define RU_IS_SLAVE_IDX 17 -#define RU_NBIOTRRC_LIST_IDX 18 -#define RU_SDR_ADDRS 19 -#define RU_SDR_CLK_SRC 20 -#define RU_SF_EXTENSION_IDX 21 -#define RU_END_OF_BURST_DELAY_IDX 22 - - - -/*-----------------------------------------------------------------------------------------------------------------------------------------*/ -/* RU configuration parameters */ -/* optname helpstr paramflags XXXptr defXXXval type numelt */ -/*-----------------------------------------------------------------------------------------------------------------------------------------*/ -#define GNBRUPARAMS_DESC { \ -{CONFIG_STRING_RU_LOCAL_IF_NAME, NULL, 0, strptr:NULL, defstrval:"lo", TYPE_STRING, 0}, \ -{CONFIG_STRING_RU_LOCAL_ADDRESS, NULL, 0, strptr:NULL, defstrval:"127.0.0.2", TYPE_STRING, 0}, \ -{CONFIG_STRING_RU_REMOTE_ADDRESS, NULL, 0, strptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \ -{CONFIG_STRING_RU_LOCAL_PORTC, NULL, 0, uptr:NULL, defuintval:50000, TYPE_UINT, 0}, \ -{CONFIG_STRING_RU_REMOTE_PORTC, NULL, 0, uptr:NULL, defuintval:50000, TYPE_UINT, 0}, \ -{CONFIG_STRING_RU_LOCAL_PORTD, NULL, 0, uptr:NULL, defuintval:50001, TYPE_UINT, 0}, \ -{CONFIG_STRING_RU_REMOTE_PORTD, NULL, 0, uptr:NULL, defuintval:50001, TYPE_UINT, 0}, \ -{CONFIG_STRING_RU_TRANSPORT_PREFERENCE, NULL, 0, strptr:NULL, defstrval:"udp_if5", TYPE_STRING, 0}, \ -{CONFIG_STRING_RU_LOCAL_RF, NULL, 0, strptr:NULL, defstrval:"yes", TYPE_STRING, 0}, \ -{CONFIG_STRING_RU_NB_TX, NULL, 0, uptr:NULL, defuintval:1, TYPE_UINT, 0}, \ -{CONFIG_STRING_RU_NB_RX, NULL, 0, uptr:NULL, defuintval:1, TYPE_UINT, 0}, \ -{CONFIG_STRING_RU_MAX_RS_EPRE, NULL, 0, iptr:NULL, defintval:-29, TYPE_INT, 0}, \ -{CONFIG_STRING_RU_MAX_RXGAIN, NULL, 0, iptr:NULL, defintval:120, TYPE_INT, 0}, \ -{CONFIG_STRING_RU_BAND_LIST, NULL, 0, uptr:NULL, defintarrayval:DEFNRBANDS, TYPE_INTARRAY, 1}, \ -{CONFIG_STRING_RU_GNB_LIST, NULL, 0, uptr:NULL, defintarrayval:DEFGNBS, TYPE_INTARRAY, 1}, \ -{CONFIG_STRING_RU_ATT_TX, NULL, 0, uptr:NULL, defintval:0, TYPE_UINT, 0}, \ -{CONFIG_STRING_RU_ATT_RX, NULL, 0, uptr:NULL, defintval:0, TYPE_UINT, 0}, \ -{CONFIG_STRING_RU_NBIOTRRC_LIST, NULL, 0, uptr:NULL, defintarrayval:DEFGNBS, TYPE_INTARRAY, 1}, \ -} +/* RUs configuration for gNB is the same for eNB */ +/* Check file enb_paramdef.h */ /*---------------------------------------------------------------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------------------------------------------------------------*/ diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf index 06c52e1aff..52a18a511b 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf @@ -256,6 +256,10 @@ RUs = ( eNB_instances = [0]; sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2"; clock_src = "external"; + # beamforming weights for static beams each of them is a int32 composed by two int16 representing imaginary and real part of the weight + # weights are input in an array, starting with the weights associated to first logical beam for all nb_tx , than the weights for 2nd logical beam and so on + # the list size is (nb_tx) X (number of logical beams) + bf_weights = [0x00007fff]; } ); From 2406662e740819732c547383ae13d5631a590b7d Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Tue, 26 Nov 2019 11:07:43 +0100 Subject: [PATCH 26/30] new config file for static beam weights --- .../CONF/gnb.band78.tm1.217PRB.usrpn300.conf | 4 - .../CONF/gnb.band78.tm1.beamw.usrpn300.conf | 291 ++++++++++++++++++ 2 files changed, 291 insertions(+), 4 deletions(-) create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.beamw.usrpn300.conf diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf index 52a18a511b..06c52e1aff 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf @@ -256,10 +256,6 @@ RUs = ( eNB_instances = [0]; sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2"; clock_src = "external"; - # beamforming weights for static beams each of them is a int32 composed by two int16 representing imaginary and real part of the weight - # weights are input in an array, starting with the weights associated to first logical beam for all nb_tx , than the weights for 2nd logical beam and so on - # the list size is (nb_tx) X (number of logical beams) - bf_weights = [0x00007fff]; } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.beamw.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.beamw.usrpn300.conf new file mode 100644 index 0000000000..a9d251efa2 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.beamw.usrpn300.conf @@ -0,0 +1,291 @@ +Active_gNBs = ( "gNB-Eurecom-5GNRBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + + cell_type = "CELL_MACRO_GNB"; + + gNB_name = "gNB-Eurecom-5GNRBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + + plmn_list = ({mcc = 208; mnc = 93; mnc_length = 2;}); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + component_carriers = ( + { + node_function = "3GPP_gNODEB"; + node_timing = "synch_to_ext_device"; + node_synch_ref = 0; + frame_type = "TDD"; + DL_prefix_type = "NORMAL"; + UL_prefix_type = "NORMAL"; + eutra_band = 78; + downlink_frequency = 3510000000L; + uplink_frequency_offset = -120000000; + Nid_cell = 0; + N_RB_DL = 217; + nb_antenna_ports = 1; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 90; + rx_gain = 125; + MIB_subCarrierSpacingCommon = 30; + MIB_ssb_SubcarrierOffset = 0; + MIB_dmrs_TypeA_Position = 2; + pdcch_ConfigSIB1 = 0; + SIB1_frequencyOffsetSSB = "khz5"; + SIB1_ssb_PeriodicityServingCell = 5; + SIB1_ss_PBCH_BlockPower = -60; + absoluteFrequencySSB = 0; + DL_FreqBandIndicatorNR = 15; + DL_absoluteFrequencyPointA = 15; + DL_offsetToCarrier = 15; + DL_SCS_SubcarrierSpacing = "kHz30"; + DL_SCS_SpecificCarrier_k0 = 0; + DL_carrierBandwidth = 15; + DL_locationAndBandwidth = 15; + DL_BWP_SubcarrierSpacing = "kHz30"; + DL_BWP_prefix_type = "NORMAL"; + UL_FreqBandIndicatorNR = 15; + UL_absoluteFrequencyPointA = 13; + UL_additionalSpectrumEmission = 3; + UL_p_Max = -1; + UL_frequencyShift7p5khz = "TRUE"; + UL_offsetToCarrier = 10; + UL_SCS_SubcarrierSpacing = "kHz30"; + UL_SCS_SpecificCarrier_k0 = 0; + UL_carrierBandwidth = 15; + UL_locationAndBandwidth = 15; + UL_BWP_SubcarrierSpacing = "kHz30"; + UL_BWP_prefix_type = "NORMAL"; + UL_timeAlignmentTimerCommon = "infinity"; + ServingCellConfigCommon_n_TimingAdvanceOffset = "n0" + ServingCellConfigCommon_ssb_PositionsInBurst_PR = 0x03; + ServingCellConfigCommon_ssb_periodicityServingCell = 10; + ServingCellConfigCommon_dmrs_TypeA_Position = 2; + NIA_SubcarrierSpacing = "kHz15"; + ServingCellConfigCommon_ss_PBCH_BlockPower = -60; + referenceSubcarrierSpacing = "kHz15"; + dl_UL_TransmissionPeriodicity = "ms0p5"; + nrofDownlinkSlots = 10; + nrofDownlinkSymbols = 10; + nrofUplinkSlots = 10; + nrofUplinkSymbols = 10; + rach_totalNumberOfRA_Preambles = 63; + rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice = "oneEighth"; + rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth = 4; + rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth = 8; + rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf = 16; + rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one = 24; + rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_two = 32; + rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_four = 8; + rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_eight = 4; + rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_sixteen = 2; + rach_groupBconfigured = "ENABLE"; + rach_ra_Msg3SizeGroupA = 56; + rach_messagePowerOffsetGroupB = "dB0"; + rach_numberOfRA_PreamblesGroupA = 32; + rach_ra_ContentionResolutionTimer = 8; + rsrp_ThresholdSSB = 64; + rsrp_ThresholdSSB_SUL = 64; + prach_RootSequenceIndex_choice = "l839"; + prach_RootSequenceIndex_l839 = 0; + prach_RootSequenceIndex_l139 = 0; + prach_msg1_SubcarrierSpacing = "kHz30"; + restrictedSetConfig = "unrestrictedSet"; + msg3_transformPrecoding = "ENABLE"; + prach_ConfigurationIndex = 10; + prach_msg1_FDM = "one"; + prach_msg1_FrequencyStart = 10; + zeroCorrelationZoneConfig = 10; + preambleReceivedTargetPower = -150; + preambleTransMax = 6; + powerRampingStep = "dB0"; + ra_ResponseWindow = 8; + groupHoppingEnabledTransformPrecoding = "ENABLE"; + msg3_DeltaPreamble = 0; + p0_NominalWithGrant = 0; + PUSCH_TimeDomainResourceAllocation_k2 = 0; + PUSCH_TimeDomainResourceAllocation_mappingType = "typeA"; + PUSCH_TimeDomainResourceAllocation_startSymbolAndLength = 0; + pucch_ResourceCommon = 0; + pucch_GroupHopping = "neither"; + hoppingId = 0; + p0_nominal = -30; + PDSCH_TimeDomainResourceAllocation_k0 = 2; + PDSCH_TimeDomainResourceAllocation_mappingType = "typeA"; + PDSCH_TimeDomainResourceAllocation_startSymbolAndLength = 0; + rateMatchPatternId = 0; + RateMatchPattern_patternType = "bitmaps"; + symbolsInResourceBlock = "oneSlot"; + periodicityAndPattern = 2; + RateMatchPattern_controlResourceSet = 5; + RateMatchPattern_subcarrierSpacing = "kHz30"; + RateMatchPattern_mode = "dynamic"; + controlResourceSetZero = 0; + searchSpaceZero = 0; + searchSpaceSIB1 = 10; + searchSpaceOtherSystemInformation = 10; + pagingSearchSpace = 10; + ra_SearchSpace = 10; + PDCCH_common_controlResourceSetId = 5; + PDCCH_common_ControlResourceSet_duration = 2; + PDCCH_cce_REG_MappingType = "nonInterleaved"; + PDCCH_reg_BundleSize = 3; + PDCCH_interleaverSize = 3; + PDCCH_shiftIndex = 10; + PDCCH_precoderGranularity = "sameAsREG-bundle"; + PDCCH_TCI_StateId = 32; + tci_PresentInDCI = "ENABLE"; + PDCCH_DMRS_ScramblingID = 0; + SearchSpaceId = 10; + commonSearchSpaces_controlResourceSetId = 5; + SearchSpace_monitoringSlotPeriodicityAndOffset_choice = "sl1"; + SearchSpace_monitoringSlotPeriodicityAndOffset_value = 0; + SearchSpace_duration = 2; + SearchSpace_nrofCandidates_aggregationLevel1 = 0; + SearchSpace_nrofCandidates_aggregationLevel2 = 0; + SearchSpace_nrofCandidates_aggregationLevel4 = 0; + SearchSpace_nrofCandidates_aggregationLevel8 = 0; + SearchSpace_nrofCandidates_aggregationLevel16 = 0; + SearchSpace_searchSpaceType = "common"; + Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel1 = 1; + Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel2 = 1; + Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel4 = 1; + Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel8 = 1; + Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel16 = 1; + Common_dci_Format2_3_monitoringPeriodicity = 1; + Common_dci_Format2_3_nrofPDCCH_Candidates = 1; + ue_Specific__dci_Formats = "formats0-0-And-1-0"; + RateMatchPatternLTE_CRS_carrierFreqDL = 6; + RateMatchPatternLTE_CRS_carrierBandwidthDL = 6; + RateMatchPatternLTE_CRS_nrofCRS_Ports = 1; + RateMatchPatternLTE_CRS_v_Shift = 0; + RateMatchPatternLTE_CRS_radioframeAllocationPeriod = 1; + RateMatchPatternLTE_CRS_radioframeAllocationOffset = 0; + RateMatchPatternLTE_CRS_subframeAllocation_choice = "oneFrame"; + } + ); + + + srb1_parameters : + { + # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] + timer_poll_retransmit = 80; + + # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] + timer_reordering = 35; + + # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] + timer_status_prohibit = 0; + + # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] + poll_pdu = 4; + + # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] + poll_byte = 99999; + + # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] + max_retx_threshold = 4; + } + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.12.26"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24"; + GNB_INTERFACE_NAME_FOR_S1U = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 2 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 114; + eNB_instances = [0]; + sdr_addrs = "addr=192.168.10.2"; + # beamforming weights for static beams each of them is a int32 composed by two int16 representing imaginary and real part of the weight + # weights are input in an array, starting with the weights associated to first logical beam for all nb_tx , than the weights for 2nd logical beam and so on + # the list size is (nb_tx) X (number of logical beams) + bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + From aab575f66ad7e1004b7a4a3eba698b9d9ab68f1f Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Wed, 27 Nov 2019 10:55:19 +0100 Subject: [PATCH 27/30] bugfix --- openair1/PHY/INIT/nr_init_ru.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/openair1/PHY/INIT/nr_init_ru.c b/openair1/PHY/INIT/nr_init_ru.c index 90b79c1a06..971f076d8d 100644 --- a/openair1/PHY/INIT/nr_init_ru.c +++ b/openair1/PHY/INIT/nr_init_ru.c @@ -113,23 +113,23 @@ int nr_phy_init_RU(RU_t *ru) { beam_count++; } AssertFatal(ru->nb_bfw==(beam_count*ru->nb_tx),"Number of beam weights from config file is %d while the expected number is %d",ru->nb_bfw,(beam_count*ru->nb_tx)); - } - int l_ind = 0; - for (i=0; iLmax;p++) { - if ((fp->L_ssb >> p) & 0x01) { - ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*)); - for (j=0; jnb_tx; j++) { - ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t)); - for (re=0; reofdm_symbol_size; re++) + int l_ind = 0; + for (i=0; iLmax;p++) { + if ((fp->L_ssb >> p) & 0x01) { + ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*)); + for (j=0; jnb_tx; j++) { + ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t)); + for (re=0; reofdm_symbol_size; re++) ru->beam_weights[i][p][j][re] = ru->bw_list[i][l_ind]; - //printf("Beam Weight %08x for beam %d and tx %d\n",ru->bw_list[i][l_ind],p,j); - l_ind++; - } // for j - } // for p - } - } //for i + //printf("Beam Weight %08x for beam %d and tx %d\n",ru->bw_list[i][l_ind],p,j); + l_ind++; + } // for j + } // for p + } + } //for i + } } // !=IF5 ru->common.sync_corr = (uint32_t*)malloc16_clear( LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(uint32_t)*fp->samples_per_subframe_wCP ); From 40bda9f8d0b916f124e89a928138f0863978f307 Mon Sep 17 00:00:00 2001 From: Wang Tsu-Han Date: Wed, 27 Nov 2019 16:27:28 +0100 Subject: [PATCH 28/30] fixes for beam precoding --- executables/nr-ru.c | 23 ++--- openair1/SCHED_NR/nr_ru_procedures.c | 147 ++++++--------------------- 2 files changed, 40 insertions(+), 130 deletions(-) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 1cdcf21896..91afe81217 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1211,13 +1211,11 @@ static void *ru_stats_thread(void *param) { sleep(1); if (opp_enabled == 1) { - if (ru->feptx_prec) { - print_meas(&ru->precoding_stats,"feptx_prec",NULL,NULL); - } if (ru->feprx) print_meas(&ru->ofdm_demod_stats,"feprx",NULL,NULL); if (ru->feptx_ofdm){ + print_meas(&ru->precoding_stats,"feptx_prec",NULL,NULL); print_meas(&ru->txdataF_copy_stats,"txdataF_copy",NULL,NULL); print_meas(&ru->ofdm_mod_stats,"feptx_ofdm",NULL,NULL); print_meas(&ru->ofdm_total_stats,"feptx_total",NULL,NULL); @@ -1281,9 +1279,9 @@ static void *ru_thread_tx( void *param ) { VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX0_RU, tti_tx ); // do TX front-end processing if needed (precoding and/or IDFTs) - //if (ru->feptx_prec) ru->feptx_prec(ru,frame_tx,tti_tx); + if (ru->feptx_prec) ru->feptx_prec(ru,frame_tx,tti_tx); - // do OFDM if needed + // do OFDM with/without TX front-end processing if needed if ((ru->fh_north_asynch_in == NULL) && (ru->feptx_ofdm)) ru->feptx_ofdm(ru,frame_tx,tti_tx); if(!emulate_rf) { @@ -1524,9 +1522,9 @@ static void *ru_thread( void *param ) { if(get_thread_parallel_conf() == PARALLEL_SINGLE_THREAD || ru->num_gNB==0) { // do TX front-end processing if needed (precoding and/or IDFTs) - //if (ru->feptx_prec) ru->feptx_prec(ru,proc->frame_tx,proc->tti_tx); + if (ru->feptx_prec) ru->feptx_prec(ru,proc->frame_tx,proc->tti_tx); - // do OFDM if needed + // do OFDM with/without TX front-end processing if needed if ((ru->fh_north_asynch_in == NULL) && (ru->feptx_ofdm)) ru->feptx_ofdm(ru,proc->frame_tx,proc->tti_tx); if(!emulate_rf) { @@ -1734,7 +1732,6 @@ void init_RU_proc(RU_t *ru) { if (ru->feprx) nr_init_feprx_thread(ru); if (ru->feptx_ofdm) nr_init_feptx_thread(ru); - //if (ru->feptx_prec) nr_init_feptx_prec_thread(ru); } if (opp_enabled == 1) threadCreate(&ru->ru_stats_thread,ru_stats_thread,(void *)ru, "emulateRF", -1, OAI_PRIORITY_RT_LOW); @@ -2047,9 +2044,9 @@ void set_function_spec_param(RU_t *ru) { malloc_IF4p5_buffer(ru); } else if (ru->function == gNodeB_3GPP) { ru->do_prach = 0; // no prach processing in RU - ru->feprx = (get_thread_worker_conf() == WORKER_ENABLE) ? nr_fep_full_2thread : nr_fep_full; // RX DFTs + ru->feprx = (get_thread_worker_conf() == WORKER_ENABLE) ? nr_fep_full_2thread : nr_fep_full; // RX DFTs ru->feptx_ofdm = (get_thread_worker_conf() == WORKER_ENABLE) ? nr_feptx_ofdm_2thread : nr_feptx_ofdm; // this is fep with idft and precoding - ru->feptx_prec = nr_feptx_prec; // this is fep with idft and precoding + ru->feptx_prec = (get_thread_worker_conf() == WORKER_ENABLE) ? NULL : nr_feptx_prec; // this is fep with idft and precoding ru->fh_north_in = NULL; // no incoming fronthaul from north ru->fh_north_out = NULL; // no outgoing fronthaul to north ru->nr_start_if = NULL; // no if interface @@ -2077,8 +2074,8 @@ void set_function_spec_param(RU_t *ru) { case REMOTE_IF5: // the remote unit is IF5 RRU ru->do_prach = 0; - ru->feprx = (get_thread_worker_conf() == WORKER_ENABLE) ? nr_fep_full_2thread : nr_fep_full; // this is frequency-shift + DFTs - ru->feptx_prec = nr_feptx_prec; // need to do transmit Precoding + IDFTs + ru->feprx = (get_thread_worker_conf() == WORKER_ENABLE) ? nr_fep_full_2thread : nr_fep_full; // this is frequency-shift + DFTs + ru->feptx_prec = (get_thread_worker_conf() == WORKER_ENABLE) ? NULL : nr_feptx_prec; // need to do transmit Precoding + IDFTs ru->feptx_ofdm = (get_thread_worker_conf() == WORKER_ENABLE) ? nr_feptx_ofdm_2thread : nr_feptx_ofdm; // need to do transmit Precoding + IDFTs ru->fh_south_in = fh_if5_south_in; // synchronous IF5 reception ru->fh_south_out = fh_if5_south_out; // synchronous IF5 transmission @@ -2102,7 +2099,7 @@ void set_function_spec_param(RU_t *ru) { case REMOTE_IF4p5: ru->do_prach = 0; ru->feprx = NULL; // DFTs - ru->feptx_prec = nr_feptx_prec; // Precoding operation + ru->feptx_prec = (get_thread_worker_conf() == WORKER_ENABLE) ? NULL : nr_feptx_prec; // Precoding operation ru->feptx_ofdm = NULL; // no OFDM mod ru->fh_south_in = fh_if4p5_south_in; // synchronous IF4p5 reception ru->fh_south_out = fh_if4p5_south_out; // synchronous IF4p5 transmission diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index a4318f1d60..c286bd5dee 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -239,9 +239,22 @@ static void *nr_feptx_thread(void *param) { nb_antenna_ports = feptx->nb_antenna_ports; ofdm_mask_full = (1<<(ru->nb_tx*2))-1; - bw = ru->beam_weights[0]; + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC , 1); start_meas(&ru->precoding_stats); - nr_beam_precoding(ru->common.txdataF, + if (ru->nb_tx == 1) { + AssertFatal(fp->N_ssb==ru->nb_tx,"Attempting to transmit %d SSB while Nb_tx = %d",fp->N_ssb,ru->nb_tx); + for (int p=0; pLmax; p++) { + if ((fp->L_ssb >> p) & 0x01){ + memcpy((void*)&ru->common.txdataF_BF[0][l*fp->ofdm_symbol_size], + (void*)&ru->common.txdataF[p][l*fp->ofdm_symbol_size], + fp->ofdm_symbol_size*sizeof(int32_t)); + } + } + } + else { + bw = ru->beam_weights[0]; + nr_beam_precoding(ru->common.txdataF, ru->common.txdataF_BF, fp, bw, @@ -249,7 +262,10 @@ static void *nr_feptx_thread(void *param) { l, aa, nb_antenna_ports); + } stop_meas(&ru->precoding_stats); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC , 0); + start_meas(&ru->ofdm_mod_stats); nr_feptx0(ru,slot,start,1,aa); @@ -270,24 +286,6 @@ static void *nr_feptx_thread(void *param) { return(NULL); } -void nr_init_feptx_thread(RU_t *ru) { - - RU_proc_t *proc = &ru->proc; - RU_feptx_t *feptx = proc->feptx; - int i = 0; - - for(i=0; i<16; i++){ - feptx[i].instance_cnt_feptx = -1; - - pthread_mutex_init( &feptx[i].mutex_feptx, NULL); - pthread_cond_init( &feptx[i].cond_feptx, NULL); - - threadCreate(&feptx[i].pthread_feptx, nr_feptx_thread, (void*)&feptx[i], "feptx", -1, OAI_PRIORITY_RT); - LOG_I(PHY,"init feptx thread %d\n", i); - } - -} - // is this supposed to generate a slot or a subframe??? // seems to be hardcoded to numerology 1 (2 slots=1 subframe) @@ -323,95 +321,25 @@ void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx) { } -static void *nr_feptx_prec_thread(void *param) { +void nr_init_feptx_thread(RU_t *ru) { - RU_prec_t *prec = (RU_prec_t *) param; - RU_t *ru; - NR_DL_FRAME_PARMS *fp; - int symbol; - int p; - int aa; - int32_t *bw; - int32_t **txdataF; - int32_t **txdataF_BF; + RU_proc_t *proc = &ru->proc; + RU_feptx_t *feptx = proc->feptx; + int i = 0; - while(!oai_exit) - { - if (wait_on_condition(&prec->mutex_feptx_prec,&prec->cond_feptx_prec,&prec->instance_cnt_feptx_prec,"NR feptx prec thread")<0) break; - ru = prec->ru; - symbol = prec->symbol; - p = prec->p; - aa = prec->aa; - fp = ru->nr_frame_parms; - bw = ru->beam_weights[0][p][aa]; - txdataF = ru->common.txdataF; - txdataF_BF = ru->common.txdataF_BF; - multadd_cpx_vector((int16_t*)&txdataF[p][symbol*fp->ofdm_symbol_size], - (int16_t*)bw, - (int16_t*)&txdataF_BF[aa][symbol*fp->ofdm_symbol_size], - 0, - fp->ofdm_symbol_size, - 15); + for(i=0; i<16; i++){ + feptx[i].instance_cnt_feptx = -1; + + pthread_mutex_init( &feptx[i].mutex_feptx, NULL); + pthread_cond_init( &feptx[i].cond_feptx, NULL); - if (release_thread(&prec->mutex_feptx_prec,&prec->instance_cnt_feptx_prec,"NR feptx thread")<0) break; - } - return 0; -} - -void nr_feptx_prec_control(RU_t *ru,int frame,int tti_tx) { - - int ret = 0; - int i = 0; - int symbol = 0; - int p = 0; - int aa = 0; - NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms; - int nb_antenna_ports = fp->Lmax; // for now logical antenna ports corresponds to SSB - RU_prec_t *prec = ru->proc.prec; - PHY_VARS_gNB **gNB_list = ru->gNB_list,*gNB; - - gNB = gNB_list[0]; - - start_meas(&ru->precoding_stats); - for(i=0; icommon.txdataF[i], - (void*)gNB->common_vars.txdataF[i], - fp->samples_per_slot_wCP*sizeof(int32_t)); - - for(symbol = 0; symbol < fp->symbols_per_slot; ++symbol){ - for(p=0; pnb_tx;aa++){ - if ((fp->L_ssb >> p) & 0x01){ - while(1){ - if(prec[i].instance_cnt_feptx_prec == -1){ - AssertFatal((ret=pthread_mutex_lock(&prec[i].mutex_feptx_prec))==0,"mutex_lock return %d\n",ret); - prec[i].instance_cnt_feptx_prec = 0; - prec[i].symbol = symbol; - prec[i].p = p; - prec[i].aa = aa; - prec[i].index = i; - prec[i].ru = ru; - AssertFatal(pthread_cond_signal(&prec[i].cond_feptx_prec) == 0,"ERROR pthread_cond_signal for gNB_L1_thread\n"); - AssertFatal((ret=pthread_mutex_unlock(&prec[i].mutex_feptx_prec))==0,"mutex_lock returns %d\n",ret); - i = (i+1) % 16; - break; - } - i = (i+1) % 16; - } - }//(frame_params->Lssb >> p) & 0x01 - }//aa - }//p - }//symbol - - i = 0; - while(1){ - if(prec[i].instance_cnt_feptx_prec == -1) ++i; - if(i == 16) break; + threadCreate(&feptx[i].pthread_feptx, nr_feptx_thread, (void*)&feptx[i], "feptx", -1, OAI_PRIORITY_RT); + LOG_I(PHY,"init feptx thread %d\n", i); } - stop_meas(&ru->precoding_stats); } + void nr_feptx_prec(RU_t *ru,int frame,int tti_tx) { int l,aa; @@ -467,21 +395,6 @@ void nr_feptx_prec(RU_t *ru,int frame,int tti_tx) { stop_meas(&ru->precoding_stats); } -void nr_init_feptx_prec_thread(RU_t *ru){ - - RU_proc_t *proc = &ru->proc; - RU_prec_t *prec = proc->prec; - int i=0; - - for(i=0; i<16; ++i){ - prec[i].instance_cnt_feptx_prec = -1; - pthread_mutex_init( &prec[i].mutex_feptx_prec, NULL); - pthread_cond_init( &prec[i].cond_feptx_prec, NULL); - - threadCreate(&prec[i].pthread_feptx_prec, nr_feptx_prec_thread, (void*)&prec[i], "nr_feptx_prec", -1, OAI_PRIORITY_RT); - } -} - void nr_fep0(RU_t *ru, int first_half) { uint8_t start_symbol, end_symbol, l, aa; From f3f58741d8fcf79508261fd5e8d1d5c465707964 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Wed, 27 Nov 2019 16:37:48 +0100 Subject: [PATCH 29/30] conflicts solved --- openair1/SCHED_NR/nr_ru_procedures.c | 50 ---------------------------- 1 file changed, 50 deletions(-) diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index 8187c2e177..c37db11188 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -321,57 +321,7 @@ void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx) { } -<<<<<<< HEAD -static void *nr_feptx_prec_thread(void *param) { - - RU_prec_t *prec = (RU_prec_t *) param; - RU_t *ru; - NR_DL_FRAME_PARMS *fp; - int symbol; - int p; - int aa; - int32_t *bw; - int32_t **txdataF; - int32_t **txdataF_BF; - - while(!oai_exit) - { - if (wait_on_condition(&prec->mutex_feptx_prec,&prec->cond_feptx_prec,&prec->instance_cnt_feptx_prec,"NR feptx prec thread")<0) break; - ru = prec->ru; - symbol = prec->symbol; - p = prec->p; - aa = prec->aa; - fp = ru->nr_frame_parms; - bw = ru->beam_weights[0][p][aa]; - txdataF = ru->common.txdataF; - txdataF_BF = ru->common.txdataF_BF; - multadd_cpx_vector((int16_t*)&txdataF[p][symbol*fp->ofdm_symbol_size], - (int16_t*)bw, - (int16_t*)&txdataF_BF[aa][symbol*fp->ofdm_symbol_size], - 0, - fp->ofdm_symbol_size, - 15); - - if (release_thread(&prec->mutex_feptx_prec,&prec->instance_cnt_feptx_prec,"NR feptx thread")<0) break; - } - return 0; -} - -void nr_feptx_prec_control(RU_t *ru,int frame,int tti_tx) { - - int ret = 0; - int i = 0; - int symbol = 0; - int p = 0; - int aa = 0; - NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms; - int nb_antenna_ports = fp->Lmax; // for now logical antenna ports corresponds to SSB - RU_prec_t *prec = ru->proc.prec; - PHY_VARS_gNB **gNB_list = ru->gNB_list,*gNB; -======= - void nr_init_feptx_thread(RU_t *ru) { ->>>>>>> 40bda9f8d0b916f124e89a928138f0863978f307 RU_proc_t *proc = &ru->proc; RU_feptx_t *feptx = proc->feptx; From d5db8c1634c3d77b456c0deb27992e8c4e9abef0 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Thu, 28 Nov 2019 17:29:41 +0100 Subject: [PATCH 30/30] make lte compile again --- targets/RT/USER/lte-ru.c | 1 + 1 file changed, 1 insertion(+) diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index f81626f929..5d614d5f94 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -81,6 +81,7 @@ /* these variables have to be defined before including ENB_APP/enb_paramdef.h */ static int DEFBANDS[] = {7}; static int DEFENBS[] = {0}; +static int DEFBFW[] = {0x00007fff}; #include "ENB_APP/enb_paramdef.h" #include "common/config/config_userapi.h"