From dd24ddd645dc57b4729284710017dd35c9712bd1 Mon Sep 17 00:00:00 2001 From: francescomani Date: Tue, 29 Nov 2022 19:05:56 +0100 Subject: [PATCH 1/7] remove NUMBER_OF_NR_PUCCH_MAX --- common/openairinterface5g_limits.h | 1 - executables/nr-gnb.c | 3 +- openair1/PHY/INIT/nr_init.c | 41 +++++++++++++++++---- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 15 ++++---- openair1/PHY/defs_gNB.h | 3 +- openair1/SCHED_NR/phy_frame_config_nr.c | 44 +++-------------------- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 4 +-- 7 files changed, 55 insertions(+), 56 deletions(-) diff --git a/common/openairinterface5g_limits.h b/common/openairinterface5g_limits.h index 2349941cf2..8f3a2b40fd 100644 --- a/common/openairinterface5g_limits.h +++ b/common/openairinterface5g_limits.h @@ -18,7 +18,6 @@ # define NUMBER_OF_NR_SCH_STATS_MAX 16 -# define NUMBER_OF_NR_PUCCH_MAX 16 # define NUMBER_OF_NR_PDCCH_MAX 16 #define MAX_MANAGED_ENB_PER_MOBILE 2 diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index 852e805e6d..9660f89f5c 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -198,7 +198,8 @@ void rx_func(void *param) { } up_removed++; } - for (j = 0; j < NUMBER_OF_NR_PUCCH_MAX; j++) + + for (j = 0; j < gNB->max_nb_pucch; j++) if (gNB->pucch[j]->active > 0 && gNB->pucch[j]->pucch_pdu.rnti == rnti_to_remove[i]) { gNB->pucch[j]->active = 0; diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 6f983f613c..515950c15e 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -134,7 +134,7 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { int max_mimo_layers = (CSI_RS_antenna_portsnr_mimo_precoding_matrix = (int32_t ***)malloc16(max_mimo_layers* sizeof(int32_t **)); + gNB->nr_mimo_precoding_matrix = (int32_t ***)malloc16(max_mimo_layers * sizeof(int32_t **)); int32_t ***mat = gNB->nr_mimo_precoding_matrix; double complex res_code; @@ -1002,14 +1002,43 @@ void reset_DLSCH_struct(const PHY_VARS_gNB *gNB, processingData_L1tx_t *msg) free_gNB_dlsch(&msg->dlsch[i][j], grid_size, fp); } -void init_nr_transport(PHY_VARS_gNB *gNB) { +void init_nr_transport(PHY_VARS_gNB *gNB) +{ + NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; + const nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config; LOG_I(PHY, "Initialise nr transport\n"); - for (int i=0; icell_config.frame_duplex_type.value ? + fp->slots_per_frame / get_nb_periods_per_frame(cfg->tdd_table.tdd_period.value) : + fp->slots_per_frame; + int nb_ul_slots_period = 0; + if (cfg->cell_config.frame_duplex_type.value) { + for(int i=0; itdd_table.max_tdd_periodicity_list[i].max_num_of_symbol_per_slot_list[j].slot_config.value == 1) { // UL symbol + nb_ul_slots_period++; + break; + } + } + } + } + else + nb_ul_slots_period = fp->slots_per_frame; + + int pucch_slots; + if (gNB->if_inst->sl_ahead > nb_slots_per_period) + pucch_slots = nb_ul_slots_period + (gNB->if_inst->sl_ahead - nb_slots_per_period); + else + pucch_slots = (nb_ul_slots_period < gNB->if_inst->sl_ahead) ? nb_ul_slots_period : gNB->if_inst->sl_ahead; + + gNB->max_nb_pucch = MAX_MOBILES_PER_GNB * pucch_slots; + + gNB->pucch = (NR_gNB_PUCCH_t **) malloc16(gNB->max_nb_pucch * sizeof(NR_gNB_PUCCH_t*)); + for (int i = 0; i < gNB->max_nb_pucch; i++) { + LOG_I(PHY,"Allocating Transport Channel Buffers for PUCCH %d/%d\n", i, gNB->max_nb_pucch); gNB->pucch[i] = new_gNB_pucch(); - AssertFatal(gNB->pucch[i]!=NULL,"Can't initialize pucch %d \n", i); + AssertFatal(gNB->pucch[i] != NULL,"Can't initialize pucch %d \n", i); } for (int i=0; iframe_parms; - for (int i = 0; i < NUMBER_OF_NR_PUCCH_MAX; i++) + for (int i = 0; i < gNB->max_nb_pucch; i++) free_gNB_pucch(gNB->pucch[i]); for (int i = 0; i < NUMBER_OF_NR_SRS_MAX; i++) diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index 905e03801c..03ed927c37 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -70,20 +70,21 @@ void free_gNB_pucch(NR_gNB_PUCCH_t *pucch) int nr_find_pucch(uint16_t rnti, int frame, int slot, - PHY_VARS_gNB *gNB) { + PHY_VARS_gNB *gNB) +{ AssertFatal(gNB!=NULL,"gNB is null\n"); int index = -1; - for (int i = 0; i < NUMBER_OF_NR_PUCCH_MAX; i++) { + for (int i = 0; i < gNB->max_nb_pucch; i++) { AssertFatal(gNB->pucch[i] != NULL,"gNB->pucch[%d] is null\n",i); if ((gNB->pucch[i]->active > 0) && (gNB->pucch[i]->pucch_pdu.rnti == rnti) && (gNB->pucch[i]->frame == frame) && (gNB->pucch[i]->slot == slot)) - return(i); + return i; else if ((gNB->pucch[i]->active == 0) && (index == -1)) - index=i; + index = i; } if (index==-1) @@ -95,11 +96,13 @@ int nr_find_pucch(uint16_t rnti, void nr_fill_pucch(PHY_VARS_gNB *gNB, int frame, int slot, - nfapi_nr_pucch_pdu_t *pucch_pdu) { + nfapi_nr_pucch_pdu_t *pucch_pdu) +{ + if (NFAPI_MODE == NFAPI_MODE_PNF) gNB->pucch[0]->active = 0; //check if ture in monolithic mode int id = nr_find_pucch(pucch_pdu->rnti,frame,slot,gNB); - AssertFatal((id >= 0) && (id < NUMBER_OF_NR_PUCCH_MAX), + AssertFatal((id >= 0) && (id < gNB->max_nb_pucch), "invalid id found for pucch !!! rnti %04x id %d\n",pucch_pdu->rnti,id); NR_gNB_PUCCH_t *pucch = gNB->pucch[id]; diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 0f2f41c470..73cad1fc87 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -617,12 +617,13 @@ typedef struct PHY_VARS_gNB_s { nfapi_nr_ul_tti_request_t UL_tti_req; nfapi_nr_uci_indication_t uci_indication; + int max_nb_pucch; NR_gNB_PBCH pbch; NR_gNB_COMMON common_vars; NR_gNB_PRACH prach_vars; NR_gNB_PRS prs_vars; NR_gNB_PUSCH *pusch_vars[NUMBER_OF_NR_ULSCH_MAX]; - NR_gNB_PUCCH_t *pucch[NUMBER_OF_NR_PUCCH_MAX]; + NR_gNB_PUCCH_t **pucch; NR_gNB_SRS_t *srs[NUMBER_OF_NR_SRS_MAX]; NR_gNB_PDCCH_t pdcch_pdu[NUMBER_OF_NR_PDCCH_MAX]; NR_gNB_UL_PDCCH_t ul_pdcch_pdu[NUMBER_OF_NR_PDCCH_MAX]; diff --git a/openair1/SCHED_NR/phy_frame_config_nr.c b/openair1/SCHED_NR/phy_frame_config_nr.c index 25c39846fe..9ed7255a84 100644 --- a/openair1/SCHED_NR/phy_frame_config_nr.c +++ b/openair1/SCHED_NR/phy_frame_config_nr.c @@ -33,6 +33,7 @@ #include "PHY/defs_gNB.h" #include "PHY/defs_nr_UE.h" #include "SCHED_NR/phy_frame_config_nr.h" +#include "common/utils/nr/nr_common.h" /******************************************************************* * @@ -53,48 +54,13 @@ int set_tdd_config_nr( nfapi_nr_config_request_scf_t *cfg, int mu, int nrofDownlinkSlots, int nrofDownlinkSymbols, - int nrofUplinkSlots, int nrofUplinkSymbols) { + int nrofUplinkSlots, int nrofUplinkSymbols) +{ + int slot_number = 0; - int nb_periods_per_frame; + int nb_periods_per_frame = get_nb_periods_per_frame(cfg->tdd_table.tdd_period.value); int nb_slots_to_set = TDD_CONFIG_NB_FRAMES*(1<tdd_table.tdd_period.value) { - case 0: - nb_periods_per_frame = 20; // 10ms/0p5ms - break; - - case 1: - nb_periods_per_frame = 16; // 10ms/0p625ms - break; - - case 2: - nb_periods_per_frame = 10; // 10ms/1ms - break; - - case 3: - nb_periods_per_frame = 8; // 10ms/1p25ms - break; - - case 4: - nb_periods_per_frame = 5; // 10ms/2ms - break; - - case 5: - nb_periods_per_frame = 4; // 10ms/2p5ms - break; - - case 6: - nb_periods_per_frame = 2; // 10ms/5ms - break; - - case 7: - nb_periods_per_frame = 1; // 10ms/10ms - break; - - default: - AssertFatal(1==0,"Undefined tdd period %d\n", cfg->tdd_table.tdd_period.value); - } - int nb_slots_per_period = ((1<max_nb_pucch; i++){ NR_gNB_PUCCH_t *pucch = gNB->pucch[i]; if (pucch) { if ((pucch->active == 1) && @@ -713,7 +713,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { start_meas(&gNB->phy_proc_rx); - for (int i=0;imax_nb_pucch; i++){ NR_gNB_PUCCH_t *pucch = gNB->pucch[i]; if (pucch) { if (NFAPI_MODE == NFAPI_MODE_PNF) From 571f488ddb02cf4dfc11c600b083288f00d837fb Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 30 Nov 2022 10:35:51 +0100 Subject: [PATCH 2/7] remove NUMBER_OF_NR_CSIRS_MAX --- common/openairinterface5g_limits.h | 1 - openair1/PHY/defs_gNB.h | 2 +- openair1/SCHED_NR/fapi_nr_l1.c | 6 +++--- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/common/openairinterface5g_limits.h b/common/openairinterface5g_limits.h index 8f3a2b40fd..ad36fae476 100644 --- a/common/openairinterface5g_limits.h +++ b/common/openairinterface5g_limits.h @@ -13,7 +13,6 @@ # define NUMBER_OF_NR_DLSCH_MAX 8 # define NUMBER_OF_NR_UCI_MAX 16 # define NUMBER_OF_NR_SRS_MAX 16 -# define NUMBER_OF_NR_CSIRS_MAX 16 # define NUMBER_OF_SCH_STATS_MAX 16 # define NUMBER_OF_NR_SCH_STATS_MAX 16 diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 73cad1fc87..b21f3c1192 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -828,7 +828,7 @@ typedef struct processingData_L1tx { PHY_VARS_gNB *gNB; nfapi_nr_dl_tti_pdcch_pdu pdcch_pdu[NFAPI_NR_MAX_NB_CORESETS]; nfapi_nr_ul_dci_request_pdus_t ul_pdcch_pdu[NFAPI_NR_MAX_NB_CORESETS]; - NR_gNB_CSIRS_t csirs_pdu[NUMBER_OF_NR_CSIRS_MAX]; + NR_gNB_CSIRS_t csirs_pdu[NR_SYMBOLS_PER_SLOT]; NR_gNB_DLSCH_t *dlsch[NUMBER_OF_NR_DLSCH_MAX][2]; NR_gNB_SSB_t ssb[64]; uint16_t num_pdsch_slot; diff --git a/openair1/SCHED_NR/fapi_nr_l1.c b/openair1/SCHED_NR/fapi_nr_l1.c index 49e6edd54e..c6b6f69126 100644 --- a/openair1/SCHED_NR/fapi_nr_l1.c +++ b/openair1/SCHED_NR/fapi_nr_l1.c @@ -102,12 +102,12 @@ void handle_nr_nfapi_ssb_pdu(processingData_L1tx_t *msgTx,int frame,int slot, void handle_nfapi_nr_csirs_pdu(processingData_L1tx_t *msgTx, - int frame,int slot, - nfapi_nr_dl_tti_csi_rs_pdu *csirs_pdu) { + int frame,int slot, + nfapi_nr_dl_tti_csi_rs_pdu *csirs_pdu) { int found = 0; - for (int id=0; idcsirs_pdu[id]; if (csirs->active == 0) { LOG_D(PHY,"Frame %d Slot %d CSI_RS with ID %d is now active\n",frame,slot,id); diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index d53eed2c1e..bed81d2f7c 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -184,7 +184,7 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,0); } - for (int i=0;icsirs_pdu[i]; if (csirs->active == 1) { LOG_D(PHY, "CSI-RS generation started in frame %d.%d\n",frame,slot); From b4b5516ca79d9d344139ca4a1a469c6758d5fca6 Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 30 Nov 2022 16:11:53 +0100 Subject: [PATCH 3/7] remove NUMBER_OF_NR_SRS_MAX --- common/openairinterface5g_limits.h | 3 -- openair1/PHY/INIT/nr_init.c | 35 ++++++++++++----------- openair1/PHY/NR_TRANSPORT/srs_rx.c | 6 ++-- openair1/PHY/defs_gNB.h | 5 ++-- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 4 +-- 5 files changed, 27 insertions(+), 26 deletions(-) diff --git a/common/openairinterface5g_limits.h b/common/openairinterface5g_limits.h index ad36fae476..f5d9c21ad5 100644 --- a/common/openairinterface5g_limits.h +++ b/common/openairinterface5g_limits.h @@ -11,10 +11,7 @@ # define NUMBER_OF_SRS_MAX 16 # define NUMBER_OF_NR_ULSCH_MAX 8 # define NUMBER_OF_NR_DLSCH_MAX 8 -# define NUMBER_OF_NR_UCI_MAX 16 -# define NUMBER_OF_NR_SRS_MAX 16 # define NUMBER_OF_SCH_STATS_MAX 16 - # define NUMBER_OF_NR_SCH_STATS_MAX 16 # define NUMBER_OF_NR_PDCCH_MAX 16 diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 515950c15e..859994e1a5 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -607,14 +607,6 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB) //PRS init nr_init_prs(gNB); - for (int id=0; idnr_srs_info[id] = (nr_srs_info_t *)malloc16_clear(sizeof(nr_srs_info_t)); - gNB->nr_srs_info[id]->srs_generated_signal = (int32_t**)malloc16_clear(MAX_NUM_NR_SRS_AP*sizeof(int32_t*)); - for(int ap=0; apnr_srs_info[id]->srs_generated_signal[ap] = (int32_t*)malloc16_clear(fp->ofdm_symbol_size*MAX_NUM_NR_SRS_SYMBOLS*sizeof(int32_t)); - } - } - generate_ul_reference_signal_sequences(SHRT_MAX); /* Generate low PAPR type 1 sequences for PUSCH DMRS, these are used if transform precoding is enabled. */ @@ -623,6 +615,15 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB) /// Transport init necessary for NR synchro init_nr_transport(gNB); + gNB->nr_srs_info = (nr_srs_info_t **)malloc16_clear(gNB->max_nb_srs * sizeof(nr_srs_info_t*)); + for (int id = 0; id < gNB->max_nb_srs; id++) { + gNB->nr_srs_info[id] = (nr_srs_info_t *)malloc16_clear(sizeof(nr_srs_info_t)); + gNB->nr_srs_info[id]->srs_generated_signal = (int32_t**)malloc16_clear(MAX_NUM_NR_SRS_AP*sizeof(int32_t*)); + for(int ap=0; apnr_srs_info[id]->srs_generated_signal[ap] = (int32_t*)malloc16_clear(fp->ofdm_symbol_size*MAX_NUM_NR_SRS_SYMBOLS*sizeof(int32_t)); + } + } + common_vars->txdataF = (int32_t **)malloc16(Ptx*sizeof(int32_t*)); common_vars->rxdataF = (int32_t **)malloc16(Prx*sizeof(int32_t*)); /* Do NOT allocate per-antenna txdataF/rxdataF: the gNB gets a pointer to the @@ -760,7 +761,7 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB) free_and_zero(nr_gold_csi_rs); free_and_zero(gNB->nr_csi_info); - for (int id = 0; id < NUMBER_OF_NR_SRS_MAX; id++) { + for (int id = 0; id < gNB->max_nb_srs; id++) { for(int i=0; inr_srs_info[id]->srs_generated_signal[i]); } @@ -1026,13 +1027,14 @@ void init_nr_transport(PHY_VARS_gNB *gNB) else nb_ul_slots_period = fp->slots_per_frame; - int pucch_slots; + int buffer_ul_slots; // the UL channels are scheduled sl_ahead before they are transmitted if (gNB->if_inst->sl_ahead > nb_slots_per_period) - pucch_slots = nb_ul_slots_period + (gNB->if_inst->sl_ahead - nb_slots_per_period); + buffer_ul_slots = nb_ul_slots_period + (gNB->if_inst->sl_ahead - nb_slots_per_period); else - pucch_slots = (nb_ul_slots_period < gNB->if_inst->sl_ahead) ? nb_ul_slots_period : gNB->if_inst->sl_ahead; + buffer_ul_slots = (nb_ul_slots_period < gNB->if_inst->sl_ahead) ? nb_ul_slots_period : gNB->if_inst->sl_ahead; - gNB->max_nb_pucch = MAX_MOBILES_PER_GNB * pucch_slots; + gNB->max_nb_pucch = MAX_MOBILES_PER_GNB * buffer_ul_slots; + gNB->max_nb_srs = buffer_ul_slots << 1; // assuming at most 2 SRS per slot gNB->pucch = (NR_gNB_PUCCH_t **) malloc16(gNB->max_nb_pucch * sizeof(NR_gNB_PUCCH_t*)); for (int i = 0; i < gNB->max_nb_pucch; i++) { @@ -1041,8 +1043,9 @@ void init_nr_transport(PHY_VARS_gNB *gNB) AssertFatal(gNB->pucch[i] != NULL,"Can't initialize pucch %d \n", i); } - for (int i=0; isrs = (NR_gNB_SRS_t **) malloc16(gNB->max_nb_srs * sizeof(NR_gNB_SRS_t*)); + for (int i = 0; i < gNB->max_nb_srs; i++) { + LOG_I(PHY,"Allocating Transport Channel Buffers for SRS %d/%d\n", i, gNB->max_nb_srs); gNB->srs[i] = new_gNB_srs(); AssertFatal(gNB->srs[i]!=NULL,"Can't initialize srs %d \n", i); } @@ -1071,7 +1074,7 @@ void reset_nr_transport(PHY_VARS_gNB *gNB) for (int i = 0; i < gNB->max_nb_pucch; i++) free_gNB_pucch(gNB->pucch[i]); - for (int i = 0; i < NUMBER_OF_NR_SRS_MAX; i++) + for (int i = 0; i < gNB->max_nb_srs; i++) free_gNB_srs(gNB->srs[i]); for (int i=0; inumber_of_nr_ulsch_max; i++) diff --git a/openair1/PHY/NR_TRANSPORT/srs_rx.c b/openair1/PHY/NR_TRANSPORT/srs_rx.c index 5d855ae6b5..7c0e241af8 100644 --- a/openair1/PHY/NR_TRANSPORT/srs_rx.c +++ b/openair1/PHY/NR_TRANSPORT/srs_rx.c @@ -64,7 +64,7 @@ int nr_find_srs(rnti_t rnti, AssertFatal(gNB!=NULL,"gNB is null\n"); int index = -1; - for (int i=0; imax_nb_srs; i++) { AssertFatal(gNB->srs[i]!=NULL,"gNB->srs[%d] is null\n",i); if ((gNB->srs[i]->active>0) && (gNB->srs[i]->srs_pdu.rnti==rnti) && @@ -85,8 +85,8 @@ void nr_fill_srs(PHY_VARS_gNB *gNB, nfapi_nr_srs_pdu_t *srs_pdu) { int id = nr_find_srs(srs_pdu->rnti,frame,slot,gNB); - AssertFatal( (id>=0) && (idrnti,id); + AssertFatal((id >= 0) && (id < gNB->max_nb_srs), + "invalid id found for srs !!! rnti %04x id %d\n",srs_pdu->rnti,id); NR_gNB_SRS_t *srs = gNB->srs[id]; srs->frame = frame; diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index b21f3c1192..739eddc052 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -618,13 +618,14 @@ typedef struct PHY_VARS_gNB_s { nfapi_nr_uci_indication_t uci_indication; int max_nb_pucch; + int max_nb_srs; NR_gNB_PBCH pbch; NR_gNB_COMMON common_vars; NR_gNB_PRACH prach_vars; NR_gNB_PRS prs_vars; NR_gNB_PUSCH *pusch_vars[NUMBER_OF_NR_ULSCH_MAX]; NR_gNB_PUCCH_t **pucch; - NR_gNB_SRS_t *srs[NUMBER_OF_NR_SRS_MAX]; + NR_gNB_SRS_t **srs; NR_gNB_PDCCH_t pdcch_pdu[NUMBER_OF_NR_PDCCH_MAX]; NR_gNB_UL_PDCCH_t ul_pdcch_pdu[NUMBER_OF_NR_PDCCH_MAX]; NR_gNB_DLSCH_t *dlsch[NUMBER_OF_NR_DLSCH_MAX][2]; // Nusers times two spatial streams @@ -637,7 +638,7 @@ typedef struct PHY_VARS_gNB_s { t_nrPolar_params **polarParams; /// SRS variables - nr_srs_info_t *nr_srs_info[NUMBER_OF_NR_SRS_MAX]; + nr_srs_info_t **nr_srs_info; /// CSI variables nr_csi_info_t *nr_csi_info; diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index bed81d2f7c..78f75b9e51 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -582,7 +582,7 @@ void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { } } - for (int i=0;imax_nb_srs; i++) { NR_gNB_SRS_t *srs = gNB->srs[i]; if (srs) { if ((srs->active == 1) && (srs->frame == frame_rx) && (srs->slot == slot_rx)) { @@ -870,7 +870,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { } } - for (int i = 0; i < NUMBER_OF_NR_SRS_MAX; i++) { + for (int i = 0; i < gNB->max_nb_srs; i++) { NR_gNB_SRS_t *srs = gNB->srs[i]; if (srs) { if ((srs->active == 1) && (srs->frame == frame_rx) && (srs->slot == slot_rx)) { From d8612a6ca7d3c6bc7971ed1e557f4c6f2bd16044 Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 30 Nov 2022 17:40:40 +0100 Subject: [PATCH 4/7] some more cleanup --- common/openairinterface5g_limits.h | 2 -- executables/nr-gnb.c | 8 -------- openair1/PHY/NR_TRANSPORT/nr_prach.c | 17 ++++++++--------- openair1/PHY/defs_gNB.h | 2 -- 4 files changed, 8 insertions(+), 21 deletions(-) diff --git a/common/openairinterface5g_limits.h b/common/openairinterface5g_limits.h index f5d9c21ad5..485c775b77 100644 --- a/common/openairinterface5g_limits.h +++ b/common/openairinterface5g_limits.h @@ -14,8 +14,6 @@ # define NUMBER_OF_SCH_STATS_MAX 16 # define NUMBER_OF_NR_SCH_STATS_MAX 16 -# define NUMBER_OF_NR_PDCCH_MAX 16 - #define MAX_MANAGED_ENB_PER_MOBILE 2 #define MAX_MANAGED_GNB_PER_MOBILE 2 diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index 9660f89f5c..645091eeae 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -206,14 +206,6 @@ void rx_func(void *param) { gNB->pucch[j]->pucch_pdu.rnti = 0; pucch_removed++; } -#if 0 - for (j = 0; j < NUMBER_OF_NR_PDCCH_MAX; j++) - gNB->pdcch_pdu[j].frame = -1; - for (j = 0; j < NUMBER_OF_NR_PDCCH_MAX; j++) - gNB->ul_pdcch_pdu[j].frame = -1; - for (j = 0; j < NUMBER_OF_NR_PRACH_MAX; j++) - gNB->prach_vars.list[j].frame = -1; -#endif } if (rnti_to_remove_count) LOG_W(NR_PHY, "to remove rnti_to_remove_count=%d, up_removed=%d down_removed=%d pucch_removed=%d\n", rnti_to_remove_count, up_removed, down_removed, pucch_removed); rnti_to_remove_count = 0; diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach.c b/openair1/PHY/NR_TRANSPORT/nr_prach.c index b3d492d025..461f012687 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_TRANSPORT/nr_prach.c @@ -39,20 +39,19 @@ extern uint16_t prach_root_sequence_map_abc[138]; extern uint16_t nr_du[838]; extern const char *prachfmt[]; -void init_prach_list(PHY_VARS_gNB *gNB) { - +void init_prach_list(PHY_VARS_gNB *gNB) +{ AssertFatal(gNB!=NULL,"gNB is null\n"); for (int i=0; iprach_vars.list[i].frame = -1; - gNB->prach_vars.list[i].slot = -1; - } + gNB->prach_vars.list[i].frame = -1; + gNB->prach_vars.list[i].slot = -1; + } } -void free_nr_prach_entry(PHY_VARS_gNB *gNB, int prach_id) { - +void free_nr_prach_entry(PHY_VARS_gNB *gNB, int prach_id) +{ gNB->prach_vars.list[prach_id].frame = -1; - gNB->prach_vars.list[prach_id].slot = -1; - + gNB->prach_vars.list[prach_id].slot = -1; } int16_t find_nr_prach(PHY_VARS_gNB *gNB,int frame, int slot, find_type_t type) { diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 739eddc052..136daf44aa 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -626,8 +626,6 @@ typedef struct PHY_VARS_gNB_s { NR_gNB_PUSCH *pusch_vars[NUMBER_OF_NR_ULSCH_MAX]; NR_gNB_PUCCH_t **pucch; NR_gNB_SRS_t **srs; - NR_gNB_PDCCH_t pdcch_pdu[NUMBER_OF_NR_PDCCH_MAX]; - NR_gNB_UL_PDCCH_t ul_pdcch_pdu[NUMBER_OF_NR_PDCCH_MAX]; NR_gNB_DLSCH_t *dlsch[NUMBER_OF_NR_DLSCH_MAX][2]; // Nusers times two spatial streams NR_gNB_ULSCH_t *ulsch[NUMBER_OF_NR_ULSCH_MAX]; // [Nusers times] /// statistics for DLSCH measurement collection From 43685afe1abcaa0feb31289ea8f9a0c53ec9d575 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 5 Dec 2022 17:10:17 +0100 Subject: [PATCH 5/7] removing NUMBER_OF_NR_UE_MAX --- openair1/SIMULATION/NR_PHY/ulsim.c | 1 - 1 file changed, 1 deletion(-) diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 210b33774e..22d0151711 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -318,7 +318,6 @@ int main(int argc, char **argv) int ldpc_offload_flag = 0; uint8_t max_rounds = 4; int chest_type[2] = {0}; - int enable_ptrs = 0; int modify_dmrs = 0; /* L_PTRS = ptrs_arg[0], K_PTRS = ptrs_arg[1] */ From 721b8e9d9f232054301c86a5bc1ecfc9a6c3b91a Mon Sep 17 00:00:00 2001 From: francescomani Date: Tue, 13 Dec 2022 18:30:32 +0100 Subject: [PATCH 6/7] setting max dlsch/ulsch limit --- common/openairinterface5g_limits.h | 7 ++++--- common/platform_constants.h | 3 --- nfapi/oai_integration/nfapi_pnf.c | 4 ++-- openair1/PHY/INIT/nr_init.c | 19 ++++++++----------- openair1/PHY/NR_TRANSPORT/nr_dlsch.c | 2 +- openair1/PHY/NR_TRANSPORT/nr_ulsch.c | 10 +++++----- openair1/PHY/defs_gNB.h | 3 --- openair1/SCHED_NR/fapi_nr_l1.c | 4 ++-- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 4 ++-- 9 files changed, 24 insertions(+), 32 deletions(-) diff --git a/common/openairinterface5g_limits.h b/common/openairinterface5g_limits.h index 485c775b77..b86f01df6a 100644 --- a/common/openairinterface5g_limits.h +++ b/common/openairinterface5g_limits.h @@ -1,6 +1,7 @@ #ifndef OPENAIRINTERFACE5G_LIMITS_H_ #define OPENAIRINTERFACE5G_LIMITS_H_ +# define MAX_MOBILES_PER_GNB 16 # define NUMBER_OF_eNB_MAX 1 # define NUMBER_OF_gNB_MAX 1 # define NUMBER_OF_RU_MAX 2 @@ -9,10 +10,10 @@ # define NUMBER_OF_ULSCH_MAX 8 # define NUMBER_OF_DLSCH_MAX 8 # define NUMBER_OF_SRS_MAX 16 -# define NUMBER_OF_NR_ULSCH_MAX 8 -# define NUMBER_OF_NR_DLSCH_MAX 8 +# define NUMBER_OF_NR_ULSCH_MAX MAX_MOBILES_PER_GNB +# define NUMBER_OF_NR_DLSCH_MAX MAX_MOBILES_PER_GNB # define NUMBER_OF_SCH_STATS_MAX 16 -# define NUMBER_OF_NR_SCH_STATS_MAX 16 +# define NUMBER_OF_NR_SCH_STATS_MAX MAX_MOBILES_PER_GNB #define MAX_MANAGED_ENB_PER_MOBILE 2 #define MAX_MANAGED_GNB_PER_MOBILE 2 diff --git a/common/platform_constants.h b/common/platform_constants.h index 9d67b76cd7..38ec11d49e 100644 --- a/common/platform_constants.h +++ b/common/platform_constants.h @@ -69,20 +69,17 @@ #ifdef LARGE_SCALE #define MAX_MOBILES_PER_ENB 128 #define MAX_MOBILES_PER_ENB_NB_IoT 128 -#define MAX_MOBILES_PER_GNB 128 #define MAX_eNB 2 #define MAX_gNB 2 #else #define MAX_MOBILES_PER_ENB 40 #define MAX_MOBILES_PER_ENB_NB_IoT 40 -#define MAX_MOBILES_PER_GNB 16 #define MAX_eNB 2 #define MAX_gNB 2 #endif #else #define MAX_MOBILES_PER_ENB 256 #define MAX_MOBILES_PER_ENB_NB_IoT 256 -#define MAX_MOBILES_PER_GNB 256 #define MAX_eNB 2 #define MAX_gNB 2 #endif diff --git a/nfapi/oai_integration/nfapi_pnf.c b/nfapi/oai_integration/nfapi_pnf.c index 864791141f..bc6cd58a79 100644 --- a/nfapi/oai_integration/nfapi_pnf.c +++ b/nfapi/oai_integration/nfapi_pnf.c @@ -1221,8 +1221,8 @@ int pnf_phy_dl_tti_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7, if (tx_data != NULL) { uint8_t *dlsch_sdu = (uint8_t *)tx_data->TLVs[0].value.direct; //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() DLSCH:pdu_index:%d handle_nfapi_dlsch_pdu(eNB, proc_rxtx, dlsch_pdu, transport_blocks:%d sdu:%p) eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols:%d\n", __FUNCTION__, rel8_pdu->pdu_index, rel8_pdu->transport_blocks, dlsch_sdu, eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols); - AssertFatal(msgTx->num_pdsch_slot < gNB->number_of_nr_dlsch_max,"Number of PDSCH PDUs %d exceeded the limit %d\n", - msgTx->num_pdsch_slot,gNB->number_of_nr_dlsch_max); + AssertFatal(msgTx->num_pdsch_slot < NUMBER_OF_NR_DLSCH_MAX,"Number of PDSCH PDUs %d exceeded the limit %d\n", + msgTx->num_pdsch_slot, NUMBER_OF_NR_DLSCH_MAX); handle_nr_nfapi_pdsch_pdu(msgTx, pdsch_pdu, dlsch_sdu); } else { diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 859994e1a5..b9e1139d14 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -489,9 +489,6 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB) while(gNB->configured == 0) usleep(10000); - gNB->number_of_nr_dlsch_max = NUMBER_OF_NR_DLSCH_MAX; - gNB->number_of_nr_ulsch_max = NUMBER_OF_NR_ULSCH_MAX; - load_dftslib(); crcTableInit(); @@ -654,7 +651,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB) int nb_re_pusch = N_RB_UL * NR_NB_SC_PER_RB; int nb_re_pusch2 = nb_re_pusch + (nb_re_pusch&7); - for (int ULSCH_id=0; ULSCH_idnumber_of_nr_ulsch_max; ULSCH_id++) { + for (int ULSCH_id = 0; ULSCH_id < NUMBER_OF_NR_ULSCH_MAX; ULSCH_id++) { pusch_vars[ULSCH_id] = (NR_gNB_PUSCH *)malloc16_clear( sizeof(NR_gNB_PUSCH) ); pusch_vars[ULSCH_id]->rxdataF_ext = (int32_t **)malloc16(Prx*sizeof(int32_t *) ); pusch_vars[ULSCH_id]->ul_ch_estimates = (int32_t **)malloc16(n_buf*sizeof(int32_t *) ); @@ -805,7 +802,7 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB) free_and_zero(prach_vars->prach_ifft); NR_gNB_PUSCH** pusch_vars = gNB->pusch_vars; - for (int ULSCH_id=0; ULSCH_idnumber_of_nr_ulsch_max; ULSCH_id++) { + for (int ULSCH_id = 0; ULSCH_id < NUMBER_OF_NR_ULSCH_MAX; ULSCH_id++) { for (int i=0; i< max_ul_mimo_layers; i++) free_and_zero(pusch_vars[ULSCH_id]->llr_layers[i]); for (int i = 0; i < Prx; i++) { @@ -983,8 +980,8 @@ void init_DLSCH_struct(PHY_VARS_gNB *gNB, processingData_L1tx_t *msg) { msg->num_pdsch_slot = 0; int num_cw = NR_MAX_NB_LAYERS > 4? 2:1; - for (int i=0; inumber_of_nr_dlsch_max; i++) { - LOG_I(PHY,"Allocating Transport Channel Buffers for DLSCH %d/%d\n",i,gNB->number_of_nr_dlsch_max); + for (int i = 0; i < NUMBER_OF_NR_DLSCH_MAX; i++) { + LOG_I(PHY,"Allocating Transport Channel Buffers for DLSCH %d/%d\n", i, NUMBER_OF_NR_DLSCH_MAX); for (int j=0; jdlsch[i][j] = new_gNB_dlsch(fp, grid_size); AssertFatal(msg->dlsch[i][j]!=NULL,"Can't initialize dlsch %d \n", i); @@ -998,7 +995,7 @@ void reset_DLSCH_struct(const PHY_VARS_gNB *gNB, processingData_L1tx_t *msg) const nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config; const uint16_t grid_size = cfg->carrier_config.dl_grid_size[fp->numerology_index].value; int num_cw = NR_MAX_NB_LAYERS > 4? 2:1; - for (int i=0; inumber_of_nr_dlsch_max; i++) + for (int i = 0; i < NUMBER_OF_NR_DLSCH_MAX; i++) for (int j=0; jdlsch[i][j], grid_size, fp); } @@ -1050,9 +1047,9 @@ void init_nr_transport(PHY_VARS_gNB *gNB) AssertFatal(gNB->srs[i]!=NULL,"Can't initialize srs %d \n", i); } - for (int i=0; inumber_of_nr_ulsch_max; i++) { + for (int i = 0; i < NUMBER_OF_NR_ULSCH_MAX; i++) { - LOG_I(PHY,"Allocating Transport Channel Buffers for ULSCH %d/%d\n",i,gNB->number_of_nr_ulsch_max); + LOG_I(PHY,"Allocating Transport Channel Buffers for ULSCH %d/%d\n", i, NUMBER_OF_NR_ULSCH_MAX); gNB->ulsch[i] = new_gNB_ulsch(gNB->max_ldpc_iterations, fp->N_RB_UL); @@ -1077,6 +1074,6 @@ void reset_nr_transport(PHY_VARS_gNB *gNB) for (int i = 0; i < gNB->max_nb_srs; i++) free_gNB_srs(gNB->srs[i]); - for (int i=0; inumber_of_nr_ulsch_max; i++) + for (int i = 0; i < NUMBER_OF_NR_ULSCH_MAX; i++) free_gNB_ulsch(&gNB->ulsch[i], fp->N_RB_UL); } diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index fa3c961a29..9b6adb8702 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -582,6 +582,6 @@ void dump_pdsch_stats(FILE *fd,PHY_VARS_gNB *gNB) { void clear_pdsch_stats(PHY_VARS_gNB *gNB) { - for (int i=0;inumber_of_nr_dlsch_max;i++) + for (int i = 0;i < NUMBER_OF_NR_SCH_STATS_MAX; i++) memset((void*)&gNB->dlsch_stats[i],0,sizeof(gNB->dlsch_stats[i])); } diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch.c index e9fcd35f6b..9fb95ac273 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch.c @@ -40,7 +40,7 @@ int16_t find_nr_ulsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type) { int16_t first_free_index=-1; AssertFatal(gNB!=NULL,"gNB is null\n"); - for (i=0; inumber_of_nr_ulsch_max; i++) { + for (i = 0; i < NUMBER_OF_NR_ULSCH_MAX; i++) { AssertFatal(gNB->ulsch[i]!=NULL,"gNB->ulsch[%d] is null\n",i); LOG_D(PHY,"searching for rnti %x : ulsch_index %d=> harq_mask %x, rnti %x, first_free_index %d\n", rnti,i,gNB->ulsch[i]->harq_mask,gNB->ulsch[i]->rnti,first_free_index); if ((gNB->ulsch[i]->harq_mask >0) && @@ -60,7 +60,7 @@ void nr_fill_ulsch(PHY_VARS_gNB *gNB, int ulsch_id = find_nr_ulsch(ulsch_pdu->rnti,gNB,SEARCH_EXIST_OR_FREE); - AssertFatal( (ulsch_id>=0) && (ulsch_idnumber_of_nr_ulsch_max), + AssertFatal((ulsch_id >= 0) && (ulsch_id < NUMBER_OF_NR_ULSCH_MAX), "illegal or no ulsch_id found!!! rnti %04x ulsch_id %d\n",ulsch_pdu->rnti,ulsch_id); NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ulsch_id]; @@ -121,7 +121,7 @@ void nr_ulsch_layer_demapping(int16_t *llr_cw, void dump_pusch_stats(FILE *fd,PHY_VARS_gNB *gNB) { - for (int i=0;inumber_of_nr_ulsch_max;i++) { + for (int i = 0;i < NUMBER_OF_NR_SCH_STATS_MAX;i++) { if (gNB->ulsch_stats[i].rnti>0 && gNB->ulsch_stats[i].frame != gNB->ulsch_stats[i].dump_frame) { gNB->ulsch_stats[i].dump_frame = gNB->ulsch_stats[i].frame; @@ -155,14 +155,14 @@ void dump_pusch_stats(FILE *fd,PHY_VARS_gNB *gNB) { void clear_pusch_stats(PHY_VARS_gNB *gNB) { - for (int i=0;inumber_of_nr_ulsch_max;i++) + for (int i = 0; i < NUMBER_OF_NR_ULSCH_MAX; i++) memset((void*)&gNB->ulsch_stats[i],0,sizeof(gNB->ulsch_stats[i])); } NR_gNB_SCH_STATS_t *get_ulsch_stats(PHY_VARS_gNB *gNB,NR_gNB_ULSCH_t *ulsch) { NR_gNB_SCH_STATS_t *stats=NULL; int first_free=-1; - for (int i=0;inumber_of_nr_ulsch_max;i++) { + for (int i = 0; i < NUMBER_OF_NR_ULSCH_MAX; i++) { if (gNB->ulsch_stats[i].rnti == 0 && first_free == -1) { first_free = i; stats=&gNB->ulsch_stats[i]; diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 136daf44aa..469218addc 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -626,7 +626,6 @@ typedef struct PHY_VARS_gNB_s { NR_gNB_PUSCH *pusch_vars[NUMBER_OF_NR_ULSCH_MAX]; NR_gNB_PUCCH_t **pucch; NR_gNB_SRS_t **srs; - NR_gNB_DLSCH_t *dlsch[NUMBER_OF_NR_DLSCH_MAX][2]; // Nusers times two spatial streams NR_gNB_ULSCH_t *ulsch[NUMBER_OF_NR_ULSCH_MAX]; // [Nusers times] /// statistics for DLSCH measurement collection NR_gNB_SCH_STATS_t dlsch_stats[NUMBER_OF_NR_SCH_STATS_MAX]; @@ -763,8 +762,6 @@ typedef struct PHY_VARS_gNB_s { notifiedFIFO_t resp_RU_tx; tpool_t threadPool; int nbDecode; - int number_of_nr_dlsch_max; - int number_of_nr_ulsch_max; void *scopeData; /// structure for analyzing high-level RT measurements rt_L1_profiling_t rt_L1_profiling; diff --git a/openair1/SCHED_NR/fapi_nr_l1.c b/openair1/SCHED_NR/fapi_nr_l1.c index c6b6f69126..b9f0d8e681 100644 --- a/openair1/SCHED_NR/fapi_nr_l1.c +++ b/openair1/SCHED_NR/fapi_nr_l1.c @@ -203,8 +203,8 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ AssertFatal(TX_req->pdu_list[pduIndex].num_TLV == 1, "TX_req->pdu_list[%d].num_TLV %d != 1\n", pduIndex,TX_req->pdu_list[pduIndex].num_TLV); uint8_t *sdu = (uint8_t *)TX_req->pdu_list[pduIndex].TLVs[0].value.direct; - AssertFatal(msgTx->num_pdsch_slot < gNB->number_of_nr_dlsch_max,"Number of PDSCH PDUs %d exceeded the limit %d\n", - msgTx->num_pdsch_slot,gNB->number_of_nr_dlsch_max); + AssertFatal(msgTx->num_pdsch_slot < NUMBER_OF_NR_DLSCH_MAX,"Number of PDSCH PDUs %d exceeded the limit %d\n", + msgTx->num_pdsch_slot, NUMBER_OF_NR_DLSCH_MAX); handle_nr_nfapi_pdsch_pdu(msgTx,&dl_tti_pdu->pdsch_pdu, sdu); } } diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 78f75b9e51..6a1a8f7b36 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -552,7 +552,7 @@ void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { } } - for (int ULSCH_id=0;ULSCH_idnumber_of_nr_ulsch_max;ULSCH_id++) { + for (int ULSCH_id = 0; ULSCH_id < NUMBER_OF_NR_ULSCH_MAX; ULSCH_id++) { NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id]; int harq_pid; NR_UL_gNB_HARQ_t *ulsch_harq; @@ -775,7 +775,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { } } - for (int ULSCH_id=0;ULSCH_idnumber_of_nr_ulsch_max;ULSCH_id++) { + for (int ULSCH_id = 0; ULSCH_id < NUMBER_OF_NR_ULSCH_MAX; ULSCH_id++) { NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id]; NR_UL_gNB_HARQ_t *ulsch_harq; From 358772429e5a627a73a5666400fef7d56de36aae Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 19 Dec 2022 18:27:19 +0100 Subject: [PATCH 7/7] fix asan failures --- openair1/PHY/INIT/nr_init.c | 10 +++++++--- openair1/SIMULATION/NR_PHY/dlschsim.c | 7 +++++++ openair1/SIMULATION/NR_PHY/pbchsim.c | 7 +++++++ openair1/SIMULATION/NR_PHY/prachsim.c | 2 +- openair1/SIMULATION/NR_PHY/pucchsim.c | 7 +++++++ openair1/SIMULATION/NR_PHY/ulschsim.c | 8 +++++++- 6 files changed, 36 insertions(+), 5 deletions(-) diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index b9e1139d14..b65068716b 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -765,6 +765,7 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB) free_and_zero(gNB->nr_srs_info[id]->srs_generated_signal); free_and_zero(gNB->nr_srs_info[id]); } + free_and_zero(gNB->nr_srs_info); free_ul_reference_signal_sequences(); free_gnb_lowpapr_sequences(); @@ -1025,10 +1026,11 @@ void init_nr_transport(PHY_VARS_gNB *gNB) nb_ul_slots_period = fp->slots_per_frame; int buffer_ul_slots; // the UL channels are scheduled sl_ahead before they are transmitted - if (gNB->if_inst->sl_ahead > nb_slots_per_period) - buffer_ul_slots = nb_ul_slots_period + (gNB->if_inst->sl_ahead - nb_slots_per_period); + int slot_ahead = gNB->if_inst ? gNB->if_inst->sl_ahead : 6; + if (slot_ahead > nb_slots_per_period) + buffer_ul_slots = nb_ul_slots_period + (slot_ahead - nb_slots_per_period); else - buffer_ul_slots = (nb_ul_slots_period < gNB->if_inst->sl_ahead) ? nb_ul_slots_period : gNB->if_inst->sl_ahead; + buffer_ul_slots = (nb_ul_slots_period < slot_ahead) ? nb_ul_slots_period : slot_ahead; gNB->max_nb_pucch = MAX_MOBILES_PER_GNB * buffer_ul_slots; gNB->max_nb_srs = buffer_ul_slots << 1; // assuming at most 2 SRS per slot @@ -1070,9 +1072,11 @@ void reset_nr_transport(PHY_VARS_gNB *gNB) for (int i = 0; i < gNB->max_nb_pucch; i++) free_gNB_pucch(gNB->pucch[i]); + free(gNB->pucch); for (int i = 0; i < gNB->max_nb_srs; i++) free_gNB_srs(gNB->srs[i]); + free(gNB->srs); for (int i = 0; i < NUMBER_OF_NR_ULSCH_MAX; i++) free_gNB_ulsch(&gNB->ulsch[i], fp->N_RB_UL); diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c index bacd100114..f5de60a297 100644 --- a/openair1/SIMULATION/NR_PHY/dlschsim.c +++ b/openair1/SIMULATION/NR_PHY/dlschsim.c @@ -366,6 +366,8 @@ int main(int argc, char **argv) frame_parms->Ncp = extended_prefix_flag ? EXTENDED : NORMAL; crcTableInit(); nr_phy_config_request_sim(gNB, N_RB_DL, N_RB_DL, mu, Nid_cell,SSB_positions); + gNB->gNB_config.tdd_table.tdd_period.value = 6; + set_tdd_config_nr(&gNB->gNB_config, mu, 7, 6, 2, 4); phy_init_nr_gNB(gNB); //init_eNB_afterRU(); frame_length_complex_samples = frame_parms->samples_per_subframe; @@ -612,6 +614,11 @@ int main(int argc, char **argv) reset_DLSCH_struct(gNB, &msgDataTx); + int nb_slots_to_set = TDD_CONFIG_NB_FRAMES * (1 << mu) * NR_NUMBER_OF_SUBFRAMES_PER_FRAME; + for (int i = 0; i < nb_slots_to_set; ++i) + free(gNB->gNB_config.tdd_table.max_tdd_periodicity_list[i].max_num_of_symbol_per_slot_list); + free(gNB->gNB_config.tdd_table.max_tdd_periodicity_list); + phy_free_nr_gNB(gNB); free(RC.gNB[0]); free(RC.gNB); diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index 7d0be09585..3b461a081e 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -471,6 +471,8 @@ int main(int argc, char **argv) frame_parms->freq_range = mu<2 ? nr_FR1 : nr_FR2; nr_phy_config_request_sim_pbchsim(gNB,N_RB_DL,N_RB_DL,mu,Nid_cell,SSB_positions); + gNB->gNB_config.tdd_table.tdd_period.value = 6; + set_tdd_config_nr(&gNB->gNB_config, mu, 7, 6, 2, 4); phy_init_nr_gNB(gNB); frame_parms->ssb_start_subcarrier = 12 * gNB->gNB_config.ssb_table.ssb_offset_point_a.value + ssb_subcarrier_offset; @@ -816,6 +818,11 @@ int main(int argc, char **argv) free_channel_desc_scm(gNB2UE); + int nb_slots_to_set = TDD_CONFIG_NB_FRAMES * (1 << mu) * NR_NUMBER_OF_SUBFRAMES_PER_FRAME; + for (int i = 0; i < nb_slots_to_set; ++i) + free(gNB->gNB_config.tdd_table.max_tdd_periodicity_list[i].max_num_of_symbol_per_slot_list); + free(gNB->gNB_config.tdd_table.max_tdd_periodicity_list); + phy_free_nr_gNB(gNB); free(RC.gNB[0]); free(RC.gNB); diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index fd145c568f..c7b8474a46 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -672,9 +672,9 @@ int main(int argc, char **argv){ memcpy((void*)&ru->config,(void*)&RC.gNB[0]->gNB_config,sizeof(ru->config)); RC.nb_nr_L1_inst=1; + set_tdd_config_nr(&gNB->gNB_config, mu, 7, 6, 2, 4); phy_init_nr_gNB(gNB); nr_phy_init_RU(ru); - set_tdd_config_nr(&gNB->gNB_config, mu, 7, 6, 2, 4); // Configure UE UE = malloc(sizeof(PHY_VARS_NR_UE)); diff --git a/openair1/SIMULATION/NR_PHY/pucchsim.c b/openair1/SIMULATION/NR_PHY/pucchsim.c index ca29219e31..498b31ec8f 100644 --- a/openair1/SIMULATION/NR_PHY/pucchsim.c +++ b/openair1/SIMULATION/NR_PHY/pucchsim.c @@ -404,6 +404,8 @@ int main(int argc, char **argv) cfg->carrier_config.num_tx_ant.value = n_tx; cfg->carrier_config.num_rx_ant.value = n_rx; nr_phy_config_request_sim(gNB,N_RB_DL,N_RB_DL,mu,Nid_cell,SSB_positions); + gNB->gNB_config.tdd_table.tdd_period.value = 6; + set_tdd_config_nr(&gNB->gNB_config, mu, 7, 6, 2, 4); phy_init_nr_gNB(gNB); /* RU handles rxdataF, and gNB just has a pointer. Here, we don't have an RU, * so we need to allocate that memory as well. */ @@ -721,6 +723,11 @@ int main(int argc, char **argv) free_channel_desc_scm(UE2gNB); term_freq_channel(); + int nb_slots_to_set = TDD_CONFIG_NB_FRAMES * (1 << mu) * NR_NUMBER_OF_SUBFRAMES_PER_FRAME; + for (int i = 0; i < nb_slots_to_set; ++i) + free(gNB->gNB_config.tdd_table.max_tdd_periodicity_list[i].max_num_of_symbol_per_slot_list); + free(gNB->gNB_config.tdd_table.max_tdd_periodicity_list); + for (i = 0; i < n_rx; i++) free(gNB->common_vars.rxdataF[i]); phy_free_nr_gNB(gNB); diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c index 39ab2273e7..0227788877 100644 --- a/openair1/SIMULATION/NR_PHY/ulschsim.c +++ b/openair1/SIMULATION/NR_PHY/ulschsim.c @@ -418,7 +418,8 @@ int main(int argc, char **argv) gNB->frame_parms.nb_antennas_rx = n_rx; nr_phy_config_request_sim(gNB, N_RB_UL, N_RB_UL, mu, Nid_cell, SSB_positions); - + gNB->gNB_config.tdd_table.tdd_period.value = 6; + set_tdd_config_nr(&gNB->gNB_config, mu, 7, 6, 2, 4); phy_init_nr_gNB(gNB); //configure UE @@ -639,6 +640,11 @@ int main(int argc, char **argv) free_nr_ue_ul_harq(UE->ul_harq_processes, NR_MAX_ULSCH_HARQ_PROCESSES, UE->frame_parms.N_RB_UL, UE->frame_parms.nb_antennas_tx); + int nb_slots_to_set = TDD_CONFIG_NB_FRAMES * (1 << mu) * NR_NUMBER_OF_SUBFRAMES_PER_FRAME; + for (int i = 0; i < nb_slots_to_set; ++i) + free(gNB->gNB_config.tdd_table.max_tdd_periodicity_list[i].max_num_of_symbol_per_slot_list); + free(gNB->gNB_config.tdd_table.max_tdd_periodicity_list); + term_nr_ue_signal(UE, 1); free(UE);