diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index 6efd26dfd7..3bd7b7a0f0 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -497,8 +497,7 @@ void init_gNB(int wait_for_sync) { RC.gNB[inst] = (PHY_VARS_gNB *) calloc(1, sizeof(PHY_VARS_gNB)); LOG_I(PHY,"[nr-gnb.c] gNB structure RC.gNB[%d] allocated @ %p\n",inst,RC.gNB[inst]); } - gNB = RC.gNB[inst]; - gNB->abstraction_flag = 0; + gNB = RC.gNB[inst]; /*nr_polar_init(&gNB->nrPolar_params, NR_POLAR_PBCH_MESSAGE_TYPE, NR_POLAR_PBCH_PAYLOAD_BITS, diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index f195f83d53..474061337b 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -162,11 +162,6 @@ void pdcp_run(const protocol_ctxt_t *const ctxt_pP) abort(); } -/* see file openair2/LAYER2/MAC/main.c for why abstraction_flag is needed - * this is very hackish - find a proper solution - */ -uint8_t abstraction_flag=0; - /* forward declarations */ void set_default_frame_parms(nfapi_nr_config_request_scf_t *config[MAX_NUM_CCs], NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]); diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index c553053cd8..c742a7088a 100644 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -260,9 +260,8 @@ void oai_create_gnb(void) { PHY_VARS_gNB *gNB = RC.gNB[0]; RC.nb_nr_CC = (int *)malloc(sizeof(int)); // TODO: find a better function to place this in - gNB->Mod_id = bodge_counter; - gNB->CC_id = bodge_counter; - gNB->abstraction_flag = 0; + gNB->Mod_id = bodge_counter; + gNB->CC_id = bodge_counter; RC.nb_nr_CC[bodge_counter] = 1; if (gNB->if_inst==0) { diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h index d08cc87f1d..835876d4bf 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h @@ -24,7 +24,7 @@ #include "PHY/defs_nr_UE.h" -//#include "PHY/defs_gNB.h" + /** @addtogroup _PHY_PARAMETER_ESTIMATION_BLOCKS_ * @{ */ diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index e295681ae0..cc566d6e1c 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -417,7 +417,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, //printf("start rx segment %d\n",r); uint32_t E = nr_get_E(G, harq_process->C, dlsch->dlsch_config.qamModOrder, dlsch->Nl, r); decParams.R = nr_get_R_ldpc_decoder(dlsch->dlsch_config.rv, E, decParams.BG, decParams.Z, &harq_process->llrLen, harq_process->DLround); - union ldpcReqUnion id = {.s={dlsch->rnti,frame,nr_slot_rx,0,0}}; + union ldpcReqUnion id = {.s = {dlsch->rnti, frame, nr_slot_rx, 0, 0}}; notifiedFIFO_elt_t *req = newNotifiedFIFO_elt(sizeof(ldpcDecode_ue_t), id.p, &nf, &nr_processDLSegment); ldpcDecode_ue_t * rdata=(ldpcDecode_ue_t *) NotifiedFifoData(req); diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index abab53fb4b..df7dede9fc 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -53,7 +53,6 @@ typedef struct { int lut[MAX_PUCCH0_NID][160][14]; } NR_gNB_PUCCH0_LUT_t; - typedef struct { uint32_t pbch_a; uint32_t pbch_a_interleaved; @@ -61,15 +60,6 @@ typedef struct { uint32_t pbch_e[NR_POLAR_PBCH_E_DWORD]; } NR_gNB_PBCH; - -typedef enum { - NR_SCH_IDLE, - NR_ACTIVE, - NR_CBA_ACTIVE, - NR_DISABLED -} NR_SCH_status_t; - - typedef struct { /// Nfapi DLSCH PDU nfapi_nr_dl_tti_pdsch_pdu pdsch_pdu; @@ -81,8 +71,6 @@ typedef struct { uint8_t **c; /// Frame where current HARQ round was sent uint32_t frame; - /// Subframe where current HARQ round was sent - uint32_t subframe; /// Interleaver outputs uint8_t *f; /// LDPC lifting size @@ -221,6 +209,7 @@ typedef struct { int llrLen; ////////////////////////////////////////////////////////////// } NR_UL_gNB_HARQ_t; + static inline int lenWithCrc(int nbSeg, int len) { if (nbSeg > 1) @@ -237,24 +226,8 @@ static inline int crcType(int nbSeg, int len) typedef struct { //! estimated rssi (dBm) int rx_rssi_dBm; - //! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation) - int rx_correlation[2]; - //! estimated correlation (wideband dB) between spatial channels (computed in dlsch_demodulation) - int rx_correlation_dB[2]; - /// Wideband CQI (= SINR) - int wideband_cqi[MAX_NUM_RU_PER_gNB]; - /// Wideband CQI in dB (= SINR dB) - int wideband_cqi_dB[MAX_NUM_RU_PER_gNB]; /// Wideband CQI (sum of all RX antennas, in dB) char wideband_cqi_tot; - /// Subband CQI per RX antenna and RB (= SINR) - int subband_cqi[MAX_NUM_RU_PER_gNB][275]; - /// Total Subband CQI and RB (= SINR) - int subband_cqi_tot[275]; - /// Subband CQI in dB and RB (= SINR dB) - int subband_cqi_dB[MAX_NUM_RU_PER_gNB][275]; - /// Total Subband CQI and RB - int subband_cqi_tot_dB[275]; } ulsch_measurements_gNB; typedef struct { @@ -379,7 +352,7 @@ typedef struct { /// Context data structure for RX/TX portion of slot processing typedef struct { /// Component Carrier index - uint8_t CC_id; + uint8_t CC_id; /// timestamp transmitted to HW openair0_timestamp timestamp_tx; /// slot to act upon for transmission @@ -393,111 +366,32 @@ typedef struct { /// \brief Instance count for RXn-TXnp4 processing thread. /// \internal This variable is protected by \ref mutex_rxtx. int instance_cnt; - /// pthread structure for RXn-TXnp4 processing thread - pthread_t pthread; - /// pthread attributes for RXn-TXnp4 processing thread - pthread_attr_t attr; /// condition variable for tx processing thread pthread_cond_t cond; /// mutex for RXn-TXnp4 processing thread pthread_mutex_t mutex; - /// scheduling parameters for RXn-TXnp4 thread - struct sched_param sched_param_rxtx; - - /// \internal This variable is protected by \ref mutex_RUs_tx. - int instance_cnt_RUs; - /// condition variable for tx processing thread - pthread_cond_t cond_RUs; - /// mutex for L1 RXTX processing thread - pthread_mutex_t mutex_RUs; - /// mutex for L1 TX FH synchronization - pthread_mutex_t mutex_RUs_tx; } gNB_L1_rxtx_proc_t; /// Context data structure for eNB slot processing typedef struct gNB_L1_proc_t_s { /// Component Carrier index - uint8_t CC_id; - /// thread index - int thread_index; + uint8_t CC_id; /// timestamp received from HW openair0_timestamp timestamp_rx; /// timestamp to send to "slave rru" openair0_timestamp timestamp_tx; /// slot to act upon for reception int slot_rx; - /// slot to act upon for PRACH - int slot_prach; /// frame to act upon for reception int frame_rx; /// frame to act upon for transmission int frame_tx; - /// frame to act upon for PRACH - int frame_prach; - /// \internal This variable is protected by \ref mutex_td. - int instance_cnt_td; - /// \internal This variable is protected by \ref mutex_te. - int instance_cnt_te; - /// \internal This variable is protected by \ref mutex_prach. - int instance_cnt_prach; - /// \internal This variable is protected by \ref mutex_asynch_rxtx. - int instance_cnt_asynch_rxtx; - /// pthread structure for eNB single processing thread - pthread_t pthread_single; - /// pthread structure for asychronous RX/TX processing thread - pthread_t pthread_asynch_rxtx; /// pthread structure for dumping L1 stats pthread_t L1_stats_thread; - /// pthread structure for printing time meas - pthread_t process_stats_thread; - /// pthread structure for reordering L1 tx thread messages - pthread_t pthread_tx_reorder; - /// flag to indicate first RX acquisition - int first_rx; - /// flag to indicate first TX transmission - int first_tx; - /// pthread attributes for single gNB processing thread - pthread_attr_t attr_single; - /// pthread attributes for prach processing thread - pthread_attr_t attr_prach; - /// pthread attributes for asynchronous RX thread - pthread_attr_t attr_asynch_rxtx; - /// scheduling parameters for parallel turbo-decoder thread - struct sched_param sched_param_td; - /// scheduling parameters for parallel turbo-encoder thread - struct sched_param sched_param_te; - /// scheduling parameters for single eNB thread - struct sched_param sched_param_single; - /// scheduling parameters for prach thread - struct sched_param sched_param_prach; - /// scheduling parameters for asynch_rxtx thread - struct sched_param sched_param_asynch_rxtx; - pthread_cond_t cond_prach; - /// condition variable for asynch RX/TX thread - pthread_cond_t cond_asynch_rxtx; - /// mutex for parallel turbo-decoder thread - pthread_mutex_t mutex_td; - /// mutex for parallel turbo-encoder thread - pthread_mutex_t mutex_te; - /// mutex for PRACH thread - pthread_mutex_t mutex_prach; - /// mutex for asynch RX/TX thread - pthread_mutex_t mutex_asynch_rxtx; - /// mutex for RU access to eNB processing (PDSCH/PUSCH) - pthread_mutex_t mutex_RU; - /// mutex for RU_tx access to eNB_tx processing (PDSCH/PUSCH) - pthread_mutex_t mutex_RU_tx; - /// mutex for RU access to eNB processing (PRACH) - pthread_mutex_t mutex_RU_PRACH; - /// mutex for RU access to eNB processing (PRACH BR) - pthread_mutex_t mutex_RU_PRACH_br; - /// mask for RUs serving eNB (PDSCH/PUSCH) - int RU_mask, RU_mask_tx; - /// mask for RUs serving eNB (PRACH) - int RU_mask_prach; /// set of scheduling variables RXn-TXnp4 threads - gNB_L1_rxtx_proc_t L1_proc, L1_proc_tx; + gNB_L1_rxtx_proc_t L1_proc; + gNB_L1_rxtx_proc_t L1_proc_tx; } gNB_L1_proc_t; typedef struct { @@ -523,8 +417,7 @@ typedef struct { //! estimated avg noise power per RB (dBm) int n0_subband_power_tot_dBm[275]; /// PRACH background noise level - int prach_I0; - + int prach_I0; } PHY_MEASUREMENTS_gNB; @@ -539,25 +432,23 @@ typedef struct { /// Top-level PHY Data Structure for gNB typedef struct PHY_VARS_gNB_s { /// Module ID indicator for this instance - module_id_t Mod_id; - uint8_t CC_id; - uint8_t configured; - gNB_L1_proc_t proc; - int abstraction_flag; - int num_RU; - RU_t *RU_list[MAX_NUM_RU_PER_gNB]; + module_id_t Mod_id; + uint8_t CC_id; + uint8_t configured; + gNB_L1_proc_t proc; + int num_RU; + RU_t *RU_list[MAX_NUM_RU_PER_gNB]; /// Ethernet parameters for northbound midhaul interface - eth_params_t eth_params_n; + eth_params_t eth_params_n; /// Ethernet parameters for fronthaul interface - eth_params_t eth_params; - int rx_total_gain_dB; - int (*nr_start_if)(struct RU_t_s *ru, struct PHY_VARS_gNB_s *gNB); - uint8_t local_flag; - nfapi_nr_config_request_scf_t gNB_config; - NR_DL_FRAME_PARMS frame_parms; + eth_params_t eth_params; + int rx_total_gain_dB; + int (*nr_start_if)(struct RU_t_s *ru, struct PHY_VARS_gNB_s *gNB); + nfapi_nr_config_request_scf_t gNB_config; + NR_DL_FRAME_PARMS frame_parms; PHY_MEASUREMENTS_gNB measurements; - NR_IF_Module_t *if_inst; - NR_UL_IND_t UL_INFO; + NR_IF_Module_t *if_inst; + NR_UL_IND_t UL_INFO; /// NFAPI RX ULSCH information nfapi_nr_rx_data_pdu_t rx_pdu_list[MAX_UL_PDUS_PER_SLOT]; @@ -570,7 +461,7 @@ typedef struct PHY_VARS_gNB_s { /// NFAPI PRACH information nfapi_nr_prach_indication_pdu_t prach_pdu_indication_list[MAX_NUM_NR_RX_RACH_PDUS]; - nfapi_nr_ul_tti_request_t UL_tti_req; + nfapi_nr_ul_tti_request_t UL_tti_req; nfapi_nr_uci_indication_t uci_indication; int max_nb_pucch; @@ -578,16 +469,16 @@ typedef struct PHY_VARS_gNB_s { int max_nb_pdsch; int max_nb_pusch; - NR_gNB_PBCH pbch; - NR_gNB_COMMON common_vars; - NR_gNB_PRACH prach_vars; - NR_gNB_PRS prs_vars; + NR_gNB_PBCH pbch; + NR_gNB_COMMON common_vars; + NR_gNB_PRACH prach_vars; + NR_gNB_PRS prs_vars; NR_gNB_PUSCH *pusch_vars; NR_gNB_PUCCH_t *pucch; NR_gNB_SRS_t *srs; NR_gNB_ULSCH_t *ulsch; NR_gNB_PHY_STATS_t phy_stats[MAX_MOBILES_PER_GNB]; - t_nrPolar_params **polarParams; + t_nrPolar_params **polarParams; /// SRS variables nr_srs_info_t **nr_srs_info; @@ -635,15 +526,11 @@ typedef struct PHY_VARS_gNB_s { uint64_t bad_pucch; int num_ulprbbl; int ulprbbl[275]; - /* - time_stats_t phy_proc; - */ + time_stats_t phy_proc_tx; time_stats_t phy_proc_rx; time_stats_t rx_prach; - /* - time_stats_t ofdm_mod_stats; - */ + time_stats_t dlsch_encoding_stats; time_stats_t dlsch_modulation_stats; time_stats_t dlsch_scrambling_stats; @@ -678,10 +565,6 @@ typedef struct PHY_VARS_gNB_s { time_stats_t srs_beam_report_stats; time_stats_t srs_iq_matrix_stats; - /* - time_stats_t rx_dft_stats; - time_stats_t ulsch_freq_offset_estimation_stats; - */ notifiedFIFO_t respPuschSymb; notifiedFIFO_t respDecode; notifiedFIFO_t resp_L1; @@ -739,7 +622,7 @@ typedef struct LDPCDecode_s { struct ldpcReqId { uint16_t rnti; uint16_t frame; - uint8_t subframe; + uint8_t slot; uint8_t codeblock; uint16_t spare; } __attribute__((packed)); @@ -756,12 +639,6 @@ typedef struct processingData_L1 { PHY_VARS_gNB *gNB; } processingData_L1_t; -typedef enum { - FILLED, - FILLING, - NOT_FILLED -} msgStatus_t; - typedef struct processingData_L1tx { int frame; int slot; diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index cf1603a810..94260334a1 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -135,11 +135,6 @@ int main(int argc, char **argv){ int prachOccasion = 0; double DS_TDL = .03; - // int8_t interf1=-19,interf2=-19; - // uint8_t abstraction_flag=0,calibration_flag=0; - // double prach_sinr; - // uint32_t nsymb; - // uint16_t preamble_max, preamble_energy_max; FILE *input_fd=NULL; char* input_file=NULL; int n_bytes=0;