From 900fcd9762e1eee1b85ad383383208e41d5e7d26 Mon Sep 17 00:00:00 2001 From: Bartosz Podrygajlo Date: Wed, 30 Oct 2024 09:05:39 +0100 Subject: [PATCH 01/75] Thread safety for MAC config Move mac_IF_mutex to MAC instance and use it for ensuring thread safety when modifying MAC structures from RRC. --- openair2/LAYER2/NR_MAC_UE/config_ue.c | 14 +++++++++++++- openair2/LAYER2/NR_MAC_UE/mac_defs.h | 1 + openair2/LAYER2/NR_MAC_UE/main_ue_nr.c | 1 + openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 21 +++++++++------------ 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 19a799dab6..eea5a56abc 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -872,6 +872,8 @@ void nr_rrc_mac_config_req_mib(module_id_t module_id, int sched_sib) { NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); + int ret = pthread_mutex_lock(&mac->if_mutex); + AssertFatal(!ret, "mutex failed %d\n", ret); AssertFatal(mib, "MIB should not be NULL\n"); if (!mac->mib) mac->mib = calloc(1, sizeof(*mac->mib)); @@ -883,6 +885,7 @@ void nr_rrc_mac_config_req_mib(module_id_t module_id, else if (sched_sib == 2) mac->get_otherSI = true; nr_ue_decode_mib(mac, cc_idP); + pthread_mutex_unlock(&mac->if_mutex); } static void setup_puschpowercontrol(NR_UE_MAC_INST_t *mac, NR_PUSCH_PowerControl_t *source, NR_PUSCH_PowerControl_t *target) @@ -1611,6 +1614,8 @@ void nr_rrc_mac_config_req_reset(module_id_t module_id, NR_UE_MAC_reset_cause_t cause) { NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); + int ret = pthread_mutex_lock(&mac->if_mutex); + AssertFatal(!ret, "mutex failed %d\n", ret); fapi_nr_synch_request_t sync_req = {.target_Nid_cell = -1, .ssb_bw_scan = true}; switch (cause) { case GO_TO_IDLE: @@ -1649,6 +1654,7 @@ void nr_rrc_mac_config_req_reset(module_id_t module_id, default: AssertFatal(false, "Invalid MAC reset cause %d\n", cause); } + pthread_mutex_unlock(&mac->if_mutex); } static int get_ta_offset(long *n_TimingAdvanceOffset) @@ -1676,6 +1682,8 @@ void nr_rrc_mac_config_req_sib1(module_id_t module_id, NR_ServingCellConfigCommonSIB_t *scc) { NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); + int ret = pthread_mutex_lock(&mac->if_mutex); + AssertFatal(!ret, "mutex failed %d\n", ret); AssertFatal(scc, "SIB1 SCC should not be NULL\n"); UPDATE_IE(mac->tdd_UL_DL_ConfigurationCommon, scc->tdd_UL_DL_ConfigurationCommon, NR_TDD_UL_DL_ConfigCommon_t); @@ -1708,6 +1716,7 @@ void nr_rrc_mac_config_req_sib1(module_id_t module_id, if (!get_softmodem_params()->emulate_l1) mac->if_module->phy_config_request(&mac->phy_config); + pthread_mutex_unlock(&mac->if_mutex); } void nr_rrc_mac_config_req_sib19_r17(module_id_t module_id, @@ -2518,8 +2527,10 @@ void nr_rrc_mac_config_req_cg(module_id_t module_id, NR_UE_NR_Capability_t *ue_Capability) { LOG_I(MAC,"[UE %d] Applying CellGroupConfig from gNodeB\n", module_id); - AssertFatal(cell_group_config, "CellGroupConfig should not be NULL\n"); NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); + int ret = pthread_mutex_lock(&mac->if_mutex); + AssertFatal(!ret, "mutex failed %d\n", ret); + AssertFatal(cell_group_config, "CellGroupConfig should not be NULL\n"); if (cell_group_config->physicalCellGroupConfig) configure_physicalcellgroup(mac, cell_group_config->physicalCellGroupConfig); @@ -2562,4 +2573,5 @@ void nr_rrc_mac_config_req_cg(module_id_t module_id, if (!mac->dl_config_request || !mac->ul_config_request) ue_init_config_request(mac, mac->current_DL_BWP->scs); + pthread_mutex_unlock(&mac->if_mutex); } diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index ffa09ccb25..426d8f88d1 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -617,6 +617,7 @@ typedef struct NR_UE_MAC_INST_s { int f_b_f_c; bool pusch_power_control_initialized; int delta_msg2; + pthread_mutex_t if_mutex; } NR_UE_MAC_INST_t; /*@}*/ diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c index a60d8d2c43..7dfe198547 100644 --- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -70,6 +70,7 @@ void nr_ue_init_mac(NR_UE_MAC_INST_t *mac) mac->p_Max = INT_MIN; mac->p_Max_alt = INT_MIN; mac->n_ta_offset = -1; + pthread_mutex_init(&mac->if_mutex, NULL); reset_mac_inst(mac); // need to inizialize because might not been setup (optional timer) diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index c4faefa0fa..7b00b1bca2 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -65,7 +65,6 @@ queue_t nr_dl_tti_req_queue; queue_t nr_tx_req_queue; queue_t nr_ul_dci_req_queue; queue_t nr_ul_tti_req_queue; -pthread_mutex_t mac_IF_mutex; static void save_pdsch_pdu_for_crnti(nfapi_nr_dl_tti_request_t *dl_tti_request); void nrue_init_standalone_socket(int tx_port, int rx_port) @@ -1141,18 +1140,17 @@ void update_harq_status(NR_UE_MAC_INST_t *mac, uint8_t harq_pid, uint8_t ack_nac int nr_ue_ul_indication(nr_uplink_indication_t *ul_info) { - int ret = pthread_mutex_lock(&mac_IF_mutex); - AssertFatal(!ret, "mutex failed %d\n", ret); - LOG_D(PHY, "Locked in ul, slot %d\n", ul_info->slot); - module_id_t module_id = ul_info->module_id; NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); + int ret = pthread_mutex_lock(&mac->if_mutex); + AssertFatal(!ret, "mutex failed %d\n", ret); + LOG_D(PHY, "Locked in ul, slot %d\n", ul_info->slot); LOG_T(NR_MAC, "Not calling scheduler mac->ra.ra_state = %d\n", mac->ra.ra_state); if (is_nr_UL_slot(mac->tdd_UL_DL_ConfigurationCommon, ul_info->slot, mac->frame_type)) nr_ue_ul_scheduler(mac, ul_info); - pthread_mutex_unlock(&mac_IF_mutex); + pthread_mutex_unlock(&mac->if_mutex); return 0; } @@ -1264,26 +1262,26 @@ static uint32_t nr_ue_dl_processing(nr_downlink_indication_t *dl_info) int nr_ue_dl_indication(nr_downlink_indication_t *dl_info) { - int ret = pthread_mutex_lock(&mac_IF_mutex); - AssertFatal(!ret, "mutex failed %d\n", ret); uint32_t ret2 = 0; NR_UE_MAC_INST_t *mac = get_mac_inst(dl_info->module_id); + int ret = pthread_mutex_lock(&mac->if_mutex); + AssertFatal(!ret, "mutex failed %d\n", ret); if (!dl_info->dci_ind && !dl_info->rx_ind) // DL indication to process DCI reception nr_ue_dl_scheduler(mac, dl_info); else // DL indication to process data channels ret2 = nr_ue_dl_processing(dl_info); - pthread_mutex_unlock(&mac_IF_mutex); + pthread_mutex_unlock(&mac->if_mutex); return ret2; } void nr_ue_slot_indication(uint8_t mod_id) { - pthread_mutex_lock(&mac_IF_mutex); NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); + pthread_mutex_lock(&mac->if_mutex); update_mac_timers(mac); - pthread_mutex_unlock(&mac_IF_mutex); + pthread_mutex_unlock(&mac->if_mutex); } nr_ue_if_module_t *nr_ue_if_module_init(uint32_t module_id) @@ -1309,7 +1307,6 @@ nr_ue_if_module_t *nr_ue_if_module_init(uint32_t module_id) nr_ue_if_module_inst[module_id]->ul_indication = nr_ue_ul_indication; nr_ue_if_module_inst[module_id]->slot_indication = nr_ue_slot_indication; } - pthread_mutex_init(&mac_IF_mutex, NULL); return nr_ue_if_module_inst[module_id]; } From 0109a6b976202b2f70e7ab31722db7be0e9dbc04 Mon Sep 17 00:00:00 2001 From: Bartosz Podrygajlo Date: Tue, 29 Oct 2024 14:40:51 +0100 Subject: [PATCH 02/75] Fix data race on csirs_vars csirs_vars used to be global array for each UE. Now its present in phy_data which is in dynamically allocated memory. --- openair1/PHY/INIT/nr_init_ue.c | 4 ---- openair1/PHY/NR_UE_TRANSPORT/csi_rx.c | 11 ++--------- openair1/PHY/defs_nr_UE.h | 3 +-- openair1/SCHED_NR_UE/defs.h | 3 ++- openair1/SCHED_NR_UE/fapi_nr_ue_l1.c | 4 ++-- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 6 +++--- 6 files changed, 10 insertions(+), 21 deletions(-) diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index 577f7a44d8..0e56cfef25 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -172,7 +172,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) NR_UE_COMMON *const common_vars = &ue->common_vars; NR_UE_PRACH **const prach_vars = ue->prach_vars; NR_UE_CSI_IM **const csiim_vars = ue->csiim_vars; - NR_UE_CSI_RS **const csirs_vars = ue->csirs_vars; NR_UE_SRS **const srs_vars = ue->srs_vars; LOG_I(PHY, "Initializing UE vars for gNB TXant %u, UE RXant %u\n", fp->nb_antennas_tx, fp->nb_antennas_rx); @@ -260,11 +259,9 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) for (int gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) { prach_vars[gNB_id] = malloc16_clear(sizeof(NR_UE_PRACH)); csiim_vars[gNB_id] = malloc16_clear(sizeof(NR_UE_CSI_IM)); - csirs_vars[gNB_id] = malloc16_clear(sizeof(NR_UE_CSI_RS)); srs_vars[gNB_id] = malloc16_clear(sizeof(NR_UE_SRS)); csiim_vars[gNB_id]->active = false; - csirs_vars[gNB_id]->active = false; srs_vars[gNB_id]->active = false; // ceil((NB_RB*8(max allocation per RB)*2(QPSK))/32) @@ -327,7 +324,6 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) free_and_zero(ue->nr_srs_info); free_and_zero(ue->csiim_vars[gNB_id]); - free_and_zero(ue->csirs_vars[gNB_id]); free_and_zero(ue->srs_vars[gNB_id]); free_and_zero(ue->prach_vars[gNB_id]); diff --git a/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c b/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c index eed7da6556..0f5ddcdefa 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c +++ b/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c @@ -877,17 +877,10 @@ static void nr_ue_generate_csi_rs(const fapi_nr_dl_config_csirs_pdu_rel15_t *csi void nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, - c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP]) + c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP], + fapi_nr_dl_config_csirs_pdu_rel15_t *csirs_config_pdu) { - int gNB_id = proc->gNB_id; - if(!ue->csirs_vars[gNB_id]->active) { - return; - } - ue->csirs_vars[gNB_id]->active = 0; - - const fapi_nr_dl_config_csirs_pdu_rel15_t *csirs_config_pdu = &ue->csirs_vars[gNB_id]->csirs_config_pdu; - #ifdef NR_CSIRS_DEBUG LOG_I(NR_PHY, "csirs_config_pdu->subcarrier_spacing = %i\n", csirs_config_pdu->subcarrier_spacing); LOG_I(NR_PHY, "csirs_config_pdu->cyclic_prefix = %i\n", csirs_config_pdu->cyclic_prefix); diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 4def69049e..78a109e4bd 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -397,7 +397,6 @@ typedef struct PHY_VARS_NR_UE_s { NR_UE_PRACH *prach_vars[NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_CSI_IM *csiim_vars[NUMBER_OF_CONNECTED_gNB_MAX]; - NR_UE_CSI_RS *csirs_vars[NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_SRS *srs_vars[NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_PRS *prs_vars[NR_MAX_PRS_COMB_SIZE]; uint8_t prs_active_gNBs; @@ -603,7 +602,7 @@ typedef struct nr_phy_data_s { // Sidelink Rx action decided by MAC sl_nr_rx_config_type_enum_t sl_rx_action; - + NR_UE_CSI_RS csirs_vars; } nr_phy_data_t; enum stream_status_e { STREAM_STATUS_UNSYNC, STREAM_STATUS_SYNCING, STREAM_STATUS_SYNCED}; diff --git a/openair1/SCHED_NR_UE/defs.h b/openair1/SCHED_NR_UE/defs.h index 4174e44238..46e3603525 100644 --- a/openair1/SCHED_NR_UE/defs.h +++ b/openair1/SCHED_NR_UE/defs.h @@ -155,7 +155,8 @@ void nr_ue_csi_im_procedures(PHY_VARS_NR_UE *ue, void nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, - c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP]); + c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP], + fapi_nr_dl_config_csirs_pdu_rel15_t *csirs_config_pdu); int psbch_pscch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_data_t *phy_data); void phy_procedures_nrUE_SL_TX(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_data_tx_t *phy_data); diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index 32fa53cc60..967371e6dd 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -424,8 +424,8 @@ static void nr_ue_scheduled_response_dl(NR_UE_MAC_INST_t *mac, phy->csiim_vars[0]->active = true; break; case FAPI_NR_DL_CONFIG_TYPE_CSI_RS: - phy->csirs_vars[0]->csirs_config_pdu = pdu->csirs_config_pdu.csirs_config_rel15; - phy->csirs_vars[0]->active = true; + phy_data->csirs_vars.csirs_config_pdu = pdu->csirs_config_pdu.csirs_config_rel15; + phy_data->csirs_vars.active = true; break; case FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH: { fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu = &pdu->dlsch_config_pdu.dlsch_config_rel15; diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index cf1ebf8319..99379e2edc 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -1071,16 +1071,16 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_ } // do procedures for CSI-RS - if ((ue->csirs_vars[gNB_id]) && (ue->csirs_vars[gNB_id]->active == 1)) { + if (phy_data->csirs_vars.active == 1) { for(int symb = 0; symb < NR_SYMBOLS_PER_SLOT; symb++) { - if(is_csi_rs_in_symbol(ue->csirs_vars[gNB_id]->csirs_config_pdu, symb)) { + if(is_csi_rs_in_symbol(phy_data->csirs_vars.csirs_config_pdu, symb)) { if (!slot_fep_map[symb]) { nr_slot_fep(ue, &ue->frame_parms, proc->nr_slot_rx, symb, rxdataF, link_type_dl, 0, ue->common_vars.rxdata); slot_fep_map[symb] = true; } } } - nr_ue_csi_rs_procedures(ue, proc, rxdataF); + nr_ue_csi_rs_procedures(ue, proc, rxdataF, &phy_data->csirs_vars.csirs_config_pdu); } if (dlsch[0].active) { From f6ea1648e90f21ed2fd5d16514e16ba1e53c4c10 Mon Sep 17 00:00:00 2001 From: Bartosz Podrygajlo Date: Tue, 29 Oct 2024 14:48:57 +0100 Subject: [PATCH 03/75] Fix data race on csiim_vars csiim_vars used to be global array for each UE. Now its present in phy_data which is in dynamically allocated memory --- openair1/PHY/INIT/nr_init_ue.c | 5 ----- openair1/PHY/NR_UE_TRANSPORT/csi_rx.c | 8 ++------ openair1/PHY/defs_nr_UE.h | 2 +- openair1/SCHED_NR_UE/defs.h | 3 ++- openair1/SCHED_NR_UE/fapi_nr_ue_l1.c | 4 ++-- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 7 +++---- 6 files changed, 10 insertions(+), 19 deletions(-) diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index 0e56cfef25..ea4d5ca22a 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -171,7 +171,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) NR_DL_FRAME_PARMS *const fp = &ue->frame_parms; NR_UE_COMMON *const common_vars = &ue->common_vars; NR_UE_PRACH **const prach_vars = ue->prach_vars; - NR_UE_CSI_IM **const csiim_vars = ue->csiim_vars; NR_UE_SRS **const srs_vars = ue->srs_vars; LOG_I(PHY, "Initializing UE vars for gNB TXant %u, UE RXant %u\n", fp->nb_antennas_tx, fp->nb_antennas_rx); @@ -258,10 +257,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) // DLSCH for (int gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) { prach_vars[gNB_id] = malloc16_clear(sizeof(NR_UE_PRACH)); - csiim_vars[gNB_id] = malloc16_clear(sizeof(NR_UE_CSI_IM)); srs_vars[gNB_id] = malloc16_clear(sizeof(NR_UE_SRS)); - - csiim_vars[gNB_id]->active = false; srs_vars[gNB_id]->active = false; // ceil((NB_RB*8(max allocation per RB)*2(QPSK))/32) @@ -323,7 +319,6 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) free_and_zero(ue->nr_srs_info); - free_and_zero(ue->csiim_vars[gNB_id]); free_and_zero(ue->srs_vars[gNB_id]); free_and_zero(ue->prach_vars[gNB_id]); diff --git a/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c b/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c index 0f5ddcdefa..bcd24fef4a 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c +++ b/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c @@ -793,13 +793,9 @@ static void nr_csi_im_power_estimation(const PHY_VARS_NR_UE *ue, void nr_ue_csi_im_procedures(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, - c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP]) + c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP], + const fapi_nr_dl_config_csiim_pdu_rel15_t *csiim_config_pdu) { - int gNB_id = proc->gNB_id; - if(!ue->csiim_vars[gNB_id]->active) - LOG_E(NR_PHY, "Scheduling reception of CSI-IM that is not active\n"); - - const fapi_nr_dl_config_csiim_pdu_rel15_t *csiim_config_pdu = (fapi_nr_dl_config_csiim_pdu_rel15_t*)&ue->csiim_vars[gNB_id]->csiim_config_pdu; #ifdef NR_CSIIM_DEBUG LOG_I(NR_PHY, "csiim_config_pdu->bwp_size = %i\n", csiim_config_pdu->bwp_size); diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 78a109e4bd..12b10e4b96 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -396,7 +396,6 @@ typedef struct PHY_VARS_NR_UE_s { nr_synch_request_t synch_request; NR_UE_PRACH *prach_vars[NUMBER_OF_CONNECTED_gNB_MAX]; - NR_UE_CSI_IM *csiim_vars[NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_SRS *srs_vars[NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_PRS *prs_vars[NR_MAX_PRS_COMB_SIZE]; uint8_t prs_active_gNBs; @@ -603,6 +602,7 @@ typedef struct nr_phy_data_s { // Sidelink Rx action decided by MAC sl_nr_rx_config_type_enum_t sl_rx_action; NR_UE_CSI_RS csirs_vars; + NR_UE_CSI_IM csiim_vars; } nr_phy_data_t; enum stream_status_e { STREAM_STATUS_UNSYNC, STREAM_STATUS_SYNCING, STREAM_STATUS_SYNCED}; diff --git a/openair1/SCHED_NR_UE/defs.h b/openair1/SCHED_NR_UE/defs.h index 46e3603525..7ae4bb6a70 100644 --- a/openair1/SCHED_NR_UE/defs.h +++ b/openair1/SCHED_NR_UE/defs.h @@ -151,7 +151,8 @@ int nr_ue_pdcch_procedures(PHY_VARS_NR_UE *ue, void nr_ue_csi_im_procedures(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, - c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP]); + c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP], + const fapi_nr_dl_config_csiim_pdu_rel15_t *csiim_config_pdu); void nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index 967371e6dd..dc2db2d2ea 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -420,8 +420,8 @@ static void nr_ue_scheduled_response_dl(NR_UE_MAC_INST_t *mac, LOG_D(PHY, "Number of DCI SearchSpaces %d\n", phy_data->phy_pdcch_config.nb_search_space); break; case FAPI_NR_DL_CONFIG_TYPE_CSI_IM: - phy->csiim_vars[0]->csiim_config_pdu = pdu->csiim_config_pdu.csiim_config_rel15; - phy->csiim_vars[0]->active = true; + phy_data->csiim_vars.csiim_config_pdu = pdu->csiim_config_pdu.csiim_config_rel15; + phy_data->csiim_vars.active = true; break; case FAPI_NR_DL_CONFIG_TYPE_CSI_RS: phy_data->csirs_vars.csirs_config_pdu = pdu->csirs_config_pdu.csirs_config_rel15; diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 99379e2edc..0e1864cad1 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -1058,16 +1058,15 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_ __attribute__ ((aligned(32))) c16_t rxdataF[ue->frame_parms.nb_antennas_rx][rxdataF_sz]; // do procedures for CSI-IM - if ((ue->csiim_vars[gNB_id]) && (ue->csiim_vars[gNB_id]->active == 1)) { + if (phy_data->csiim_vars.active == 1) { for(int symb_idx = 0; symb_idx < 4; symb_idx++) { - int symb = ue->csiim_vars[gNB_id]->csiim_config_pdu.l_csiim[symb_idx]; + int symb = phy_data->csiim_vars.csiim_config_pdu.l_csiim[symb_idx]; if (!slot_fep_map[symb]) { nr_slot_fep(ue, &ue->frame_parms, proc->nr_slot_rx, symb, rxdataF, link_type_dl, 0, ue->common_vars.rxdata); slot_fep_map[symb] = true; } } - nr_ue_csi_im_procedures(ue, proc, rxdataF); - ue->csiim_vars[gNB_id]->active = 0; + nr_ue_csi_im_procedures(ue, proc, rxdataF, &phy_data->csiim_vars.csiim_config_pdu); } // do procedures for CSI-RS From 4d070036529199231f184c63c30933473c3b91a1 Mon Sep 17 00:00:00 2001 From: Bartosz Podrygajlo Date: Wed, 30 Oct 2024 09:54:26 +0100 Subject: [PATCH 04/75] Thread safe get_ue_nas_info Call get_ue_nas_info before any thread starts to prevent concurrent initialization of uicc array. --- executables/nr-uesoftmodem.c | 1 + openair3/NAS/NR_UE/nr_nas_msg.c | 11 ++++++----- openair3/NAS/NR_UE/nr_nas_msg.h | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 4e5e1a19f9..dabb0bc8e2 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -453,6 +453,7 @@ int main(int argc, char **argv) init_pdcp(0); else init_pdcp(mode_offset + ue_id_g); + nas_init_nrue(NB_UE_INST); init_NR_UE(NB_UE_INST, get_nrUE_params()->uecap_file, get_nrUE_params()->reconfig_file, get_nrUE_params()->rbconfig_file); diff --git a/openair3/NAS/NR_UE/nr_nas_msg.c b/openair3/NAS/NR_UE/nr_nas_msg.c index 59d646e3df..1199aad94b 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg.c +++ b/openair3/NAS/NR_UE/nr_nas_msg.c @@ -1210,11 +1210,6 @@ static int get_user_nssai_idx(const nr_nas_msg_snssai_t allowed_nssai[8], const void *nas_nrue_task(void *args_p) { - for (int UE_id = 0; UE_id < NB_UE_INST; UE_id++) { - // This sets UE uicc from command line. Needs to be called 2 seconds into nr-ue runtime, otherwise the unused command line - // arguments will be reported as unused and the modem asserts. - (void)get_ue_nas_info(UE_id); - } while (1) { nas_nrue(NULL); } @@ -1453,3 +1448,9 @@ void *nas_nrue(void *args_p) } return NULL; } + +void nas_init_nrue(int num_ues) { + for (int i = 0; i < num_ues; i++) { + (void)get_ue_nas_info(i); + } +} diff --git a/openair3/NAS/NR_UE/nr_nas_msg.h b/openair3/NAS/NR_UE/nr_nas_msg.h index 2e687baf8f..e10ac54b0f 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg.h +++ b/openair3/NAS/NR_UE/nr_nas_msg.h @@ -160,5 +160,6 @@ nr_ue_nas_t *get_ue_nas_info(module_id_t module_id); void generateRegistrationRequest(as_nas_info_t *initialNasMsg, nr_ue_nas_t *nas); void *nas_nrue_task(void *args_p); void *nas_nrue(void *args_p); +void nas_init_nrue(int num_ues); #endif /* __NR_NAS_MSG_SIM_H__*/ From b3d45cf698453eb84f6c76b2892795f02eaba03c Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Sun, 27 Oct 2024 20:06:02 +0100 Subject: [PATCH 05/75] CI: Add test with 4 DL layers, 60 MHz BW to SA-2x2 pipeline --- .../gnb.sa.band77.162prb.usrpn310.4x4.conf | 252 ++++++++++++++++++ .../container_sa_n310_4X4_60MHz_quectel.xml | 163 +++++++++++ .../5g_sa_n310_4x4_60MHz/docker-compose.yml | 20 ++ 3 files changed, 435 insertions(+) create mode 100644 ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.4x4.conf create mode 100644 ci-scripts/xml_files/container_sa_n310_4X4_60MHz_quectel.xml create mode 100644 ci-scripts/yaml_files/5g_sa_n310_4x4_60MHz/docker-compose.yml diff --git a/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.4x4.conf b/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.4x4.conf new file mode 100644 index 0000000000..27c6fa6b0f --- /dev/null +++ b/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.4x4.conf @@ -0,0 +1,252 @@ +Active_gNBs = ( "gNB-OAI"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +sa = 1; +usrp-tx-thread-config = 1; +tune-offset = 30720000; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + gNB_name = "gNB-OAI"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + plmn_list = ({ mcc = 208; mnc = 97; mnc_length = 2; snssaiList = ({ sst = 1; }) }); + + nr_cellid = 12345678L; + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 0; + pdsch_AntennaPorts_XP = 2; + pusch_AntennaPorts = 4; + pdsch_AntennaPorts_N1 = 2; + maxMIMO_layers = 4; + do_CSIRS = 1; + do_SRS = 1; + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 3300.60 MHz + 81*12*30e-3 MHz = 3329.76 + absoluteFrequencySSB = 673344; + # this is 3300.60 MHz + dl_absoluteFrequencyPointA = 671400; + dl_frequencyBand = 77; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 162; + #initialDownlinkBWP + #genericParameters + # this is RBstart=0,L=162 (275*(275-L+1))+(274-RBstart)) + initialDLBWPlocationAndBandwidth = 31624; + # +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 12; + initialDLBWPsearchSpaceZero = 0; + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 77; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 162; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 31624; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 1; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 98; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 12; + preambleReceivedTargetPower = -96; +#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; +#powerRampingStep +# 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 1; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 4; +#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 3; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 15; +#ra_ContentionResolutionTimer +#(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; +#prach-RootSequenceIndex_PR +#1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 2; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + # + msg1_SubcarrierSpacing = 1, +# restrictedSetConfig +# 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0, + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -70; + + ssb_PositionsInBurst_Bitmap = 1; + +# ssb_periodicityServingCell +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + +# dmrs_TypeA_position +# 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 1; + + + #tdd-UL-DL-ConfigurationCommon +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + referenceSubcarrierSpacing = 1; + # pattern1 + # dl_UL_TransmissionPeriodicity + # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 + dl_UL_TransmissionPeriodicity = 5; + nrofDownlinkSlots = 3; + nrofDownlinkSymbols = 6; + nrofUplinkSlots = 1; + nrofUplinkSymbols = 4; + + ssPBCH_BlockPower = -25; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// AMF parameters: + amf_ip_address = ({ ipv4 = "192.168.61.132"; }); + + NETWORK_INTERFACES : + { + GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.61.129/26"; + GNB_IPV4_ADDRESS_FOR_NGU = "192.168.61.129/26"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + + } +); + +MACRLCs = ( +{ + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + pusch_TargetSNRx10 = 250; + pucch_TargetSNRx10 = 250; + ulsch_max_frame_inactivity = 0; + pusch_FailureThres = 100; + ul_max_mcs = 28; +} +); + +L1s = ( +{ + num_cc = 1; + tr_n_preference = "local_mac"; + prach_dtx_threshold = 120; + pusch_dtx_threshold = 20; + max_ldpc_iterations = 10; +} +); + +RUs = ( +{ + local_rf = "yes" + nb_tx = 4; + nb_rx = 4; + att_tx = 0; + att_rx = 0; + bands = [77]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 75; + eNB_instances = [0]; + ##beamforming 1x2 matrix: 1 layer x 2 antennas + bf_weights = [0x00007fff, 0x0000, 0x00007fff, 0x0000]; + #clock_src = "internal"; + sdr_addrs = "addr=192.168.80.53, clock_source=internal,time_source=internal" + +} +); + +security = { + # preferred ciphering algorithms + # the first one of the list that an UE supports in chosen + # valid values: nea0, nea1, nea2, nea3 + ciphering_algorithms = ( "nea1", "nea0" ); + + # preferred integrity algorithms + # the first one of the list that an UE supports in chosen + # valid values: nia0, nia1, nia2, nia3 + integrity_algorithms = ( "nia1", "nia0" ); + + # setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter + # what 'ciphering_algorithms' configures; same thing for 'drb_integrity' + drb_ciphering = "yes"; + drb_integrity = "yes"; +}; + +log_config : +{ + global_log_level ="info"; + hw_log_level ="info"; + phy_log_level ="info"; + mac_log_level ="info"; + rlc_log_level ="info"; + pdcp_log_level ="info"; + rrc_log_level ="info"; + ngap_log_level ="debug"; + f1ap_log_level ="debug"; +}; diff --git a/ci-scripts/xml_files/container_sa_n310_4X4_60MHz_quectel.xml b/ci-scripts/xml_files/container_sa_n310_4X4_60MHz_quectel.xml new file mode 100644 index 0000000000..0ffe3044b6 --- /dev/null +++ b/ci-scripts/xml_files/container_sa_n310_4X4_60MHz_quectel.xml @@ -0,0 +1,163 @@ + + + TEST-SA-FR1-N310-4x4-60MHz + 60 MHz 4x4 TDD SA + tasks + + 100000 + 111111 + 010010 + 800813 + 030101 + 010001 + 050001 + 071000 + 071001 + 070002 + 010010 + 000001 + 030201 + 200000 + 333333 + + + + + Pull_Cluster_Image + Pull Images from Cluster + oai-gnb + matix + + + + Custom_Command + Disable Sleep States + matix + sudo cpupower idle-set -D 0 + + + + Custom_Command + true + Enable Sleep States + matix + sudo cpupower idle-set -E + + + + Attach_UE + Attach UE + up2 + + + + Detach_UE + true + Detach UE + up2 + + + Create_Workspace + Create new Workspace + 0 + 0 + + + Deploy_Object + Deploy gNB (TDD/Band77/60MHz/N310) in a container + ci-scripts/yaml_files/5g_sa_n310_4x4_60MHz + 0 + 0 + + + + IdleSleep + Sleep + 5 + + + + IdleSleep + Sleep + 10 + + + + Ping + Ping: 100pings in 20sec + up2 + -c 100 -i 0.2 %cn_ip% + 1 + 15 + + + + Iperf + iperf (DL/480Mbps/UDP)(30 sec)(single-ue profile) + -u -b 480M -t 30 -R + matix-cn5g + up2 + 25 + 80 + + + + Iperf + iperf (UL/120Mbps/UDP)(30 sec)(single-ue profile) + -u -b 120M -t 30 + matix-cn5g + up2 + 10 + 70 + + + + Iperf + iperf (BIDIR TCP)(30 sec)(single-ue profile) + -t 30 --bidir + matix-cn5g + up2 + + + + Undeploy_Object + true + Undeploy gNB + ci-scripts/yaml_files/5g_sa_n310_4x4_60MHz + 0 + 0 + oai-gnb + 10,100,100,100 + 10,100,100,100 + + + + Clean_Test_Server_Images + true + Clean Test Images on Test Server + 0 + + + + diff --git a/ci-scripts/yaml_files/5g_sa_n310_4x4_60MHz/docker-compose.yml b/ci-scripts/yaml_files/5g_sa_n310_4x4_60MHz/docker-compose.yml new file mode 100644 index 0000000000..ed6c76ae78 --- /dev/null +++ b/ci-scripts/yaml_files/5g_sa_n310_4x4_60MHz/docker-compose.yml @@ -0,0 +1,20 @@ +services: + oai-gnb: + image: ${REGISTRY:-oaisoftwarealliance}/${GNB_IMG:-oai-gnb}:${TAG:-develop} + network_mode: "host" + container_name: oai-gnb + cap_drop: + - ALL + cap_add: + - SYS_NICE + - IPC_LOCK + environment: + TZ: Europe/Paris + USE_ADDITIONAL_OPTIONS: --log_config.global_log_options level,nocolor,time + volumes: + - ../../conf_files/gnb.sa.band77.162prb.usrpn310.4x4.conf:/opt/oai-gnb/etc/gnb.conf + healthcheck: + test: /bin/bash -c "pgrep nr-softmodem" + interval: 10s + timeout: 5s + retries: 5 From 5e8d62ff850b5bf0f88943a63b9b9386289c93de Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Thu, 31 Oct 2024 13:05:12 +0100 Subject: [PATCH 06/75] CI: remove ssb_SubcarrierOffset from config file ssb_SubcarrierOffset is no longer taken in account from the gNB config file, as it is computed automatically. --- ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.2x2.conf | 1 - ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.4x4.conf | 1 - 2 files changed, 2 deletions(-) diff --git a/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.2x2.conf b/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.2x2.conf index 1612b12ebd..d47920de75 100644 --- a/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.2x2.conf +++ b/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.2x2.conf @@ -21,7 +21,6 @@ gNBs = ////////// Physical parameters: - ssb_SubcarrierOffset = 0; pdsch_AntennaPorts_XP = 2; pusch_AntennaPorts = 2; do_CSIRS = 1; diff --git a/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.4x4.conf b/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.4x4.conf index 27c6fa6b0f..3e4906e7e0 100644 --- a/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.4x4.conf +++ b/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.4x4.conf @@ -21,7 +21,6 @@ gNBs = ////////// Physical parameters: - ssb_SubcarrierOffset = 0; pdsch_AntennaPorts_XP = 2; pusch_AntennaPorts = 4; pdsch_AntennaPorts_N1 = 2; From b77c0d81e0d63dbf0be4ae839d0cefe620f4885f Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Thu, 31 Oct 2024 13:10:51 +0100 Subject: [PATCH 07/75] CI: update information about frequency in SA-2x2 config files --- ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.2x2.conf | 4 ++-- ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.4x4.conf | 4 ++-- ci-scripts/conf_files/gnb.sa.band77.273prb.usrpn310.2x2.conf | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.2x2.conf b/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.2x2.conf index d47920de75..b607b35f42 100644 --- a/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.2x2.conf +++ b/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.2x2.conf @@ -34,9 +34,9 @@ gNBs = # downlinkConfigCommon #frequencyInfoDL - # this is 3300.60 MHz + 81*12*30e-3 MHz = 3329.76 + # this is 4100.16 MHz absoluteFrequencySSB = 673344; - # this is 3300.60 MHz + # this is 4071 MHz dl_absoluteFrequencyPointA = 671400; dl_frequencyBand = 77; #scs-SpecificCarrierList diff --git a/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.4x4.conf b/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.4x4.conf index 3e4906e7e0..77bfa89115 100644 --- a/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.4x4.conf +++ b/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.4x4.conf @@ -36,9 +36,9 @@ gNBs = # downlinkConfigCommon #frequencyInfoDL - # this is 3300.60 MHz + 81*12*30e-3 MHz = 3329.76 + # this is 4100.16 MHz absoluteFrequencySSB = 673344; - # this is 3300.60 MHz + # this is 4071 MHz dl_absoluteFrequencyPointA = 671400; dl_frequencyBand = 77; #scs-SpecificCarrierList diff --git a/ci-scripts/conf_files/gnb.sa.band77.273prb.usrpn310.2x2.conf b/ci-scripts/conf_files/gnb.sa.band77.273prb.usrpn310.2x2.conf index f993f225c9..2eb32f6781 100644 --- a/ci-scripts/conf_files/gnb.sa.band77.273prb.usrpn310.2x2.conf +++ b/ci-scripts/conf_files/gnb.sa.band77.273prb.usrpn310.2x2.conf @@ -32,10 +32,10 @@ gNBs = ( # downlinkConfigCommon # frequencyInfoDL - # this is 3900.60 MHz + (134 PRBs + 4 SCs)@30kHz SCS (GSCN: 8158) + # this is 4100.16 MHz absoluteFrequencySSB = 673344; dl_frequencyBand = 77; - # this is 3900.60 MHz + # this is 4051.02 MHz dl_absoluteFrequencyPointA = 670068; # scs-SpecificCarrierList From 9ce8a9ac7d287409affa678b6a23bcf03fc2c1d0 Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Thu, 31 Oct 2024 13:12:57 +0100 Subject: [PATCH 08/75] CI: use default value for ulsch_max_frame_inactivity in 60 MHz 4x4 config file --- ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.4x4.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.4x4.conf b/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.4x4.conf index 77bfa89115..9c8be4d460 100644 --- a/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.4x4.conf +++ b/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.4x4.conf @@ -185,7 +185,6 @@ MACRLCs = ( tr_n_preference = "local_RRC"; pusch_TargetSNRx10 = 250; pucch_TargetSNRx10 = 250; - ulsch_max_frame_inactivity = 0; pusch_FailureThres = 100; ul_max_mcs = 28; } From 2696f475aa993ba975acd8530a6820832629c4c4 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 6 Nov 2024 09:51:01 +0100 Subject: [PATCH 09/75] Remove libatlas-base-dev from ARM64 deps: not needed (see #802) --- doc/cross-compile.md | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/cross-compile.md b/doc/cross-compile.md index ce61ce2e40..1054abbc1f 100644 --- a/doc/cross-compile.md +++ b/doc/cross-compile.md @@ -32,7 +32,6 @@ sudo apt install -y gcc-11-aarch64-linux-gnu \ g++-11-aarch64-linux-gnu sudo apt-get install -y \ - libatlas-base-dev:arm64 \ libblas-dev:arm64 \ libc6-dev-i386 \ liblapack-dev:arm64 \ From af63f3f91cd829fc879a9f129025650159556e38 Mon Sep 17 00:00:00 2001 From: Bartosz Podrygajlo Date: Wed, 6 Nov 2024 09:58:17 +0100 Subject: [PATCH 10/75] Add missing asserts for mac->if_mutex lock/unlock calls --- openair2/LAYER2/NR_MAC_UE/config_ue.c | 12 ++++++++---- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 13 ++++++++----- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index eea5a56abc..3c66515eef 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -885,7 +885,8 @@ void nr_rrc_mac_config_req_mib(module_id_t module_id, else if (sched_sib == 2) mac->get_otherSI = true; nr_ue_decode_mib(mac, cc_idP); - pthread_mutex_unlock(&mac->if_mutex); + ret = pthread_mutex_unlock(&mac->if_mutex); + AssertFatal(!ret, "mutex failed %d\n", ret); } static void setup_puschpowercontrol(NR_UE_MAC_INST_t *mac, NR_PUSCH_PowerControl_t *source, NR_PUSCH_PowerControl_t *target) @@ -1654,7 +1655,8 @@ void nr_rrc_mac_config_req_reset(module_id_t module_id, default: AssertFatal(false, "Invalid MAC reset cause %d\n", cause); } - pthread_mutex_unlock(&mac->if_mutex); + ret = pthread_mutex_unlock(&mac->if_mutex); + AssertFatal(!ret, "mutex failed %d\n", ret); } static int get_ta_offset(long *n_TimingAdvanceOffset) @@ -1716,7 +1718,8 @@ void nr_rrc_mac_config_req_sib1(module_id_t module_id, if (!get_softmodem_params()->emulate_l1) mac->if_module->phy_config_request(&mac->phy_config); - pthread_mutex_unlock(&mac->if_mutex); + ret = pthread_mutex_unlock(&mac->if_mutex); + AssertFatal(!ret, "mutex failed %d\n", ret); } void nr_rrc_mac_config_req_sib19_r17(module_id_t module_id, @@ -2573,5 +2576,6 @@ void nr_rrc_mac_config_req_cg(module_id_t module_id, if (!mac->dl_config_request || !mac->ul_config_request) ue_init_config_request(mac, mac->current_DL_BWP->scs); - pthread_mutex_unlock(&mac->if_mutex); + ret = pthread_mutex_unlock(&mac->if_mutex); + AssertFatal(!ret, "mutex failed %d\n", ret); } diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 7b00b1bca2..24f5469286 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -1150,8 +1150,8 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info) if (is_nr_UL_slot(mac->tdd_UL_DL_ConfigurationCommon, ul_info->slot, mac->frame_type)) nr_ue_ul_scheduler(mac, ul_info); - pthread_mutex_unlock(&mac->if_mutex); - + ret = pthread_mutex_unlock(&mac->if_mutex); + AssertFatal(!ret, "mutex failed %d\n", ret); return 0; } @@ -1272,16 +1272,19 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info) else // DL indication to process data channels ret2 = nr_ue_dl_processing(dl_info); - pthread_mutex_unlock(&mac->if_mutex); + ret = pthread_mutex_unlock(&mac->if_mutex); + AssertFatal(!ret, "mutex failed %d\n", ret); return ret2; } void nr_ue_slot_indication(uint8_t mod_id) { NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); - pthread_mutex_lock(&mac->if_mutex); + int ret = pthread_mutex_lock(&mac->if_mutex); + AssertFatal(!ret, "mutex failed %d\n", ret); update_mac_timers(mac); - pthread_mutex_unlock(&mac->if_mutex); + ret = pthread_mutex_unlock(&mac->if_mutex); + AssertFatal(!ret, "mutex failed %d\n", ret); } nr_ue_if_module_t *nr_ue_if_module_init(uint32_t module_id) From d8c7ff4c2c0a8cc1f0c9f05d7ffaa338a4297f08 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Wed, 16 Oct 2024 18:15:37 +0200 Subject: [PATCH 11/75] Refactor init_gNB() * code cleanup * clang-formatted * adopted calloc_or_fail * allocate nb_nr_L1_inst of RC.gNB instead of (RC.nb_nr_L1_inst + 1) --- executables/nr-gnb.c | 49 ++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index 0954a13287..006f126bd0 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -439,39 +439,41 @@ void init_eNB_afterRU(void) { } -void init_gNB(int wait_for_sync) { - - int inst; - PHY_VARS_gNB *gNB; - +/** + * @brief Initialize gNB struct in RAN context + */ +void init_gNB(int wait_for_sync) +{ + LOG_I(NR_PHY, "Initializing gNB threads wait_for_sync:%d\n", wait_for_sync); if (RC.gNB == NULL) { - RC.gNB = (PHY_VARS_gNB **) calloc(1+RC.nb_nr_L1_inst, sizeof(PHY_VARS_gNB *)); - LOG_D(PHY, "gNB L1 structure RC.gNB allocated @ %p\n", RC.gNB); + RC.gNB = (PHY_VARS_gNB **)calloc_or_fail(RC.nb_nr_L1_inst, sizeof(PHY_VARS_gNB *)); + LOG_D(NR_PHY, "gNB L1 structure RC.gNB allocated @ %p\n", RC.gNB); } - for (inst=0; instnrPolar_params, - NR_POLAR_PBCH_MESSAGE_TYPE, - NR_POLAR_PBCH_PAYLOAD_BITS, - NR_POLAR_PBCH_AGGREGATION_LEVEL);*/ + PHY_VARS_gNB *gNB = RC.gNB[inst]; + LOG_D(NR_PHY, "Initializing gNB %d\n", inst); + // Init module ID + gNB->Mod_id = inst; + + // Register MAC interface module AssertFatal((gNB->if_inst = NR_IF_Module_init(inst)) != NULL, "Cannot register interface"); - gNB->if_inst->NR_Schedule_response = nr_schedule_response; - gNB->if_inst->NR_PHY_config_req = nr_phy_config_request; - memset(&gNB->UL_INFO, 0, sizeof(gNB->UL_INFO)); + LOG_I(NR_PHY, "Registered with MAC interface module (%p)\n", gNB->if_inst); + // Set function pointers in MAC IF module + gNB->if_inst->NR_Schedule_response = nr_schedule_response; + gNB->if_inst->NR_PHY_config_req = nr_phy_config_request; + + // Clear UL_INFO and set rx/crc indication lists + memset((void *)&gNB->UL_INFO, 0, sizeof(gNB->UL_INFO)); gNB->UL_INFO.rx_ind.pdu_list = gNB->rx_pdu_list; gNB->UL_INFO.crc_ind.crc_list = gNB->crc_pdu_list; - /*gNB->UL_INFO.sr_ind.sr_indication_body.sr_pdu_list = gNB->sr_pdu_list; - gNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list = gNB->harq_pdu_list; - gNB->UL_INFO.cqi_ind.cqi_pdu_list = gNB->cqi_pdu_list; - gNB->UL_INFO.cqi_ind.cqi_raw_pdu_list = gNB->cqi_raw_pdu_list;*/ gNB->prach_energy_counter = 0; gNB->chest_time = get_softmodem_params()->chest_time; @@ -479,7 +481,6 @@ void init_gNB(int wait_for_sync) { } } - void stop_gNB(int nb_inst) { for (int inst=0; inst Date: Thu, 17 Oct 2024 12:42:18 +0200 Subject: [PATCH 12/75] Do L1 configuration right after gNB initialization * do always gNB init for L1 instance and also for CU and CU-CP * do L1 config only for L1 instances --- executables/nr-softmodem.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 47548239b9..fe0b0503f0 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -631,8 +631,12 @@ int main( int argc, char **argv ) { // don't create if node doesn't connect to RRC/S1/GTP const ngran_node_t node_type = get_node_type(); - if (RC.nb_nr_L1_inst > 0) + if (RC.nb_nr_L1_inst > 0) { + // Initialize gNB structure in RAN context + init_gNB(wait_for_sync); + // Initialize L1 RCconfig_NR_L1(); + } if (NFAPI_MODE != NFAPI_MODE_PNF) { int ret = create_gNB_tasks(node_type, uniqCfg); @@ -651,10 +655,6 @@ int main( int argc, char **argv ) { // start the main threads number_of_cards = 1; - if (RC.nb_nr_L1_inst > 0) { - init_gNB(wait_for_sync); - } - wait_gNBs(); int sl_ahead = NFAPI_MODE == NFAPI_MODE_AERIAL ? 0 : 6; if (RC.nb_RU >0) { From e57acf61905145c33f3fa5e7ff6eb6e8c24a744b Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Thu, 17 Oct 2024 12:43:36 +0200 Subject: [PATCH 13/75] Refactor RCconfig_NR_L1 * removed initialization of gNB * separate function to get blacklisted UL PRBs * call the getter in both L1 and MAC/RLC configuration * other minor improvements --- openair1/PHY/defs_gNB.h | 2 +- openair2/GNB_APP/gnb_config.c | 250 ++++++++++++++++------------------ 2 files changed, 119 insertions(+), 133 deletions(-) diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index da316de8aa..7022ad8b23 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -514,7 +514,7 @@ typedef struct PHY_VARS_gNB_s { int srs_thres; uint64_t bad_pucch; int num_ulprbbl; - int ulprbbl[275]; + uint16_t ulprbbl [MAX_BWP_SIZE]; time_stats_t phy_proc_tx; time_stats_t phy_proc_rx; diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 08e4d97a31..bb85afc429 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -834,135 +834,133 @@ void RCconfig_nr_prs(void) } } +#define ALL_SYMBOLS_TAKEN 0x3FFF + +/** + * @brief Get number or blacklisted UL PRBs and their mapping from gNB config + */ +static int get_prb_blacklist(uint8_t instance, uint16_t *prbbl) +{ + paramdef_t GNBSParams[] = GNBSPARAMS_DESC; + paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST, NULL, 0}; + config_get(config_get_if(), GNBSParams, sizeofArray(GNBSParams), NULL); + int num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; + AssertFatal(num_gnbs > 0, "Failed to parse config file, no GNBs found in field %s \n", GNB_CONFIG_STRING_ACTIVE_GNBS); + paramdef_t GNBParams[] = GNBPARAMS_DESC; + config_getlist(config_get_if(), &GNBParamList, GNBParams, sizeofArray(GNBParams), NULL); + + int num_prbbl = 0; + char *ulprbbl = *GNBParamList.paramarray[0][GNB_ULPRBBLACKLIST_IDX].strptr; + + if (!ulprbbl) + return -1; + + LOG_D(NR_PHY, "PRB blacklist found: %s\n", ulprbbl); + char *save = NULL; + char *pt = strtok_r(ulprbbl, ",", &save); + + while (pt) { + const int rb = atoi(pt); + AssertFatal(rb < MAX_BWP_SIZE, "RB %d out of bounds (max 275 PRBs)\n", rb); + prbbl[rb] = ALL_SYMBOLS_TAKEN; + LOG_D(NR_PHY, "Blacklisting prb %d\n", rb); + pt = strtok_r(NULL, ",", &save); + num_prbbl++; + } + return num_prbbl; +} + void RCconfig_NR_L1(void) { - int j = 0; - if (RC.gNB == NULL) { - RC.gNB = (PHY_VARS_gNB **)malloc((1 + NUMBER_OF_gNB_MAX) * sizeof(PHY_VARS_gNB *)); - LOG_I(NR_PHY, "RC.gNB = %p\n", RC.gNB); - memset(RC.gNB, 0, (1 + NUMBER_OF_gNB_MAX) * sizeof(PHY_VARS_gNB *)); + LOG_I(NR_PHY, "Initializing NR L1: RC.nb_nr_L1_inst = %d\n", RC.nb_nr_L1_inst); - if (RC.gNB[j] == NULL) { - RC.gNB[j] = calloc(1, sizeof(PHY_VARS_gNB)); - } - } - if (NFAPI_MODE != NFAPI_MODE_PNF) { - paramdef_t GNBSParams[] = GNBSPARAMS_DESC; - ////////// Identification parameters - paramdef_t GNBParams[] = GNBPARAMS_DESC; + for (int j = 0; j < RC.nb_nr_L1_inst; j++) { + PHY_VARS_gNB *gNB = RC.gNB[j]; + AssertFatal(RC.gNB[j] != NULL, "gNB L1 instance is null at index %d, cannot complete L1 configuration\n", j); + // gNB params + if (NFAPI_MODE != NFAPI_MODE_PNF) { + paramdef_t GNBSParams[] = GNBSPARAMS_DESC; + paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST, NULL, 0}; + config_get(config_get_if(), GNBSParams, sizeofArray(GNBSParams), NULL); + int num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; + AssertFatal(num_gnbs > 0, "Failed to parse config file, no GNBs found in field %s \n", GNB_CONFIG_STRING_ACTIVE_GNBS); - paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST, NULL, 0}; + paramdef_t GNBParams[] = GNBPARAMS_DESC; + config_getlist(config_get_if(), &GNBParamList, GNBParams, sizeofArray(GNBParams), NULL); + int N1 = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_N1_IDX].iptr; + int N2 = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_N2_IDX].iptr; + int XP = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_XP_IDX].iptr; - config_get(config_get_if(), GNBSParams, sizeofArray(GNBSParams), NULL); - int num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; - AssertFatal(num_gnbs > 0, "Failed to parse config file no gnbs %s \n", GNB_CONFIG_STRING_ACTIVE_GNBS); - - config_getlist(config_get_if(), &GNBParamList, GNBParams, sizeofArray(GNBParams), NULL); - int N1 = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_N1_IDX].iptr; - int N2 = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_N2_IDX].iptr; - int XP = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_XP_IDX].iptr; - char *ulprbbl = *GNBParamList.paramarray[0][GNB_ULPRBBLACKLIST_IDX].strptr; - if (ulprbbl) - LOG_D(NR_PHY, "PRB blacklist %s\n", ulprbbl); - char *save = NULL; - char *pt = strtok_r(ulprbbl, ",", &save); - int prbbl[275]; - int num_prbbl = 0; - memset(prbbl, 0, 275 * sizeof(int)); - - while (pt) { - const int rb = atoi(pt); - AssertFatal(rb < 275, "RB %d out of bounds (max 275)\n", rb); - prbbl[rb] = 0x3FFF; // all symbols taken - LOG_D(NR_PHY, "Blacklisting prb %d\n", atoi(pt)); - pt = strtok_r(NULL, ",", &save); - num_prbbl++; - } - - RC.gNB[j]->num_ulprbbl = num_prbbl; - LOG_D(NR_PHY, "Copying %d blacklisted PRB to L1 context\n", num_prbbl); - memcpy(RC.gNB[j]->ulprbbl, prbbl, 275 * sizeof(int)); - - RC.gNB[j]->ap_N1 = N1; - RC.gNB[j]->ap_N2 = N2; - RC.gNB[j]->ap_XP = XP; - } - - paramdef_t L1_Params[] = L1PARAMS_DESC; - paramlist_def_t L1_ParamList = {CONFIG_STRING_L1_LIST, NULL, 0}; - - config_getlist(config_get_if(), &L1_ParamList, L1_Params, sizeofArray(L1_Params), NULL); - - if (L1_ParamList.numelt > 0) { - for (j = 0; j < RC.nb_nr_L1_inst; j++) { - if (RC.gNB[j] == NULL) { - RC.gNB[j] = (PHY_VARS_gNB *)malloc(sizeof(PHY_VARS_gNB)); - memset(RC.gNB[j], 0, sizeof(PHY_VARS_gNB)); - RC.gNB[j]->Mod_id = j; + // PRB Blacklist + uint16_t prbbl[MAX_BWP_SIZE] = {0}; + int num_ulprbbl = get_prb_blacklist(j, prbbl); + if (num_ulprbbl != -1) { + RC.gNB[j]->num_ulprbbl = num_ulprbbl; + LOG_D(NR_PHY, "Copying %d blacklisted PRB to L1 context\n", RC.gNB[j]->num_ulprbbl); + memcpy(RC.gNB[j]->ulprbbl, prbbl, MAX_BWP_SIZE * sizeof(prbbl[0])); } - AssertFatal(*L1_ParamList.paramarray[j][L1_THREAD_POOL_SIZE].uptr == 2022, "thread_pool_size removed, please use --thread-pool\n"); - RC.gNB[j]->ofdm_offset_divisor = *(L1_ParamList.paramarray[j][L1_OFDM_OFFSET_DIVISOR].uptr); - RC.gNB[j]->pucch0_thres = *(L1_ParamList.paramarray[j][L1_PUCCH0_DTX_THRESHOLD].uptr); - RC.gNB[j]->prach_thres = *(L1_ParamList.paramarray[j][L1_PRACH_DTX_THRESHOLD].uptr); - RC.gNB[j]->pusch_thres = *(L1_ParamList.paramarray[j][L1_PUSCH_DTX_THRESHOLD].uptr); - RC.gNB[j]->srs_thres = *(L1_ParamList.paramarray[j][L1_SRS_DTX_THRESHOLD].uptr); - RC.gNB[j]->max_ldpc_iterations = *(L1_ParamList.paramarray[j][L1_MAX_LDPC_ITERATIONS].uptr); - RC.gNB[j]->L1_rx_thread_core = *(L1_ParamList.paramarray[j][L1_RX_THREAD_CORE].iptr); - RC.gNB[j]->L1_tx_thread_core = *(L1_ParamList.paramarray[j][L1_TX_THREAD_CORE].iptr); - LOG_I(PHY,"L1_RX_THREAD_CORE %d (%d)\n",*(L1_ParamList.paramarray[j][L1_RX_THREAD_CORE].iptr),L1_RX_THREAD_CORE); - RC.gNB[j]->TX_AMP = (int16_t)(32767.0 / pow(10.0, .05 * (double)(*L1_ParamList.paramarray[j][L1_TX_AMP_BACKOFF_dB].uptr))); - RC.gNB[j]->phase_comp = *L1_ParamList.paramarray[j][L1_PHASE_COMP].uptr; - LOG_I(PHY, "TX_AMP = %d (-%d dBFS)\n", RC.gNB[j]->TX_AMP, *L1_ParamList.paramarray[j][L1_TX_AMP_BACKOFF_dB].uptr); - AssertFatal(RC.gNB[j]->TX_AMP > 300, "TX_AMP is too small, must be larger than 300 (is %d)\n", RC.gNB[j]->TX_AMP); - if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_mac") == 0) { - // sf_ahead = 2; // Need 4 subframe gap between RX and TX - } else if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "nfapi") == 0) { - RC.gNB[j]->eth_params_n.my_addr = strdup(*(L1_ParamList.paramarray[j][L1_LOCAL_N_ADDRESS_IDX].strptr)); - RC.gNB[j]->eth_params_n.remote_addr = strdup(*(L1_ParamList.paramarray[j][L1_REMOTE_N_ADDRESS_IDX].strptr)); - RC.gNB[j]->eth_params_n.my_portc = *(L1_ParamList.paramarray[j][L1_LOCAL_N_PORTC_IDX].iptr); - RC.gNB[j]->eth_params_n.remote_portc = *(L1_ParamList.paramarray[j][L1_REMOTE_N_PORTC_IDX].iptr); - RC.gNB[j]->eth_params_n.my_portd = *(L1_ParamList.paramarray[j][L1_LOCAL_N_PORTD_IDX].iptr); - RC.gNB[j]->eth_params_n.remote_portd = *(L1_ParamList.paramarray[j][L1_REMOTE_N_PORTD_IDX].iptr); - RC.gNB[j]->eth_params_n.transp_preference = ETH_UDP_MODE; - // sf_ahead = 2; // Cannot cope with 4 subframes betweem RX and TX - set it to 2 + // Antenna ports + gNB->ap_N1 = N1; + gNB->ap_N2 = N2; + gNB->ap_XP = XP; + } + + // L1 params + paramdef_t L1_Params[] = L1PARAMS_DESC; + paramlist_def_t L1_ParamList = {CONFIG_STRING_L1_LIST, NULL, 0}; + config_getlist(config_get_if(), &L1_ParamList, L1_Params, sizeofArray(L1_Params), NULL); + if (L1_ParamList.numelt > 0) { + AssertFatal(*L1_ParamList.paramarray[j][L1_THREAD_POOL_SIZE].uptr == 2022, + "thread_pool_size removed, please use --thread-pool\n"); + gNB->ofdm_offset_divisor = *(L1_ParamList.paramarray[j][L1_OFDM_OFFSET_DIVISOR].uptr); + gNB->pucch0_thres = *(L1_ParamList.paramarray[j][L1_PUCCH0_DTX_THRESHOLD].uptr); + gNB->prach_thres = *(L1_ParamList.paramarray[j][L1_PRACH_DTX_THRESHOLD].uptr); + gNB->pusch_thres = *(L1_ParamList.paramarray[j][L1_PUSCH_DTX_THRESHOLD].uptr); + gNB->srs_thres = *(L1_ParamList.paramarray[j][L1_SRS_DTX_THRESHOLD].uptr); + gNB->max_ldpc_iterations = *(L1_ParamList.paramarray[j][L1_MAX_LDPC_ITERATIONS].uptr); + gNB->L1_rx_thread_core = *(L1_ParamList.paramarray[j][L1_RX_THREAD_CORE].iptr); + gNB->L1_tx_thread_core = *(L1_ParamList.paramarray[j][L1_TX_THREAD_CORE].iptr); + LOG_I(NR_PHY, "L1_RX_THREAD_CORE %d (%d)\n", *(L1_ParamList.paramarray[j][L1_RX_THREAD_CORE].iptr), L1_RX_THREAD_CORE); + gNB->TX_AMP = (int16_t)(32767.0 / pow(10.0, .05 * (double)(*L1_ParamList.paramarray[j][L1_TX_AMP_BACKOFF_dB].uptr))); + gNB->phase_comp = *L1_ParamList.paramarray[j][L1_PHASE_COMP].uptr; + LOG_I(NR_PHY, "TX_AMP = %d (-%d dBFS)\n", gNB->TX_AMP, *L1_ParamList.paramarray[j][L1_TX_AMP_BACKOFF_dB].uptr); + AssertFatal(gNB->TX_AMP > 300, "TX_AMP is too small, must be larger than 300 (is %d)\n", gNB->TX_AMP); + // Midhaul configuration + if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_mac") == 0) { + // do nothing + } else if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "nfapi") == 0) { + gNB->eth_params_n.my_addr = strdup(*(L1_ParamList.paramarray[j][L1_LOCAL_N_ADDRESS_IDX].strptr)); + gNB->eth_params_n.remote_addr = strdup(*(L1_ParamList.paramarray[j][L1_REMOTE_N_ADDRESS_IDX].strptr)); + gNB->eth_params_n.my_portc = *(L1_ParamList.paramarray[j][L1_LOCAL_N_PORTC_IDX].iptr); + gNB->eth_params_n.remote_portc = *(L1_ParamList.paramarray[j][L1_REMOTE_N_PORTC_IDX].iptr); + gNB->eth_params_n.my_portd = *(L1_ParamList.paramarray[j][L1_LOCAL_N_PORTD_IDX].iptr); + gNB->eth_params_n.remote_portd = *(L1_ParamList.paramarray[j][L1_REMOTE_N_PORTD_IDX].iptr); + gNB->eth_params_n.transp_preference = ETH_UDP_MODE; RC.nb_nr_macrlc_inst = 1; // This is used by mac_top_init_gNB() - // This is used by init_gNB_afterRU() RC.nb_nr_CC = (int *)malloc((1 + RC.nb_nr_inst) * sizeof(int)); RC.nb_nr_CC[0] = 1; - LOG_D(PHY, - "%s() NFAPI PNF mode - RC.nb_nr_inst=1 this is because phy_init_RU() uses that to index and not RC.num_gNB - why the " - "2 similar variables?\n", - __FUNCTION__); - LOG_D(PHY, "%s() NFAPI PNF mode - RC.nb_nr_CC[0]=%d for init_gNB_afterRU()\n", __FUNCTION__, RC.nb_nr_CC[0]); - LOG_D(PHY, - "%s() NFAPI PNF mode - RC.nb_nr_macrlc_inst:%d because used by mac_top_init_gNB()\n", - __FUNCTION__, + LOG_D(NR_PHY, + "RC.nb_nr_CC[0] = %d for init_gNB_afterRU()\n" + "RC.nb_nr_macrlc_inst = %d (used by mac_top_init_gNB())\n", + RC.nb_nr_CC[0], RC.nb_nr_macrlc_inst); - configure_nr_nfapi_pnf(RC.gNB[j]->eth_params_n.remote_addr, - RC.gNB[j]->eth_params_n.remote_portc, - RC.gNB[j]->eth_params_n.my_addr, - RC.gNB[j]->eth_params_n.my_portd, - RC.gNB[j]->eth_params_n.remote_portd); - } else { // other midhaul + configure_nr_nfapi_pnf(gNB->eth_params_n.remote_addr, + gNB->eth_params_n.remote_portc, + gNB->eth_params_n.my_addr, + gNB->eth_params_n.my_portd, + gNB->eth_params_n.remote_portd); + } else { + // other midhaul, do nothing } - } // for (j = 0; j < RC.nb_nr_L1_inst; j++) - l1_north_init_gNB(); - } else { - LOG_E(PHY, "No " CONFIG_STRING_L1_LIST " configuration found"); - - // need to create some structures for VNF - - j = 0; - - if (RC.gNB[j] == NULL) { - RC.gNB[j] = (PHY_VARS_gNB *)malloc(sizeof(PHY_VARS_gNB)); - memset((void *)RC.gNB[j], 0, sizeof(PHY_VARS_gNB)); - RC.gNB[j]->Mod_id = j; + LOG_D(NR_PHY, "Initializing northbound interface for L1\n"); + l1_north_init_gNB(); + } else { + LOG_E(NR_PHY, "No " CONFIG_STRING_L1_LIST " configuration found"); } } } @@ -1258,8 +1256,6 @@ static f1ap_setup_req_t *RC_read_F1Setup(uint64_t id, void RCconfig_nr_macrlc(configmodule_interface_t *cfg) { int j = 0; - uint16_t prbbl[275] = {0}; - int num_prbbl = 0; paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST, NULL, 0}; paramdef_t GNBSParams[] = GNBSPARAMS_DESC; @@ -1276,21 +1272,6 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg) GNBParams[i].chkPptr = &(config_check_GNBParams[i]); config_getlist(cfg, &GNBParamList, GNBParams, sizeofArray(GNBParams), NULL); - if (NFAPI_MODE != NFAPI_MODE_PNF) { - ////////// Identification parameters - - char *ulprbbl = *GNBParamList.paramarray[0][GNB_ULPRBBLACKLIST_IDX].strptr; - char *save = NULL; - char *pt = strtok_r(ulprbbl, ",", &save); - memset(prbbl, 0, sizeof(prbbl)); - while (pt) { - const int prb = atoi(pt); - AssertFatal(prb < 275, "RB %d out of bounds (max 275)\n", prb); - prbbl[prb] = 0x3FFF; // all symbols taken - pt = strtok_r(NULL, ",", &save); - num_prbbl++; - } - } paramdef_t MacRLC_Params[] = MACRLCPARAMS_DESC; paramlist_def_t MacRLC_ParamList = {CONFIG_STRING_MACRLC_LIST, NULL, 0}; /* map parameter checking array instances to parameter definition array instances */ @@ -1482,8 +1463,13 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg) RC.nrmac[j]->min_grant_prb = *(MacRLC_ParamList.paramarray[j][MACRLC_MIN_GRANT_PRB_IDX].u8ptr); RC.nrmac[j]->min_grant_mcs = *(MacRLC_ParamList.paramarray[j][MACRLC_MIN_GRANT_MCS_IDX].u8ptr); RC.nrmac[j]->identity_pm = *(MacRLC_ParamList.paramarray[j][MACRLC_IDENTITY_PM_IDX].u8ptr); - RC.nrmac[j]->num_ulprbbl = num_prbbl; - memcpy(RC.nrmac[j]->ulprbbl, prbbl, 275 * sizeof(prbbl[0])); + // PRB Blacklist + uint16_t prbbl[MAX_BWP_SIZE] = {0}; + int num_ulprbbl = get_prb_blacklist(j, prbbl); + if (num_ulprbbl != -1) { + LOG_I(NR_PHY, "Copying %d blacklisted PRB to L1 context\n", num_ulprbbl); + memcpy(RC.nrmac[j]->ulprbbl, prbbl, MAX_BWP_SIZE * sizeof(prbbl[0])); + } bool ab = *MacRLC_ParamList.paramarray[j][MACRLC_ANALOG_BEAMFORMING_IDX].u8ptr; if (ab) { NR_beam_info_t *beam_info = &RC.nrmac[j]->beam_info; From 2ff25e688ad63f0b828fc367fafc80cbf4495b85 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Thu, 17 Oct 2024 12:47:06 +0200 Subject: [PATCH 14/75] Remove gNB and L1 init in RCconfig_nr_prs * gNB and L1 init is done in init_gNB and RCconfig_NR_L1 * moved RCconfig_nr_prs out of create_gNB_tasks for consistency * do RCconfig_nr_prs only for L1 instances --- executables/nr-softmodem.c | 7 +++---- openair2/GNB_APP/gnb_config.c | 16 +++------------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index fe0b0503f0..7ecb0bbc79 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -273,10 +273,6 @@ static int create_gNB_tasks(ngran_node_t node_type, configmodule_interface_t *cf RCconfig_verify(cfg, node_type); - if(NFAPI_MODE != NFAPI_MODE_AERIAL){ - RCconfig_nr_prs(); - } - if (RC.nb_nr_macrlc_inst > 0) RCconfig_nr_macrlc(cfg); @@ -636,6 +632,9 @@ int main( int argc, char **argv ) { init_gNB(wait_for_sync); // Initialize L1 RCconfig_NR_L1(); + // Initialize Positioning Reference Signal configuration + if(NFAPI_MODE != NFAPI_MODE_PNF && NFAPI_MODE != NFAPI_MODE_AERIAL) + RCconfig_nr_prs(); } if (NFAPI_MODE != NFAPI_MODE_PNF) { diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index bb85afc429..8273141f8a 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -746,25 +746,15 @@ void RCconfig_nr_prs(void) prs_config_t *prs_config = NULL; char str[7][100] = {0}; + AssertFatal(RC.gNB != NULL, "gNB context is null, cannot complete PRS configuration\n"); + paramdef_t PRS_Params[] = PRS_PARAMS_DESC; paramlist_def_t PRS_ParamList = {CONFIG_STRING_PRS_CONFIG,NULL,0}; - if (RC.gNB == NULL) { - RC.gNB = (PHY_VARS_gNB **)malloc((1+NUMBER_OF_gNB_MAX)*sizeof(PHY_VARS_gNB*)); - LOG_I(NR_PHY,"RC.gNB = %p\n",RC.gNB); - memset(RC.gNB,0,(1+NUMBER_OF_gNB_MAX)*sizeof(PHY_VARS_gNB*)); - } - config_getlist(config_get_if(), &PRS_ParamList, PRS_Params, sizeofArray(PRS_Params), NULL); if (PRS_ParamList.numelt > 0) { for (j = 0; j < RC.nb_nr_L1_inst; j++) { - - if (RC.gNB[j] == NULL) { - RC.gNB[j] = (PHY_VARS_gNB *)malloc(sizeof(PHY_VARS_gNB)); - LOG_I(NR_PHY,"RC.gNB[%d] = %p\n",j,RC.gNB[j]); - memset(RC.gNB[j],0,sizeof(PHY_VARS_gNB)); - RC.gNB[j]->Mod_id = j; - } + AssertFatal(RC.gNB[j] != NULL, "gNB L1 instance is null at index %d, cannot complete L1 configuration\n", j); RC.gNB[j]->prs_vars.NumPRSResources = *(PRS_ParamList.paramarray[j][NUM_PRS_RESOURCES].uptr); for (k = 0; k < RC.gNB[j]->prs_vars.NumPRSResources; k++) From e828d0e6a4ff5fa889a479b151224507d8cc9e18 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Thu, 17 Oct 2024 12:49:37 +0200 Subject: [PATCH 15/75] Removed unused num_ulprbbl in gNB_MAC_INST_s --- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index e0cf53c5a0..420445076f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -842,7 +842,7 @@ typedef struct gNB_MAC_INST_s { NR_COMMON_channels_t common_channels[NFAPI_CC_MAX]; /// current PDU index (BCH,DLSCH) uint16_t pdu_index[NFAPI_CC_MAX]; - int num_ulprbbl; + /// UL PRBs blacklist uint16_t ulprbbl[MAX_BWP_SIZE]; /// NFAPI Config Request Structure nfapi_nr_config_request_scf_t config[NFAPI_CC_MAX]; From ebeedbfe7fdfae43833516247b94fde005b1a1c2 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Wed, 16 Oct 2024 18:17:07 +0200 Subject: [PATCH 16/75] Cleanup of unused set_default_frame_parms --- executables/nr-softmodem.c | 54 -------------------------------------- 1 file changed, 54 deletions(-) diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 7ecb0bbc79..c565b451e4 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -160,9 +160,6 @@ void pdcp_run(const protocol_ctxt_t *const ctxt_pP) abort(); } -/* 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]); - /*---------------------BMC: timespec helpers -----------------------------*/ struct timespec min_diff_time = { .tv_sec = 0, .tv_nsec = 0 }; @@ -407,57 +404,6 @@ static void get_options(configmodule_interface_t *cfg) } } -void set_default_frame_parms(nfapi_nr_config_request_scf_t *config[MAX_NUM_CCs], - NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) { - for (int CC_id=0; CC_idssb_config.scs_common.value = 1; - config[CC_id]->cell_config.frame_duplex_type.value = 1; //FDD - //config[CC_id]->subframe_config.dl_cyclic_prefix_type.value = 0; //NORMAL - config[CC_id]->carrier_config.dl_grid_size[1].value = 106; - config[CC_id]->carrier_config.ul_grid_size[1].value = 106; - config[CC_id]->cell_config.phy_cell_id.value = 0; - ///dl frequency to be filled in - /* //Set some default values that may be overwritten while reading options - frame_parms[CC_id]->frame_type = FDD; - frame_parms[CC_id]->tdd_config = 3; - frame_parms[CC_id]->tdd_config_S = 0; - frame_parms[CC_id]->N_RB_DL = 100; - frame_parms[CC_id]->N_RB_UL = 100; - frame_parms[CC_id]->Ncp = NORMAL; - frame_parms[CC_id]->Ncp_UL = NORMAL; - frame_parms[CC_id]->Nid_cell = 0; - frame_parms[CC_id]->num_MBSFN_config = 0; - frame_parms[CC_id]->nb_antenna_ports_gNB = 1; - frame_parms[CC_id]->nb_antennas_tx = 1; - frame_parms[CC_id]->nb_antennas_rx = 1; - - frame_parms[CC_id]->nushift = 0; - - frame_parms[CC_id]->phich_config_common.phich_resource = oneSixth; - frame_parms[CC_id]->phich_config_common.phich_duration = normal; - // UL RS Config - frame_parms[CC_id]->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift = 0;//n_DMRS1 set to 0 - frame_parms[CC_id]->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled = 0; - frame_parms[CC_id]->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = 0; - frame_parms[CC_id]->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = 0; - - frame_parms[CC_id]->prach_config_common.rootSequenceIndex=22; - frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig=1; - frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.prach_ConfigIndex=0; - frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.highSpeedFlag=0; - frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.prach_FreqOffset=0; - - // downlink_frequency[CC_id][0] = 2680000000; // Use float to avoid issue with frequency over 2^31. - // downlink_frequency[CC_id][1] = downlink_frequency[CC_id][0]; - // downlink_frequency[CC_id][2] = downlink_frequency[CC_id][0]; - // downlink_frequency[CC_id][3] = downlink_frequency[CC_id][0]; - frame_parms[CC_id]->dl_CarrierFreq=downlink_frequency[CC_id][0]; - */ - } -} - void wait_RUs(void) { LOG_D(PHY, "Waiting for RUs to be configured ... RC.ru_mask:%02lx\n", RC.ru_mask); // wait for all RUs to be configured over fronthaul From ba43ebb5a8dcfd74e850c1ce5161a625d7578ea0 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Wed, 16 Oct 2024 18:17:23 +0200 Subject: [PATCH 17/75] Cleanup of dump_nr_prach_config --- openair1/PHY/NR_TRANSPORT/nr_prach_common.c | 36 --------------------- openair1/SIMULATION/NR_PHY/prachsim.c | 3 -- 2 files changed, 39 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach_common.c b/openair1/PHY/NR_TRANSPORT/nr_prach_common.c index 5933e84cbb..95d312293a 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_prach_common.c +++ b/openair1/PHY/NR_TRANSPORT/nr_prach_common.c @@ -42,42 +42,6 @@ c16_t nr_ru[839]; // quantized roots of unity static uint32_t nr_ZC_inv[839]; // multiplicative inverse for roots u uint16_t nr_du[838]; -/*void dump_nr_prach_config(NR_DL_FRAME_PARMS *frame_parms,uint8_t subframe) { - - FILE *fd; - - fd = fopen("prach_config.txt","w"); - fprintf(fd,"prach_config: subframe = %d\n",subframe); - fprintf(fd,"prach_config: N_RB_UL = %d\n",frame_parms->N_RB_UL); - fprintf(fd,"prach_config: frame_type = %s\n",(frame_parms->frame_type==1) ? "TDD":"FDD"); - - if (frame_parms->frame_type==TDD) { - fprintf(fd,"prach_config: p_tdd_UL_DL_Configuration.referenceSCS = %d\n",frame_parms->p_tdd_UL_DL_Configuration->referenceSubcarrierSpacing); - fprintf(fd,"prach_config: p_tdd_UL_DL_Configuration.dl_UL_TransmissionPeriodicity = %d\n",frame_parms->p_tdd_UL_DL_Configuration->dl_UL_TransmissionPeriodicity); - fprintf(fd,"prach_config: p_tdd_UL_DL_Configuration.nrofDownlinkSlots = %d\n",frame_parms->p_tdd_UL_DL_Configuration->nrofDownlinkSlots); - fprintf(fd,"prach_config: p_tdd_UL_DL_Configuration.nrofDownlinkSymbols = %d\n",frame_parms->p_tdd_UL_DL_Configuration->nrofDownlinkSymbols); - fprintf(fd,"prach_config: p_tdd_UL_DL_Configuration.nrofUownlinkSlots = %d\n",frame_parms->p_tdd_UL_DL_Configuration->nrofDownlinkSlots); - fprintf(fd,"prach_config: p_tdd_UL_DL_Configuration.nrofUownlinkSymbols = %d\n",frame_parms->p_tdd_UL_DL_Configuration->nrofDownlinkSymbols); - if (frame_parms->p_tdd_UL_DL_Configuration->p_next) { - fprintf(fd,"prach_config: p_tdd_UL_DL_Configuration.referenceSCS2 = %d\n",frame_parms->p_tdd_UL_DL_Configuration->p_next->referenceSubcarrierSpacing); - fprintf(fd,"prach_config: p_tdd_UL_DL_Configuration.dl_UL_TransmissionPeriodicity2 = %d\n",frame_parms->p_tdd_UL_DL_Configuration->p_next->dl_UL_TransmissionPeriodicity); - fprintf(fd,"prach_config: p_tdd_UL_DL_Configuration.nrofDownlinkSlots2 = %d\n",frame_parms->p_tdd_UL_DL_Configuration->p_next->nrofDownlinkSlots); - fprintf(fd,"prach_config: p_tdd_UL_DL_Configuration.nrofDownlinkSymbols2 = %d\n",frame_parms->p_tdd_UL_DL_Configuration->p_next->nrofDownlinkSymbols); - fprintf(fd,"prach_config: p_tdd_UL_DL_Configuration.nrofUownlinkSlots2 = %d\n",frame_parms->p_tdd_UL_DL_Configuration->p_next->nrofDownlinkSlots); - fprintf(fd,"prach_config: p_tdd_UL_DL_Configuration.nrofUownlinkSymbols2 = %d\n",frame_parms->p_tdd_UL_DL_Configuration->p_next->nrofDownlinkSymbols); - - } - } - - fprintf(fd,"prach_config: rootSequenceIndex = %d\n",frame_parms->prach_config_common.rootSequenceIndex); - fprintf(fd,"prach_config: prach_ConfigIndex = %d\n",frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex); - fprintf(fd,"prach_config: Ncs_config = %d\n",frame_parms->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig); - fprintf(fd,"prach_config: highSpeedFlag = %d\n",frame_parms->prach_config_common.prach_ConfigInfo.highSpeedFlag); - fprintf(fd,"prach_config: n_ra_prboffset = %d\n",frame_parms->prach_config_common.prach_ConfigInfo.msg1_frequencystart); - fclose(fd); - -}*/ - // This function computes the du void nr_fill_du(uint16_t N_ZC, const uint16_t *prach_root_sequence_map) { diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index 4ccf0317e9..76b5d979b3 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -662,9 +662,6 @@ int main(int argc, char **argv){ LOG_M("txsig0_frame.m","txs0", txdata[0],frame_parms->samples_per_frame,1,1); #endif - // multipath channel - // dump_nr_prach_config(&gNB->frame_parms,subframe); - for (i = 0; i < frame_parms->samples_per_subframe; i++) { for (aa=0; aa<1; aa++) { if (awgn_flag == 0) { From 3698881849e460a453fda1f8a3d681107ed5f29a Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Wed, 16 Oct 2024 18:18:12 +0200 Subject: [PATCH 18/75] Removed redundant initialization of pre-processor function pointers * done already in mac_top_init_gNB --- openair2/LAYER2/NR_MAC_gNB/config.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 7baca618d1..8e25622f30 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -712,14 +712,6 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, c (nrmac->ulsch_slot_bitmap[slot / 64] & ((uint64_t)1 << (slot % 64))) != 0); } - if (get_softmodem_params()->phy_test) { - nrmac->pre_processor_dl = nr_preprocessor_phytest; - nrmac->pre_processor_ul = nr_ul_preprocessor_phytest; - } else { - nrmac->pre_processor_dl = nr_init_fr1_dlsch_preprocessor(0); - nrmac->pre_processor_ul = nr_init_fr1_ulsch_preprocessor(0); - } - NR_COMMON_channels_t *cc = &nrmac->common_channels[0]; NR_SCHED_LOCK(&nrmac->sched_lock); for (int n = 0; n < NR_NB_RA_PROC_MAX; n++) { From 3e5292ca0b975ea964d1a7123f61d2b50e230c0e Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Wed, 16 Oct 2024 18:48:24 +0200 Subject: [PATCH 19/75] Cleanup unused global vars in executables/nr-softmodem.c --- executables/nr-softmodem.c | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index c565b451e4..10fb69d745 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -92,27 +92,18 @@ unsigned short config_frames[4] = {2,9,11,13}; pthread_cond_t nfapi_sync_cond; pthread_mutex_t nfapi_sync_mutex; int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex - -extern uint8_t nfapi_mode; // Default to monolithic mode THREAD_STRUCT thread_struct; pthread_cond_t sync_cond; pthread_mutex_t sync_mutex; int sync_var=-1; //!< protected by mutex \ref sync_mutex. int config_sync_var=-1; - -volatile int start_gNB = 0; int oai_exit = 0; - -int NB_UE_INST = 0; - static int wait_for_sync = 0; unsigned int mmapped_dma=0; uint64_t downlink_frequency[MAX_NUM_CCs][4]; int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; - -//Temp fix for inexistent NR upper layer unsigned char NB_gNB_INST = 1; char *uecap_file; @@ -131,26 +122,10 @@ double rx_gain[MAX_NUM_CCs][4] = {{110,0,0,0},{20,0,0,0}}; double rx_gain_off = 0.0; static int tx_max_power[MAX_NUM_CCs]; /* = {0,0}*/; - - int chain_offset=0; - -uint8_t dci_Format = 0; -uint8_t nb_antenna_tx = 1; -uint8_t nb_antenna_rx = 1; - -int otg_enabled; - extern void *udp_eNB_task(void *args_p); - -int transmission_mode=1; int emulate_rf = 0; int numerology = 0; - - -/* struct for ethernet specific parameters given in eNB conf file */ -eth_params_t *eth_params; - double cpuf; /* hack: pdcp_run() is required by 4G scheduler which is compiled into From 881c6b0c1abc4a5017f63a5acfb9bcc3122d1d8f Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Wed, 16 Oct 2024 19:01:22 +0200 Subject: [PATCH 20/75] Refactor l1_north_init_gNB * code cleanup * clang-formatted * simplified code --- openair1/PHY/INIT/nr_init.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 708f23e01a..3624f50e87 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -41,28 +41,25 @@ #include "SCHED_NR/fapi_nr_l1.h" #include "PHY/NR_REFSIG/ul_ref_seq_nr.h" -int l1_north_init_gNB() { +int l1_north_init_gNB() +{ + AssertFatal(RC.nb_nr_L1_inst > 0, "Failed to init PHY callbacks: nb_nr_L1_inst = %d\n", RC.nb_nr_L1_inst); + AssertFatal(RC.gNB != NULL, "Failed to init PHY callbacks: RC.gNB is null\n"); + LOG_I(NR_PHY, "RC.nb_nr_L1_inst = %d\n", RC.nb_nr_L1_inst); - if (RC.nb_nr_L1_inst > 0 && RC.gNB != NULL) { + for (uint8_t i = 0; i < RC.nb_nr_L1_inst; i++) { - AssertFatal(RC.nb_nr_L1_inst>0,"nb_nr_L1_inst=%d\n",RC.nb_nr_L1_inst); - AssertFatal(RC.gNB!=NULL,"RC.gNB is null\n"); - LOG_D(PHY, "%s() RC.nb_nr_L1_inst:%d\n", __FUNCTION__, RC.nb_nr_L1_inst); - - for (int i=0; iif_inst = NR_IF_Module_init(i))<0) return(-1); - - LOG_D(PHY, "%s() RC.gNB[%d] installing callbacks\n", __FUNCTION__, i); - RC.gNB[i]->if_inst->NR_PHY_config_req = nr_phy_config_request; - RC.gNB[i]->if_inst->NR_Schedule_response = nr_schedule_response; + if ((RC.gNB[i]->if_inst = NR_IF_Module_init(i)) < 0) { + LOG_E(NR_PHY, "Error: Failed to initialize NR_IF_Module for gNB[%d]\n", i); + return -1; } - } else { - LOG_D(PHY, "%s() Not installing PHY callbacks - RC.nb_nr_L1_inst:%d RC.gNB:%p\n", __FUNCTION__, RC.nb_nr_L1_inst, RC.gNB); + + LOG_D(NR_PHY, "RC.gNB[%d]: installing callbacks\n", i); + RC.gNB[i]->if_inst->NR_PHY_config_req = nr_phy_config_request; + RC.gNB[i]->if_inst->NR_Schedule_response = nr_schedule_response; } - return(0); + return 0; } NR_gNB_PHY_STATS_t *get_phy_stats(PHY_VARS_gNB *gNB, uint16_t rnti) From dfb90a173de0f53066a4ca04e81ad083ede3b2cc Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Wed, 16 Oct 2024 19:02:25 +0200 Subject: [PATCH 21/75] Cleanup commented out code in nr_init.c --- openair1/PHY/INIT/nr_init.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 3624f50e87..d7b4616ec1 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -309,15 +309,6 @@ void install_nr_schedule_handlers(NR_IF_Module_t *if_inst) if_inst->NR_PHY_config_req = nr_phy_config_request; if_inst->NR_Schedule_response = nr_schedule_response; } -/* -void install_schedule_handlers(IF_Module_t *if_inst) -{ - if_inst->PHY_config_req = phy_config_request; - if_inst->schedule_response = schedule_response; -}*/ - -/// this function is a temporary addition for NR configuration - void nr_phy_config_request_sim(PHY_VARS_gNB *gNB, int N_RB_DL, From eaeae880d01a6d3f4ea9b96174c94e3279a68ba2 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Thu, 17 Oct 2024 13:06:52 +0200 Subject: [PATCH 22/75] Removed unused wait_for_sync --- executables/lte-enb.c | 5 +++-- executables/lte-softmodem.c | 4 ++-- executables/lte-softmodem.h | 2 +- executables/nr-gnb.c | 4 ++-- executables/nr-softmodem.c | 3 +-- executables/nr-softmodem.h | 2 +- executables/softmodem-common.h | 4 ---- 7 files changed, 10 insertions(+), 14 deletions(-) diff --git a/executables/lte-enb.c b/executables/lte-enb.c index 24d24da9ea..42c97e8913 100644 --- a/executables/lte-enb.c +++ b/executables/lte-enb.c @@ -131,7 +131,7 @@ static struct { extern double cpuf; -void init_eNB(int); +void init_eNB(); void stop_eNB(int nb_inst); int wakeup_tx(PHY_VARS_eNB *eNB, int frame_rx, int subframe_rx, int frame_tx, int subframe_tx, uint64_t timestamp_tx); @@ -1219,7 +1219,8 @@ void init_eNB_afterRU(void) { } -void init_eNB(int wait_for_sync) { +void init_eNB() +{ int CC_id; int inst; PHY_VARS_eNB *eNB; diff --git a/executables/lte-softmodem.c b/executables/lte-softmodem.c index 9d42adeb73..552de278d1 100644 --- a/executables/lte-softmodem.c +++ b/executables/lte-softmodem.c @@ -532,8 +532,8 @@ int main ( int argc, char **argv ) printf("RC.nb_L1_inst:%d\n", RC.nb_L1_inst); if (RC.nb_L1_inst > 0) { - printf("Initializing eNB threads wait_for_sync:%d\n", get_softmodem_params()->wait_for_sync); - init_eNB(get_softmodem_params()->wait_for_sync); + printf("Initializing eNB threads\n"); + init_eNB(); } for (int x=0; x < RC.nb_L1_inst; x++) for (int CC_id=0; CC_id 0) { // Initialize gNB structure in RAN context - init_gNB(wait_for_sync); + init_gNB(); // Initialize L1 RCconfig_NR_L1(); // Initialize Positioning Reference Signal configuration diff --git a/executables/nr-softmodem.h b/executables/nr-softmodem.h index a17201d329..4311777f6c 100644 --- a/executables/nr-softmodem.h +++ b/executables/nr-softmodem.h @@ -41,7 +41,7 @@ extern uint64_t ulsch_slot_bitmap; extern char *uecap_file; // In nr-gnb.c -extern void init_gNB(int wait_for_sync); +extern void init_gNB(); extern void stop_gNB(int); // In nr-ru.c diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index b6bbc11a2e..3d6f9a78ef 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -125,7 +125,6 @@ extern "C" #define DO_RA softmodem_params.do_ra #define SA softmodem_params.sa #define SL_MODE softmodem_params.sl_mode -#define WAIT_FOR_SYNC softmodem_params.wait_for_sync #define CHAIN_OFFSET softmodem_params.chain_offset #define NUMEROLOGY softmodem_params.numerology #define BAND softmodem_params.band @@ -161,7 +160,6 @@ extern int usrp_tx_thread; {"clock-source", CONFIG_HLP_CLK, 0, .uptr=&CLOCK_SOURCE, .defintval=0, TYPE_UINT, 0}, \ {"time-source", CONFIG_HLP_TME, 0, .uptr=&TIMING_SOURCE, .defintval=0, TYPE_UINT, 0}, \ {"tune-offset", CONFIG_HLP_TUNE_OFFSET, 0, .dblptr=&TUNE_OFFSET, .defintval=0, TYPE_DOUBLE, 0}, \ - {"wait-for-sync", NULL, PARAMFLAG_BOOL, .iptr=&WAIT_FOR_SYNC, .defintval=0, TYPE_INT, 0}, \ {"C" , CONFIG_HLP_DLF, 0, .u64ptr=&(downlink_frequency[0][0]), .defuintval=0, TYPE_UINT64, 0}, \ {"CO" , CONFIG_HLP_ULF, 0, .iptr=&(uplink_frequency_offset[0][0]), .defintval=0, TYPE_INT, 0}, \ {"a" , CONFIG_HLP_CHOFF, 0, .iptr=&CHAIN_OFFSET, .defintval=0, TYPE_INT, 0}, \ @@ -224,7 +222,6 @@ extern int usrp_tx_thread; { .s5 = { NULL } }, \ { .s5 = { NULL } }, \ { .s5 = { NULL } }, \ - { .s5 = { NULL } }, \ { .s3a = { config_checkstr_assign_integer, \ {"MONOLITHIC", "PNF", "VNF", "AERIAL","UE_STUB_PNF","UE_STUB_OFFNET","STANDALONE_PNF"}, \ {NFAPI_MONOLITHIC, NFAPI_MODE_PNF, NFAPI_MODE_VNF, NFAPI_MODE_AERIAL,NFAPI_UE_STUB_PNF,NFAPI_UE_STUB_OFFNET,NFAPI_MODE_STANDALONE_PNF}, \ @@ -309,7 +306,6 @@ typedef struct { uint8_t sl_mode; uint8_t usim_test; int emulate_rf; - int wait_for_sync; //eNodeB only int chain_offset; int numerology; int band; From f80b09ac990abe0593b92c0e288273a8bb1e5bc9 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Mon, 28 Oct 2024 08:13:00 +0100 Subject: [PATCH 23/75] Simplified use of nb_nr_inst * nb_nr_inst represents the number of gNB instances and the number of RAN contexts * it used also to count the number of RRC instances in the node * it is set from config file in NRRCConfig, therefore redundant checks after this function have been removed * redundant global variable NB_gNB_INST, set after nb_nr_inst, was removed --- executables/nr-gnb.c | 3 --- executables/nr-softmodem.c | 18 +++++------------- openair2/GNB_APP/gnb_app.c | 2 -- openair2/GNB_APP/gnb_config.c | 6 +++++- 4 files changed, 10 insertions(+), 19 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index f250893133..6e9dd91a59 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -400,10 +400,7 @@ void term_gNB_Tpool(int inst) { void init_eNB_afterRU(void) { int inst,ru_id,i,aa; PHY_VARS_gNB *gNB; - LOG_D(PHY, "%s() RC.nb_nr_inst:%d\n", __FUNCTION__, RC.nb_nr_inst); - if(NFAPI_MODE == NFAPI_MODE_PNF) - RC.nb_nr_inst = 1; for (inst=0; inst 0) { - AssertFatal(RC.nb_nr_inst == 1, "multiple RRC instances are not supported\n"); - RC.nrrrc = calloc(1, sizeof(*RC.nrrrc)); - RC.nrrrc[0] = calloc(1,sizeof(gNB_RRC_INST)); - RCconfig_NRRRC(RC.nrrrc[0]); - } - - if (RC.nb_nr_inst > 0 && - !get_softmodem_params()->nsa && - !(node_type == ngran_gNB_DU)) { + if (!get_softmodem_params()->nsa && !(node_type == ngran_gNB_DU)) { // we start pdcp in both cuup (for drb) and cucp (for srb) init_pdcp(); } @@ -373,7 +366,6 @@ static void get_options(configmodule_interface_t *cfg) memset((void *)&RC,0,sizeof(RC)); /* Read RC configuration file */ NRRCConfig(); - NB_gNB_INST = RC.nb_nr_inst; NB_RU = RC.nb_RU; } } diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index 49b53aa572..e62ddf38b0 100644 --- a/openair2/GNB_APP/gnb_app.c +++ b/openair2/GNB_APP/gnb_app.c @@ -54,8 +54,6 @@ #include "gnb_config.h" #include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h" -extern unsigned char NB_gNB_INST; - extern RAN_CONTEXT_t RC; #define GNB_REGISTER_RETRY_DELAY 10 diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 8273141f8a..1f600331d7 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -2136,6 +2136,11 @@ void NRRCConfig(void) { config_get(config_get_if(), GNBSParams, sizeofArray(GNBSParams), NULL); RC.nb_nr_inst = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; + AssertFatal(RC.nb_nr_inst == NUMBER_OF_gNB_MAX, + "Configuration error: RC.nb_nr_inst (%d) must equal NUMBER_OF_gNB_MAX (%d).\n" + "Currently, only one instance of each layer (L1, L2, L3) is supported.\n" + "Ensure that nb_nr_inst matches the maximum allowed gNB instances in this configuration.", + RC.nb_nr_inst, NUMBER_OF_gNB_MAX); // Get num MACRLC instances config_getlist(config_get_if(), &MACRLCParamList, NULL, 0, NULL); @@ -2383,7 +2388,6 @@ int gNB_app_handle_f1ap_gnb_cu_configuration_update(f1ap_gnb_cu_configuration_up gnb_cu_cfg_update->num_cells_to_activate, RC.nb_nr_inst); AssertFatal(gnb_cu_cfg_update->num_cells_to_activate == 1, "only one cell supported at the moment\n"); - AssertFatal(RC.nb_nr_inst == 1, "expected one instance\n"); gNB_MAC_INST *mac = RC.nrmac[0]; NR_SCHED_LOCK(&mac->sched_lock); for (j = 0; j < gnb_cu_cfg_update->num_cells_to_activate; j++) { From b7063c8b75ba7aa6b6cde7bcf48b5a9c949895c1 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Tue, 29 Oct 2024 09:05:47 +0100 Subject: [PATCH 24/75] Return a pointer to a new RRC instance (gNB_RRC_INST) from RCconfig_NRRRC --- executables/nr-softmodem.c | 3 +-- openair2/GNB_APP/gnb_config.c | 12 ++++++++++-- openair2/GNB_APP/gnb_config.h | 2 +- openair2/RRC/NR/rrc_gNB.c | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 16e34050da..cb6a61eb2b 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -256,8 +256,7 @@ static int create_gNB_tasks(ngran_node_t node_type, configmodule_interface_t *cf LOG_D(GNB_APP, "Allocating gNB_RRC_INST\n"); RC.nrrrc = calloc(1, sizeof(*RC.nrrrc)); - RC.nrrrc[0] = calloc(1, sizeof(gNB_RRC_INST)); - RCconfig_NRRRC(RC.nrrrc[0]); + RC.nrrrc[0] = RCconfig_NRRRC(); if (!get_softmodem_params()->nsa && !(node_type == ngran_gNB_DU)) { // we start pdcp in both cuup (for drb) and cucp (for srb) diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 1f600331d7..dc4670ed5c 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1773,8 +1773,14 @@ static void fill_measurement_configuration(uint8_t gnb_idx, gNB_RRC_INST *rrc) } } -void RCconfig_NRRRC(gNB_RRC_INST *rrc) +/** + * @brief Allocates and initializes RRC instances + * Currently assuming 1 instance + */ +gNB_RRC_INST *RCconfig_NRRRC() { + // Allocate memory for 1 RRC instance + gNB_RRC_INST *rrc = calloc(1, sizeof(*rrc)); int num_gnbs = 0; char aprefix[MAX_OPTNAME_SIZE*2 + 8]; @@ -1914,7 +1920,9 @@ void RCconfig_NRRRC(gNB_RRC_INST *rrc) }//End if (num_gnbs>0) config_security(rrc); -}//End RCconfig_NRRRC function + + return rrc; +} int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) { diff --git a/openair2/GNB_APP/gnb_config.h b/openair2/GNB_APP/gnb_config.h index e406a1ad7f..0a52684612 100644 --- a/openair2/GNB_APP/gnb_config.h +++ b/openair2/GNB_APP/gnb_config.h @@ -101,7 +101,7 @@ extern void NRRCConfig(void); //void enb_config_display(void); //void ru_config_display(void); -void RCconfig_NRRRC(gNB_RRC_INST *rrc); +gNB_RRC_INST *RCconfig_NRRRC(); int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i); int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i); void wait_f1_setup_response(void); diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index ce42a7be3f..c018b8030a 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -219,7 +219,7 @@ static void init_NR_SI(gNB_RRC_INST *rrc) AssertFatal(NODE_IS_MONOLITHIC(rrc->node_type), "phy_test and do_ra only work in monolithic\n"); rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_allocate_new_ue_context(rrc); LOG_I(NR_RRC,"Adding new user (%p)\n",ue_context_p); - if (!NODE_IS_CU(RC.nrrrc[0]->node_type)) { + if (!NODE_IS_CU(rrc->node_type)) { rrc_add_nsa_user(rrc,ue_context_p,NULL); } } From 14a379cb750481004e9c424bd812c0817f334c81 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Fri, 25 Oct 2024 22:37:44 +0200 Subject: [PATCH 25/75] Removed global variable NB_RU * this variable was set after RC.nb_RU, which is set in NRRCConfig therefore it was redundant since it can be easily replaced by the original --- executables/nr-gnb.c | 2 +- executables/nr-ru.c | 2 +- executables/nr-softmodem.c | 1 - openair1/PHY/phy_extern.h | 3 --- openair1/PHY/phy_vars.h | 1 - 5 files changed, 2 insertions(+), 7 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index 6e9dd91a59..46e2d3fafe 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -412,7 +412,7 @@ void init_eNB_afterRU(void) { // map antennas and PRACH signals to gNB RX if (0) AssertFatal(gNB->num_RU>0,"Number of RU attached to gNB %d is zero\n",gNB->Mod_id); - LOG_D(PHY, "Mapping RX ports from %d RUs to gNB %d\n", gNB->num_RU, gNB->Mod_id); + LOG_D(NR_PHY, "Mapping RX ports from %d RUs to gNB %d\n", gNB->num_RU, gNB->Mod_id); for (ru_id=0,aa=0; ru_idnum_RU; ru_id++) { AssertFatal(gNB->RU_list[ru_id]->common.rxdataF != NULL, "RU %d : common.rxdataF is NULL\n", gNB->RU_list[ru_id]->idx); diff --git a/executables/nr-ru.c b/executables/nr-ru.c index e3f13cd014..5a4002e609 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1819,7 +1819,7 @@ static void NRRCconfig_RU(configmodule_interface_t *cfg) if (RUParamList.numelt > 0) { RC.ru = (RU_t **)malloc(RC.nb_RU*sizeof(RU_t *)); - RC.ru_mask = (1 << NB_RU) - 1; + RC.ru_mask = (1 << RC.nb_RU) - 1; for (int j = 0; j < RC.nb_RU; j++) { RC.ru[j] = calloc(1, sizeof(*RC.ru[j])); diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index cb6a61eb2b..a934978492 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -365,7 +365,6 @@ static void get_options(configmodule_interface_t *cfg) memset((void *)&RC,0,sizeof(RC)); /* Read RC configuration file */ NRRCConfig(); - NB_RU = RC.nb_RU; } } diff --git a/openair1/PHY/phy_extern.h b/openair1/PHY/phy_extern.h index 8584bf351e..f1e4bb5bcd 100644 --- a/openair1/PHY/phy_extern.h +++ b/openair1/PHY/phy_extern.h @@ -63,9 +63,6 @@ static const short primary_synch2[144] = { -13477, 29867, -7292, -31946, -29523, -14218, 25100, -21063, -16384, -28378, 27073, -18459, -26120, -19785, 2448, -32676, -24020, 22287, -31754, 8085, 32767, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -extern unsigned char NB_RU; - - static const char NB_functions[7][20] = { "eNodeB_3GPP", "eNodeB_3GPP_BBU", diff --git a/openair1/PHY/phy_vars.h b/openair1/PHY/phy_vars.h index 85d2d2a59f..61b8361d21 100644 --- a/openair1/PHY/phy_vars.h +++ b/openair1/PHY/phy_vars.h @@ -30,7 +30,6 @@ PHY_VARS_UE ***PHY_vars_UE_g; UL_RCC_IND_t UL_RCC_INFO; -unsigned char NB_RU=0; int number_of_cards; uint8_t max_turbo_iterations=4; From b61de6453a7dc00081db51bd068a53ff781e4e5b Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Mon, 28 Oct 2024 08:34:45 +0100 Subject: [PATCH 26/75] Refactor NRRCConfig * the goal of this function is to initialize and configure the RAN Context * the goal of get_options is to get command line options * this commit aims at making the implementation more consistent * move initialization of RC.nb_nr_CC to this function * cleanup redundant initializations of RC.nb_nr_macrlc_inst outside NRRCConfig * cleanup redundant initization of RC.nb_nr_macrlc_inst from getter function (get_node_type) * cleanup RC initialization in RCconfig_NR_L1 * removed redundant log lines (print number of instances in NRRCConfig only) * do RC init after getting CL options and configuration * get_node_type shall access configuration only, not RC context * NRRCConfig shall be called only once: made it thread-safe --- executables/nr-gnb.c | 2 - executables/nr-softmodem.c | 12 ++--- openair1/PHY/INIT/nr_init.c | 1 - openair2/GNB_APP/gnb_config.c | 84 +++++++++++++++++++++-------------- 4 files changed, 55 insertions(+), 44 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index 46e2d3fafe..4206cfd585 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -402,8 +402,6 @@ void init_eNB_afterRU(void) { PHY_VARS_gNB *gNB; for (inst=0; instldpc_offload_flag = get_softmodem_params()->ldpc_offload_flag; diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index a934978492..e7436f8798 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -246,8 +246,6 @@ static int create_gNB_tasks(ngran_node_t node_type, configmodule_interface_t *cf if (RC.nb_nr_macrlc_inst > 0) RCconfig_nr_macrlc(cfg); - LOG_D(PHY, "%s() RC.nb_nr_L1_inst:%d\n", __FUNCTION__, RC.nb_nr_L1_inst); - if (RC.nb_nr_L1_inst>0) AssertFatal(l1_north_init_gNB()==0,"could not initialize L1 north interface\n"); AssertFatal (gnb_nb <= RC.nb_nr_inst, @@ -360,12 +358,6 @@ static void get_options(configmodule_interface_t *cfg) get_common_options(cfg, SOFTMODEM_GNB_BIT); config_process_cmdline(cfg, cmdline_params, sizeofArray(cmdline_params), NULL); CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP); - - if ( !(CONFIG_ISFLAGSET(CONFIG_ABORT)) ) { - memset((void *)&RC,0,sizeof(RC)); - /* Read RC configuration file */ - NRRCConfig(); - } } void wait_RUs(void) { @@ -502,6 +494,7 @@ int main( int argc, char **argv ) { lock_memory_to_ram(); get_options(uniqCfg); + EPC_MODE_ENABLED = !IS_SOFTMODEM_NOS1; if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) { @@ -536,6 +529,9 @@ int main( int argc, char **argv ) { // don't create if node doesn't connect to RRC/S1/GTP const ngran_node_t node_type = get_node_type(); + // Init RAN context + if (!(CONFIG_ISFLAGSET(CONFIG_ABORT))) + NRRCConfig(); if (RC.nb_nr_L1_inst > 0) { // Initialize gNB structure in RAN context diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index d7b4616ec1..e723b3a330 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -45,7 +45,6 @@ int l1_north_init_gNB() { AssertFatal(RC.nb_nr_L1_inst > 0, "Failed to init PHY callbacks: nb_nr_L1_inst = %d\n", RC.nb_nr_L1_inst); AssertFatal(RC.gNB != NULL, "Failed to init PHY callbacks: RC.gNB is null\n"); - LOG_I(NR_PHY, "RC.nb_nr_L1_inst = %d\n", RC.nb_nr_L1_inst); for (uint8_t i = 0; i < RC.nb_nr_L1_inst; i++) { diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index dc4670ed5c..3e9292e775 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -928,17 +928,6 @@ void RCconfig_NR_L1(void) gNB->eth_params_n.remote_portd = *(L1_ParamList.paramarray[j][L1_REMOTE_N_PORTD_IDX].iptr); gNB->eth_params_n.transp_preference = ETH_UDP_MODE; - RC.nb_nr_macrlc_inst = 1; // This is used by mac_top_init_gNB() - - RC.nb_nr_CC = (int *)malloc((1 + RC.nb_nr_inst) * sizeof(int)); - RC.nb_nr_CC[0] = 1; - - LOG_D(NR_PHY, - "RC.nb_nr_CC[0] = %d for init_gNB_afterRU()\n" - "RC.nb_nr_macrlc_inst = %d (used by mac_top_init_gNB())\n", - RC.nb_nr_CC[0], - RC.nb_nr_macrlc_inst); - configure_nr_nfapi_pnf(gNB->eth_params_n.remote_addr, gNB->eth_params_n.remote_portc, gNB->eth_params_n.my_addr, @@ -1372,7 +1361,6 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg) NR_ServingCellConfig_t *scd = get_scd_config(cfg); if (MacRLC_ParamList.numelt > 0) { - RC.nb_nr_macrlc_inst = MacRLC_ParamList.numelt; ngran_node_t node_type = get_node_type(); mac_top_init_gNB(node_type, scc, scd, &config); RC.nb_nr_mac_CC = (int *)malloc(RC.nb_nr_macrlc_inst * sizeof(int)); @@ -2133,16 +2121,29 @@ int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) { return 0; } -void NRRCConfig(void) { +static pthread_mutex_t rc_mutex = PTHREAD_MUTEX_INITIALIZER; +static bool rc_done = false; + +/** + * @brief This function is initializing the RAN context + * the its various layer instances + */ +void NRRCConfig(void) +{ + // Call NRRCConfig only once + pthread_mutex_lock(&rc_mutex); + if (rc_done) { + LOG_E(GNB_APP, "RAN Context has been already initialized\n"); + pthread_mutex_unlock(&rc_mutex); + return; + } + + memset((void *)&RC, 0, sizeof(RC)); - paramlist_def_t MACRLCParamList = {CONFIG_STRING_MACRLC_LIST,NULL,0}; - paramlist_def_t L1ParamList = {CONFIG_STRING_L1_LIST,NULL,0}; - paramlist_def_t RUParamList = {CONFIG_STRING_RU_LIST,NULL,0}; paramdef_t GNBSParams[] = GNBSPARAMS_DESC; - -/* get global parameters, defined outside any section in the config file */ - config_get(config_get_if(), GNBSParams, sizeofArray(GNBSParams), NULL); + + // Set num of gNBs instances RC.nb_nr_inst = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; AssertFatal(RC.nb_nr_inst == NUMBER_OF_gNB_MAX, "Configuration error: RC.nb_nr_inst (%d) must equal NUMBER_OF_gNB_MAX (%d).\n" @@ -2150,18 +2151,38 @@ void NRRCConfig(void) { "Ensure that nb_nr_inst matches the maximum allowed gNB instances in this configuration.", RC.nb_nr_inst, NUMBER_OF_gNB_MAX); - // Get num MACRLC instances + // Set num MACRLC instances + paramlist_def_t MACRLCParamList = {CONFIG_STRING_MACRLC_LIST, NULL, 0}; config_getlist(config_get_if(), &MACRLCParamList, NULL, 0, NULL); - RC.nb_nr_macrlc_inst = MACRLCParamList.numelt; - // Get num L1 instances + RC.nb_nr_macrlc_inst = MACRLCParamList.numelt; + + // Set num L1 instances + paramlist_def_t L1ParamList = {CONFIG_STRING_L1_LIST, NULL, 0}; config_getlist(config_get_if(), &L1ParamList, NULL, 0, NULL); RC.nb_nr_L1_inst = L1ParamList.numelt; - - // Get num RU instances - config_getlist(config_get_if(), &RUParamList, NULL, 0, NULL); - RC.nb_RU = RUParamList.numelt; -} + // Set num RU instances + paramlist_def_t RUParamList = {CONFIG_STRING_RU_LIST, NULL, 0}; + config_getlist(config_get_if(), &RUParamList, NULL, 0, NULL); + RC.nb_RU = RUParamList.numelt; + + // Set num component carriers + RC.nb_nr_CC = calloc_or_fail(1, sizeof(*RC.nb_nr_CC)); + *RC.nb_nr_CC = RC.nb_nr_L1_inst; + AssertFatal(*RC.nb_nr_CC <= MAX_NUM_CCs, "Configured number of CCs (%d) not supported\n", *RC.nb_nr_CC); + + LOG_I(GNB_APP, + "Initialized RAN Context: RC.nb_nr_inst = %d, RC.nb_nr_macrlc_inst = %d, RC.nb_nr_L1_inst = %d, RC.nb_RU = %d, " + "RC.nb_nr_CC[0] = %d\n", + RC.nb_nr_inst, + RC.nb_nr_macrlc_inst, + RC.nb_nr_L1_inst, + RC.nb_RU, + *RC.nb_nr_CC); + + rc_done = true; + pthread_mutex_unlock(&rc_mutex); +} int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) { int J, l; @@ -2465,12 +2486,9 @@ ngran_node_t get_node_type(void) char aprefix[MAX_OPTNAME_SIZE*2 + 8]; sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0); config_getlist(config_get_if(), &GNBE1ParamList, GNBE1Params, sizeofArray(GNBE1Params), aprefix); - if (MacRLC_ParamList.numelt > 0) { - RC.nb_nr_macrlc_inst = MacRLC_ParamList.numelt; - for (int j = 0; j < RC.nb_nr_macrlc_inst; j++) { - if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "f1") == 0) { - return ngran_gNB_DU; // MACRLCs present in config: it must be a DU - } + for (int j = 0; j < MacRLC_ParamList.numelt; j++) { + if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "f1") == 0) { + return ngran_gNB_DU; // MACRLCs present in config: it must be a DU } } From d57ea715c0f7ef85bf1ec712eaf69e87a2ef872a Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Wed, 4 Sep 2024 12:19:11 +0200 Subject: [PATCH 27/75] Improve polar decoder/encoder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Ensure packed struct through bitfield - decoder tree buffer increase: i don't find evidence in the 3GPP standard of the max size of polar coded PDU. even with this max size, the way this tree is built is not trivial. so, it is hard to predict, i just put 8 system pages (32KB) that looks enough [1] - a lot of reformatting [1] https://arxiv.org/pdf/1804.04389 according to this paper, the largest polar code in 5G is in UL, so likely the biggest problem will be in gNB, not the UE. in DL, the max output coded block is 512, in UL 1024. probably the tree we discuss is related to this size. "frozen bits" means only bits we don't encode/decode because polar code size is only by power of 2. We see this in OAI code: NR_POLAR_PUCCH_N_MAX is 10, so 2^10 is 1024, that is the maximum size for 5G polar code length. in the code, we assert if N > 512: "N = %d, not done yet\n", polarParams->N". so, the today OAI code can't do PUCCH large blocks. using current oai limitation of 2⁹ max code size, we can create up to 2^9+2⁸... nodes, so 1023 nodes in the tree. the problem then is that each node have variable size, depending on the 'level' (the power of 2 we are currently). the algo provision large alpha and beta to be able to store all lower levels in the tree (int leaf_sz = 1 << level) therefore upper tree nodes are large (the top level for n=9 uses about 1.5KB) and the bottom nodes uses 64 bytes. if all nodes are populated, the size will be very large: 1.5KB + 2 * 800 + .... but, we create nodes in the tree only for the "information bits", so the payload, that is limited to 128 bits (else we assert, the code is not "finished"). 1.5KB * 128 is >> 8KB i allocated. but, we can't create more than one mode at top level, so there is maximum 1.5KB + 2 * 800, + 4 * 400 + 8 * 200 + 16 * 100 + remaining of 128-32 nodes of 64 bytes. about 14KB. i allocated 1024*sizeof(__m256i) bytes = 32KB that looks good. --- openair1/PHY/CODING/TESTBENCH/polartest.c | 68 ++-- .../CODING/nrPolar_tools/nr_polar_decoder.c | 166 ++++++--- .../nrPolar_tools/nr_polar_decoding_tools.c | 330 +++++++++--------- .../PHY/CODING/nrPolar_tools/nr_polar_defs.h | 108 ++++-- .../CODING/nrPolar_tools/nr_polar_encoder.c | 6 +- .../nr_polar_interleaving_pattern.c | 6 +- .../nrPolar_tools/nr_polar_procedures.c | 107 ------ openair1/PHY/CODING/nr_polar_init.c | 20 +- 8 files changed, 404 insertions(+), 407 deletions(-) diff --git a/openair1/PHY/CODING/TESTBENCH/polartest.c b/openair1/PHY/CODING/TESTBENCH/polartest.c index cd280c236e..266f829efa 100644 --- a/openair1/PHY/CODING/TESTBENCH/polartest.c +++ b/openair1/PHY/CODING/TESTBENCH/polartest.c @@ -91,11 +91,12 @@ int main(int argc, char *argv[]) case 'L': aggregation_level=atoi(optarg); - if (aggregation_level != 1 && aggregation_level != 2 && aggregation_level != 4 && aggregation_level != 8 && aggregation_level != 16) { - printf("Illegal aggregation level %d \n",aggregation_level); - exit(-1); - } - break; + if (aggregation_level != 1 && aggregation_level != 2 && aggregation_level != 4 && aggregation_level != 8 + && aggregation_level != 16) { + printf("Illegal aggregation level %d \n", aggregation_level); + exit(-1); + } + break; case 'k': testLength=atoi(optarg); @@ -106,9 +107,10 @@ int main(int argc, char *argv[]) break; case 'h': - printf("./polartest\nOptions\n-h Print this help\n-s SNRstart (dB)\n-d SNRinc (dB)\n-f SNRstop (dB)\n-m [0=PBCH|1=DCI|2=UCI]\n" - "-i Number of iterations\n-l decoderListSize\n-q Flag for optimized coders usage\n-F Flag for test results logging\n" - "-L aggregation level (for DCI)\n-k packet_length (bits) for DCI/UCI\n"); + printf( + "./polartest\nOptions\n-h Print this help\n-s SNRstart (dB)\n-d SNRinc (dB)\n-f SNRstop (dB)\n-m [0=PBCH|1=DCI|2=UCI]\n" + "-i Number of iterations\n-l decoderListSize\n-q Flag for optimized coders usage\n-F Flag for test results logging\n" + "-L aggregation level (for DCI)\n-k packet_length (bits) for DCI/UCI\n"); exit(-1); break; @@ -186,7 +188,7 @@ int main(int argc, char *argv[]) double channelOutput[coderLength]; //add noise int16_t channelOutput_int16[coderLength]; - t_nrPolar_params *currentPtr = nr_polar_params(polarMessageType, testLength, aggregation_level, true); + t_nrPolar_params *currentPtr = nr_polar_params(polarMessageType, testLength, aggregation_level); #ifdef DEBUG_DCI_POLAR_PARAMS uint32_t dci_pdu[4]; @@ -283,30 +285,37 @@ int main(int argc, char *argv[]) channelOutput[i] = modulatedInput[i] + (gaussdouble(0.0,1.0) * (1/sqrt(2*SNR_lin))); if (decoder_int16==1) { - if (channelOutput[i] > 15) channelOutput_int16[i] = 127; - else if (channelOutput[i] < -16) channelOutput_int16[i] = -128; - else channelOutput_int16[i] = (int16_t) (8*channelOutput[i]); - } + if (channelOutput[i] > 15) + channelOutput_int16[i] = 127; + else if (channelOutput[i] < -16) + channelOutput_int16[i] = -128; + else + channelOutput_int16[i] = (int16_t)(8 * channelOutput[i]); + } } start_meas(&timeDecoder); if (decoder_int16==1) { - decoderState = polar_decoder_int16(channelOutput_int16, (uint64_t *)estimatedOutput, 0, - polarMessageType, testLength, aggregation_level); + decoderState = polar_decoder_int16(channelOutput_int16, + (uint64_t *)estimatedOutput, + 0, + polarMessageType, + testLength, + aggregation_level); } else { //0 --> PBCH, 1 --> DCI, -1 --> UCI if (polarMessageType == 0) { - decoderState = polar_decoder(channelOutput, - estimatedOutput, - decoderListSize, - polarMessageType, testLength, aggregation_level); - } else if (polarMessageType == 1) { - decoderState = polar_decoder_dci(channelOutput, - estimatedOutput, - decoderListSize, - rnti, - polarMessageType, testLength, aggregation_level); - } + decoderState = + polar_decoder(channelOutput, estimatedOutput, decoderListSize, polarMessageType, testLength, aggregation_level); + } else if (polarMessageType == 1) { + decoderState = polar_decoder_dci(channelOutput, + estimatedOutput, + decoderListSize, + rnti, + polarMessageType, + testLength, + aggregation_level); + } } stop_meas(&timeDecoder); @@ -332,7 +341,12 @@ int main(int argc, char *argv[]) if (nBitError>0) blockErrorState=1; #ifdef DEBUG_POLARTEST for (int i = 0; i < testArrayLength; i++) - printf("[polartest/decoderState=%u] testInput[%d]=0x%08x, estimatedOutput[%d]=0x%08x\n",decoderState, i, testInput[i], i, estimatedOutput[i]); + printf("[polartest/decoderState=%u] testInput[%d]=0x%08x, estimatedOutput[%d]=0x%08x\n", + decoderState, + i, + testInput[i], + i, + estimatedOutput[i]); #endif //Iteration times are in microseconds. diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c index 5704a9e0d4..1d7e7e8373 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c @@ -66,7 +66,7 @@ int8_t polar_decoder(double *input, uint8_t aggregation_level ) { - t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, true); + t_nrPolar_params *polarParams = nr_polar_params(messageType, messageLength, aggregation_level); //Assumes no a priori knowledge. uint8_t bit[polarParams->N][polarParams->n + 1][2 * listSize]; memset(bit, 0, sizeof bit); @@ -329,7 +329,7 @@ int8_t polar_decoder_dci(double *input, int8_t messageType, uint16_t messageLength, uint8_t aggregation_level ) { - t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, true); + t_nrPolar_params *polarParams = nr_polar_params(messageType, messageLength, aggregation_level); uint8_t bit[polarParams->N][polarParams->n+1][2*listSize]; memset(bit,0,sizeof bit); @@ -595,25 +595,17 @@ int8_t polar_decoder_dci(double *input, void init_polar_deinterleaver_table(t_nrPolar_params *polarParams) { AssertFatal(polarParams->K > 17, "K = %d < 18, is not allowed\n",polarParams->K); AssertFatal(polarParams->K < 129, "K = %d > 128, is not supported yet\n",polarParams->K); - int bit_i,ip,ipmod64; - int numbytes = polarParams->K>>3; - int residue = polarParams->K & 7; - - if (residue > 0) - numbytes++; - + int numbytes = (polarParams->K + 7) / 8; for (int byte=0; byteK >> 3) ? 8 : residue; + int numbits = byte < (polarParams->K >> 3) ? 8 : polarParams->K & 7; - for (int i=0; iK - 1 - polarParams->interleaving_pattern[(8 * byte) + i]; - ipmod64 = ip&63; - AssertFatal(ip<128,"ip = %d\n",ip); - + int ip = polarParams->K - 1 - polarParams->interleaving_pattern[(8 * byte) + bit]; + int ipmod64 = ip & 63; + AssertFatal(ip < 128, "ip = %d\n", ip); for (int val=0; val<256; val++) { - bit_i=(val>>i)&1; - + int bit_i = (val >> bit) & 1; if (ip < 64) polarParams->B_tab0[byte][val] |= ((uint64_t)bit_i) << ipmod64; else @@ -623,6 +615,64 @@ void init_polar_deinterleaver_table(t_nrPolar_params *polarParams) { } } +static inline void nr_polar_rate_matching_int16(int16_t *input, + int16_t *output, + const uint16_t *rmp, + const uint16_t K, + const uint16_t N, + const uint16_t E, + const uint8_t i_bil) +{ + if (E >= N) { // repetition + memset(output, 0, N * sizeof(*output)); + for (int i = 0; i <= E - 1; i++) + output[rmp[i]] += input[i]; + } else { + if ((K / (double)E) <= (7.0 / 16)) + memset(output, 0, N * sizeof(*output)); // puncturing + else { // shortening + for (int i = 0; i <= N - 1; i++) + output[i] = 32767; // instead of INFINITY, to prevent [-Woverflow] + } + + for (int i = 0; i <= E - 1; i++) + output[rmp[i]] = input[i]; + } +} + +static inline void nr_polar_info_extraction_from_u(uint64_t *Cprime, + const uint8_t *u, + const uint8_t *information_bit_pattern, + const uint8_t *parity_check_bit_pattern, + uint16_t N, + uint8_t n_pc) +{ + int k = 0; + + if (n_pc > 0) { + for (int n = 0; n < N; n++) { + if (information_bit_pattern[n] == 1) { + if (parity_check_bit_pattern[n] == 0) { + int k1 = k >> 6; + int k2 = k - (k1 << 6); + Cprime[k1] |= (uint64_t)u[n] << k2; + k++; + } + } + } + + } else { + for (int n = 0; n < N; n++) { + if (information_bit_pattern[n] == 1) { + int k1 = k >> 6; + int k2 = k - (k1 << 6); + Cprime[k1] |= (uint64_t)u[n] << k2; + k++; + } + } + } +} + uint32_t polar_decoder_int16(int16_t *input, uint64_t *out, uint8_t ones_flag, @@ -630,12 +680,12 @@ uint32_t polar_decoder_int16(int16_t *input, uint16_t messageLength, uint8_t aggregation_level) { - t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, true); - + t_nrPolar_params *polarParams = nr_polar_params(messageType, messageLength, aggregation_level); + const uint N = polarParams->N; #ifdef POLAR_CODING_DEBUG printf("\nRX\n"); printf("rm:"); - for (int i = 0; i < polarParams->N; i++) { + for (int i = 0; i < N; i++) { if (i % 4 == 0) { printf(" "); } @@ -644,25 +694,28 @@ uint32_t polar_decoder_int16(int16_t *input, printf("\n"); #endif - int16_t d_tilde[polarParams->N]; - nr_polar_rate_matching_int16(input, + int16_t d_tilde[N]; + const uint E = polarParams->encoderLength; + int16_t inbis[E]; + int16_t *input_deinterleaved; + if (polarParams->i_bil) { + for (int i = 0; i < E; i++) + inbis[i] = input[polarParams->i_bil_pattern[i]]; + input_deinterleaved = inbis; + } else { + input_deinterleaved = input; + } + + nr_polar_rate_matching_int16(input_deinterleaved, d_tilde, polarParams->rate_matching_pattern, polarParams->K, - polarParams->N, - polarParams->encoderLength, + N, + E, polarParams->i_bil); - - for (int i=0; iN; i++) { - if (d_tilde[i] < -128) - d_tilde[i] = -128; - else if (d_tilde[i] > 127) - d_tilde[i] = 128; - } - #ifdef POLAR_CODING_DEBUG printf("d: "); - for (int i = 0; i < polarParams->N; i++) { + for (int i = 0; i < N; i++) { if (i % 4 == 0) { printf(" "); } @@ -670,15 +723,23 @@ uint32_t polar_decoder_int16(int16_t *input, } printf("\n"); #endif - - memcpy(polarParams->tree.root->alpha, d_tilde, sizeof(d_tilde)); - uint8_t nr_polar_U[polarParams->N]; + uint8_t nr_polar_U[N]; memset(nr_polar_U, 0, sizeof(nr_polar_U)); - generic_polar_decoder(polarParams, polarParams->tree.root, nr_polar_U); - + static uint64_t cnt = 0, timeTree = 0, timeDecoder = 0; + uint64_t a = rdtsc_oai(); + decoder_tree_t tree; + build_decoder_tree(&tree, polarParams); + uint64_t b = rdtsc_oai(); + memcpy(treeAlpha(tree.root), d_tilde, sizeof(d_tilde)); + generic_polar_decoder(polarParams, tree.root, nr_polar_U); + uint64_t c = rdtsc_oai(); + timeTree += b - a; + timeDecoder += c - b; + if (cnt++ % 1000 == 0) + printf("tree: %ld, dec %ld\n", timeTree / (cnt), timeDecoder / (cnt)); #ifdef POLAR_CODING_DEBUG printf("u: "); - for (int i = 0; i < polarParams->N; i++) { + for (int i = 0; i < N; i++) { if (i % 4 == 0) { printf(" "); } @@ -693,7 +754,7 @@ uint32_t polar_decoder_int16(int16_t *input, nr_polar_U, polarParams->information_bit_pattern, polarParams->parity_check_bit_pattern, - polarParams->N, + N, polarParams->n_pc); #ifdef POLAR_CODING_DEBUG @@ -718,17 +779,30 @@ uint32_t polar_decoder_int16(int16_t *input, | polarParams->B_tab0[3][Cprimebyte[3]] | polarParams->B_tab0[4][Cprimebyte[4]] | polarParams->B_tab0[5][Cprimebyte[5]] | polarParams->B_tab0[6][Cprimebyte[6]] | polarParams->B_tab0[7][Cprimebyte[7]]; } else if (polarParams->K<129) { - int len = polarParams->K/8; - - if ((polarParams->K & 7) > 0) - len++; - - for (int k=0; kB_tab0[k][Cprimebyte[k]]; B[1] |= polarParams->B_tab1[k][Cprimebyte[k]]; } } + uint128_t Cprime128 = *(uint128_t *)Cprime; + uint128_t res = 0; + uint deinterleaving_pattern[polarParams->K]; + + for (int i = 0; i < polarParams->K; i++) + deinterleaving_pattern[polarParams->interleaving_pattern[i]] = i; + for (int i = 0; i < polarParams->K; i++) { + uint128_t bit = (Cprime128 >> i) & 1; + res |= bit << (polarParams->K - 1 - deinterleaving_pattern[i]); + } + uint128_t B128 = *(uint128_t *)B; + printf("old:(k=%d)", polarParams->K); + for (int i = 0; i < polarParams->K; i++) + printf("%lld", (B128 >> i) & 1); + printf("\nnew:(k=%d)", polarParams->K); + for (int i = 0; i < polarParams->K; i++) + printf("%lld", (res >> i) & 1); + printf("\n\n"); #ifdef POLAR_CODING_DEBUG int B_array = (polarParams->K + 63) >> 6; int n_start = (B_array << 6) - polarParams->K; diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c index 8180f5ebeb..aa7f835291 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c @@ -149,100 +149,79 @@ void updatePathMetric2(double *pathMetric, pathMetric[i] = tempPM[(i - listSize)] + log(1 + exp(multiplier * llr[row][0][(i - listSize)])); // eq. (11b) } -decoder_node_t *new_decoder_node(int first_leaf_index, int level) { - - decoder_node_t *node=(decoder_node_t *)malloc(sizeof(decoder_node_t)); - - node->first_leaf_index=first_leaf_index; - node->level=level; - node->Nv = 1<leaf = 0; - node->left=(decoder_node_t *)NULL; - node->right=(decoder_node_t *)NULL; - node->all_frozen=0; - node->alpha = (int16_t*)malloc16(node->Nv*sizeof(int16_t)); - node->beta = (int16_t*)malloc16(node->Nv*sizeof(int16_t)); - memset((void*)node->beta,-1,node->Nv*sizeof(int16_t)); - +static inline decoder_node_t *new_decoder_node(simde__m256i **buffer, + const int level, + const int first_leaf_index, + const bool leaf, + const bool frozen) +{ + int leaf_sz = 1 << level; + // we will use SIMD128 minimum + leaf_sz = (leaf_sz + 7) & ~7; + if (leaf_sz > 15) // we will use SIMD256 + leaf_sz = (leaf_sz + 15) & ~15; + const int tree_sz = (sizeof(decoder_node_t) + 31) & ~31; + decoder_node_t *node = (decoder_node_t *)*buffer; + *buffer = *buffer + (tree_sz + leaf_sz * sizeof(int16_t) + leaf_sz + sizeof(**buffer) - 1) / sizeof(**buffer); + *node = (decoder_node_t){.first_leaf_index = first_leaf_index, + .level = level, + .leaf = leaf, + .all_frozen = frozen, + .alpha = tree_sz, + .beta = tree_sz + leaf_sz * sizeof(int16_t), + .betaInit = false}; return(node); } -decoder_node_t *add_nodes(int level, int first_leaf_index, t_nrPolar_params *polarParams) { - - int all_frozen_below = 1; - int Nv = 1<tree.num_nodes,Nv,level); -#endif - polarParams->tree.num_nodes++; +static inline decoder_node_t *add_nodes(decoder_tree_t *tree, + int level, + int first_leaf_index, + const uint8_t *information_bit_pattern, + simde__m256i **buffer) +{ if (level==0) { #ifdef DEBUG_NEW_IMPL - printf("leaf %d (%s)\n", first_leaf_index, polarParams->information_bit_pattern[first_leaf_index]==1 ? "information or crc" : "frozen"); + printf("leaf %d (%s)\n", first_leaf_index, information_bit_pattern[first_leaf_index] == 1 ? "information or crc" : "frozen"); #endif - new_node->leaf=1; - new_node->all_frozen = polarParams->information_bit_pattern[first_leaf_index]==0 ? 1 : 0; - return new_node; // this is a leaf node + return new_decoder_node(buffer, level, first_leaf_index, true, information_bit_pattern[first_leaf_index] == 0); } - for (int i=0;iinformation_bit_pattern[i+first_leaf_index]>0) { - all_frozen_below = 0; - break; - } + int Nv = 1 << level; + const uint8_t *ptr = information_bit_pattern + first_leaf_index; + const uint8_t *end = ptr + Nv; + bool all_frozen_below = true; + while (ptr < end && all_frozen_below) { + all_frozen_below = *ptr++ <= 0; } - if (all_frozen_below==0) - new_node->left = add_nodes(level - 1, first_leaf_index, polarParams); - else { -#ifdef DEBUG_NEW_IMPL - printf("aggregating frozen bits %d ... %d at level %d (%s)\n",first_leaf_index,first_leaf_index+Nv-1,level,((first_leaf_index/Nv)&1)==0?"left":"right"); -#endif - new_node->leaf=1; - new_node->all_frozen=1; + if (all_frozen_below) { + return new_decoder_node(buffer, level, first_leaf_index, true, true); } - if (all_frozen_below==0) - new_node->right = add_nodes(level - 1, first_leaf_index + (Nv / 2), polarParams); - -#ifdef DEBUG_NEW_IMPL - printf("new_node (%d): first_leaf_index %d, left %p, right %p\n",Nv,first_leaf_index,new_node->left,new_node->right); -#endif + decoder_node_t *new_node = new_decoder_node(buffer, level, first_leaf_index, false, false); + new_node->left = add_nodes(tree, level - 1, first_leaf_index, information_bit_pattern, buffer); + new_node->right = add_nodes(tree, level - 1, first_leaf_index + (Nv / 2), information_bit_pattern, buffer); return(new_node); } -void delete_nodes(decoder_node_t * n) { - if (n) { - if(n->left) - delete_nodes(n->left); - if(n->right) - delete_nodes(n->right); - free(n->alpha); - free(n->beta); - free(n); - } -} - -void delete_decoder_tree(t_nrPolar_params *polarParams) { - if (polarParams->tree.root) - delete_nodes(polarParams->tree.root); -} - -void build_decoder_tree(t_nrPolar_params *polarParams) +void build_decoder_tree(decoder_tree_t *tree, const t_nrPolar_params *pp) { - polarParams->tree.num_nodes=0; - polarParams->tree.root = add_nodes(polarParams->n,0,polarParams); + simde__m256i *buffer = tree->buffer; + tree->root = add_nodes(tree, pp->n, 0, pp->information_bit_pattern, &buffer); + AssertFatal(buffer < tree->buffer + sizeofArray(tree->buffer), + "Arbitrary size too small (also check arbitrary max size of the entire polar decoder) %ld instead of max %ld\n", + buffer - tree->buffer, + sizeofArray(tree->buffer)); #ifdef DEBUG_NEW_IMPL - printf("root : left %p, right %p\n",polarParams->tree.root->left,polarParams->tree.root->right); + printf("root : left %p, right %p\n", tree->root->left, tree->root->right); #endif } -static void applyFtoleft(const t_nrPolar_params *pp, decoder_node_t *node, uint8_t *output) +static inline void applyFtoleft(const t_nrPolar_params *pp, decoder_node_t *node, uint8_t *output) { - int16_t *alpha_v=node->alpha; - int16_t *alpha_l=node->left->alpha; - int16_t *betal = node->left->beta; - int16_t a,b,absa,absb,maska,maskb,minabs; + int16_t *alpha_v = treeAlpha(node); + int16_t *alpha_l = treeAlpha(node->left); + int8_t *betal = treeBeta(node->left); #ifdef DEBUG_NEW_IMPL printf("applyFtoleft %d, Nv %d (level %d,node->left (leaf %d, AF %d))\n",node->first_leaf_index,node->Nv,node->level,node->left->leaf,node->left->all_frozen); @@ -250,61 +229,59 @@ static void applyFtoleft(const t_nrPolar_params *pp, decoder_node_t *node, uint8 for (int i = 0; i < node->Nv; i++) printf("i%d (frozen %d): alpha_v[i] = %d\n", i, 1 - pp->information_bit_pattern[node->first_leaf_index + i], alpha_v[i]); #endif - + assert(node->level); + const int sz = 1 << (node->level - 1); if (node->left->all_frozen == 0) { - int avx2mod = (node->Nv/2)&15; + int avx2mod = sz & 15; if (avx2mod == 0) { - simde__m256i a256,b256,absa256,absb256,minabs256; - int avx2len = node->Nv/2/16; + int avx2len = sz / 16; // printf("avx2len %d\n",avx2len); for (int i=0;i> 15; + int16_t maskb = b >> 15; + int16_t absa = (a + maska) ^ maska; + int16_t absb = (b + maskb) ^ maskb; + int16_t minabs = absa < absb ? absa : absb; + alpha_l[i] = (maska ^ maskb) == 0 ? minabs : -minabs; + // printf("alphal[%d] %d (%d,%d)\n",i,alpha_l[i],a,b); + } } - else - { // equivalent scalar code to above, activated only on non x86/ARM architectures - for (int i=0;iNv/2;i++) { - a=alpha_v[i]; - b=alpha_v[i+(node->Nv/2)]; - maska=a>>15; - maskb=b>>15; - absa=(a+maska)^maska; - absb=(b+maskb)^maskb; - minabs = absaNv == 2) { // apply hard decision on left node - betal[0] = (alpha_l[0]>0) ? -1 : 1; + if (sz == 1) { // apply hard decision on left node + const int tmp = alpha_l[0] <= 0; + betal[0] = tmp * 2 - 1; + node->left->betaInit = true; #ifdef DEBUG_NEW_IMPL printf("betal[0] %d (%p)\n",betal[0],&betal[0]); #endif - output[node->first_leaf_index] = (1 + betal[0]) >> 1; + output[node->first_leaf_index] = tmp; #ifdef DEBUG_NEW_IMPL printf("Setting bit %d to %d (LLR %d)\n",node->first_leaf_index,(betal[0]+1)>>1,alpha_l[0]); #endif @@ -312,39 +289,47 @@ static void applyFtoleft(const t_nrPolar_params *pp, decoder_node_t *node, uint8 } } -static void applyGtoright(const t_nrPolar_params *pp, decoder_node_t *node, uint8_t *output) +static inline void applyGtoright(const t_nrPolar_params *pp, decoder_node_t *node, uint8_t *output) { - int16_t *alpha_v=node->alpha; - int16_t *alpha_r=node->right->alpha; - int16_t *betal = node->left->beta; - int16_t *betar = node->right->beta; + int16_t *alpha_v = treeAlpha(node); + int16_t *alpha_r = treeAlpha(node->right); + int8_t *betal = treeBeta(node->left); + int8_t *betar = treeBeta(node->right); #ifdef DEBUG_NEW_IMPL printf("applyGtoright %d, Nv %d (level %d), (leaf %d, AF %d)\n",node->first_leaf_index,node->Nv,node->level,node->right->leaf,node->right->all_frozen); #endif - - if (node->right->all_frozen == 0) { - int avx2mod = (node->Nv/2)&15; - if (avx2mod == 0) { - int avx2len = node->Nv/2/16; - - for (int i=0;ilevel); + const int sz = 1 << (node->level - 1); + if (node->right->all_frozen == 0) { + if (!node->left->betaInit) { + for (int i = 0; i < sz; i++) { + int temp_alpha_r = alpha_v[i + sz] + alpha_v[i]; + if (temp_alpha_r > SHRT_MAX) { + alpha_r[i] = SHRT_MAX; + } else if (temp_alpha_r < -SHRT_MAX) { + alpha_r[i] = -SHRT_MAX; + } else { + alpha_r[i] = temp_alpha_r; + } } - } - else if (avx2mod == 8) { - ((simde__m128i *)alpha_r)[0] = simde_mm_subs_epi16(((simde__m128i *)alpha_v)[1],simde_mm_sign_epi16(((simde__m128i *)alpha_v)[0],((simde__m128i *)betal)[0])); - } - else if (avx2mod == 4) { - ((simde__m64 *)alpha_r)[0] = simde_mm_subs_pi16(((simde__m64 *)alpha_v)[1],simde_mm_sign_pi16(((simde__m64 *)alpha_v)[0],((simde__m64 *)betal)[0])); - } - else - { - int temp_alpha_r; - for (int i = 0; i < node->Nv / 2; i++) { - temp_alpha_r = alpha_v[i + (node->Nv / 2)] - (betal[i] * alpha_v[i]); + } else { + int avx2mod = sz & 15; + if (avx2mod == 0) { + int avx2len = sz / 16; + + for (int i = 0; i < avx2len; i++) { + simde__m256i tmp = simde_mm256_sign_epi16(((simde__m256i *)alpha_v)[i], _mm256_cvtepi8_epi16(((simde__m128i *)betal)[i])); + ((simde__m256i *)alpha_r)[i] = + + simde_mm256_subs_epi16(((simde__m256i *)alpha_v)[i + avx2len], tmp); + } + } else if (avx2mod == 8) { + simde__m128i tmp = simde_mm_sign_epi16(((simde__m128i *)alpha_v)[0], _mm_cvtepi8_epi16(((simde__m128i *)betal)[0])); + ((simde__m128i *)alpha_r)[0] = simde_mm_subs_epi16(((simde__m128i *)alpha_v)[1], tmp); + } else { + for (int i = 0; i < sz; i++) { + int temp_alpha_r = alpha_v[i + sz] - (betal[i] * alpha_v[i]); if (temp_alpha_r > SHRT_MAX) { alpha_r[i] = SHRT_MAX; } else if (temp_alpha_r < -SHRT_MAX) { @@ -352,55 +337,56 @@ static void applyGtoright(const t_nrPolar_params *pp, decoder_node_t *node, uint } else { alpha_r[i] = temp_alpha_r; } - } + } } - if (node->Nv == 2) { // apply hard decision on right node - betar[0] = (alpha_r[0]>0) ? -1 : 1; - output[node->first_leaf_index + 1] = (1 + betar[0]) >> 1; + } + if (sz == 1) { // apply hard decision on right node + int tmp = alpha_r[0] <= 0; + betar[0] = tmp * 2 - 1; + node->right->betaInit = true; + output[node->first_leaf_index + 1] = tmp; + #ifdef DEBUG_NEW_IMPL printf("Setting bit %d to %d (LLR %d)\n",node->first_leaf_index+1,(betar[0]+1)>>1,alpha_r[0]); #endif - } + } } } -static const int16_t all1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; +static const int64_t all11[4] = {-1, -1, -1, -1}; -void computeBeta(const t_nrPolar_params *pp,decoder_node_t *node) { - - int16_t *betav = node->beta; - int16_t *betal = node->left->beta; - int16_t *betar = node->right->beta; +static inline void computeBeta(decoder_node_t *node) +{ + int8_t *betav = treeBeta(node); + int8_t *betal = treeBeta(node->left); + int8_t *betar = treeBeta(node->right); #ifdef DEBUG_NEW_IMPL printf("Computing beta @ level %d first_leaf_index %d (all_frozen %d)\n",node->level,node->first_leaf_index,node->left->all_frozen); #endif + assert(node->level); + const int sz = 1 << (node->level - 1); if (node->left->all_frozen==0) { // if left node is not aggregation of frozen bits - int avx2mod = (node->Nv/2)&15; - register simde__m256i allones=*((simde__m256i*)all1); + assert(node->left->betaInit && node->right->betaInit); + int avx2mod = sz & 31; if (avx2mod == 0) { - int avx2len = node->Nv/2/16; + int avx2len = sz / 16; for (int i=0;iNv/2;i++) { - betav[i] = (betal[i] != betar[i]) ? 1 : -1; - } - } + } else { + assert(node->right->betaInit); + memcpy(betav, betar, sz * sizeof(*betav)); + node->betaInit = true; } - else memcpy((void*)&betav[0],betar,(node->Nv/2)*sizeof(int16_t)); - memcpy((void*)&betav[node->Nv/2],betar,(node->Nv/2)*sizeof(int16_t)); + assert(node->right->betaInit); + memcpy(&betav[sz], betar, sz * sizeof(*betav)); + node->betaInit = true; } void generic_polar_decoder(const t_nrPolar_params *pp, decoder_node_t *node, uint8_t *nr_polar_U) @@ -415,5 +401,5 @@ void generic_polar_decoder(const t_nrPolar_params *pp, decoder_node_t *node, uin if (node->right->leaf == 0) generic_polar_decoder(pp, node->right, nr_polar_U); - computeBeta(pp, node); + computeBeta(node); } diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h b/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h index 84b3241e68..82292fb8fe 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h @@ -63,18 +63,18 @@ static const uint8_t nr_polar_subblock_interleaver_pattern[32] = {0,1,2,4,3,5,6, typedef struct decoder_node_t_s { struct decoder_node_t_s *left; struct decoder_node_t_s *right; - int level; - int leaf; - int Nv; - int first_leaf_index; - int all_frozen; - int16_t *alpha; - int16_t *beta; + uint64_t level: 16; + uint64_t leaf: 16; + uint64_t first_leaf_index: 16; + uint64_t all_frozen: 1; + uint64_t betaInit: 1; + uint32_t alpha; + uint32_t beta; } decoder_node_t; typedef struct decoder_tree_t_s { decoder_node_t *root; - int num_nodes; + simde__m256i buffer[1024]; // seems enough but to be refined } decoder_tree_t; typedef struct nrPolar_params { @@ -100,6 +100,7 @@ typedef struct nrPolar_params { uint16_t *interleaving_pattern; uint16_t *rate_matching_pattern; + uint16_t *i_bil_pattern; const uint16_t *Q_0_Nminus1; int16_t *Q_I_N; int16_t *Q_F_N; @@ -110,13 +111,10 @@ typedef struct nrPolar_params { const uint8_t **G_N; int groupsize; int *rm_tab; - uint64_t cprime_tab0[32][256]; - uint64_t cprime_tab1[32][256]; - uint64_t B_tab0[32][256]; - uint64_t B_tab1[32][256]; - // lowercase: bits, Uppercase: Bits stored in bytes - // polar_encoder vectors - decoder_tree_t tree; + uint64_t cprime_tab0[16][256]; + uint64_t cprime_tab1[16][256]; + uint64_t B_tab0[16][256]; + uint64_t B_tab1[16][256]; } t_nrPolar_params; void polar_encoder(uint32_t *input, @@ -164,19 +162,23 @@ int8_t polar_decoder_dci(double *input, void generic_polar_decoder(const t_nrPolar_params *pp, decoder_node_t *node, uint8_t *nr_polar_U); -void computeBeta(const t_nrPolar_params *pp, - decoder_node_t *node); +static inline int16_t *treeAlpha(decoder_node_t *node) +{ + return (int16_t *)((uint8_t *)node + node->alpha); +} -void build_decoder_tree(t_nrPolar_params *pp); +static inline int8_t *treeBeta(decoder_node_t *node) +{ + return (int8_t *)node + node->beta; +} + +void build_decoder_tree(decoder_tree_t *tree, const t_nrPolar_params *pp); void build_polar_tables(t_nrPolar_params *polarParams); void init_polar_deinterleaver_table(t_nrPolar_params *polarParams); void nr_polar_print_polarParams(void); -t_nrPolar_params *nr_polar_params (int8_t messageType, - uint16_t messageLength, - uint8_t aggregation_level, - int decoder_flag); +t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, uint8_t aggregation_level); uint16_t nr_polar_aggregation_prime (uint8_t aggregation_level); @@ -207,14 +209,6 @@ void nr_polar_rate_matching(double *input, uint16_t N, uint16_t E); -void nr_polar_rate_matching_int16(int16_t *input, - int16_t *output, - const uint16_t *rmp, - const uint16_t K, - const uint16_t N, - const uint16_t E, - const uint8_t i_bil); - void nr_polar_interleaving_pattern(uint16_t K, uint8_t I_IL, uint16_t *PI_k_); @@ -256,13 +250,6 @@ void nr_polar_generate_u(uint64_t *u, void nr_polar_uxG(uint8_t const* u, size_t N, uint8_t* D); -void nr_polar_info_extraction_from_u(uint64_t *Cprime, - const uint8_t *u, - const uint8_t *information_bit_pattern, - const uint8_t *parity_check_bit_pattern, - uint16_t N, - uint8_t n_pc); - void nr_polar_bit_insertion(uint8_t *input, uint8_t *output, uint16_t N, @@ -328,7 +315,52 @@ static inline void nr_polar_deinterleaver(uint8_t *input, uint8_t *output, uint1 output[pattern[i]] = input[i]; } -void delete_decoder_tree(t_nrPolar_params *); +/* + * De-interleaving of coded bits implementation + * TS 138.212: Section 5.4.1.3 - Interleaving of coded bits + */ +static inline void nr_polar_rm_deinterleaving_lut(uint16_t *out, const uint E) +{ + int16_t in[E]; + for (int i = 0; i < E; i++) + in[i] = i; + int T = ceil((sqrt(8 * E + 1) - 1) / 2); + int v_tab[T][T]; + memset(v_tab, 0, sizeof(v_tab)); + int k = 0; + for (int i = 0; i < T; i++) { + for (int j = 0; j < T - i; j++) { + if (k < E) { + v_tab[i][j] = k + 1; + } + k++; + } + } + + int v[T][T]; + k = 0; + for (int j = 0; j < T; j++) { + for (int i = 0; i < T - j; i++) { + if (k < E && v_tab[i][j] != 0) { + v[i][j] = in[k]; + k++; + } else { + v[i][j] = INT_MAX; + } + } + } + + k = 0; + memset(out, 0, E * sizeof(*out)); + for (int i = 0; i < T; i++) { + for (int j = 0; j < T - i; j++) { + if (v[i][j] != INT_MAX) { + out[k] = v[i][j]; + k++; + } + } + } +} extern pthread_mutex_t PolarListMutex; static inline void polarReturn(t_nrPolar_params *polarParams) diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c index c23513bdf6..285f936085 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c @@ -47,7 +47,7 @@ void polar_encoder(uint32_t *in, int8_t messageType, uint16_t messageLength, uint8_t aggregation_level) { - t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, false); + t_nrPolar_params *polarParams = nr_polar_params(messageType, messageLength, aggregation_level); uint8_t nr_polar_A[polarParams->payloadBits]; nr_bit2byte_uint32_8(in, polarParams->payloadBits, nr_polar_A); /* @@ -146,7 +146,7 @@ void polar_encoder_dci(uint32_t *in, int8_t messageType, uint16_t messageLength, uint8_t aggregation_level) { - t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, false); + t_nrPolar_params *polarParams = nr_polar_params(messageType, messageLength, aggregation_level); #ifdef DEBUG_POLAR_ENCODER_DCI printf("[polar_encoder_dci] in: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\n", in[0], in[1], in[2], in[3]); @@ -463,7 +463,7 @@ void polar_encoder_fast(uint64_t *A, uint16_t messageLength, uint8_t aggregation_level) { - t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, false); + t_nrPolar_params *polarParams = nr_polar_params(messageType, messageLength, aggregation_level); #ifdef POLAR_CODING_DEBUG printf("polarParams->payloadBits = %i\n", polarParams->payloadBits); diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_interleaving_pattern.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_interleaving_pattern.c index 264ef9731d..97450d9dbf 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_interleaving_pattern.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_interleaving_pattern.c @@ -33,7 +33,7 @@ #include "PHY/CODING/nrPolar_tools/nr_polar_defs.h" void nr_polar_interleaving_pattern(uint16_t K, uint8_t I_IL, uint16_t *PI_k_){ - uint K_IL_max = 164, k = 0; + uint K_IL_max = 164; uint8_t interleaving_pattern_table[164] = { 0, 2, 4, 7, 9, 14, 19, 20, 24, 25, 26, 28, 31, 34, 42, 45, 49, 50, 51, 53, 54, 56, 58, 59, 61, 62, 65, 66, 67, 69, 70, 71, 72, 76, 77, 81, 82, 83, 87, 88, 89, 91, 93, 95, 98, 101, 104, 106, @@ -44,10 +44,10 @@ void nr_polar_interleaving_pattern(uint16_t K, uint8_t I_IL, uint16_t *PI_k_){ 40, 146, 41, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163}; if (I_IL == 0) { - for (; k <= K - 1; k++) + for (int k = 0; k < K; k++) PI_k_[k] = k; } else { - for (int m = 0; m <= (K_IL_max - 1); m++) { + for (int m = 0, k = 0; m < K_IL_max; m++) { if (interleaving_pattern_table[m] >= (K_IL_max - K)) { PI_k_[k] = interleaving_pattern_table[m] - (K_IL_max - K); k++; diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_procedures.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_procedures.c index a4d3bb301e..1a1a3fb830 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_procedures.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_procedures.c @@ -89,40 +89,6 @@ void nr_polar_generate_u(uint64_t *u, } } -void nr_polar_info_extraction_from_u(uint64_t *Cprime, - const uint8_t *u, - const uint8_t *information_bit_pattern, - const uint8_t *parity_check_bit_pattern, - uint16_t N, - uint8_t n_pc) -{ - int k = 0; - - if (n_pc > 0) { - for (int n = 0; n < N; n++) { - if (information_bit_pattern[n] == 1) { - if (parity_check_bit_pattern[n] == 0) { - int k1 = k >> 6; - int k2 = k - (k1 << 6); - Cprime[k1] |= (uint64_t)u[n] << k2; - k++; - } - } - } - - } else { - for (int n = 0; n < N; n++) { - if (information_bit_pattern[n] == 1) { - int k1 = k >> 6; - int k2 = k - (k1 << 6); - Cprime[k1] |= (uint64_t)u[n] << k2; - k++; - } - } - } -} - - static void encode_packed_byte(uint8_t* in_out) { @@ -442,76 +408,3 @@ void nr_polar_rate_matching(double *input, } } } - -/* - * De-interleaving of coded bits implementation - * TS 138.212: Section 5.4.1.3 - Interleaving of coded bits - */ -void nr_polar_rm_deinterleaving_cb(const int16_t *in, int16_t *out, const uint16_t E) -{ - int T = ceil((sqrt(8 * E + 1) - 1) / 2); - int v_tab[T][T]; - memset(v_tab, 0, sizeof(v_tab)); - int k = 0; - for (int i = 0; i < T; i++) { - for (int j = 0; j < T - i; j++) { - if (k < E) { - v_tab[i][j] = k + 1; - } - k++; - } - } - - int v[T][T]; - k = 0; - for (int j = 0; j < T; j++) { - for (int i = 0; i < T - j; i++) { - if (k < E && v_tab[i][j] != 0) { - v[i][j] = in[k]; - k++; - } else { - v[i][j] = INT_MAX; - } - } - } - - k = 0; - memset(out, 0, E * sizeof(*out)); - for (int i = 0; i < T; i++) { - for (int j = 0; j < T - i; j++) { - if (v[i][j] != INT_MAX) { - out[k] = v[i][j]; - k++; - } - } - } -} - -void nr_polar_rate_matching_int16(int16_t *input, - int16_t *output, - const uint16_t *rmp, - const uint16_t K, - const uint16_t N, - const uint16_t E, - const uint8_t i_bil) -{ - if (i_bil == 1) { - nr_polar_rm_deinterleaving_cb(input, input, E); - } - - if (E >= N) { // repetition - memset(output, 0, N * sizeof(*output)); - for (int i = 0; i <= E - 1; i++) - output[rmp[i]] += input[i]; - } else { - if ((K / (double)E) <= (7.0 / 16)) - memset(output, 0, N * sizeof(*output)); // puncturing - else { // shortening - for (int i = 0; i <= N - 1; i++) - output[i] = 32767; // instead of INFINITY, to prevent [-Woverflow] - } - - for (int i = 0; i <= E - 1; i++) - output[rmp[i]] = input[i]; - } -} diff --git a/openair1/PHY/CODING/nr_polar_init.c b/openair1/PHY/CODING/nr_polar_init.c index 1d12aae23e..d0c9dc3c60 100644 --- a/openair1/PHY/CODING/nr_polar_init.c +++ b/openair1/PHY/CODING/nr_polar_init.c @@ -47,8 +47,7 @@ static void nr_polar_delete_list(t_nrPolar_params * polarParams) { return; if (polarParams->nextPtr) nr_polar_delete_list(polarParams->nextPtr); - - delete_decoder_tree(polarParams); + // From build_polar_tables() free(polarParams->rm_tab); if (polarParams->crc_generator_matrix) @@ -71,7 +70,7 @@ static void nr_polar_delete(void) { pthread_mutex_unlock(&PolarListMutex); } -t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, uint8_t aggregation_level, int decoder_flag) +t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, uint8_t aggregation_level) { // The lock is weak, because we never delete in the list, only at exit time // therefore, returning t_nrPolar_params * from the list is safe for future usage @@ -87,8 +86,6 @@ t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, ui if (currentPtr->busy == false && currentPtr->idx == PolarKey ) { currentPtr->busy=true; pthread_mutex_unlock(&PolarListMutex); - if (decoder_flag && !currentPtr->tree.root) - build_decoder_tree(currentPtr); return currentPtr ; } else @@ -97,11 +94,10 @@ t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, ui // printf("currentPtr %p (polarParams %p)\n",currentPtr,polarParams); //Else, initialize and add node to the end of the linked list. - t_nrPolar_params *newPolarInitNode = calloc(sizeof(t_nrPolar_params),1); + t_nrPolar_params *newPolarInitNode = malloc(sizeof(t_nrPolar_params)); + AssertFatal(newPolarInitNode, "[nr_polar_init] New t_nrPolar_params * could not be created"); - newPolarInitNode->busy = true; - newPolarInitNode->nextPtr = NULL; - newPolarInitNode->nextPtr = PolarList; + *newPolarInitNode = (t_nrPolar_params){.busy = true, .nextPtr = PolarList}; PolarList = newPolarInitNode; pthread_mutex_unlock(&PolarListMutex); // LOG_D(PHY,"Setting new polarParams index %d, messageType %d, messageLength %d, aggregation_prime %d\n",(messageType * messageLength * aggregation_prime),messageType,messageLength,aggregation_prime); @@ -220,6 +216,10 @@ t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, ui newPolarInitNode->K, newPolarInitNode->N, newPolarInitNode->encoderLength); + if (newPolarInitNode->i_bil) { + newPolarInitNode->i_bil_pattern = malloc(sizeof(uint16_t) * newPolarInitNode->encoderLength); + nr_polar_rm_deinterleaving_lut(newPolarInitNode->i_bil_pattern, newPolarInitNode->encoderLength); + } newPolarInitNode->information_bit_pattern = malloc(sizeof(uint8_t) * newPolarInitNode->N); newPolarInitNode->parity_check_bit_pattern = malloc(sizeof(uint8_t) * newPolarInitNode->N); newPolarInitNode->Q_I_N = malloc(sizeof(int16_t) * (newPolarInitNode->K + newPolarInitNode->n_pc)); @@ -245,8 +245,6 @@ t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, ui // sort the Q_I_N array in ascending order (first K positions) qsort((void *)newPolarInitNode->Q_I_N,newPolarInitNode->K,sizeof(int16_t),intcmp); - if (decoder_flag == 1) - build_decoder_tree(newPolarInitNode); build_polar_tables(newPolarInitNode); init_polar_deinterleaver_table(newPolarInitNode); From 3e019af4d98bd6edfd06e6cc3724a90c40942cd8 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Wed, 4 Sep 2024 14:09:45 +0200 Subject: [PATCH 28/75] remove the big LUT for decoder de-interleaver no performance degradation some reformatting --- openair1/PHY/CODING/TESTBENCH/polartest.c | 200 +++++++++--------- .../CODING/nrPolar_tools/nr_polar_decoder.c | 118 ++--------- .../nrPolar_tools/nr_polar_decoding_tools.c | 23 +- .../PHY/CODING/nrPolar_tools/nr_polar_defs.h | 6 +- .../CODING/nrPolar_tools/nr_polar_encoder.c | 2 + openair1/PHY/CODING/nr_polar_init.c | 2 - 6 files changed, 136 insertions(+), 215 deletions(-) diff --git a/openair1/PHY/CODING/TESTBENCH/polartest.c b/openair1/PHY/CODING/TESTBENCH/polartest.c index 266f829efa..f39da2eb6d 100644 --- a/openair1/PHY/CODING/TESTBENCH/polartest.c +++ b/openair1/PHY/CODING/TESTBENCH/polartest.c @@ -48,49 +48,49 @@ int main(int argc, char *argv[]) printf("handling optarg %c\n",arguments); switch (arguments) { case 's': - SNRstart = atof(optarg); - SNRstop = SNRstart + 2; - break; + SNRstart = atof(optarg); + SNRstop = SNRstart + 2; + break; case 'd': - SNRinc = atof(optarg); - break; + SNRinc = atof(optarg); + break; case 'f': - SNRstop = atof(optarg); - break; + SNRstop = atof(optarg); + break; case 'm': - polarMessageType = atoi(optarg); - if (polarMessageType!=0 && polarMessageType!=1 && polarMessageType!=2) - printf("Illegal polar message type %d (should be 0,1 or 2)\n", polarMessageType); - break; + polarMessageType = atoi(optarg); + if (polarMessageType!=0 && polarMessageType!=1 && polarMessageType!=2) + printf("Illegal polar message type %d (should be 0,1 or 2)\n", polarMessageType); + break; case 'i': - iterations = atoi(optarg); - break; + iterations = atoi(optarg); + break; case 'l': decoderListSize = (uint8_t) atoi(optarg); break; case 'q': - decoder_int16 = 1; - break; + decoder_int16 = 1; + break; case 'g': - iterations = 1; - SNRstart = -6.0; - SNRstop = -6.0; - decoder_int16 = 1; - break; + iterations = 1; + SNRstart = -6.0; + SNRstop = -6.0; + decoder_int16 = 1; + break; case 'F': - logFlag = 1; - break; + logFlag = 1; + break; case 'L': - aggregation_level=atoi(optarg); + aggregation_level=atoi(optarg); if (aggregation_level != 1 && aggregation_level != 2 && aggregation_level != 4 && aggregation_level != 8 && aggregation_level != 16) { printf("Illegal aggregation level %d \n", aggregation_level); @@ -99,18 +99,18 @@ int main(int argc, char *argv[]) break; case 'k': - testLength=atoi(optarg); - if (testLength < 12 || testLength > 127) { - printf("Illegal packet bitlength %d \n",testLength); - exit(-1); - } - break; + testLength=atoi(optarg); + if (testLength < 12 || testLength > 127) { + printf("Illegal packet bitlength %d \n",testLength); + exit(-1); + } + break; case 'h': printf( - "./polartest\nOptions\n-h Print this help\n-s SNRstart (dB)\n-d SNRinc (dB)\n-f SNRstop (dB)\n-m [0=PBCH|1=DCI|2=UCI]\n" - "-i Number of iterations\n-l decoderListSize\n-q Flag for optimized coders usage\n-F Flag for test results logging\n" - "-L aggregation level (for DCI)\n-k packet_length (bits) for DCI/UCI\n"); + "./polartest\nOptions\n-h Print this help\n-s SNRstart (dB)\n-d SNRinc (dB)\n-f SNRstop (dB)\n-m [0=PBCH|1=DCI|2=UCI]\n" + "-i Number of iterations\n-l decoderListSize\n-q Flag for optimized coders usage\n-F Flag for test results logging\n" + "-L aggregation level (for DCI)\n-k packet_length (bits) for DCI/UCI\n"); exit(-1); break; @@ -155,7 +155,7 @@ int main(int argc, char *argv[]) strcat(fileName,currentTimeInfo); //Create "~/Desktop/polartestResults" folder if it doesn't already exist. /*struct stat folder = {0}; - if (stat(folderName, &folder) == -1) mkdir(folderName, S_IRWXU | S_IRWXG | S_IRWXO);*/ + if (stat(folderName, &folder) == -1) mkdir(folderName, S_IRWXU | S_IRWXG | S_IRWXO);*/ logFile = fopen(fileName, "w"); if (logFile==NULL) { @@ -203,25 +203,25 @@ int main(int argc, char *argv[]) t_nrPolar_params *currentPtrDCI=nr_polar_params(1, size, aggregation_level); polar_encoder_dci(dci_pdu, encoder_output, currentPtrDCI, rnti); - for (int i=0; i<54; i++) printf("encoder_output: [%2d]->0x%08x \n", i, encoder_output[i]); + for (int i=0; i<54; i++) + printf("encoder_output: [%2d]->0x%08x \n", i, encoder_output[i]); uint8_t *encoder_outputByte = malloc(sizeof(uint8_t) * currentPtrDCI->encoderLength); double *modulated_input = malloc (sizeof(double) * currentPtrDCI->encoderLength); double *channel_output = malloc (sizeof(double) * currentPtrDCI->encoderLength); uint32_t dci_est[4]; - memset(dci_est,0,sizeof(uint32_t)*4); - printf("dci_est: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\n", dci_est[0], dci_est[1], dci_est[2], dci_est[3]); + memset(dci_est,0,sizeof(dci_est)); nr_bit2byte_uint32_8(encoder_output, currentPtrDCI->encoderLength, encoder_outputByte); printf("[polartest] encoder_outputByte: "); for (int i = 0; i < currentPtrDCI->encoderLength; i++) printf("%d-", encoder_outputByte[i]); printf("\n"); SNR_lin = pow(10, 0/10); //SNR = 0 dB for(int i=0; iencoderLength; i++) { - if (encoder_outputByte[i] == 0) - modulated_input[i]=1/sqrt(2); - else - modulated_input[i]=(-1)/sqrt(2); - channel_output[i] = modulated_input[i] + (gaussdouble(0.0,1.0) * (1/sqrt(2*SNR_lin))); + if (encoder_outputByte[i] == 0) + modulated_input[i]=1/sqrt(2); + else + modulated_input[i]=(-1)/sqrt(2); + channel_output[i] = modulated_input[i] + (gaussdouble(0.0,1.0) * (1/sqrt(2*SNR_lin))); } decoderState = polar_decoder_dci(channel_output, dci_est, NR_POLAR_DECODER_LISTSIZE, rnti, 1, size, aggregation_level); @@ -235,41 +235,41 @@ int main(int argc, char *argv[]) #endif for (SNR = SNRstart; SNR <= SNRstop; SNR += SNRinc) { - printf("SNR %f\n",SNR); - SNR_lin = pow(10, SNR/10); + printf("SNR %f\n",SNR); + SNR_lin = pow(10, SNR/10); - for (itr = 1; itr <= iterations; itr++) { - //Generate random values for all the bits of "testInput", not just as much as "currentPtr->payloadBits". - for (int i = 0; i < testArrayLength; i++) { - for (int j = 0; j < (sizeof(testInput[0])*8)-1; j++) { - testInput[i] |= ( ((uint32_t) (rand()%2)) &1); - testInput[i]<<=1; - } - testInput[i] |= ( ((uint32_t) (rand()%2)) &1); - } + for (itr = 1; itr <= iterations; itr++) { + //Generate random values for all the bits of "testInput", not just as much as "currentPtr->payloadBits". + for (int i = 0; i < testArrayLength; i++) { + for (int j = 0; j < (sizeof(testInput[0])*8)-1; j++) { + testInput[i] |= ( ((uint32_t) (rand()%2)) &1); + testInput[i]<<=1; + } + testInput[i] |= ( ((uint32_t) (rand()%2)) &1); + } #ifdef DEBUG_POLARTEST - //testInput[0] = 0x360f8a5c; - printf("testInput: [0]->0x%08x\n", testInput[0]); + //testInput[0] = 0x360f8a5c; + printf("testInput: [0]->0x%08x\n", testInput[0]); #endif - int len_mod64=currentPtr->payloadBits&63; - ((uint64_t *)testInput)[currentPtr->payloadBits/64]&=((((uint64_t)1)<payloadBits&63; + ((uint64_t *)testInput)[currentPtr->payloadBits/64]&=((((uint64_t)1)< PBCH, 1 --> DCI, -1 --> UCI - if (polarMessageType == 0) - polar_encoder(testInput, encoderOutput, polarMessageType, testLength, aggregation_level); - else if (polarMessageType == 1) - polar_encoder_dci(testInput, encoderOutput, rnti, polarMessageType, testLength, aggregation_level); - } - stop_meas(&timeEncoder); + start_meas(&timeEncoder); + if (decoder_int16==1) { + polar_encoder_fast((uint64_t *)testInput, encoderOutput, 0, 0, polarMessageType, testLength, aggregation_level); + //polar_encoder_fast((uint64_t*)testInput, (uint64_t*)encoderOutput,0,0,currentPtr); + } else { //0 --> PBCH, 1 --> DCI, -1 --> UCI + if (polarMessageType == 0) + polar_encoder(testInput, encoderOutput, polarMessageType, testLength, aggregation_level); + else if (polarMessageType == 1) + polar_encoder_dci(testInput, encoderOutput, rnti, polarMessageType, testLength, aggregation_level); + } + stop_meas(&timeEncoder); #ifdef DEBUG_POLARTEST - printf("encoderOutput: [0]->0x%08x\n", encoderOutput[0]); - //for (int i=1;i0x%08x\n", i, encoderOutput[1]); + printf("encoderOutput: [0]->0x%08x\n", encoderOutput[0]); + //for (int i=1;i0x%08x\n", i, encoderOutput[1]); #endif //Bit-to-byte: @@ -277,14 +277,14 @@ int main(int argc, char *argv[]) //BPSK modulation for(int i=0; i 15) channelOutput_int16[i] = 127; else if (channelOutput[i] < -16) @@ -296,17 +296,17 @@ int main(int argc, char *argv[]) start_meas(&timeDecoder); - if (decoder_int16==1) { + if (decoder_int16 == 1) { decoderState = polar_decoder_int16(channelOutput_int16, (uint64_t *)estimatedOutput, 0, polarMessageType, testLength, aggregation_level); - } else { //0 --> PBCH, 1 --> DCI, -1 --> UCI - if (polarMessageType == 0) { + } else { // 0 --> PBCH, 1 --> DCI, -1 --> UCI + if (polarMessageType == 0) { decoderState = - polar_decoder(channelOutput, estimatedOutput, decoderListSize, polarMessageType, testLength, aggregation_level); + polar_decoder(channelOutput, estimatedOutput, decoderListSize, polarMessageType, testLength, aggregation_level); } else if (polarMessageType == 1) { decoderState = polar_decoder_dci(channelOutput, estimatedOutput, @@ -325,28 +325,28 @@ int main(int argc, char *argv[]) //calculate errors if (decoderState!=0) { - blockErrorState=-1; - nBitError=-1; + blockErrorState=-1; + nBitError=-1; } else { - for (int i = 0; i < (testArrayLength-1); i++) { - for (int j = 0; j < 32; j++) { - if ( ((estimatedOutput[i]>>j) & 1) != ((testInput[i]>>j) & 1) ) - nBitError++; - } - } - for (int j = 0; j < testLength - ((testArrayLength-1) * 32); j++) - if ( ((estimatedOutput[(testArrayLength-1)]>>j) & 1) != ((testInput[(testArrayLength-1)]>>j) & 1) ) - nBitError++; + for (int i = 0; i < (testArrayLength-1); i++) { + for (int j = 0; j < 32; j++) { + if ( ((estimatedOutput[i]>>j) & 1) != ((testInput[i]>>j) & 1) ) + nBitError++; + } + } + for (int j = 0; j < testLength - ((testArrayLength-1) * 32); j++) + if ( ((estimatedOutput[(testArrayLength-1)]>>j) & 1) != ((testInput[(testArrayLength-1)]>>j) & 1) ) + nBitError++; } if (nBitError>0) blockErrorState=1; #ifdef DEBUG_POLARTEST - for (int i = 0; i < testArrayLength; i++) - printf("[polartest/decoderState=%u] testInput[%d]=0x%08x, estimatedOutput[%d]=0x%08x\n", - decoderState, - i, - testInput[i], - i, - estimatedOutput[i]); + for (int i = 0; i < testArrayLength; i++) + printf("[polartest/decoderState=%u] testInput[%d]=0x%08x, estimatedOutput[%d]=0x%08x\n", + decoderState, + i, + testInput[i], + i, + estimatedOutput[i]); #endif //Iteration times are in microseconds. @@ -363,9 +363,9 @@ int main(int argc, char *argv[]) decoderState=0; nBitError=0; blockErrorState=0; - memset(testInput,0,sizeof(uint32_t) * realArrayLength); - memset(encoderOutput,0,sizeof(uint32_t) * coderArrayLength); - memset(estimatedOutput,0,sizeof(uint32_t) * realArrayLength); + memset(testInput,0,sizeof(uint32_t) * realArrayLength); + memset(encoderOutput,0,sizeof(uint32_t) * coderArrayLength); + memset(estimatedOutput,0,sizeof(uint32_t) * realArrayLength); } //Calculate error statistics for the SNR. diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c index 1d7e7e8373..5a61eebb3d 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c @@ -592,29 +592,6 @@ int8_t polar_decoder_dci(double *input, return 0; } -void init_polar_deinterleaver_table(t_nrPolar_params *polarParams) { - AssertFatal(polarParams->K > 17, "K = %d < 18, is not allowed\n",polarParams->K); - AssertFatal(polarParams->K < 129, "K = %d > 128, is not supported yet\n",polarParams->K); - int numbytes = (polarParams->K + 7) / 8; - for (int byte=0; byteK >> 3) ? 8 : polarParams->K & 7; - - for (int bit = 0; bit < numbits; bit++) { - // flip bit endian for B - int ip = polarParams->K - 1 - polarParams->interleaving_pattern[(8 * byte) + bit]; - int ipmod64 = ip & 63; - AssertFatal(ip < 128, "ip = %d\n", ip); - for (int val=0; val<256; val++) { - int bit_i = (val >> bit) & 1; - if (ip < 64) - polarParams->B_tab0[byte][val] |= ((uint64_t)bit_i) << ipmod64; - else - polarParams->B_tab1[byte][val] |= ((uint64_t)bit_i) << ipmod64; - } - } - } -} - static inline void nr_polar_rate_matching_int16(int16_t *input, int16_t *output, const uint16_t *rmp, @@ -644,28 +621,29 @@ static inline void nr_polar_info_extraction_from_u(uint64_t *Cprime, const uint8_t *u, const uint8_t *information_bit_pattern, const uint8_t *parity_check_bit_pattern, + const uint16_t *interleaving_pattern, uint16_t N, - uint8_t n_pc) + uint8_t n_pc, + int K) { int k = 0; if (n_pc > 0) { for (int n = 0; n < N; n++) { - if (information_bit_pattern[n] == 1) { - if (parity_check_bit_pattern[n] == 0) { - int k1 = k >> 6; - int k2 = k - (k1 << 6); - Cprime[k1] |= (uint64_t)u[n] << k2; - k++; - } + if (information_bit_pattern[n] == 1 && parity_check_bit_pattern[n] == 0) { + int targetBit = K - 1 - interleaving_pattern[k]; + int k1 = targetBit >> 6; + int k2 = targetBit & 63; + Cprime[k1] |= (uint64_t)u[n] << k2; + k++; } } - } else { for (int n = 0; n < N; n++) { if (information_bit_pattern[n] == 1) { - int k1 = k >> 6; - int k2 = k - (k1 << 6); + int targetBit = K - 1 - interleaving_pattern[k]; + int k1 = targetBit >> 6; + int k2 = targetBit & 63; Cprime[k1] |= (uint64_t)u[n] << k2; k++; } @@ -725,18 +703,8 @@ uint32_t polar_decoder_int16(int16_t *input, #endif uint8_t nr_polar_U[N]; memset(nr_polar_U, 0, sizeof(nr_polar_U)); - static uint64_t cnt = 0, timeTree = 0, timeDecoder = 0; - uint64_t a = rdtsc_oai(); - decoder_tree_t tree; - build_decoder_tree(&tree, polarParams); - uint64_t b = rdtsc_oai(); - memcpy(treeAlpha(tree.root), d_tilde, sizeof(d_tilde)); - generic_polar_decoder(polarParams, tree.root, nr_polar_U); - uint64_t c = rdtsc_oai(); - timeTree += b - a; - timeDecoder += c - b; - if (cnt++ % 1000 == 0) - printf("tree: %ld, dec %ld\n", timeTree / (cnt), timeDecoder / (cnt)); + memcpy(treeAlpha(polarParams->decoder.root), d_tilde, sizeof(d_tilde)); + generic_polar_decoder(polarParams, polarParams->decoder.root, nr_polar_U); #ifdef POLAR_CODING_DEBUG printf("u: "); for (int i = 0; i < N; i++) { @@ -749,13 +717,15 @@ uint32_t polar_decoder_int16(int16_t *input, #endif // Extract the information bits (û to ĉ) - uint64_t Cprime[4]= {0}; - nr_polar_info_extraction_from_u(Cprime, + uint64_t B[4] = {0}; + nr_polar_info_extraction_from_u(B, nr_polar_U, polarParams->information_bit_pattern, polarParams->parity_check_bit_pattern, + polarParams->interleaving_pattern, N, - polarParams->n_pc); + polarParams->n_pc, + polarParams->K); #ifdef POLAR_CODING_DEBUG printf("c: "); @@ -765,55 +735,7 @@ uint32_t polar_decoder_int16(int16_t *input, } int n1 = n >> 6; int n2 = n - (n1 << 6); - printf("%lu", (Cprime[n1] >> n2) & 1); - } - printf("\n"); -#endif - - //Deinterleaving (ĉ to b) - uint8_t *Cprimebyte = (uint8_t *)Cprime; - uint64_t B[4] = {0}; - - if (polarParams->K<65) { - B[0] = polarParams->B_tab0[0][Cprimebyte[0]] | polarParams->B_tab0[1][Cprimebyte[1]] | polarParams->B_tab0[2][Cprimebyte[2]] - | polarParams->B_tab0[3][Cprimebyte[3]] | polarParams->B_tab0[4][Cprimebyte[4]] | polarParams->B_tab0[5][Cprimebyte[5]] - | polarParams->B_tab0[6][Cprimebyte[6]] | polarParams->B_tab0[7][Cprimebyte[7]]; - } else if (polarParams->K<129) { - for (int k = 0; k < 8; k++) { - B[0] |= polarParams->B_tab0[k][Cprimebyte[k]]; - B[1] |= polarParams->B_tab1[k][Cprimebyte[k]]; - } - } - - uint128_t Cprime128 = *(uint128_t *)Cprime; - uint128_t res = 0; - uint deinterleaving_pattern[polarParams->K]; - - for (int i = 0; i < polarParams->K; i++) - deinterleaving_pattern[polarParams->interleaving_pattern[i]] = i; - for (int i = 0; i < polarParams->K; i++) { - uint128_t bit = (Cprime128 >> i) & 1; - res |= bit << (polarParams->K - 1 - deinterleaving_pattern[i]); - } - uint128_t B128 = *(uint128_t *)B; - printf("old:(k=%d)", polarParams->K); - for (int i = 0; i < polarParams->K; i++) - printf("%lld", (B128 >> i) & 1); - printf("\nnew:(k=%d)", polarParams->K); - for (int i = 0; i < polarParams->K; i++) - printf("%lld", (res >> i) & 1); - printf("\n\n"); -#ifdef POLAR_CODING_DEBUG - int B_array = (polarParams->K + 63) >> 6; - int n_start = (B_array << 6) - polarParams->K; - printf("b: "); - for (int n = 0; n < polarParams->K; n++) { - if (n % 4 == 0) { - printf(" "); - } - int n1 = (n + n_start) >> 6; - int n2 = (n + n_start) - (n1 << 6); - printf("%lu", (B[B_array - 1 - n1] >> (63 - n2)) & 1); + printf("%lu", (B[n1] >> n2) & 1); } printf("\n"); #endif diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c index aa7f835291..a3d20a37c7 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c @@ -161,8 +161,10 @@ static inline decoder_node_t *new_decoder_node(simde__m256i **buffer, if (leaf_sz > 15) // we will use SIMD256 leaf_sz = (leaf_sz + 15) & ~15; const int tree_sz = (sizeof(decoder_node_t) + 31) & ~31; - decoder_node_t *node = (decoder_node_t *)*buffer; - *buffer = *buffer + (tree_sz + leaf_sz * sizeof(int16_t) + leaf_sz + sizeof(**buffer) - 1) / sizeof(**buffer); + uintptr_t tmp = (uintptr_t)*buffer; + tmp = (tmp + sizeof(**buffer) - 1) & ~(sizeof(**buffer) - 1); + decoder_node_t *node = (decoder_node_t *)tmp; + *buffer = (simde__m256i *)(tmp + tree_sz + leaf_sz * sizeof(int16_t) + leaf_sz); *node = (decoder_node_t){.first_leaf_index = first_leaf_index, .level = level, .leaf = leaf, @@ -204,17 +206,16 @@ static inline decoder_node_t *add_nodes(decoder_tree_t *tree, return(new_node); } -void build_decoder_tree(decoder_tree_t *tree, const t_nrPolar_params *pp) +void build_decoder_tree(t_nrPolar_params *pp) { - simde__m256i *buffer = tree->buffer; - tree->root = add_nodes(tree, pp->n, 0, pp->information_bit_pattern, &buffer); - AssertFatal(buffer < tree->buffer + sizeofArray(tree->buffer), + uintptr_t tmp = (uintptr_t)pp->decoder.buffer; + tmp = (tmp + sizeof(*pp->decoder.buffer) - 1) & ~(sizeof(*pp->decoder.buffer) - 1); + simde__m256i *buffer = (simde__m256i *)tmp; + pp->decoder.root = add_nodes(&pp->decoder, pp->n, 0, pp->information_bit_pattern, &buffer); + AssertFatal(buffer < pp->decoder.buffer + sizeofArray(pp->decoder.buffer), "Arbitrary size too small (also check arbitrary max size of the entire polar decoder) %ld instead of max %ld\n", - buffer - tree->buffer, - sizeofArray(tree->buffer)); -#ifdef DEBUG_NEW_IMPL - printf("root : left %p, right %p\n", tree->root->left, tree->root->right); -#endif + buffer - pp->decoder.buffer, + sizeofArray(pp->decoder.buffer)); } static inline void applyFtoleft(const t_nrPolar_params *pp, decoder_node_t *node, uint8_t *output) diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h b/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h index 82292fb8fe..83819018a9 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h @@ -113,8 +113,7 @@ typedef struct nrPolar_params { int *rm_tab; uint64_t cprime_tab0[16][256]; uint64_t cprime_tab1[16][256]; - uint64_t B_tab0[16][256]; - uint64_t B_tab1[16][256]; + decoder_tree_t decoder; } t_nrPolar_params; void polar_encoder(uint32_t *input, @@ -172,9 +171,8 @@ static inline int8_t *treeBeta(decoder_node_t *node) return (int8_t *)node + node->beta; } -void build_decoder_tree(decoder_tree_t *tree, const t_nrPolar_params *pp); +void build_decoder_tree(t_nrPolar_params *pp); void build_polar_tables(t_nrPolar_params *polarParams); -void init_polar_deinterleaver_table(t_nrPolar_params *polarParams); void nr_polar_print_polarParams(void); diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c index 285f936085..cc85216f23 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c @@ -452,6 +452,8 @@ void build_polar_tables(t_nrPolar_params *polarParams) { // rerun again to create groups for (int outpos = 0, tcnt = 0; outpos < polarParams->encoderLength; outpos += mingroupsize, tcnt++) polarParams->rm_tab[tcnt] = polarParams->rate_matching_pattern[outpos] >> shift; + + build_decoder_tree(polarParams); } diff --git a/openair1/PHY/CODING/nr_polar_init.c b/openair1/PHY/CODING/nr_polar_init.c index d0c9dc3c60..dda293a07e 100644 --- a/openair1/PHY/CODING/nr_polar_init.c +++ b/openair1/PHY/CODING/nr_polar_init.c @@ -246,8 +246,6 @@ t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, ui qsort((void *)newPolarInitNode->Q_I_N,newPolarInitNode->K,sizeof(int16_t),intcmp); build_polar_tables(newPolarInitNode); - - init_polar_deinterleaver_table(newPolarInitNode); return newPolarInitNode; } From a23520664767f51c2e9d31b8a08d6e5d607e080a Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Wed, 4 Sep 2024 18:20:49 +0200 Subject: [PATCH 29/75] minor improvements for memory and SIMDE --- openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c | 4 ++-- openair1/PHY/CODING/nr_polar_init.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c index a3d20a37c7..412f1a9a48 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c @@ -320,13 +320,13 @@ static inline void applyGtoright(const t_nrPolar_params *pp, decoder_node_t *nod int avx2len = sz / 16; for (int i = 0; i < avx2len; i++) { - simde__m256i tmp = simde_mm256_sign_epi16(((simde__m256i *)alpha_v)[i], _mm256_cvtepi8_epi16(((simde__m128i *)betal)[i])); + simde__m256i tmp = simde_mm256_sign_epi16(((simde__m256i *)alpha_v)[i], simde_mm256_cvtepi8_epi16(((simde__m128i *)betal)[i])); ((simde__m256i *)alpha_r)[i] = simde_mm256_subs_epi16(((simde__m256i *)alpha_v)[i + avx2len], tmp); } } else if (avx2mod == 8) { - simde__m128i tmp = simde_mm_sign_epi16(((simde__m128i *)alpha_v)[0], _mm_cvtepi8_epi16(((simde__m128i *)betal)[0])); + simde__m128i tmp = simde_mm_sign_epi16(((simde__m128i *)alpha_v)[0], simde_mm_cvtepi8_epi16(((simde__m128i *)betal)[0])); ((simde__m128i *)alpha_r)[0] = simde_mm_subs_epi16(((simde__m128i *)alpha_v)[1], tmp); } else { for (int i = 0; i < sz; i++) { diff --git a/openair1/PHY/CODING/nr_polar_init.c b/openair1/PHY/CODING/nr_polar_init.c index dda293a07e..1b04f76da3 100644 --- a/openair1/PHY/CODING/nr_polar_init.c +++ b/openair1/PHY/CODING/nr_polar_init.c @@ -57,6 +57,7 @@ static void nr_polar_delete_list(t_nrPolar_params * polarParams) { free(polarParams->rate_matching_pattern); free(polarParams->information_bit_pattern); free(polarParams->parity_check_bit_pattern); + free(polarParams->i_bil_pattern); free(polarParams->Q_I_N); free(polarParams->Q_F_N); free(polarParams->Q_PC_N); From 00e50f082d9a0ca7f04c92896e6589c5c8509a7e Mon Sep 17 00:00:00 2001 From: Bartosz Podrygajlo Date: Tue, 10 Sep 2024 10:38:48 +0200 Subject: [PATCH 30/75] Limit recursion in polar decoder Use non-recursive polar decoder after traversing the tree once. Maximum number of nodes is set to 600 (unsure of the maximum). This is more performant than the recursive version. --- .../nrPolar_tools/nr_polar_decoding_tools.c | 46 +++++++++++++++++-- .../PHY/CODING/nrPolar_tools/nr_polar_defs.h | 14 +++++- openair1/PHY/CODING/nr_polar_init.c | 2 +- 3 files changed, 56 insertions(+), 6 deletions(-) diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c index 412f1a9a48..21827c4bc5 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c @@ -390,17 +390,55 @@ static inline void computeBeta(decoder_node_t *node) node->betaInit = true; } -void generic_polar_decoder(const t_nrPolar_params *pp, decoder_node_t *node, uint8_t *nr_polar_U) -{ +void generic_polar_decoder_recursive(t_nrPolar_params *pp, decoder_node_t *node, uint8_t *nr_polar_U) { // Apply F to left applyFtoleft(pp, node, nr_polar_U); + int iter = pp->tree_linearization.iter++; + pp->tree_linearization.op_list[iter].op_code = POLAR_OP_CODE_LEFT; + pp->tree_linearization.op_list[iter].node = node; + // if left is not a leaf recurse down to the left if (node->left->leaf==0) - generic_polar_decoder(pp, node->left, nr_polar_U); + generic_polar_decoder_recursive(pp, node->left, nr_polar_U); applyGtoright(pp, node, nr_polar_U); + iter = pp->tree_linearization.iter++; + pp->tree_linearization.op_list[iter].op_code = POLAR_OP_CODE_RIGHT; + pp->tree_linearization.op_list[iter].node = node; + if (node->right->leaf == 0) - generic_polar_decoder(pp, node->right, nr_polar_U); + generic_polar_decoder_recursive(pp, node->right, nr_polar_U); computeBeta(node); + + iter = pp->tree_linearization.iter++; + pp->tree_linearization.op_list[iter].op_code = POLAR_OP_CODE_BETA; + pp->tree_linearization.op_list[iter].node = node; +} + +void generic_polar_decoder(t_nrPolar_params *pp, decoder_node_t *node, uint8_t *nr_polar_U) +{ + if (pp->tree_linearization.is_initialized == false) { + pp->tree_linearization.iter = 0; + generic_polar_decoder_recursive(pp, node, nr_polar_U); + pp->tree_linearization.is_initialized = true; + AssertFatal(pp->tree_linearization.iter < sizeofArray(pp->tree_linearization.op_list), + "Arbitrary size %lu is too small, number of operations is %d", + sizeofArray(pp->tree_linearization.op_list), + pp->tree_linearization.iter); + } else { + for (int i = 0; i < pp->tree_linearization.iter; i++) { + decoder_node_t *n = pp->tree_linearization.op_list[i].node; + switch (pp->tree_linearization.op_list[i].op_code) { + case POLAR_OP_CODE_LEFT: + applyFtoleft(pp, n, nr_polar_U); + break; + case POLAR_OP_CODE_RIGHT: + applyGtoright(pp, n, nr_polar_U); + break; + case POLAR_OP_CODE_BETA: + computeBeta(n); + } + } + } } diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h b/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h index 83819018a9..546260a5f2 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h @@ -60,6 +60,10 @@ static const uint8_t nr_polar_subblock_interleaver_pattern[32] = {0,1,2,4,3,5,6, #define uint128_t __uint128_t +#define POLAR_OP_CODE_LEFT 0 +#define POLAR_OP_CODE_RIGHT 1 +#define POLAR_OP_CODE_BETA 2 + typedef struct decoder_node_t_s { struct decoder_node_t_s *left; struct decoder_node_t_s *right; @@ -114,6 +118,14 @@ typedef struct nrPolar_params { uint64_t cprime_tab0[16][256]; uint64_t cprime_tab1[16][256]; decoder_tree_t decoder; + struct { + int iter; + bool is_initialized; + struct { + int op_code; + decoder_node_t* node; + } op_list[600]; + } tree_linearization; } t_nrPolar_params; void polar_encoder(uint32_t *input, @@ -159,7 +171,7 @@ int8_t polar_decoder_dci(double *input, uint16_t messageLength, uint8_t aggregation_level); -void generic_polar_decoder(const t_nrPolar_params *pp, decoder_node_t *node, uint8_t *nr_polar_U); +void generic_polar_decoder(t_nrPolar_params *pp, decoder_node_t *node, uint8_t *nr_polar_U); static inline int16_t *treeAlpha(decoder_node_t *node) { diff --git a/openair1/PHY/CODING/nr_polar_init.c b/openair1/PHY/CODING/nr_polar_init.c index 1b04f76da3..899aa5447f 100644 --- a/openair1/PHY/CODING/nr_polar_init.c +++ b/openair1/PHY/CODING/nr_polar_init.c @@ -98,7 +98,7 @@ t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, ui t_nrPolar_params *newPolarInitNode = malloc(sizeof(t_nrPolar_params)); AssertFatal(newPolarInitNode, "[nr_polar_init] New t_nrPolar_params * could not be created"); - *newPolarInitNode = (t_nrPolar_params){.busy = true, .nextPtr = PolarList}; + *newPolarInitNode = (t_nrPolar_params){.busy = true, .nextPtr = PolarList, .tree_linearization.is_initialized = false}; PolarList = newPolarInitNode; pthread_mutex_unlock(&PolarListMutex); // LOG_D(PHY,"Setting new polarParams index %d, messageType %d, messageLength %d, aggregation_prime %d\n",(messageType * messageLength * aggregation_prime),messageType,messageLength,aggregation_prime); From 4a971caf9f2e161958caa98da7308ac89118ae43 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Fri, 4 Oct 2024 15:24:35 +0200 Subject: [PATCH 31/75] use SIMD in the highest cpu part the version in develop is difficult to understand, and surprizing design it loops only when avx2mod == 0 because when this test is false, the size is always small i also spent time to understand, but i think i have not changed it by not looping over the array. --- .../nrPolar_tools/nr_polar_decoding_tools.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c index 21827c4bc5..434c8a420d 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c @@ -321,24 +321,16 @@ static inline void applyGtoright(const t_nrPolar_params *pp, decoder_node_t *nod for (int i = 0; i < avx2len; i++) { simde__m256i tmp = simde_mm256_sign_epi16(((simde__m256i *)alpha_v)[i], simde_mm256_cvtepi8_epi16(((simde__m128i *)betal)[i])); - ((simde__m256i *)alpha_r)[i] = - - simde_mm256_subs_epi16(((simde__m256i *)alpha_v)[i + avx2len], tmp); + ((simde__m256i *)alpha_r)[i] = simde_mm256_subs_epi16(((simde__m256i *)alpha_v)[i + avx2len], tmp); } } else if (avx2mod == 8) { simde__m128i tmp = simde_mm_sign_epi16(((simde__m128i *)alpha_v)[0], simde_mm_cvtepi8_epi16(((simde__m128i *)betal)[0])); ((simde__m128i *)alpha_r)[0] = simde_mm_subs_epi16(((simde__m128i *)alpha_v)[1], tmp); } else { - for (int i = 0; i < sz; i++) { - int temp_alpha_r = alpha_v[i + sz] - (betal[i] * alpha_v[i]); - if (temp_alpha_r > SHRT_MAX) { - alpha_r[i] = SHRT_MAX; - } else if (temp_alpha_r < -SHRT_MAX) { - alpha_r[i] = -SHRT_MAX; - } else { - alpha_r[i] = temp_alpha_r; - } - } + simde__m128i tmp = simde_mm_sign_epi16(*(simde__m128i *)alpha_v, simde_mm_cvtepi8_epi16(*(simde__m128i *)betal)); + simde__m128i tmp2 = simde_mm_loadu_si128((simde__m128i *)(alpha_v + sz)); + simde__m128i res = simde_mm_subs_epi16(tmp2, tmp); + simde_mm_storeu_si128(alpha_r, res); } } if (sz == 1) { // apply hard decision on right node From 28234893f79dd0eaa32aad46c2c651c050c147dd Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Fri, 18 Oct 2024 11:29:32 +0200 Subject: [PATCH 32/75] add default value setting instead of assert if we process uninitialized beta --- .../CODING/nrPolar_tools/nr_polar_decoding_tools.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c index 434c8a420d..85fb382102 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c @@ -358,8 +358,15 @@ static inline void computeBeta(decoder_node_t *node) #endif assert(node->level); const int sz = 1 << (node->level - 1); - if (node->left->all_frozen==0) { // if left node is not aggregation of frozen bits - assert(node->left->betaInit && node->right->betaInit); + if (node->left->all_frozen == 0) { // if left node is not aggregation of frozen bits + if (!node->left->betaInit) { + memset(betal, -1, sz); + node->left->betaInit = true; + } + if (!node->right->betaInit) { + memset(betar, -1, sz); + node->right->betaInit = true; + } int avx2mod = sz & 31; if (avx2mod == 0) { int avx2len = sz / 16; From 16535f3de411c4a47cb814a82dda1b0ca8387366 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 7 Nov 2024 09:43:16 +0100 Subject: [PATCH 33/75] Reformat all polar code Commands used: clang-format -i openair1/PHY/CODING/TESTBENCH/polartest.c clang-format -i openair1/PHY/CODING/nr_polar_init.c clang-format -i openair1/PHY/CODING/nrPolar_tools/* --- openair1/PHY/CODING/TESTBENCH/polartest.c | 397 +++++++++-------- .../nrPolar_tools/nr_bitwise_operations.c | 8 +- .../PHY/CODING/nrPolar_tools/nr_crc_byte.c | 14 +- .../CODING/nrPolar_tools/nr_polar_dci_defs.h | 36 +- .../CODING/nrPolar_tools/nr_polar_decoder.c | 406 ++++++++++-------- .../nrPolar_tools/nr_polar_decoding_tools.c | 110 ++--- .../PHY/CODING/nrPolar_tools/nr_polar_defs.h | 133 +++--- .../CODING/nrPolar_tools/nr_polar_encoder.c | 278 ++++++------ .../nr_polar_interleaving_pattern.c | 5 +- .../nrPolar_tools/nr_polar_kernal_operation.c | 79 ++-- .../nrPolar_tools/nr_polar_matrix_and_array.c | 5 +- .../CODING/nrPolar_tools/nr_polar_pbch_defs.h | 72 ++-- .../nrPolar_tools/nr_polar_procedures.c | 143 +++--- .../nrPolar_tools/nr_polar_pucch_defs.h | 23 +- .../nrPolar_tools/nr_polar_rate_match.c | 7 +- .../nrPolar_tools/nr_polar_sequence_pattern.c | 112 ++++- .../CODING/nrPolar_tools/nr_polar_uci_defs.h | 28 +- openair1/PHY/CODING/nr_polar_init.c | 111 +++-- 18 files changed, 1041 insertions(+), 926 deletions(-) diff --git a/openair1/PHY/CODING/TESTBENCH/polartest.c b/openair1/PHY/CODING/TESTBENCH/polartest.c index f39da2eb6d..beab44c689 100644 --- a/openair1/PHY/CODING/TESTBENCH/polartest.c +++ b/openair1/PHY/CODING/TESTBENCH/polartest.c @@ -12,161 +12,162 @@ #include "PHY/CODING/coding_defs.h" #include "SIMULATION/TOOLS/sim.h" #include "common/config/config_userapi.h" -//#include "common/utils/LOG/log.h" +// #include "common/utils/LOG/log.h" #include "coding_unitary_defs.h" -//#define DEBUG_DCI_POLAR_PARAMS -//#define DEBUG_POLAR_TIMING -//#define DEBUG_POLARTEST +// #define DEBUG_DCI_POLAR_PARAMS +// #define DEBUG_POLAR_TIMING +// #define DEBUG_POLARTEST configmodule_interface_t *uniqCfg = NULL; int main(int argc, char *argv[]) { - //Default simulation values (Aim for iterations = 1000000.) - int decoder_int16=0; - int itr, iterations = 1000, arguments, polarMessageType = 0; //0=PBCH, 1=DCI, 2=UCI - double SNRstart = -20.0, SNRstop = 0.0, SNRinc= 0.5; //dB + // Default simulation values (Aim for iterations = 1000000.) + int decoder_int16 = 0; + int itr, iterations = 1000, arguments, polarMessageType = 0; // 0=PBCH, 1=DCI, 2=UCI + double SNRstart = -20.0, SNRstop = 0.0, SNRinc = 0.5; // dB double SNR, SNR_lin; int16_t nBitError = 0; // -1 = Decoding failed (All list entries have failed the CRC checks). - uint32_t decoderState=0, blockErrorState=0; //0 = Success, -1 = Decoding failed, 1 = Block Error. + uint32_t decoderState = 0, blockErrorState = 0; // 0 = Success, -1 = Decoding failed, 1 = Block Error. uint16_t testLength = NR_POLAR_PBCH_PAYLOAD_BITS, coderLength = NR_POLAR_PBCH_E; - uint16_t blockErrorCumulative=0, bitErrorCumulative=0; + uint16_t blockErrorCumulative = 0, bitErrorCumulative = 0; uint8_t aggregation_level = 8, decoderListSize = 8, logFlag = 0; - uint16_t rnti=0; + uint16_t rnti = 0; if ((uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY)) == 0) { exit_fun("[POLARTEST] Error, configuration module init failed\n"); } logInit(); - while ((arguments = getopt (argc, argv, "--:O:s:d:f:m:i:l:a:p:hqgFL:k:")) != -1) { - + while ((arguments = getopt(argc, argv, "--:O:s:d:f:m:i:l:a:p:hqgFL:k:")) != -1) { /* ignore long options starting with '--', option '-O' and their arguments that are handled by configmodule */ /* with this opstring getopt returns 1 for non-option arguments, refer to 'man 3 getopt' */ if (arguments == 1 || arguments == '-' || arguments == 'O') continue; - printf("handling optarg %c\n",arguments); + printf("handling optarg %c\n", arguments); switch (arguments) { - case 's': - SNRstart = atof(optarg); - SNRstop = SNRstart + 2; - break; + case 's': + SNRstart = atof(optarg); + SNRstop = SNRstart + 2; + break; - case 'd': - SNRinc = atof(optarg); - break; + case 'd': + SNRinc = atof(optarg); + break; - case 'f': - SNRstop = atof(optarg); - break; + case 'f': + SNRstop = atof(optarg); + break; - case 'm': - polarMessageType = atoi(optarg); - if (polarMessageType!=0 && polarMessageType!=1 && polarMessageType!=2) - printf("Illegal polar message type %d (should be 0,1 or 2)\n", polarMessageType); - break; + case 'm': + polarMessageType = atoi(optarg); + if (polarMessageType != 0 && polarMessageType != 1 && polarMessageType != 2) + printf("Illegal polar message type %d (should be 0,1 or 2)\n", polarMessageType); + break; - case 'i': - iterations = atoi(optarg); - break; + case 'i': + iterations = atoi(optarg); + break; - case 'l': - decoderListSize = (uint8_t) atoi(optarg); - break; + case 'l': + decoderListSize = (uint8_t)atoi(optarg); + break; - case 'q': - decoder_int16 = 1; - break; + case 'q': + decoder_int16 = 1; + break; - case 'g': - iterations = 1; - SNRstart = -6.0; - SNRstop = -6.0; - decoder_int16 = 1; - break; + case 'g': + iterations = 1; + SNRstart = -6.0; + SNRstop = -6.0; + decoder_int16 = 1; + break; - case 'F': - logFlag = 1; - break; + case 'F': + logFlag = 1; + break; - case 'L': - aggregation_level=atoi(optarg); - if (aggregation_level != 1 && aggregation_level != 2 && aggregation_level != 4 && aggregation_level != 8 - && aggregation_level != 16) { - printf("Illegal aggregation level %d \n", aggregation_level); + case 'L': + aggregation_level = atoi(optarg); + if (aggregation_level != 1 && aggregation_level != 2 && aggregation_level != 4 && aggregation_level != 8 + && aggregation_level != 16) { + printf("Illegal aggregation level %d \n", aggregation_level); + exit(-1); + } + break; + + case 'k': + testLength = atoi(optarg); + if (testLength < 12 || testLength > 127) { + printf("Illegal packet bitlength %d \n", testLength); + exit(-1); + } + break; + + case 'h': + printf( + "./polartest\nOptions\n-h Print this help\n-s SNRstart (dB)\n-d SNRinc (dB)\n-f SNRstop (dB)\n-m [0=PBCH|1=DCI|2=UCI]\n" + "-i Number of iterations\n-l decoderListSize\n-q Flag for optimized coders usage\n-F Flag for test results logging\n" + "-L aggregation level (for DCI)\n-k packet_length (bits) for DCI/UCI\n"); exit(-1); - } - break; + break; - case 'k': - testLength=atoi(optarg); - if (testLength < 12 || testLength > 127) { - printf("Illegal packet bitlength %d \n",testLength); - exit(-1); - } - break; - - case 'h': - printf( - "./polartest\nOptions\n-h Print this help\n-s SNRstart (dB)\n-d SNRinc (dB)\n-f SNRstop (dB)\n-m [0=PBCH|1=DCI|2=UCI]\n" - "-i Number of iterations\n-l decoderListSize\n-q Flag for optimized coders usage\n-F Flag for test results logging\n" - "-L aggregation level (for DCI)\n-k packet_length (bits) for DCI/UCI\n"); - exit(-1); - break; - - default: - perror("[polartest.c] Problem at argument parsing with getopt"); - exit(-1); - break; + default: + perror("[polartest.c] Problem at argument parsing with getopt"); + exit(-1); + break; } } - //Initiate timing. (Results depend on CPU Frequency. Therefore, might change due to performance variances during simulation.) - time_stats_t timeEncoder,timeDecoder; + // Initiate timing. (Results depend on CPU Frequency. Therefore, might change due to performance variances during simulation.) + time_stats_t timeEncoder, timeDecoder; cpu_meas_enabled = 1; reset_meas(&timeEncoder); reset_meas(&timeDecoder); randominit(0); crcTableInit(); - if (polarMessageType == 0) { //PBCH + if (polarMessageType == 0) { // PBCH aggregation_level = NR_POLAR_PBCH_AGGREGATION_LEVEL; - } else if (polarMessageType == 1) { //DCI - coderLength = 108*aggregation_level; - } else if (polarMessageType == 2) { //UCI - //pucch2 parameters, 1 symbol, aggregation_level = NPRB - AssertFatal(aggregation_level>2,"For UCI formats, aggregation (N_RB) should be > 2\n"); - coderLength = 16*aggregation_level; + } else if (polarMessageType == 1) { // DCI + coderLength = 108 * aggregation_level; + } else if (polarMessageType == 2) { // UCI + // pucch2 parameters, 1 symbol, aggregation_level = NPRB + AssertFatal(aggregation_level > 2, "For UCI formats, aggregation (N_RB) should be > 2\n"); + coderLength = 16 * aggregation_level; } - //Logging + // Logging time_t currentTime; char fileName[512], currentTimeInfo[25]; char folderName[] = "."; FILE *logFile = NULL; - if (logFlag){ - time (¤tTime); + if (logFlag) { + time(¤tTime); #ifdef DEBUG_POLAR_TIMING - sprintf(fileName,"%s/TIMING_ListSize_%d_Payload_%d_Itr_%d", folderName, decoderListSize, testLength, iterations); + sprintf(fileName, "%s/TIMING_ListSize_%d_Payload_%d_Itr_%d", folderName, decoderListSize, testLength, iterations); #else - sprintf(fileName,"%s/_ListSize_%d_Payload_%d_Itr_%d", folderName, decoderListSize, testLength, iterations); + sprintf(fileName, "%s/_ListSize_%d_Payload_%d_Itr_%d", folderName, decoderListSize, testLength, iterations); #endif strftime(currentTimeInfo, 25, "_%Y-%m-%d-%H-%M-%S.csv", localtime(¤tTime)); - strcat(fileName,currentTimeInfo); - //Create "~/Desktop/polartestResults" folder if it doesn't already exist. + strcat(fileName, currentTimeInfo); + // Create "~/Desktop/polartestResults" folder if it doesn't already exist. /*struct stat folder = {0}; if (stat(folderName, &folder) == -1) mkdir(folderName, S_IRWXU | S_IRWXG | S_IRWXO);*/ logFile = fopen(fileName, "w"); - if (logFile==NULL) { - fprintf(stderr,"[polartest.c] Problem creating file %s with fopen\n",fileName); + if (logFile == NULL) { + fprintf(stderr, "[polartest.c] Problem creating file %s with fopen\n", fileName); exit(-1); } #ifdef DEBUG_POLAR_TIMING - fprintf(logFile,",timeEncoderCRCByte[us],timeEncoderCRCBit[us],timeEncoderInterleaver[us],timeEncoderBitInsertion[us],timeEncoder1[us],timeEncoder2[us],timeEncoderRateMatching[us],timeEncoderByte2Bit[us]\n"); + fprintf(logFile, + ",timeEncoderCRCByte[us],timeEncoderCRCBit[us],timeEncoderInterleaver[us],timeEncoderBitInsertion[us],timeEncoder1[us]," + "timeEncoder2[us],timeEncoderRateMatching[us],timeEncoderByte2Bit[us]\n"); #else - fprintf(logFile,",SNR,nBitError,blockErrorState,t_encoder[us],t_decoder[us]\n"); + fprintf(logFile, ",SNR,nBitError,blockErrorState,t_encoder[us],t_decoder[us]\n"); #endif } @@ -177,54 +178,55 @@ int main(int argc, char *argv[]) // satisfies uint64_t array length const uint8_t realArrayLength = ((testArrayLength + 1) / 2) * 2; printf("testArrayLength %d realArrayLength %d\n", testArrayLength, realArrayLength); - uint32_t testInput[realArrayLength]; //generate randomly + uint32_t testInput[realArrayLength]; // generate randomly uint32_t encoderOutput[coderArrayLength]; - uint32_t estimatedOutput[realArrayLength]; //decoder output - memset(testInput,0,sizeof(uint32_t) * realArrayLength); // does not reset all - memset(encoderOutput,0,sizeof(uint32_t) * coderArrayLength); - memset(estimatedOutput,0,sizeof(uint32_t) * realArrayLength); + uint32_t estimatedOutput[realArrayLength]; // decoder output + memset(testInput, 0, sizeof(uint32_t) * realArrayLength); // does not reset all + memset(encoderOutput, 0, sizeof(uint32_t) * coderArrayLength); + memset(estimatedOutput, 0, sizeof(uint32_t) * realArrayLength); uint8_t encoderOutputByte[coderLength]; - double modulatedInput[coderLength]; //channel input - double channelOutput[coderLength]; //add noise + double modulatedInput[coderLength]; // channel input + double channelOutput[coderLength]; // add noise int16_t channelOutput_int16[coderLength]; t_nrPolar_params *currentPtr = nr_polar_params(polarMessageType, testLength, aggregation_level); #ifdef DEBUG_DCI_POLAR_PARAMS uint32_t dci_pdu[4]; - memset(dci_pdu,0,sizeof(uint32_t)*4); - dci_pdu[0]=0x01189400; + memset(dci_pdu, 0, sizeof(uint32_t) * 4); + dci_pdu[0] = 0x01189400; printf("dci_pdu: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\n", dci_pdu[0], dci_pdu[1], dci_pdu[2], dci_pdu[3]); - uint16_t size=41; - rnti=3; - aggregation_level=8; + uint16_t size = 41; + rnti = 3; + aggregation_level = 8; uint32_t encoder_output[54]; - memset(encoder_output,0,sizeof(uint32_t)*54); - t_nrPolar_params *currentPtrDCI=nr_polar_params(1, size, aggregation_level); + memset(encoder_output, 0, sizeof(uint32_t) * 54); + t_nrPolar_params *currentPtrDCI = nr_polar_params(1, size, aggregation_level); polar_encoder_dci(dci_pdu, encoder_output, currentPtrDCI, rnti); - for (int i=0; i<54; i++) + for (int i = 0; i < 54; i++) printf("encoder_output: [%2d]->0x%08x \n", i, encoder_output[i]); uint8_t *encoder_outputByte = malloc(sizeof(uint8_t) * currentPtrDCI->encoderLength); - double *modulated_input = malloc (sizeof(double) * currentPtrDCI->encoderLength); - double *channel_output = malloc (sizeof(double) * currentPtrDCI->encoderLength); + double *modulated_input = malloc(sizeof(double) * currentPtrDCI->encoderLength); + double *channel_output = malloc(sizeof(double) * currentPtrDCI->encoderLength); uint32_t dci_est[4]; - memset(dci_est,0,sizeof(dci_est)); + memset(dci_est, 0, sizeof(dci_est)); nr_bit2byte_uint32_8(encoder_output, currentPtrDCI->encoderLength, encoder_outputByte); printf("[polartest] encoder_outputByte: "); - for (int i = 0; i < currentPtrDCI->encoderLength; i++) printf("%d-", encoder_outputByte[i]); printf("\n"); + for (int i = 0; i < currentPtrDCI->encoderLength; i++) + printf("%d-", encoder_outputByte[i]); + printf("\n"); - SNR_lin = pow(10, 0/10); //SNR = 0 dB - for(int i=0; iencoderLength; i++) { + SNR_lin = pow(10, 0 / 10); // SNR = 0 dB + for (int i = 0; i < currentPtrDCI->encoderLength; i++) { if (encoder_outputByte[i] == 0) - modulated_input[i]=1/sqrt(2); + modulated_input[i] = 1 / sqrt(2); else - modulated_input[i]=(-1)/sqrt(2); - channel_output[i] = modulated_input[i] + (gaussdouble(0.0,1.0) * (1/sqrt(2*SNR_lin))); + modulated_input[i] = (-1) / sqrt(2); + channel_output[i] = modulated_input[i] + (gaussdouble(0.0, 1.0) * (1 / sqrt(2 * SNR_lin))); } - decoderState = polar_decoder_dci(channel_output, dci_est, NR_POLAR_DECODER_LISTSIZE, rnti, - 1, size, aggregation_level); + decoderState = polar_decoder_dci(channel_output, dci_est, NR_POLAR_DECODER_LISTSIZE, rnti, 1, size, aggregation_level); printf("dci_est: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\n", dci_est[0], dci_est[1], dci_est[2], dci_est[3]); free(encoder_outputByte); free(channel_output); @@ -235,56 +237,56 @@ int main(int argc, char *argv[]) #endif for (SNR = SNRstart; SNR <= SNRstop; SNR += SNRinc) { - printf("SNR %f\n",SNR); - SNR_lin = pow(10, SNR/10); + printf("SNR %f\n", SNR); + SNR_lin = pow(10, SNR / 10); for (itr = 1; itr <= iterations; itr++) { - //Generate random values for all the bits of "testInput", not just as much as "currentPtr->payloadBits". + // Generate random values for all the bits of "testInput", not just as much as "currentPtr->payloadBits". for (int i = 0; i < testArrayLength; i++) { - for (int j = 0; j < (sizeof(testInput[0])*8)-1; j++) { - testInput[i] |= ( ((uint32_t) (rand()%2)) &1); - testInput[i]<<=1; - } - testInput[i] |= ( ((uint32_t) (rand()%2)) &1); + for (int j = 0; j < (sizeof(testInput[0]) * 8) - 1; j++) { + testInput[i] |= (((uint32_t)(rand() % 2)) & 1); + testInput[i] <<= 1; + } + testInput[i] |= (((uint32_t)(rand() % 2)) & 1); } #ifdef DEBUG_POLARTEST - //testInput[0] = 0x360f8a5c; + // testInput[0] = 0x360f8a5c; printf("testInput: [0]->0x%08x\n", testInput[0]); #endif - int len_mod64=currentPtr->payloadBits&63; - ((uint64_t *)testInput)[currentPtr->payloadBits/64]&=((((uint64_t)1)<payloadBits & 63; + ((uint64_t *)testInput)[currentPtr->payloadBits / 64] &= ((((uint64_t)1) << len_mod64) - 1); start_meas(&timeEncoder); - if (decoder_int16==1) { - polar_encoder_fast((uint64_t *)testInput, encoderOutput, 0, 0, polarMessageType, testLength, aggregation_level); - //polar_encoder_fast((uint64_t*)testInput, (uint64_t*)encoderOutput,0,0,currentPtr); - } else { //0 --> PBCH, 1 --> DCI, -1 --> UCI - if (polarMessageType == 0) - polar_encoder(testInput, encoderOutput, polarMessageType, testLength, aggregation_level); - else if (polarMessageType == 1) - polar_encoder_dci(testInput, encoderOutput, rnti, polarMessageType, testLength, aggregation_level); + if (decoder_int16 == 1) { + polar_encoder_fast((uint64_t *)testInput, encoderOutput, 0, 0, polarMessageType, testLength, aggregation_level); + // polar_encoder_fast((uint64_t*)testInput, (uint64_t*)encoderOutput,0,0,currentPtr); + } else { // 0 --> PBCH, 1 --> DCI, -1 --> UCI + if (polarMessageType == 0) + polar_encoder(testInput, encoderOutput, polarMessageType, testLength, aggregation_level); + else if (polarMessageType == 1) + polar_encoder_dci(testInput, encoderOutput, rnti, polarMessageType, testLength, aggregation_level); } stop_meas(&timeEncoder); #ifdef DEBUG_POLARTEST printf("encoderOutput: [0]->0x%08x\n", encoderOutput[0]); - //for (int i=1;i0x%08x\n", i, encoderOutput[1]); + // for (int i=1;i0x%08x\n", i, encoderOutput[1]); #endif - //Bit-to-byte: + // Bit-to-byte: nr_bit2byte_uint32_8(encoderOutput, coderLength, encoderOutputByte); - //BPSK modulation - for(int i=0; i 15) channelOutput_int16[i] = 127; else if (channelOutput[i] < -16) @@ -306,7 +308,7 @@ int main(int argc, char *argv[]) } else { // 0 --> PBCH, 1 --> DCI, -1 --> UCI if (polarMessageType == 0) { decoderState = - polar_decoder(channelOutput, estimatedOutput, decoderListSize, polarMessageType, testLength, aggregation_level); + polar_decoder(channelOutput, estimatedOutput, decoderListSize, polarMessageType, testLength, aggregation_level); } else if (polarMessageType == 1) { decoderState = polar_decoder_dci(channelOutput, estimatedOutput, @@ -318,70 +320,83 @@ int main(int argc, char *argv[]) } } stop_meas(&timeDecoder); - + #ifdef DEBUG_POLARTEST printf("estimatedOutput: [0]->0x%08x\n", estimatedOutput[0]); #endif - //calculate errors - if (decoderState!=0) { - blockErrorState=-1; - nBitError=-1; + // calculate errors + if (decoderState != 0) { + blockErrorState = -1; + nBitError = -1; } else { - for (int i = 0; i < (testArrayLength-1); i++) { - for (int j = 0; j < 32; j++) { - if ( ((estimatedOutput[i]>>j) & 1) != ((testInput[i]>>j) & 1) ) - nBitError++; - } - } - for (int j = 0; j < testLength - ((testArrayLength-1) * 32); j++) - if ( ((estimatedOutput[(testArrayLength-1)]>>j) & 1) != ((testInput[(testArrayLength-1)]>>j) & 1) ) - nBitError++; + for (int i = 0; i < (testArrayLength - 1); i++) { + for (int j = 0; j < 32; j++) { + if (((estimatedOutput[i] >> j) & 1) != ((testInput[i] >> j) & 1)) + nBitError++; + } + } + for (int j = 0; j < testLength - ((testArrayLength - 1) * 32); j++) + if (((estimatedOutput[(testArrayLength - 1)] >> j) & 1) != ((testInput[(testArrayLength - 1)] >> j) & 1)) + nBitError++; } - if (nBitError>0) blockErrorState=1; + if (nBitError > 0) + blockErrorState = 1; #ifdef DEBUG_POLARTEST for (int i = 0; i < testArrayLength; i++) - printf("[polartest/decoderState=%u] testInput[%d]=0x%08x, estimatedOutput[%d]=0x%08x\n", - decoderState, - i, - testInput[i], - i, - estimatedOutput[i]); + printf("[polartest/decoderState=%u] testInput[%d]=0x%08x, estimatedOutput[%d]=0x%08x\n", + decoderState, + i, + testInput[i], + i, + estimatedOutput[i]); #endif - //Iteration times are in microseconds. - if (logFlag) fprintf(logFile,",%f,%d,%u,%f,%f\n", SNR, nBitError, blockErrorState, (timeEncoder.diff/(get_cpu_freq_GHz()*1000.0)), (timeDecoder.diff/(get_cpu_freq_GHz()*1000.0))); + // Iteration times are in microseconds. + if (logFlag) + fprintf(logFile, + ",%f,%d,%u,%f,%f\n", + SNR, + nBitError, + blockErrorState, + (timeEncoder.diff / (get_cpu_freq_GHz() * 1000.0)), + (timeDecoder.diff / (get_cpu_freq_GHz() * 1000.0))); - if (nBitError<0) { + if (nBitError < 0) { blockErrorCumulative++; - bitErrorCumulative+=testLength; + bitErrorCumulative += testLength; } else { - blockErrorCumulative+=blockErrorState; - bitErrorCumulative+=nBitError; + blockErrorCumulative += blockErrorState; + bitErrorCumulative += nBitError; } - decoderState=0; - nBitError=0; - blockErrorState=0; - memset(testInput,0,sizeof(uint32_t) * realArrayLength); - memset(encoderOutput,0,sizeof(uint32_t) * coderArrayLength); - memset(estimatedOutput,0,sizeof(uint32_t) * realArrayLength); + decoderState = 0; + nBitError = 0; + blockErrorState = 0; + memset(testInput, 0, sizeof(uint32_t) * realArrayLength); + memset(encoderOutput, 0, sizeof(uint32_t) * coderArrayLength); + memset(estimatedOutput, 0, sizeof(uint32_t) * realArrayLength); } - //Calculate error statistics for the SNR. + // Calculate error statistics for the SNR. printf("[ListSize=%d] SNR=%+8.3f, BLER=%9.6f, BER=%12.9f, t_Encoder=%9.3fus, t_Decoder=%9.3fus\n", - decoderListSize, SNR, ((double)blockErrorCumulative/iterations), - ((double)bitErrorCumulative / (iterations*testLength)), - (double)timeEncoder.diff/timeEncoder.trials/(get_cpu_freq_GHz()*1000.0),(double)timeDecoder.diff/timeDecoder.trials/(get_cpu_freq_GHz()*1000.0)); + decoderListSize, + SNR, + ((double)blockErrorCumulative / iterations), + ((double)bitErrorCumulative / (iterations * testLength)), + (double)timeEncoder.diff / timeEncoder.trials / (get_cpu_freq_GHz() * 1000.0), + (double)timeDecoder.diff / timeDecoder.trials / (get_cpu_freq_GHz() * 1000.0)); - if (blockErrorCumulative==0 && bitErrorCumulative==0) break; + if (blockErrorCumulative == 0 && bitErrorCumulative == 0) + break; blockErrorCumulative = 0; bitErrorCumulative = 0; } - print_meas(&timeEncoder,"polar_encoder",NULL,NULL); - print_meas(&timeDecoder,"polar_decoder",NULL,NULL); - if (logFlag) fclose(logFile); + print_meas(&timeEncoder, "polar_encoder", NULL, NULL); + print_meas(&timeDecoder, "polar_decoder", NULL, NULL); + if (logFlag) + fclose(logFile); return (0); } diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_bitwise_operations.c b/openair1/PHY/CODING/nrPolar_tools/nr_bitwise_operations.c index d489183d9a..205c94f748 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_bitwise_operations.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_bitwise_operations.c @@ -28,11 +28,12 @@ * \email turker.yilmaz@eurecom.fr * \note * \warning -*/ + */ #include "PHY/CODING/nrPolar_tools/nr_polar_defs.h" -void nr_bit2byte_uint32_8(uint32_t *in, uint16_t arraySize, uint8_t *out) { +void nr_bit2byte_uint32_8(uint32_t *in, uint16_t arraySize, uint8_t *out) +{ const uint arrayInd = ceil(arraySize / 32.0); for (int i = 0; i < (arrayInd - 1); i++) { for (int j = 0; j < 32; j++) { @@ -44,7 +45,8 @@ void nr_bit2byte_uint32_8(uint32_t *in, uint16_t arraySize, uint8_t *out) { out[j + ((arrayInd - 1) * 32)] = (in[(arrayInd - 1)] >> j) & 1; } -void nr_byte2bit_uint8_32(uint8_t *in, uint16_t arraySize, uint32_t *out) { +void nr_byte2bit_uint8_32(uint8_t *in, uint16_t arraySize, uint32_t *out) +{ const uint arrayInd = ceil(arraySize / 32.0); for (int i = 0; i < arrayInd; i++) { out[i] = 0; diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_crc_byte.c b/openair1/PHY/CODING/nrPolar_tools/nr_crc_byte.c index d04dde62e7..1908aa654c 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_crc_byte.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_crc_byte.c @@ -29,7 +29,8 @@ const uint8_t **crc24c_generator_matrix(uint16_t payloadSizeBits) uint8_t crcPolynomialSize = 24; uint8_t temp1[crcPolynomialSize], temp2[crcPolynomialSize]; - uint8_t **crc_generator_matrix = malloc(payloadSizeBits*sizeof(uint8_t *) + payloadSizeBits*crcPolynomialSize*sizeof(uint8_t)); + uint8_t **crc_generator_matrix = + malloc(payloadSizeBits * sizeof(uint8_t *) + payloadSizeBits * crcPolynomialSize * sizeof(uint8_t)); if (crc_generator_matrix) for (int i = 0; i < payloadSizeBits; i++) crc_generator_matrix[i] = ((uint8_t *)&crc_generator_matrix[payloadSizeBits]) + i * crcPolynomialSize; @@ -38,7 +39,8 @@ const uint8_t **crc24c_generator_matrix(uint16_t payloadSizeBits) crc_generator_matrix[payloadSizeBits - 1][i] = crcPolynomialPattern[i + 1]; for (int i = payloadSizeBits - 2; i >= 0; i--) { - for (int j = 0; j < crcPolynomialSize-1; j++) temp1[j]=crc_generator_matrix[i+1][j+1]; + for (int j = 0; j < crcPolynomialSize - 1; j++) + temp1[j] = crc_generator_matrix[i + 1][j + 1]; temp1[crcPolynomialSize - 1] = 0; @@ -46,10 +48,10 @@ const uint8_t **crc24c_generator_matrix(uint16_t payloadSizeBits) temp2[j] = crc_generator_matrix[i + 1][0] * crcPolynomialPattern[j + 1]; for (int j = 0; j < crcPolynomialSize; j++) { - if(temp1[j]+temp2[j] == 1) - crc_generator_matrix[i][j]=1; - else - crc_generator_matrix[i][j]=0; + if (temp1[j] + temp2[j] == 1) + crc_generator_matrix[i][j] = 1; + else + crc_generator_matrix[i][j] = 0; } } return (const uint8_t **)crc_generator_matrix; diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_dci_defs.h b/openair1/PHY/CODING/nrPolar_tools/nr_polar_dci_defs.h index 842088b26c..871f4f57b0 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_dci_defs.h +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_dci_defs.h @@ -20,31 +20,31 @@ */ /*! \file PHY/CODING/nrPolar_tools/nr_polar_dci_defs.h -* \brief Defines the constant variables for polar coding of the DCI from 38-212, V15.1.1 2018-04. -* \author -* \date 2018 -* \version 0.1 -* \company Eurecom -* \email: -* \note -* \warning -*/ + * \brief Defines the constant variables for polar coding of the DCI from 38-212, V15.1.1 2018-04. + * \author + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: + * \note + * \warning + */ #ifndef __NR_POLAR_DCI_DEFS__H__ #define __NR_POLAR_DCI_DEFS__H__ -#define NR_POLAR_DCI_MESSAGE_TYPE 1 //int8_t +#define NR_POLAR_DCI_MESSAGE_TYPE 1 // int8_t #define NR_POLAR_DCI_CRC_PARITY_BITS 24 #define NR_POLAR_DCI_CRC_ERROR_CORRECTION_BITS 3 -//Sec. 7.3.3: Channel Coding -#define NR_POLAR_DCI_N_MAX 9 //uint8_t -#define NR_POLAR_DCI_I_IL 1 //uint8_t -#define NR_POLAR_DCI_I_SEG 0 //uint8_t -#define NR_POLAR_DCI_N_PC 0 //uint8_t -#define NR_POLAR_DCI_N_PC_WM 0 //uint8_t +// Sec. 7.3.3: Channel Coding +#define NR_POLAR_DCI_N_MAX 9 // uint8_t +#define NR_POLAR_DCI_I_IL 1 // uint8_t +#define NR_POLAR_DCI_I_SEG 0 // uint8_t +#define NR_POLAR_DCI_N_PC 0 // uint8_t +#define NR_POLAR_DCI_N_PC_WM 0 // uint8_t -//Sec. 7.3.4: Rate Matching -#define NR_POLAR_DCI_I_BIL 0 //uint8_t +// Sec. 7.3.4: Rate Matching +#define NR_POLAR_DCI_I_BIL 0 // uint8_t #endif diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c index 5a61eebb3d..14013681b0 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c @@ -39,17 +39,17 @@ #include "PHY/CODING/nrPolar_tools/nr_polar_defs.h" #include "assertions.h" -//#define POLAR_CODING_DEBUG +// #define POLAR_CODING_DEBUG static inline void updateCrcChecksum2(int xlen, - int ylen, - uint8_t crcChecksum[xlen][ylen], - int gxlen, - int gylen, - uint8_t crcGen[gxlen][gylen], - uint8_t listSize, - uint32_t i2, - uint8_t len) + int ylen, + uint8_t crcChecksum[xlen][ylen], + int gxlen, + int gylen, + uint8_t crcGen[gxlen][gylen], + uint8_t listSize, + uint32_t i2, + uint8_t len) { for (uint i = 0; i < listSize; i++) { for (uint j = 0; j < len; j++) { @@ -63,67 +63,71 @@ int8_t polar_decoder(double *input, uint8_t listSize, int8_t messageType, uint16_t messageLength, - uint8_t aggregation_level - ) + uint8_t aggregation_level) { t_nrPolar_params *polarParams = nr_polar_params(messageType, messageLength, aggregation_level); - //Assumes no a priori knowledge. + // Assumes no a priori knowledge. uint8_t bit[polarParams->N][polarParams->n + 1][2 * listSize]; memset(bit, 0, sizeof bit); - uint8_t bitUpdated[polarParams->N][polarParams->n+1]; //0=False, 1=True - memset(bitUpdated,0,sizeof bitUpdated); - uint8_t llrUpdated[polarParams->N][polarParams->n+1]; //0=False, 1=True - memset(llrUpdated,0,sizeof llrUpdated); + uint8_t bitUpdated[polarParams->N][polarParams->n + 1]; // 0=False, 1=True + memset(bitUpdated, 0, sizeof bitUpdated); + uint8_t llrUpdated[polarParams->N][polarParams->n + 1]; // 0=False, 1=True + memset(llrUpdated, 0, sizeof llrUpdated); double llr[polarParams->N][polarParams->n + 1][2 * listSize]; - uint8_t crcChecksum[polarParams->crcParityBits][2*listSize]; - memset(crcChecksum,0,sizeof crcChecksum); - double pathMetric[2*listSize]; - uint8_t crcState[2*listSize]; //0=False, 1=True + uint8_t crcChecksum[polarParams->crcParityBits][2 * listSize]; + memset(crcChecksum, 0, sizeof crcChecksum); + double pathMetric[2 * listSize]; + uint8_t crcState[2 * listSize]; // 0=False, 1=True - for (int i=0; i<(2*listSize); i++) { + for (int i = 0; i < (2 * listSize); i++) { pathMetric[i] = 0; - crcState[i]=1; + crcState[i] = 1; } - for (int i=0; iN; i++) { - llrUpdated[i][polarParams->n]=1; + for (int i = 0; i < polarParams->N; i++) { + llrUpdated[i][polarParams->n] = 1; bitUpdated[i][0] = (polarParams->information_bit_pattern[i] + 1) % 2; } - uint8_t extended_crc_generator_matrix[polarParams->K][polarParams->crcParityBits]; //G_P3 - uint8_t tempECGM[polarParams->K][polarParams->crcParityBits]; //G_P2 + uint8_t extended_crc_generator_matrix[polarParams->K][polarParams->crcParityBits]; // G_P3 + uint8_t tempECGM[polarParams->K][polarParams->crcParityBits]; // G_P2 - for (int i=0; ipayloadBits; i++) { - for (int j=0; jcrcParityBits; j++) { - tempECGM[i][j]=polarParams->crc_generator_matrix[i][j]; + for (int i = 0; i < polarParams->payloadBits; i++) { + for (int j = 0; j < polarParams->crcParityBits; j++) { + tempECGM[i][j] = polarParams->crc_generator_matrix[i][j]; } } - for (int i=polarParams->payloadBits; iK; i++) { - for (int j=0; jcrcParityBits; j++) { + for (int i = polarParams->payloadBits; i < polarParams->K; i++) { + for (int j = 0; j < polarParams->crcParityBits; j++) { tempECGM[i][j] = (i - polarParams->payloadBits) == j; } } - for (int i=0; iK; i++) { - for (int j=0; jcrcParityBits; j++) { - extended_crc_generator_matrix[i][j]=tempECGM[polarParams->interleaving_pattern[i]][j]; + for (int i = 0; i < polarParams->K; i++) { + for (int j = 0; j < polarParams->crcParityBits; j++) { + extended_crc_generator_matrix[i][j] = tempECGM[polarParams->interleaving_pattern[i]][j]; } } - //The index of the last 1-valued bit that appears in each column. - AssertFatal(polarParams->crcParityBits > 0, "UB for VLA. crcParityBits negative\n"); + // The index of the last 1-valued bit that appears in each column. + AssertFatal(polarParams->crcParityBits > 0, "UB for VLA. crcParityBits negative\n"); uint16_t last1ind[polarParams->crcParityBits]; - for (int j=0; jcrcParityBits; j++) { - for (int i=0; iK; i++) { + for (int j = 0; j < polarParams->crcParityBits; j++) { + for (int i = 0; i < polarParams->K; i++) { if (extended_crc_generator_matrix[i][j] == 1) last1ind[j] = i; } } double d_tilde[polarParams->N]; - nr_polar_rate_matching(input, d_tilde, polarParams->rate_matching_pattern, polarParams->K, polarParams->N, polarParams->encoderLength); + nr_polar_rate_matching(input, + d_tilde, + polarParams->rate_matching_pattern, + polarParams->K, + polarParams->N, + polarParams->encoderLength); for (int j = 0; j < polarParams->N; j++) llr[j][polarParams->n][0] = d_tilde[j]; @@ -131,18 +135,18 @@ int8_t polar_decoder(double *input, /* * SCL polar decoder. */ - uint32_t nonFrozenBit=0; + uint32_t nonFrozenBit = 0; uint currentListSize = 1; uint decoderIterationCheck = 0; int checkCrcBits = -1; - uint8_t listIndex[2*listSize], copyIndex; + uint8_t listIndex[2 * listSize], copyIndex; for (uint currentBit = 0; currentBit < polarParams->N; currentBit++) { updateLLR(currentListSize, currentBit, 0, polarParams->N, polarParams->n + 1, 2 * listSize, llr, llrUpdated, bit, bitUpdated); - if (polarParams->information_bit_pattern[currentBit]==0) { //Frozen bit. + if (polarParams->information_bit_pattern[currentBit] == 0) { // Frozen bit. updatePathMetric(pathMetric, currentListSize, 0, currentBit, polarParams->N, polarParams->n + 1, 2 * listSize, llr); - } else { //Information or CRC bit. + } else { // Information or CRC bit. updatePathMetric2(pathMetric, currentListSize, currentBit, polarParams->N, polarParams->n + 1, 2 * listSize, llr); for (int i = 0; i < currentListSize; i++) { @@ -198,30 +202,30 @@ int8_t polar_decoder(double *input, break; } - //First, backup the best "listSize" number of entries. - for (int k=(listSize-1); k>0; k--) { - for (int i=0; iN; i++) { - for (int j=0; j<(polarParams->n+1); j++) { + // First, backup the best "listSize" number of entries. + for (int k = (listSize - 1); k > 0; k--) { + for (int i = 0; i < polarParams->N; i++) { + for (int j = 0; j < (polarParams->n + 1); j++) { bit[i][j][listIndex[(2 * listSize - 1) - k]] = bit[i][j][listIndex[k]]; llr[i][j][listIndex[(2 * listSize - 1) - k]] = llr[i][j][listIndex[k]]; } } } - for (int k=(listSize-1); k>0; k--) { + for (int k = (listSize - 1); k > 0; k--) { for (int i = 0; i < polarParams->crcParityBits; i++) { - crcChecksum[i][listIndex[(2*listSize-1)-k]] = crcChecksum[i][listIndex[k]]; + crcChecksum[i][listIndex[(2 * listSize - 1) - k]] = crcChecksum[i][listIndex[k]]; } } for (int k = (listSize - 1); k > 0; k--) crcState[listIndex[(2 * listSize - 1) - k]] = crcState[listIndex[k]]; - //Copy the best "listSize" number of entries to the first indices. + // Copy the best "listSize" number of entries to the first indices. for (int k = 0; k < listSize; k++) { if (k > listIndex[k]) { - copyIndex = listIndex[(2*listSize-1)-k]; - } else { //Use the backup. + copyIndex = listIndex[(2 * listSize - 1) - k]; + } else { // Use the backup. copyIndex = listIndex[k]; } @@ -235,40 +239,40 @@ int8_t polar_decoder(double *input, for (int k = 0; k < listSize; k++) { if (k > listIndex[k]) { - copyIndex = listIndex[(2*listSize-1)-k]; - } else { //Use the backup. + copyIndex = listIndex[(2 * listSize - 1) - k]; + } else { // Use the backup. copyIndex = listIndex[k]; } for (int i = 0; i < polarParams->crcParityBits; i++) { - crcChecksum[i][k]=crcChecksum[i][copyIndex]; + crcChecksum[i][k] = crcChecksum[i][copyIndex]; } } for (int k = 0; k < listSize; k++) { if (k > listIndex[k]) { - copyIndex = listIndex[(2*listSize-1)-k]; - } else { //Use the backup. + copyIndex = listIndex[(2 * listSize - 1) - k]; + } else { // Use the backup. copyIndex = listIndex[k]; } - crcState[k]=crcState[copyIndex]; + crcState[k] = crcState[copyIndex]; } currentListSize = listSize; } - for (int i=0; icrcParityBits; i++) { - if (last1ind[i]==nonFrozenBit) { - checkCrcBits=i; + for (int i = 0; i < polarParams->crcParityBits; i++) { + if (last1ind[i] == nonFrozenBit) { + checkCrcBits = i; break; } } - if ( checkCrcBits > (-1) ) { + if (checkCrcBits > (-1)) { for (uint i = 0; i < currentListSize; i++) { - if (crcChecksum[checkCrcBits][i]==1) { - crcState[i]=0; //0=False, 1=True + if (crcChecksum[checkCrcBits][i] == 1) { + crcState[i] = 0; // 0=False, 1=True } } } @@ -276,15 +280,15 @@ int8_t polar_decoder(double *input, for (uint i = 0; i < currentListSize; i++) decoderIterationCheck += crcState[i]; - if (decoderIterationCheck==0) { - //perror("[SCL polar decoder] All list entries have failed the CRC checks."); + if (decoderIterationCheck == 0) { + // perror("[SCL polar decoder] All list entries have failed the CRC checks."); polarReturn(polarParams); return -1; } nonFrozenBit++; - decoderIterationCheck=0; - checkCrcBits=-1; + decoderIterationCheck = 0; + checkCrcBits = -1; } } @@ -294,19 +298,19 @@ int8_t polar_decoder(double *input, nr_sort_asc_double_1D_array_ind(pathMetric, listIndex, currentListSize); uint8_t nr_polar_A[polarParams->payloadBits]; for (uint i = 0; i < fmin(listSize, (pow(2, polarParams->crcCorrectionBits))); i++) { - if ( crcState[listIndex[i]] == 1 ) { + if (crcState[listIndex[i]] == 1) { uint8_t nr_polar_U[polarParams->N]; for (int j = 0; j < polarParams->N; j++) nr_polar_U[j] = bit[j][0][listIndex[i]]; - //Extract the information bits (û to ĉ) + // Extract the information bits (û to ĉ) uint8_t nr_polar_CPrime[polarParams->N]; nr_polar_info_bit_extraction(nr_polar_U, nr_polar_CPrime, polarParams->information_bit_pattern, polarParams->N); - //Deinterleaving (ĉ to b) + // Deinterleaving (ĉ to b) uint8_t nr_polar_B[polarParams->K]; nr_polar_deinterleaver(nr_polar_CPrime, nr_polar_B, polarParams->interleaving_pattern, polarParams->K); - //Remove the CRC (â) + // Remove the CRC (â) memcpy(nr_polar_A, nr_polar_B, polarParams->payloadBits); break; @@ -328,123 +332,137 @@ int8_t polar_decoder_dci(double *input, uint16_t n_RNTI, int8_t messageType, uint16_t messageLength, - uint8_t aggregation_level ) { + uint8_t aggregation_level) +{ t_nrPolar_params *polarParams = nr_polar_params(messageType, messageLength, aggregation_level); - uint8_t bit[polarParams->N][polarParams->n+1][2*listSize]; - memset(bit,0,sizeof bit); - uint8_t bitUpdated[polarParams->N][polarParams->n+1]; //0=False, 1=True - memset(bitUpdated,0,sizeof bitUpdated); - uint8_t llrUpdated[polarParams->N][polarParams->n+1]; //0=False, 1=True - memset(llrUpdated,0,sizeof llrUpdated); - double llr[polarParams->N][polarParams->n+1][2*listSize]; - uint8_t crcChecksum[polarParams->crcParityBits][2*listSize]; - memset(crcChecksum,0,sizeof crcChecksum); - double pathMetric[2*listSize]; - uint8_t crcState[2*listSize]; //0=False, 1=True + uint8_t bit[polarParams->N][polarParams->n + 1][2 * listSize]; + memset(bit, 0, sizeof bit); + uint8_t bitUpdated[polarParams->N][polarParams->n + 1]; // 0=False, 1=True + memset(bitUpdated, 0, sizeof bitUpdated); + uint8_t llrUpdated[polarParams->N][polarParams->n + 1]; // 0=False, 1=True + memset(llrUpdated, 0, sizeof llrUpdated); + double llr[polarParams->N][polarParams->n + 1][2 * listSize]; + uint8_t crcChecksum[polarParams->crcParityBits][2 * listSize]; + memset(crcChecksum, 0, sizeof crcChecksum); + double pathMetric[2 * listSize]; + uint8_t crcState[2 * listSize]; // 0=False, 1=True uint8_t extended_crc_scrambling_pattern[polarParams->crcParityBits]; - for (int i=0; i<(2*listSize); i++) { + for (int i = 0; i < (2 * listSize); i++) { pathMetric[i] = 0; - crcState[i]=1; + crcState[i] = 1; } - for (int i=0; iN; i++) { - llrUpdated[i][polarParams->n]=1; + for (int i = 0; i < polarParams->N; i++) { + llrUpdated[i][polarParams->n] = 1; bitUpdated[i][0] = (polarParams->information_bit_pattern[i] + 1) % 2; } - uint8_t extended_crc_generator_matrix[polarParams->K][polarParams->crcParityBits]; //G_P3: K-by-P - uint8_t tempECGM[polarParams->K][polarParams->crcParityBits]; //G_P2: K-by-P + uint8_t extended_crc_generator_matrix[polarParams->K][polarParams->crcParityBits]; // G_P3: K-by-P + uint8_t tempECGM[polarParams->K][polarParams->crcParityBits]; // G_P2: K-by-P - for (int i=0; ipayloadBits; i++) { - for (int j=0; jcrcParityBits; j++) { - tempECGM[i][j]=polarParams->crc_generator_matrix[i+polarParams->crcParityBits][j]; + for (int i = 0; i < polarParams->payloadBits; i++) { + for (int j = 0; j < polarParams->crcParityBits; j++) { + tempECGM[i][j] = polarParams->crc_generator_matrix[i + polarParams->crcParityBits][j]; } } - for (int i=polarParams->payloadBits; iK; i++) { - for (int j=0; jcrcParityBits; j++) { + for (int i = polarParams->payloadBits; i < polarParams->K; i++) { + for (int j = 0; j < polarParams->crcParityBits; j++) { tempECGM[i][j] = (i - polarParams->payloadBits) == j; } } - for (int i=0; iK; i++) { - for (int j=0; jcrcParityBits; j++) { - extended_crc_generator_matrix[i][j]=tempECGM[polarParams->interleaving_pattern[i]][j]; + for (int i = 0; i < polarParams->K; i++) { + for (int j = 0; j < polarParams->crcParityBits; j++) { + extended_crc_generator_matrix[i][j] = tempECGM[polarParams->interleaving_pattern[i]][j]; } } - //The index of the last 1-valued bit that appears in each column. + // The index of the last 1-valued bit that appears in each column. uint16_t last1ind[polarParams->crcParityBits]; - for (int j=0; jcrcParityBits; j++) { - for (int i=0; iK; i++) { - if (extended_crc_generator_matrix[i][j]==1) last1ind[j]=i; + for (int j = 0; j < polarParams->crcParityBits; j++) { + for (int i = 0; i < polarParams->K; i++) { + if (extended_crc_generator_matrix[i][j] == 1) + last1ind[j] = i; } } for (int i = 0; i < 8; i++) extended_crc_scrambling_pattern[i] = 0; - for (int i=8; icrcParityBits; i++) { - extended_crc_scrambling_pattern[i]=(n_RNTI>>(23-i))&1; + for (int i = 8; i < polarParams->crcParityBits; i++) { + extended_crc_scrambling_pattern[i] = (n_RNTI >> (23 - i)) & 1; } double d_tilde[polarParams->N]; - nr_polar_rate_matching(input, d_tilde, polarParams->rate_matching_pattern, polarParams->K, polarParams->N, polarParams->encoderLength); + nr_polar_rate_matching(input, + d_tilde, + polarParams->rate_matching_pattern, + polarParams->K, + polarParams->N, + polarParams->encoderLength); for (int j = 0; j < polarParams->N; j++) - llr[j][polarParams->n][0]=d_tilde[j]; + llr[j][polarParams->n][0] = d_tilde[j]; /* * SCL polar decoder. */ - for (int i=0; icrcParityBits; i++) { - for (int j=0; jcrcParityBits; j++) - crcChecksum[i][0]=crcChecksum[i][0]+polarParams->crc_generator_matrix[j][i]; + for (int i = 0; i < polarParams->crcParityBits; i++) { + for (int j = 0; j < polarParams->crcParityBits; j++) + crcChecksum[i][0] = crcChecksum[i][0] + polarParams->crc_generator_matrix[j][i]; - crcChecksum[i][0]=(crcChecksum[i][0]%2); + crcChecksum[i][0] = (crcChecksum[i][0] % 2); } - uint32_t nonFrozenBit=0; + uint32_t nonFrozenBit = 0; uint currentListSize = 1; uint decoderIterationCheck = 0; int checkCrcBits = -1; - uint8_t listIndex[2*listSize], copyIndex; + uint8_t listIndex[2 * listSize], copyIndex; for (uint currentBit = 0; currentBit < polarParams->N; currentBit++) { - updateLLR(currentListSize, currentBit, 0, polarParams->N, polarParams->n+1, 2*listSize, llr, llrUpdated, bit, bitUpdated); + updateLLR(currentListSize, currentBit, 0, polarParams->N, polarParams->n + 1, 2 * listSize, llr, llrUpdated, bit, bitUpdated); - if (polarParams->information_bit_pattern[currentBit]==0) { //Frozen bit. - updatePathMetric(pathMetric, currentListSize, 0, currentBit,polarParams->N, polarParams->n+1, 2*listSize, llr); - } else { //Information or CRC bit. - updatePathMetric2(pathMetric, currentListSize, currentBit, polarParams->N, polarParams->n+1, 2*listSize, llr); + if (polarParams->information_bit_pattern[currentBit] == 0) { // Frozen bit. + updatePathMetric(pathMetric, currentListSize, 0, currentBit, polarParams->N, polarParams->n + 1, 2 * listSize, llr); + } else { // Information or CRC bit. + updatePathMetric2(pathMetric, currentListSize, currentBit, polarParams->N, polarParams->n + 1, 2 * listSize, llr); for (int i = 0; i < currentListSize; i++) { for (int j = 0; j < polarParams->N; j++) { - for (int k = 0; k < (polarParams->n+1); k++) { - bit[j][k][i+currentListSize]=bit[j][k][i]; - llr[j][k][i+currentListSize]=llr[j][k][i]; + for (int k = 0; k < (polarParams->n + 1); k++) { + bit[j][k][i + currentListSize] = bit[j][k][i]; + llr[j][k][i + currentListSize] = llr[j][k][i]; } } } for (int i = 0; i < currentListSize; i++) { - bit[currentBit][0][i]=0; - crcState[i+currentListSize]=crcState[i]; + bit[currentBit][0][i] = 0; + crcState[i + currentListSize] = crcState[i]; } - for (int i = currentListSize; i < 2*currentListSize; i++) bit[currentBit][0][i]=1; + for (int i = currentListSize; i < 2 * currentListSize; i++) + bit[currentBit][0][i] = 1; - bitUpdated[currentBit][0]=1; - updateCrcChecksum2(polarParams->crcParityBits, 2*listSize, crcChecksum, - polarParams->K, polarParams->crcParityBits, extended_crc_generator_matrix, - currentListSize, nonFrozenBit, polarParams->crcParityBits); - currentListSize*=2; + bitUpdated[currentBit][0] = 1; + updateCrcChecksum2(polarParams->crcParityBits, + 2 * listSize, + crcChecksum, + polarParams->K, + polarParams->crcParityBits, + extended_crc_generator_matrix, + currentListSize, + nonFrozenBit, + polarParams->crcParityBits); + currentListSize *= 2; - //Keep only the best "listSize" number of entries. + // Keep only the best "listSize" number of entries. if (currentListSize > listSize) { for (uint i = 0; i < 2 * listSize; i++) listIndex[i] = i; @@ -456,7 +474,7 @@ int8_t polar_decoder_dci(double *input, int swaps = 0; for (uint j = listSize; j < (2 * listSize - i) - 1; j++) { - if (listIndex[j+1] > listIndex[j]) { + if (listIndex[j + 1] > listIndex[j]) { int tempInd = listIndex[j]; listIndex[j] = listIndex[j + 1]; listIndex[j + 1] = tempInd; @@ -468,30 +486,30 @@ int8_t polar_decoder_dci(double *input, break; } - //First, backup the best "listSize" number of entries. - for (int k=(listSize-1); k>0; k--) { - for (int i=0; iN; i++) { - for (int j=0; j<(polarParams->n+1); j++) { - bit[i][j][listIndex[(2*listSize-1)-k]]=bit[i][j][listIndex[k]]; - llr[i][j][listIndex[(2*listSize-1)-k]]=llr[i][j][listIndex[k]]; + // First, backup the best "listSize" number of entries. + for (int k = (listSize - 1); k > 0; k--) { + for (int i = 0; i < polarParams->N; i++) { + for (int j = 0; j < (polarParams->n + 1); j++) { + bit[i][j][listIndex[(2 * listSize - 1) - k]] = bit[i][j][listIndex[k]]; + llr[i][j][listIndex[(2 * listSize - 1) - k]] = llr[i][j][listIndex[k]]; } } } - for (int k=(listSize-1); k>0; k--) { + for (int k = (listSize - 1); k > 0; k--) { for (int i = 0; i < polarParams->crcParityBits; i++) { - crcChecksum[i][listIndex[(2*listSize-1)-k]] = crcChecksum[i][listIndex[k]]; + crcChecksum[i][listIndex[(2 * listSize - 1) - k]] = crcChecksum[i][listIndex[k]]; } } for (int k = (listSize - 1); k > 0; k--) crcState[listIndex[(2 * listSize - 1) - k]] = crcState[listIndex[k]]; - //Copy the best "listSize" number of entries to the first indices. + // Copy the best "listSize" number of entries to the first indices. for (int k = 0; k < listSize; k++) { if (k > listIndex[k]) { - copyIndex = listIndex[(2*listSize-1)-k]; - } else { //Use the backup. + copyIndex = listIndex[(2 * listSize - 1) - k]; + } else { // Use the backup. copyIndex = listIndex[k]; } @@ -505,40 +523,40 @@ int8_t polar_decoder_dci(double *input, for (int k = 0; k < listSize; k++) { if (k > listIndex[k]) { - copyIndex = listIndex[(2*listSize-1)-k]; - } else { //Use the backup. + copyIndex = listIndex[(2 * listSize - 1) - k]; + } else { // Use the backup. copyIndex = listIndex[k]; } for (int i = 0; i < polarParams->crcParityBits; i++) { - crcChecksum[i][k]=crcChecksum[i][copyIndex]; + crcChecksum[i][k] = crcChecksum[i][copyIndex]; } } for (int k = 0; k < listSize; k++) { if (k > listIndex[k]) { - copyIndex = listIndex[(2*listSize-1)-k]; - } else { //Use the backup. + copyIndex = listIndex[(2 * listSize - 1) - k]; + } else { // Use the backup. copyIndex = listIndex[k]; } - crcState[k]=crcState[copyIndex]; + crcState[k] = crcState[copyIndex]; } currentListSize = listSize; } - for (int i=0; icrcParityBits; i++) { - if (last1ind[i]==nonFrozenBit) { - checkCrcBits=i; + for (int i = 0; i < polarParams->crcParityBits; i++) { + if (last1ind[i] == nonFrozenBit) { + checkCrcBits = i; break; } } - if ( checkCrcBits > (-1) ) { + if (checkCrcBits > (-1)) { for (uint i = 0; i < currentListSize; i++) { - if (crcChecksum[checkCrcBits][i]!=extended_crc_scrambling_pattern[checkCrcBits]) { - crcState[i]=0; //0=False, 1=True + if (crcChecksum[checkCrcBits][i] != extended_crc_scrambling_pattern[checkCrcBits]) { + crcState[i] = 0; // 0=False, 1=True } } } @@ -546,15 +564,15 @@ int8_t polar_decoder_dci(double *input, for (uint i = 0; i < currentListSize; i++) decoderIterationCheck += crcState[i]; - if (decoderIterationCheck==0) { - //perror("[SCL polar decoder] All list entries have failed the CRC checks."); + if (decoderIterationCheck == 0) { + // perror("[SCL polar decoder] All list entries have failed the CRC checks."); polarReturn(polarParams); return -1; } nonFrozenBit++; - decoderIterationCheck=0; - checkCrcBits=-1; + decoderIterationCheck = 0; + checkCrcBits = -1; } } @@ -565,19 +583,19 @@ int8_t polar_decoder_dci(double *input, uint8_t nr_polar_A[polarParams->payloadBits]; for (uint i = 0; i < fmin(listSize, (pow(2, polarParams->crcCorrectionBits))); i++) { - if ( crcState[listIndex[i]] == 1 ) { + if (crcState[listIndex[i]] == 1) { uint8_t nr_polar_U[polarParams->N]; for (int j = 0; j < polarParams->N; j++) nr_polar_U[j] = bit[j][0][listIndex[i]]; - //Extract the information bits (û to ĉ) + // Extract the information bits (û to ĉ) uint8_t nr_polar_CPrime[polarParams->N]; nr_polar_info_bit_extraction(nr_polar_U, nr_polar_CPrime, polarParams->information_bit_pattern, polarParams->N); - //Deinterleaving (ĉ to b) + // Deinterleaving (ĉ to b) uint8_t nr_polar_B[polarParams->K]; nr_polar_deinterleaver(nr_polar_CPrime, nr_polar_B, polarParams->interleaving_pattern, polarParams->K); - //Remove the CRC (â) + // Remove the CRC (â) memcpy(nr_polar_A, nr_polar_B, polarParams->payloadBits); break; } @@ -740,55 +758,61 @@ uint32_t polar_decoder_int16(int16_t *input, printf("\n"); #endif - int len=polarParams->payloadBits; - //int len_mod64=len&63; + int len = polarParams->payloadBits; + // int len_mod64=len&63; int crclen = polarParams->crcParityBits; - uint64_t rxcrc=B[0]&((1<>crclen); - uint8_t A32_flip[4+offset]; + if (len <= 32) { + Ar = (uint32_t)(B[0] >> crclen); + uint8_t A32_flip[4 + offset]; if (ones_flag) { A32_flip[0] = 0xff; A32_flip[1] = 0xff; A32_flip[2] = 0xff; } - uint32_t Aprime= (uint32_t)(Ar<<(32-len)); - A32_flip[0+offset]=((uint8_t *)&Aprime)[3]; - A32_flip[1+offset]=((uint8_t *)&Aprime)[2]; - A32_flip[2+offset]=((uint8_t *)&Aprime)[1]; - A32_flip[3+offset]=((uint8_t *)&Aprime)[0]; - if (crclen == 24) crc = (uint64_t)((crc24c(A32_flip,8*offset+len)>>8)&0xffffff); - else if (crclen == 11) crc = (uint64_t)((crc11(A32_flip,8*offset+len)>>21)&0x7ff); - else if (crclen == 6) crc = (uint64_t)((crc6(A32_flip,8*offset+len)>>26)&0x3f); - } else if (len<=64) { + uint32_t Aprime = (uint32_t)(Ar << (32 - len)); + A32_flip[0 + offset] = ((uint8_t *)&Aprime)[3]; + A32_flip[1 + offset] = ((uint8_t *)&Aprime)[2]; + A32_flip[2 + offset] = ((uint8_t *)&Aprime)[1]; + A32_flip[3 + offset] = ((uint8_t *)&Aprime)[0]; + if (crclen == 24) + crc = (uint64_t)((crc24c(A32_flip, 8 * offset + len) >> 8) & 0xffffff); + else if (crclen == 11) + crc = (uint64_t)((crc11(A32_flip, 8 * offset + len) >> 21) & 0x7ff); + else if (crclen == 6) + crc = (uint64_t)((crc6(A32_flip, 8 * offset + len) >> 26) & 0x3f); + } else if (len <= 64) { Ar = (B[0] >> crclen) | (B[1] << (64 - crclen)); - uint8_t A64_flip[8+offset]; + uint8_t A64_flip[8 + offset]; if (ones_flag) { A64_flip[0] = 0xff; A64_flip[1] = 0xff; A64_flip[2] = 0xff; } - uint64_t Aprime= (uint64_t)(Ar<<(64-len)); - A64_flip[0+offset]=((uint8_t *)&Aprime)[7]; - A64_flip[1+offset]=((uint8_t *)&Aprime)[6]; - A64_flip[2+offset]=((uint8_t *)&Aprime)[5]; - A64_flip[3+offset]=((uint8_t *)&Aprime)[4]; - A64_flip[4+offset]=((uint8_t *)&Aprime)[3]; - A64_flip[5+offset]=((uint8_t *)&Aprime)[2]; - A64_flip[6+offset]=((uint8_t *)&Aprime)[1]; - A64_flip[7+offset]=((uint8_t *)&Aprime)[0]; - if (crclen==24) crc = (uint64_t)(crc24c(A64_flip,8*offset+len)>>8)&0xffffff; - else if (crclen==11) crc = (uint64_t)(crc11(A64_flip,8*offset+len)>>21)&0x7ff; - else if (crclen==6) crc = (uint64_t)(crc6(A64_flip,8*offset+len)>>26)&0x3f; + uint64_t Aprime = (uint64_t)(Ar << (64 - len)); + A64_flip[0 + offset] = ((uint8_t *)&Aprime)[7]; + A64_flip[1 + offset] = ((uint8_t *)&Aprime)[6]; + A64_flip[2 + offset] = ((uint8_t *)&Aprime)[5]; + A64_flip[3 + offset] = ((uint8_t *)&Aprime)[4]; + A64_flip[4 + offset] = ((uint8_t *)&Aprime)[3]; + A64_flip[5 + offset] = ((uint8_t *)&Aprime)[2]; + A64_flip[6 + offset] = ((uint8_t *)&Aprime)[1]; + A64_flip[7 + offset] = ((uint8_t *)&Aprime)[0]; + if (crclen == 24) + crc = (uint64_t)(crc24c(A64_flip, 8 * offset + len) >> 8) & 0xffffff; + else if (crclen == 11) + crc = (uint64_t)(crc11(A64_flip, 8 * offset + len) >> 21) & 0x7ff; + else if (crclen == 6) + crc = (uint64_t)(crc6(A64_flip, 8 * offset + len) >> 26) & 0x3f; } #ifdef POLAR_CODING_DEBUG @@ -815,7 +839,7 @@ uint32_t polar_decoder_int16(int16_t *input, Cprime[0], crc, rxcrc, - crc^rxcrc, + crc ^ rxcrc, polarParams->payloadBits); #endif diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c index 85fb382102..cc0f31f1de 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c @@ -28,22 +28,22 @@ * \email turker.yilmaz@eurecom.fr * \note * \warning -*/ + */ #include "PHY/CODING/nrPolar_tools/nr_polar_defs.h" #include "PHY/sse_intrin.h" #include "PHY/impl_defs_top.h" -//#define DEBUG_NEW_IMPL 1 +// #define DEBUG_NEW_IMPL 1 static inline void updateBit(uint8_t listSize, - uint16_t row, - uint16_t col, - uint16_t xlen, - uint8_t ylen, - int zlen, - uint8_t bit[xlen][ylen][zlen], - uint8_t bitU[xlen][ylen]) + uint16_t row, + uint16_t col, + uint16_t xlen, + uint8_t ylen, + int zlen, + uint8_t bit[xlen][ylen][zlen], + uint8_t bitU[xlen][ylen]) { const uint offset = (xlen / (pow(2, (ylen - col)))); @@ -64,18 +64,12 @@ static inline void updateBit(uint8_t listSize, bitU[row][col] = 1; } -static inline void computeLLR(uint16_t row, - uint16_t col, - uint8_t i, - uint16_t offset, - int xlen, - int ylen, - int zlen, - double llr[xlen][ylen][zlen]) +static inline void +computeLLR(uint16_t row, uint16_t col, uint8_t i, uint16_t offset, int xlen, int ylen, int zlen, double llr[xlen][ylen][zlen]) { double a = llr[row][col + 1][i]; double b = llr[row + offset][col + 1][i]; - llr[row][col][i] = log((exp(a + b) + 1) / (exp(a) + exp(b))); //eq. (8a) + llr[row][col][i] = log((exp(a + b) + 1) / (exp(a) + exp(b))); // eq. (8a) } void updateLLR(uint8_t listSize, @@ -113,14 +107,13 @@ void updateLLR(uint8_t listSize, } void updatePathMetric(double *pathMetric, - uint8_t listSize, - uint8_t bitValue, - uint16_t row, - int xlen, - int ylen, - int zlen, - double llr[xlen][ylen][zlen] - ) + uint8_t listSize, + uint8_t bitValue, + uint16_t row, + int xlen, + int ylen, + int zlen, + double llr[xlen][ylen][zlen]) { const int multiplier = (2 * bitValue) - 1; for (uint i = 0; i < listSize; i++) @@ -128,12 +121,12 @@ void updatePathMetric(double *pathMetric, } void updatePathMetric2(double *pathMetric, - uint8_t listSize, - uint16_t row, - int xlen, - int ylen, - int zlen, - double llr[xlen][ylen][zlen]) + uint8_t listSize, + uint16_t row, + int xlen, + int ylen, + int zlen, + double llr[xlen][ylen][zlen]) { double tempPM[listSize]; memcpy(tempPM, pathMetric, (sizeof(double) * listSize)); @@ -172,7 +165,7 @@ static inline decoder_node_t *new_decoder_node(simde__m256i **buffer, .alpha = tree_sz, .beta = tree_sz + leaf_sz * sizeof(int16_t), .betaInit = false}; - return(node); + return (node); } static inline decoder_node_t *add_nodes(decoder_tree_t *tree, @@ -181,7 +174,7 @@ static inline decoder_node_t *add_nodes(decoder_tree_t *tree, const uint8_t *information_bit_pattern, simde__m256i **buffer) { - if (level==0) { + if (level == 0) { #ifdef DEBUG_NEW_IMPL printf("leaf %d (%s)\n", first_leaf_index, information_bit_pattern[first_leaf_index] == 1 ? "information or crc" : "frozen"); #endif @@ -203,7 +196,7 @@ static inline decoder_node_t *add_nodes(decoder_tree_t *tree, decoder_node_t *new_node = new_decoder_node(buffer, level, first_leaf_index, false, false); new_node->left = add_nodes(tree, level - 1, first_leaf_index, information_bit_pattern, buffer); new_node->right = add_nodes(tree, level - 1, first_leaf_index + (Nv / 2), information_bit_pattern, buffer); - return(new_node); + return (new_node); } void build_decoder_tree(t_nrPolar_params *pp) @@ -225,7 +218,12 @@ static inline void applyFtoleft(const t_nrPolar_params *pp, decoder_node_t *node int8_t *betal = treeBeta(node->left); #ifdef DEBUG_NEW_IMPL - printf("applyFtoleft %d, Nv %d (level %d,node->left (leaf %d, AF %d))\n",node->first_leaf_index,node->Nv,node->level,node->left->leaf,node->left->all_frozen); + printf("applyFtoleft %d, Nv %d (level %d,node->left (leaf %d, AF %d))\n", + node->first_leaf_index, + node->Nv, + node->level, + node->left->leaf, + node->left->all_frozen); for (int i = 0; i < node->Nv; i++) printf("i%d (frozen %d): alpha_v[i] = %d\n", i, 1 - pp->information_bit_pattern[node->first_leaf_index + i], alpha_v[i]); @@ -238,7 +236,7 @@ static inline void applyFtoleft(const t_nrPolar_params *pp, decoder_node_t *node int avx2len = sz / 16; // printf("avx2len %d\n",avx2len); - for (int i=0;ileft->betaInit = true; #ifdef DEBUG_NEW_IMPL - printf("betal[0] %d (%p)\n",betal[0],&betal[0]); + printf("betal[0] %d (%p)\n", betal[0], &betal[0]); #endif output[node->first_leaf_index] = tmp; #ifdef DEBUG_NEW_IMPL - printf("Setting bit %d to %d (LLR %d)\n",node->first_leaf_index,(betal[0]+1)>>1,alpha_l[0]); + printf("Setting bit %d to %d (LLR %d)\n", node->first_leaf_index, (betal[0] + 1) >> 1, alpha_l[0]); #endif } } @@ -298,7 +294,12 @@ static inline void applyGtoright(const t_nrPolar_params *pp, decoder_node_t *nod int8_t *betar = treeBeta(node->right); #ifdef DEBUG_NEW_IMPL - printf("applyGtoright %d, Nv %d (level %d), (leaf %d, AF %d)\n",node->first_leaf_index,node->Nv,node->level,node->right->leaf,node->right->all_frozen); + printf("applyGtoright %d, Nv %d (level %d), (leaf %d, AF %d)\n", + node->first_leaf_index, + node->Nv, + node->level, + node->right->leaf, + node->right->all_frozen); #endif assert(node->level); const int sz = 1 << (node->level - 1); @@ -320,7 +321,8 @@ static inline void applyGtoright(const t_nrPolar_params *pp, decoder_node_t *nod int avx2len = sz / 16; for (int i = 0; i < avx2len; i++) { - simde__m256i tmp = simde_mm256_sign_epi16(((simde__m256i *)alpha_v)[i], simde_mm256_cvtepi8_epi16(((simde__m128i *)betal)[i])); + simde__m256i tmp = + simde_mm256_sign_epi16(((simde__m256i *)alpha_v)[i], simde_mm256_cvtepi8_epi16(((simde__m128i *)betal)[i])); ((simde__m256i *)alpha_r)[i] = simde_mm256_subs_epi16(((simde__m256i *)alpha_v)[i + avx2len], tmp); } } else if (avx2mod == 8) { @@ -340,7 +342,7 @@ static inline void applyGtoright(const t_nrPolar_params *pp, decoder_node_t *nod output[node->first_leaf_index + 1] = tmp; #ifdef DEBUG_NEW_IMPL - printf("Setting bit %d to %d (LLR %d)\n",node->first_leaf_index+1,(betar[0]+1)>>1,alpha_r[0]); + printf("Setting bit %d to %d (LLR %d)\n", node->first_leaf_index + 1, (betar[0] + 1) >> 1, alpha_r[0]); #endif } } @@ -354,7 +356,10 @@ static inline void computeBeta(decoder_node_t *node) int8_t *betal = treeBeta(node->left); int8_t *betar = treeBeta(node->right); #ifdef DEBUG_NEW_IMPL - printf("Computing beta @ level %d first_leaf_index %d (all_frozen %d)\n",node->level,node->first_leaf_index,node->left->all_frozen); + printf("Computing beta @ level %d first_leaf_index %d (all_frozen %d)\n", + node->level, + node->first_leaf_index, + node->left->all_frozen); #endif assert(node->level); const int sz = 1 << (node->level - 1); @@ -370,7 +375,7 @@ static inline void computeBeta(decoder_node_t *node) int avx2mod = sz & 31; if (avx2mod == 0) { int avx2len = sz / 16; - for (int i=0;ibetaInit = true; } -void generic_polar_decoder_recursive(t_nrPolar_params *pp, decoder_node_t *node, uint8_t *nr_polar_U) { +void generic_polar_decoder_recursive(t_nrPolar_params *pp, decoder_node_t *node, uint8_t *nr_polar_U) +{ // Apply F to left applyFtoleft(pp, node, nr_polar_U); int iter = pp->tree_linearization.iter++; @@ -397,7 +403,7 @@ void generic_polar_decoder_recursive(t_nrPolar_params *pp, decoder_node_t *node, pp->tree_linearization.op_list[iter].node = node; // if left is not a leaf recurse down to the left - if (node->left->leaf==0) + if (node->left->leaf == 0) generic_polar_decoder_recursive(pp, node->left, nr_polar_U); applyGtoright(pp, node, nr_polar_U); diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h b/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h index 546260a5f2..5210dbec6d 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h @@ -28,7 +28,7 @@ * \email raymond.knopp@eurecom.fr, turker.yilmaz@eurecom.fr * \note * \warning -*/ + */ #ifndef __NR_POLAR_DEFS__H__ #define __NR_POLAR_DEFS__H__ @@ -43,17 +43,18 @@ #include "PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h" #include "PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h" #include "PHY/CODING/coding_defs.h" -//#include "SIMULATION/TOOLS/sim.h" +// #include "SIMULATION/TOOLS/sim.h" -#define NR_POLAR_DECODER_LISTSIZE 8 //uint8_t +#define NR_POLAR_DECODER_LISTSIZE 8 // uint8_t -#define NR_POLAR_AGGREGATION_LEVEL_1_PRIME 149 //uint16_t -#define NR_POLAR_AGGREGATION_LEVEL_2_PRIME 151 //uint16_t -#define NR_POLAR_AGGREGATION_LEVEL_4_PRIME 157 //uint16_t -#define NR_POLAR_AGGREGATION_LEVEL_8_PRIME 163 //uint16_t -#define NR_POLAR_AGGREGATION_LEVEL_16_PRIME 167 //uint16_t +#define NR_POLAR_AGGREGATION_LEVEL_1_PRIME 149 // uint16_t +#define NR_POLAR_AGGREGATION_LEVEL_2_PRIME 151 // uint16_t +#define NR_POLAR_AGGREGATION_LEVEL_4_PRIME 157 // uint16_t +#define NR_POLAR_AGGREGATION_LEVEL_8_PRIME 163 // uint16_t +#define NR_POLAR_AGGREGATION_LEVEL_16_PRIME 167 // uint16_t -static const uint8_t nr_polar_subblock_interleaver_pattern[32] = {0,1,2,4,3,5,6,7,8,16,9,17,10,18,11,19,12,20,13,21,14,22,15,23,24,25,26,28,27,29,30,31}; +static const uint8_t nr_polar_subblock_interleaver_pattern[32] = {0, 1, 2, 4, 3, 5, 6, 7, 8, 16, 9, 17, 10, 18, 11, 19, + 12, 20, 13, 21, 14, 22, 15, 23, 24, 25, 26, 28, 27, 29, 30, 31}; #define Nmax 1024 #define nmax 10 @@ -82,7 +83,7 @@ typedef struct decoder_tree_t_s { } decoder_tree_t; typedef struct nrPolar_params { - //messageType: 0=PBCH, 1=DCI, -1=UCI + // messageType: 0=PBCH, 1=DCI, -1=UCI struct nrPolar_params *nextPtr __attribute__((aligned(16))); bool busy; @@ -123,16 +124,12 @@ typedef struct nrPolar_params { bool is_initialized; struct { int op_code; - decoder_node_t* node; + decoder_node_t *node; } op_list[600]; } tree_linearization; } t_nrPolar_params; -void polar_encoder(uint32_t *input, - uint32_t *output, - int8_t messageType, - uint16_t messageLength, - uint8_t aggregation_level); +void polar_encoder(uint32_t *input, uint32_t *output, int8_t messageType, uint16_t messageLength, uint8_t aggregation_level); void polar_encoder_dci(uint32_t *in, uint32_t *out, @@ -190,7 +187,7 @@ void nr_polar_print_polarParams(void); t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, uint8_t aggregation_level); -uint16_t nr_polar_aggregation_prime (uint8_t aggregation_level); +uint16_t nr_polar_aggregation_prime(uint8_t aggregation_level); const uint8_t **nr_polar_kronecker_power_matrices(uint8_t n); @@ -201,27 +198,13 @@ const uint16_t *nr_polar_sequence_pattern(uint8_t n); * @param K Number of bits to encode (=payloadBits+crcParityBits) * @param E * @param n_max */ -uint32_t nr_polar_output_length(uint16_t K, - uint16_t E, - uint8_t n_max); +uint32_t nr_polar_output_length(uint16_t K, uint16_t E, uint8_t n_max); -void nr_polar_rate_matching_pattern(uint16_t *rmp, - uint16_t *J, - const uint8_t *P_i_, - uint16_t K, - uint16_t N, - uint16_t E); +void nr_polar_rate_matching_pattern(uint16_t *rmp, uint16_t *J, const uint8_t *P_i_, uint16_t K, uint16_t N, uint16_t E); -void nr_polar_rate_matching(double *input, - double *output, - uint16_t *rmp, - uint16_t K, - uint16_t N, - uint16_t E); +void nr_polar_rate_matching(double *input, double *output, uint16_t *rmp, uint16_t K, uint16_t N, uint16_t E); -void nr_polar_interleaving_pattern(uint16_t K, - uint8_t I_IL, - uint16_t *PI_k_); +void nr_polar_interleaving_pattern(uint16_t K, uint8_t I_IL, uint16_t *PI_k_); void nr_polar_info_bit_pattern(uint8_t *ibp, uint8_t *pcbp, @@ -236,18 +219,11 @@ void nr_polar_info_bit_pattern(uint8_t *ibp, const uint8_t n_PC, const uint8_t n_pc_wm); -void nr_polar_info_bit_extraction(uint8_t *input, - uint8_t *output, - uint8_t *pattern, - uint16_t size); +void nr_polar_info_bit_extraction(uint8_t *input, uint8_t *output, uint8_t *pattern, uint16_t size); -void nr_bit2byte_uint32_8(uint32_t *in, - uint16_t arraySize, - uint8_t *out); +void nr_bit2byte_uint32_8(uint32_t *in, uint16_t arraySize, uint8_t *out); -void nr_byte2bit_uint8_32(uint8_t *in, - uint16_t arraySize, - uint32_t *out); +void nr_byte2bit_uint8_32(uint8_t *in, uint16_t arraySize, uint32_t *out); const uint8_t **crc24c_generator_matrix(uint16_t payloadSizeBits); @@ -258,15 +234,9 @@ void nr_polar_generate_u(uint64_t *u, uint16_t N, uint8_t n_pc); -void nr_polar_uxG(uint8_t const* u, size_t N, uint8_t* D); +void nr_polar_uxG(uint8_t const *u, size_t N, uint8_t *D); -void nr_polar_bit_insertion(uint8_t *input, - uint8_t *output, - uint16_t N, - uint16_t K, - int16_t *Q_I_N, - int16_t *Q_PC_N, - uint8_t n_PC); +void nr_polar_bit_insertion(uint8_t *input, uint8_t *output, uint16_t N, uint16_t K, int16_t *Q_I_N, int16_t *Q_PC_N, uint8_t n_PC); void nr_matrix_multiplication_uint8_1D_uint8_2D(const uint8_t *matrix1, const uint8_t **matrix2, @@ -274,46 +244,39 @@ void nr_matrix_multiplication_uint8_1D_uint8_2D(const uint8_t *matrix1, uint16_t row, uint16_t col); -void nr_sort_asc_double_1D_array_ind(double *matrix, - uint8_t *ind, - uint8_t len); +void nr_sort_asc_double_1D_array_ind(double *matrix, uint8_t *ind, uint8_t len); void nr_free_double_2D_array(double **input, uint16_t xlen); #ifndef __cplusplus void updateLLR(uint8_t listSize, - uint16_t row, - uint16_t col, - uint16_t xlen, - uint8_t ylen, - int zlen, - double llr[xlen][ylen][zlen], - uint8_t llrU[xlen][ylen], - uint8_t bit[xlen][ylen][zlen], - uint8_t bitU[xlen][ylen] - ); + uint16_t row, + uint16_t col, + uint16_t xlen, + uint8_t ylen, + int zlen, + double llr[xlen][ylen][zlen], + uint8_t llrU[xlen][ylen], + uint8_t bit[xlen][ylen][zlen], + uint8_t bitU[xlen][ylen]); void updatePathMetric(double *pathMetric, - uint8_t listSize, - uint8_t bitValue, - uint16_t row, - int xlen, - int ylen, - int zlen, - double llr[xlen][ylen][zlen] - ); + uint8_t listSize, + uint8_t bitValue, + uint16_t row, + int xlen, + int ylen, + int zlen, + double llr[xlen][ylen][zlen]); void updatePathMetric2(double *pathMetric, - uint8_t listSize, - uint16_t row, - int xlen, - int ylen, - int zlen, - double llr[xlen][ylen][zlen]); + uint8_t listSize, + uint16_t row, + int xlen, + int ylen, + int zlen, + double llr[xlen][ylen][zlen]); #endif -//Also nr_polar_rate_matcher -static inline void nr_polar_interleaver(uint8_t *input, - uint8_t *output, - uint16_t *pattern, - uint16_t size) +// Also nr_polar_rate_matcher +static inline void nr_polar_interleaver(uint8_t *input, uint8_t *output, uint16_t *pattern, uint16_t size) { for (int i = 0; i < size; i++) output[i] = input[pattern[i]]; diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c index cc85216f23..0f22900d72 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c @@ -30,23 +30,20 @@ * \warning */ -//#define DEBUG_POLAR_ENCODER -//#define DEBUG_POLAR_ENCODER_DCI -//#define DEBUG_POLAR_MATLAB -//#define POLAR_CODING_DEBUG +// #define DEBUG_POLAR_ENCODER +// #define DEBUG_POLAR_ENCODER_DCI +// #define DEBUG_POLAR_MATLAB +// #define POLAR_CODING_DEBUG #include "PHY/CODING/nrPolar_tools/nr_polar_defs.h" #include "assertions.h" #include -//input [a_31 a_30 ... a_0] -//output [f_31 f_30 ... f_0] [f_63 f_62 ... f_32] ... +// input [a_31 a_30 ... a_0] +// output [f_31 f_30 ... f_0] [f_63 f_62 ... f_32] ... -void polar_encoder(uint32_t *in, - uint32_t *out, - int8_t messageType, - uint16_t messageLength, - uint8_t aggregation_level) { +void polar_encoder(uint32_t *in, uint32_t *out, int8_t messageType, uint16_t messageLength, uint8_t aggregation_level) +{ t_nrPolar_params *polarParams = nr_polar_params(messageType, messageLength, aggregation_level); uint8_t nr_polar_A[polarParams->payloadBits]; nr_bit2byte_uint32_8(in, polarParams->payloadBits, nr_polar_A); @@ -83,21 +80,21 @@ void polar_encoder(uint32_t *in, printf("b[%d]=%d\n", i, nr_polar_B[i]); #endif - //Interleaving (c to c') + // Interleaving (c to c') uint8_t nr_polar_CPrime[polarParams->K]; nr_polar_interleaver(nr_polar_B, nr_polar_CPrime, polarParams->interleaving_pattern, polarParams->K); #ifdef DEBUG_POLAR_ENCODER - uint64_t Cprime=0; + uint64_t Cprime = 0; - for (int i = 0; iK; i++) { + for (int i = 0; i < polarParams->K; i++) { Cprime = Cprime | ((uint64_t)nr_polar_CPrime[i] << i); if (nr_polar_CPrime[i] == 1) printf("pos %d : %lx\n", i, Cprime); } - printf("polar_Cprime %lx\n",Cprime); + printf("polar_Cprime %lx\n", Cprime); #endif - //Bit insertion (c' to u) + // Bit insertion (c' to u) uint8_t nr_polar_U[polarParams->N]; nr_polar_bit_insertion(nr_polar_CPrime, nr_polar_U, @@ -119,11 +116,10 @@ void polar_encoder(uint32_t *in, for (int i = 0; i < polarParams->N; i++) D[i / 64] |= ((uint64_t)nr_polar_D[i]) << (i & 63); - printf("D %llx,%llx,%llx,%llx,%llx,%llx,%llx,%llx\n", - D[0],D[1],D[2],D[3],D[4],D[5],D[6],D[7]); + printf("D %llx,%llx,%llx,%llx,%llx,%llx,%llx,%llx\n", D[0], D[1], D[2], D[3], D[4], D[5], D[6], D[7]); #endif - //Rate matching - //Sub-block interleaving (d to y) and Bit selection (y to e) + // Rate matching + // Sub-block interleaving (d to y) and Bit selection (y to e) uint8_t nr_polar_E[polarParams->encoderLength]; nr_polar_interleaver(nr_polar_D, nr_polar_E, polarParams->rate_matching_pattern, polarParams->encoderLength); /* @@ -145,7 +141,8 @@ void polar_encoder_dci(uint32_t *in, uint16_t n_RNTI, int8_t messageType, uint16_t messageLength, - uint8_t aggregation_level) { + uint8_t aggregation_level) +{ t_nrPolar_params *polarParams = nr_polar_params(messageType, messageLength, aggregation_level); #ifdef DEBUG_POLAR_ENCODER_DCI @@ -176,10 +173,11 @@ void polar_encoder_dci(uint32_t *in, printf("\n"); printf("[polar_encoder_dci] GP: "); - for (int i=0; icrcParityBits; i++) printf("%d-", polarParams->crc_generator_matrix[0][i]); + for (int i = 0; i < polarParams->crcParityBits; i++) + printf("%d-", polarParams->crc_generator_matrix[0][i]); printf("\n"); #endif - //Calculate CRC. + // Calculate CRC. uint8_t nr_polar_crc[polarParams->crcParityBits]; nr_matrix_multiplication_uint8_1D_uint8_2D(nr_polar_APrime, polarParams->crc_generator_matrix, @@ -197,14 +195,14 @@ void polar_encoder_dci(uint32_t *in, printf("\n"); #endif uint8_t nr_polar_B[polarParams->payloadBits + 8 + 16]; - //Attach CRC to the Transport Block. (a to b) + // Attach CRC to the Transport Block. (a to b) memcpy(nr_polar_B, nr_polar_A, polarParams->payloadBits); for (uint i = polarParams->payloadBits; i < polarParams->K; i++) nr_polar_B[i] = nr_polar_crc[i - polarParams->payloadBits]; - //Scrambling (b to c) - for (int i=0; i<16; i++) + // Scrambling (b to c) + for (int i = 0; i < 16; i++) nr_polar_B[polarParams->payloadBits + 8 + i] = (nr_polar_B[polarParams->payloadBits + 8 + i] + ((n_RNTI >> (15 - i)) & 1)) % 2; #ifdef DEBUG_POLAR_ENCODER_DCI @@ -213,10 +211,10 @@ void polar_encoder_dci(uint32_t *in, printf("%d-", nr_polar_B[i]); printf("\n"); #endif - //Interleaving (c to c') + // Interleaving (c to c') uint8_t nr_polar_CPrime[polarParams->K]; nr_polar_interleaver(nr_polar_B, nr_polar_CPrime, polarParams->interleaving_pattern, polarParams->K); - //Bit insertion (c' to u) + // Bit insertion (c' to u) uint8_t nr_polar_U[polarParams->N]; nr_polar_bit_insertion(nr_polar_CPrime, nr_polar_U, @@ -225,14 +223,14 @@ void polar_encoder_dci(uint32_t *in, polarParams->Q_I_N, polarParams->Q_PC_N, polarParams->n_pc); - //Encoding (u to d) + // Encoding (u to d) uint8_t nr_polar_D[polarParams->N]; nr_matrix_multiplication_uint8_1D_uint8_2D(nr_polar_U, polarParams->G_N, nr_polar_D, polarParams->N, polarParams->N); for (uint i = 0; i < polarParams->N; i++) nr_polar_D[i] %= 2; - //Rate matching - //Sub-block interleaving (d to y) and Bit selection (y to e) + // Rate matching + // Sub-block interleaving (d to y) and Bit selection (y to e) uint8_t nr_polar_E[polarParams->encoderLength]; nr_polar_interleaver(nr_polar_D, nr_polar_E, polarParams->rate_matching_pattern, polarParams->encoderLength); /* @@ -294,44 +292,50 @@ __attribute__((always_inline)) static inline void polar_rate_matching(const t_nr { // handle rate matching with a single 128 bit word using bit shuffling // can be done with SIMD intrisics if needed - if (polarParams->groupsize < 8) { - AssertFatal(polarParams->encoderLength<=512,"Need to handle groupsize(%d)<8 and N(%d)>512\n",polarParams->groupsize,polarParams->encoderLength); - uint128_t *out128=(uint128_t*)out; - uint128_t *in128=(uint128_t*)in; - for (int i=0;iencoderLength>>7;i++) + if (polarParams->groupsize < 8) { + AssertFatal(polarParams->encoderLength <= 512, + "Need to handle groupsize(%d)<8 and N(%d)>512\n", + polarParams->groupsize, + polarParams->encoderLength); + uint128_t *out128 = (uint128_t *)out; + uint128_t *in128 = (uint128_t *)in; + for (int i = 0; i < polarParams->encoderLength >> 7; i++) out128[i] = 0; #ifdef DEBUG_POLAR_ENCODER uint128_t tmp1; #endif - for (int i=0; iencoderLength; i++) { + for (int i = 0; i < polarParams->encoderLength; i++) { #ifdef DEBUG_POLAR_ENCODER - printf("%d<-%u : %llx.%llx =>",i,polarParams->rate_matching_pattern[i],((uint64_t *)out)[1],((uint64_t *)out)[0]); + printf("%d<-%u : %llx.%llx =>", i, polarParams->rate_matching_pattern[i], ((uint64_t *)out)[1], ((uint64_t *)out)[0]); #endif - uint8_t pi=polarParams->rate_matching_pattern[i]; - uint8_t pi7=pi>>7; - uint8_t pimod128=pi&127; - uint8_t imod128=i&127; - uint8_t i7=i>>7; + uint8_t pi = polarParams->rate_matching_pattern[i]; + uint8_t pi7 = pi >> 7; + uint8_t pimod128 = pi & 127; + uint8_t imod128 = i & 127; + uint8_t i7 = i >> 7; uint128_t tmp0 = (in128[pi7] & (((uint128_t)1) << (pimod128))); - if (tmp0!=0) { - out128[i7] = out128[i7] | ((uint128_t)1)<%llx.%llx => %llx.%llx\n", - ((uint64_t *)&tmp0)[1],((uint64_t *)&tmp0)[0], - ((uint64_t *)&tmp1)[1],((uint64_t *)&tmp1)[0], - ((uint64_t *)out)[1],((uint64_t *)out)[0]); + ((uint64_t *)&tmp0)[1], + ((uint64_t *)&tmp0)[0], + ((uint64_t *)&tmp1)[1], + ((uint64_t *)&tmp1)[0], + ((uint64_t *)out)[1], + ((uint64_t *)out)[0]); #endif } } - } + } // These are based on LUTs for byte and short word groups else if (polarParams->groupsize == 8) for (int i = 0; i < polarParams->encoderLength >> 3; i++) ((uint8_t *)out)[i] = ((uint8_t *)in)[polarParams->rm_tab[i]]; else // groupsize==16 - for (int i=0; iencoderLength>>4; i++) { + for (int i = 0; i < polarParams->encoderLength >> 4; i++) { ((uint16_t *)out)[i] = ((uint16_t *)in)[polarParams->rm_tab[i]]; } @@ -340,19 +344,20 @@ __attribute__((always_inline)) static inline void polar_rate_matching(const t_nr } } -void build_polar_tables(t_nrPolar_params *polarParams) { +void build_polar_tables(t_nrPolar_params *polarParams) +{ // build table b -> c' - AssertFatal(polarParams->K > 17, "K = %d < 18, is not possible\n",polarParams->K); + AssertFatal(polarParams->K > 17, "K = %d < 18, is not possible\n", polarParams->K); AssertFatal(polarParams->K < 129, "K = %d > 128, is not supported yet\n", polarParams->K); - const int numbytes = (polarParams->K+7)/8; - const int residue = polarParams->K&7; + const int numbytes = (polarParams->K + 7) / 8; + const int residue = polarParams->K & 7; uint deinterleaving_pattern[polarParams->K]; for (int i = 0; i < polarParams->K; i++) deinterleaving_pattern[polarParams->interleaving_pattern[i]] = i; - for (int byte=0; byteK>>3) ? 8 : residue; + for (int byte = 0; byte < numbytes; byte++) { + int numbits = byte < (polarParams->K >> 3) ? 8 : residue; for (uint64_t val = 0; val < 256LU; val++) { // uint16_t * tmp=polarParams->deinterleaving_pattern+polarParams->K - 1 - 8 * byte; union { @@ -360,10 +365,10 @@ void build_polar_tables(t_nrPolar_params *polarParams) { uint64_t pieces[2]; } tab = {0}; uint *tmp = deinterleaving_pattern + polarParams->K - 8 * byte - 1; - for (int i=0; i> i) & 1; tab.full |= bit_i << ip; } @@ -372,50 +377,57 @@ void build_polar_tables(t_nrPolar_params *polarParams) { } } - AssertFatal(polarParams->N == 512 || polarParams->N == 256 || polarParams->N == 128 || polarParams->N == 64, "N = %d, not done yet\n", polarParams->N); + AssertFatal(polarParams->N == 512 || polarParams->N == 256 || polarParams->N == 128 || polarParams->N == 64, + "N = %d, not done yet\n", + polarParams->N); // rate matching table - int iplast=polarParams->rate_matching_pattern[0]; - int ccnt=0; + int iplast = polarParams->rate_matching_pattern[0]; + int ccnt = 0; #ifdef DEBUG_POLAR_ENCODER - int groupcnt=0; - int firstingroup_out=0; - int firstingroup_in=iplast; + int groupcnt = 0; + int firstingroup_out = 0; + int firstingroup_in = iplast; #endif int mingroupsize = 1024; // compute minimum group size of rate-matching pattern - for (int outpos=1; outposencoderLength; outpos++) { + for (int outpos = 1; outpos < polarParams->encoderLength; outpos++) { int ip = polarParams->rate_matching_pattern[outpos]; #ifdef DEBUG_POLAR_ENCODER - printf("rm: outpos %d, inpos %d\n",outpos,ip); + printf("rm: outpos %d, inpos %d\n", outpos, ip); #endif if ((ip - iplast) == 1) ccnt++; else { #ifdef DEBUG_POLAR_ENCODER groupcnt++; - printf("group %d (size %d): (%d:%d) => (%d:%d)\n",groupcnt,ccnt+1, - firstingroup_in,firstingroup_in+ccnt, - firstingroup_out,firstingroup_out+ccnt); + printf("group %d (size %d): (%d:%d) => (%d:%d)\n", + groupcnt, + ccnt + 1, + firstingroup_in, + firstingroup_in + ccnt, + firstingroup_out, + firstingroup_out + ccnt); #endif if ((ccnt + 1) < mingroupsize) mingroupsize = ccnt + 1; - ccnt=0; + ccnt = 0; #ifdef DEBUG_POLAR_ENCODER - firstingroup_out=outpos; - firstingroup_in=ip; + firstingroup_out = outpos; + firstingroup_in = ip; #endif } - iplast=ip; + iplast = ip; } #ifdef DEBUG_POLAR_ENCODER groupcnt++; #endif - if ((ccnt+1) (%d:%d)\n", groupcnt, @@ -456,7 +468,6 @@ void build_polar_tables(t_nrPolar_params *polarParams) { build_decoder_tree(polarParams); } - void polar_encoder_fast(uint64_t *A, void *out, int32_t crcmask, @@ -482,27 +493,27 @@ void polar_encoder_fast(uint64_t *A, #endif // AssertFatal(polarParams->K > 32, "K = %d < 33, is not supported yet\n",polarParams->K); - AssertFatal(polarParams->K < 129, "K = %d > 128, is not supported yet\n",polarParams->K); - AssertFatal(polarParams->payloadBits < 65, "payload bits = %d > 64, is not supported yet\n",polarParams->payloadBits); + AssertFatal(polarParams->K < 129, "K = %d > 128, is not supported yet\n", polarParams->K); + AssertFatal(polarParams->payloadBits < 65, "payload bits = %d > 64, is not supported yet\n", polarParams->payloadBits); int bitlen = polarParams->payloadBits; // append crc - AssertFatal(bitlen<129,"support for payloads <= 128 bits\n"); + AssertFatal(bitlen < 129, "support for payloads <= 128 bits\n"); // AssertFatal(polarParams->crcParityBits == 24,"support for 24-bit crc only for now\n"); - //int bitlen0=bitlen; + // int bitlen0=bitlen; #ifdef POLAR_CODING_DEBUG printf("\nTX\n"); printf("a: "); - for (int n = (bitlen + 63)/64 ; n >=0; n--) { - if (n % 4 == 0) - printf(" "); - if (n < bitlen) - printf("%lu", (A[n/64] >> (n%64)) & 1); + for (int n = (bitlen + 63) / 64; n >= 0; n--) { + if (n % 4 == 0) + printf(" "); + if (n < bitlen) + printf("%lu", (A[n / 64] >> (n % 64)) & 1); } printf("\n"); #endif - uint64_t tcrc=0; + uint64_t tcrc = 0; uint offset = 0; // appending 24 ones before a0 for DCI as stated in 38.212 7.3.2 @@ -513,76 +524,76 @@ void polar_encoder_fast(uint64_t *A, //???a'_{N-1} a'_{N-2} ... a'_{N-A} 0 .... 0, where N=64,128,192,..., N is smallest multiple of 64 greater than or equal to A // First flip A bitstring byte endian for CRC routines (optimized for DLSCH/ULSCH, not PBCH/PDCCH) - // CRC reads in each byte in bit positions 7 down to 0, for PBCH/PDCCH we need to read in a_{A-1} down to a_{0}, A = length of bit string (e.g. 32 for PBCH) - if (bitlen<=32) { - uint8_t A32_flip[4+offset]; + // CRC reads in each byte in bit positions 7 down to 0, for PBCH/PDCCH we need to read in a_{A-1} down to a_{0}, A = length of bit + // string (e.g. 32 for PBCH) + if (bitlen <= 32) { + uint8_t A32_flip[4 + offset]; if (ones_flag) { A32_flip[0] = 0xff; A32_flip[1] = 0xff; A32_flip[2] = 0xff; } - uint32_t Aprime= (uint32_t)(((uint32_t)*A)<<(32-bitlen)); - A32_flip[0+offset]=((uint8_t *)&Aprime)[3]; - A32_flip[1+offset]=((uint8_t *)&Aprime)[2]; - A32_flip[2+offset]=((uint8_t *)&Aprime)[1]; - A32_flip[3+offset]=((uint8_t *)&Aprime)[0]; - if (polarParams->crcParityBits == 24) - tcrc = (uint64_t)(((crcmask^(crc24c(A32_flip,8*offset+bitlen)>>8)))&0xffffff); + uint32_t Aprime = (uint32_t)(((uint32_t)*A) << (32 - bitlen)); + A32_flip[0 + offset] = ((uint8_t *)&Aprime)[3]; + A32_flip[1 + offset] = ((uint8_t *)&Aprime)[2]; + A32_flip[2 + offset] = ((uint8_t *)&Aprime)[1]; + A32_flip[3 + offset] = ((uint8_t *)&Aprime)[0]; + if (polarParams->crcParityBits == 24) + tcrc = (uint64_t)(((crcmask ^ (crc24c(A32_flip, 8 * offset + bitlen) >> 8))) & 0xffffff); else if (polarParams->crcParityBits == 11) - tcrc = (uint64_t)(((crcmask^(crc11(A32_flip,bitlen)>>21)))&0x7ff); + tcrc = (uint64_t)(((crcmask ^ (crc11(A32_flip, bitlen) >> 21))) & 0x7ff); else if (polarParams->crcParityBits == 6) - tcrc = (uint64_t)(((crcmask^(crc6(A32_flip,bitlen)>>26)))&0x3f); - } else if (bitlen<=64) { - uint8_t A64_flip[8+offset]; + tcrc = (uint64_t)(((crcmask ^ (crc6(A32_flip, bitlen) >> 26))) & 0x3f); + } else if (bitlen <= 64) { + uint8_t A64_flip[8 + offset]; if (ones_flag) { A64_flip[0] = 0xff; A64_flip[1] = 0xff; A64_flip[2] = 0xff; } - uint64_t Aprime= (uint64_t)(((uint64_t)*A)<<(64-bitlen)); - A64_flip[0+offset]=((uint8_t *)&Aprime)[7]; - A64_flip[1+offset]=((uint8_t *)&Aprime)[6]; - A64_flip[2+offset]=((uint8_t *)&Aprime)[5]; - A64_flip[3+offset]=((uint8_t *)&Aprime)[4]; - A64_flip[4+offset]=((uint8_t *)&Aprime)[3]; - A64_flip[5+offset]=((uint8_t *)&Aprime)[2]; - A64_flip[6+offset]=((uint8_t *)&Aprime)[1]; - A64_flip[7+offset]=((uint8_t *)&Aprime)[0]; + uint64_t Aprime = (uint64_t)(((uint64_t)*A) << (64 - bitlen)); + A64_flip[0 + offset] = ((uint8_t *)&Aprime)[7]; + A64_flip[1 + offset] = ((uint8_t *)&Aprime)[6]; + A64_flip[2 + offset] = ((uint8_t *)&Aprime)[5]; + A64_flip[3 + offset] = ((uint8_t *)&Aprime)[4]; + A64_flip[4 + offset] = ((uint8_t *)&Aprime)[3]; + A64_flip[5 + offset] = ((uint8_t *)&Aprime)[2]; + A64_flip[6 + offset] = ((uint8_t *)&Aprime)[1]; + A64_flip[7 + offset] = ((uint8_t *)&Aprime)[0]; if (polarParams->crcParityBits == 24) - tcrc = (uint64_t)((crcmask^(crc24c(A64_flip,8*offset+bitlen)>>8)))&0xffffff; + tcrc = (uint64_t)((crcmask ^ (crc24c(A64_flip, 8 * offset + bitlen) >> 8))) & 0xffffff; else if (polarParams->crcParityBits == 11) - tcrc = (uint64_t)((crcmask^(crc11(A64_flip,bitlen)>>21)))&0x7ff; - } - else if (bitlen<=128) { - uint8_t A128_flip[16+offset]; + tcrc = (uint64_t)((crcmask ^ (crc11(A64_flip, bitlen) >> 21))) & 0x7ff; + } else if (bitlen <= 128) { + uint8_t A128_flip[16 + offset]; if (ones_flag) { A128_flip[0] = 0xff; A128_flip[1] = 0xff; A128_flip[2] = 0xff; } - uint128_t Aprime= (uint128_t)(((uint128_t)*A)<<(128-bitlen)); - for (int i=0; i<16 ; i++) - A128_flip[i+offset]=((uint8_t*)&Aprime)[15-i]; + uint128_t Aprime = (uint128_t)(((uint128_t)*A) << (128 - bitlen)); + for (int i = 0; i < 16; i++) + A128_flip[i + offset] = ((uint8_t *)&Aprime)[15 - i]; if (polarParams->crcParityBits == 24) - tcrc = (uint64_t)((crcmask^(crc24c(A128_flip,8*offset+bitlen)>>8)))&0xffffff; + tcrc = (uint64_t)((crcmask ^ (crc24c(A128_flip, 8 * offset + bitlen) >> 8))) & 0xffffff; else if (polarParams->crcParityBits == 11) - tcrc = (uint64_t)((crcmask^(crc11(A128_flip,bitlen)>>21)))&0x7ff; + tcrc = (uint64_t)((crcmask ^ (crc11(A128_flip, bitlen) >> 21))) & 0x7ff; } // this is number of quadwords in the bit string - int quadwlen = (polarParams->K+63)/64; + int quadwlen = (polarParams->K + 63) / 64; // Create the B bit string as // 0, 0, ..., 0, a'_0, a'_1, ..., a'_A-1, p_0, p_1, ..., p_{N_parity-1} //??? b_{N'-1} b_{N'-2} ... b_{N'-A} b_{N'-A-1} ... b_{N'-A-Nparity} = a_{N-1} a_{N-2} ... a_{N-A} p_{N_parity-1} ... p_0 - uint64_t B[4]= {0}; + uint64_t B[4] = {0}; B[0] = (A[0] << polarParams->crcParityBits) | tcrc; for (int n = 1; n < quadwlen; n++) - if ((bitlen+63)/64 > n) - B[n] = (A[n] << polarParams->crcParityBits) | (A[n-1]>>(64-polarParams->crcParityBits)); + if ((bitlen + 63) / 64 > n) + B[n] = (A[n] << polarParams->crcParityBits) | (A[n - 1] >> (64 - polarParams->crcParityBits)); else - B[n] = (A[n-1]>>(64-polarParams->crcParityBits)); + B[n] = (A[n - 1] >> (64 - polarParams->crcParityBits)); #ifdef POLAR_CODING_DEBUG int bitlen_B = bitlen + polarParams->crcParityBits; @@ -602,17 +613,13 @@ void polar_encoder_fast(uint64_t *A, // TS 38.212 - Section 5.3.1.1 Interleaving // For each byte of B, lookup in corresponding table for 64-bit word corresponding to that byte and its position - uint64_t Cprime[4]= {0}; + uint64_t Cprime[4] = {0}; uint8_t *Bbyte = (uint8_t *)B; if (polarParams->K < 65) { - Cprime[0] = polarParams->cprime_tab0[0][Bbyte[0]] | - polarParams->cprime_tab0[1][Bbyte[1]] | - polarParams->cprime_tab0[2][Bbyte[2]] | - polarParams->cprime_tab0[3][Bbyte[3]] | - polarParams->cprime_tab0[4][Bbyte[4]] | - polarParams->cprime_tab0[5][Bbyte[5]] | - polarParams->cprime_tab0[6][Bbyte[6]] | - polarParams->cprime_tab0[7][Bbyte[7]]; + Cprime[0] = polarParams->cprime_tab0[0][Bbyte[0]] | polarParams->cprime_tab0[1][Bbyte[1]] + | polarParams->cprime_tab0[2][Bbyte[2]] | polarParams->cprime_tab0[3][Bbyte[3]] + | polarParams->cprime_tab0[4][Bbyte[4]] | polarParams->cprime_tab0[5][Bbyte[5]] + | polarParams->cprime_tab0[6][Bbyte[6]] | polarParams->cprime_tab0[7][Bbyte[7]]; } else if (polarParams->K < 129) { for (int i = 0; i < 1 + (polarParams->K / 8); i++) { Cprime[0] |= polarParams->cprime_tab0[i][Bbyte[i]]; @@ -622,7 +629,8 @@ void polar_encoder_fast(uint64_t *A, #ifdef DEBUG_POLAR_MATLAB // Cprime = pbchCprime - for (int i = 0; i < quadwlen; i++) printf("[polar_encoder_fast]C'[%d]= 0x%llx\n", i, (unsigned long long)(Cprime[i])); + for (int i = 0; i < quadwlen; i++) + printf("[polar_encoder_fast]C'[%d]= 0x%llx\n", i, (unsigned long long)(Cprime[i])); #endif #ifdef POLAR_CODING_DEBUG @@ -677,8 +685,8 @@ void polar_encoder_fast(uint64_t *A, fflush(stdout); #endif - memset((void*)out,0,polarParams->encoderLength>>3); - polar_rate_matching(polarParams,(void *)D, out); + memset((void *)out, 0, polarParams->encoderLength >> 3); + polar_rate_matching(polarParams, (void *)D, out); #ifdef POLAR_CODING_DEBUG uint64_t *out64 = (uint64_t *)out; diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_interleaving_pattern.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_interleaving_pattern.c index 97450d9dbf..6002c1ed82 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_interleaving_pattern.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_interleaving_pattern.c @@ -28,11 +28,12 @@ * \email turker.yilmaz@eurecom.fr * \note * \warning -*/ + */ #include "PHY/CODING/nrPolar_tools/nr_polar_defs.h" -void nr_polar_interleaving_pattern(uint16_t K, uint8_t I_IL, uint16_t *PI_k_){ +void nr_polar_interleaving_pattern(uint16_t K, uint8_t I_IL, uint16_t *PI_k_) +{ uint K_IL_max = 164; uint8_t interleaving_pattern_table[164] = { 0, 2, 4, 7, 9, 14, 19, 20, 24, 25, 26, 28, 31, 34, 42, 45, 49, 50, 51, 53, 54, 56, 58, 59, diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_kernal_operation.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_kernal_operation.c index 81e7bb99f7..03f546a6e9 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_kernal_operation.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_kernal_operation.c @@ -7,53 +7,48 @@ void nr_polar_kernal_operation(uint8_t *u, uint8_t *d, uint16_t N) { - // Martino's algorithm to avoid multiplication for the generating matrix of polar codes - - uint32_t i,j; + // Martino's algorithm to avoid multiplication for the generating matrix of polar codes - simde__m256i A,B,C,D,E,U,zerosOnly, OUT; - simde__m256i inc; - uint32_t dTest[8]; - uint32_t uArray[8]; - uint32_t k; - uint32_t incArray[8]; - - //initialisation - for(k=0; k<8; k++) - incArray[k]=k; - inc=simde_mm256_loadu_si256((simde__m256i const*)incArray); // 0, 1, ..., 7 to increase - - zerosOnly=simde_mm256_setzero_si256(); // for comparison + uint32_t i, j; - for(i=0; i If zero, then XOR with the u(j) - D=simde_mm256_cmpeq_epi32(C, zerosOnly); // compare with zero and use the result as mask - - E=simde_mm256_maskload_epi32((int const*)uArray, D); // load only some u(j)s for the XOR - OUT=simde_mm256_xor_si256(OUT, E); //32 bit x 8 + // initialisation + for (k = 0; k < 8; k++) + incArray[k] = k; + inc = simde_mm256_loadu_si256((simde__m256i const *)incArray); // 0, 1, ..., 7 to increase - } - simde_mm256_storeu_si256((simde__m256i*)dTest, OUT); + zerosOnly = simde_mm256_setzero_si256(); // for comparison - for(k=0; k<8; k++) // Conversion from 32 bits to 8 bits - { - d[i+k]=(uint8_t)dTest[k]; // With AVX512 there is an intrinsic to do it - } + for (i = 0; i < N; i += 8) { + B = simde_mm256_set1_epi32((int)i); // i, ..., i + B = simde_mm256_add_epi32(B, inc); // i, i+1, ..., i+7 - } + OUT = simde_mm256_setzero_si256(); // it will contain the result of all the XORs for the d(i)s + for (j = 0; j < N; j++) { + A = simde_mm256_set1_epi32((int)(j)); // j, j, ..., j + A = simde_mm256_sub_epi32(A, B); //(j-i), (j-(i+1)), ... (j-(i+7)) + + U = simde_mm256_set1_epi32((int)u[j]); + simde_mm256_storeu_si256((simde__m256i *)uArray, U); // u(j) ... u(j) for the maskload + + C = simde_mm256_and_si256(A, B); //(j-i)&i -> If zero, then XOR with the u(j) + D = simde_mm256_cmpeq_epi32(C, zerosOnly); // compare with zero and use the result as mask + + E = simde_mm256_maskload_epi32((int const *)uArray, D); // load only some u(j)s for the XOR + OUT = simde_mm256_xor_si256(OUT, E); // 32 bit x 8 + } + simde_mm256_storeu_si256((simde__m256i *)dTest, OUT); + + for (k = 0; k < 8; k++) // Conversion from 32 bits to 8 bits + { + d[i + k] = (uint8_t)dTest[k]; // With AVX512 there is an intrinsic to do it + } + } } diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_matrix_and_array.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_matrix_and_array.c index 0db423260f..d96be2ec25 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_matrix_and_array.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_matrix_and_array.c @@ -28,7 +28,7 @@ * \email turker.yilmaz@eurecom.fr * \note * \warning -*/ + */ #include "PHY/CODING/nrPolar_tools/nr_polar_defs.h" @@ -47,7 +47,8 @@ void nr_matrix_multiplication_uint8_1D_uint8_2D(const uint8_t *matrix1, } // Modified Bubble Sort. -void nr_sort_asc_double_1D_array_ind(double *matrix, uint8_t *ind, uint8_t len) { +void nr_sort_asc_double_1D_array_ind(double *matrix, uint8_t *ind, uint8_t len) +{ for (int i = 0; i < len; i++) { int swaps = 0; for (int j = 0; j < (len - i) - 1; j++) { diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h b/openair1/PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h index 1904d1bd83..a9e59556bd 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h @@ -28,46 +28,70 @@ * \email turker.yilmaz@eurecom.fr * \note * \warning -*/ + */ #ifndef __NR_POLAR_PBCH_DEFS__H__ #define __NR_POLAR_PBCH_DEFS__H__ -#define NR_POLAR_PBCH_AGGREGATION_LEVEL 0 //uint8_t -#define NR_POLAR_PBCH_MESSAGE_TYPE 0 //int8_t -#define NR_POLAR_PSBCH_MESSAGE_TYPE 3 //int8_t -#define NR_POLAR_PBCH_PAYLOAD_BITS 32 //uint16_t +#define NR_POLAR_PBCH_AGGREGATION_LEVEL 0 // uint8_t +#define NR_POLAR_PBCH_MESSAGE_TYPE 0 // int8_t +#define NR_POLAR_PSBCH_MESSAGE_TYPE 3 // int8_t +#define NR_POLAR_PBCH_PAYLOAD_BITS 32 // uint16_t #define NR_POLAR_PBCH_CRC_PARITY_BITS 24 #define NR_POLAR_PBCH_CRC_ERROR_CORRECTION_BITS 3 -//Assumed 3 by 3GPP when NR_POLAR_PBCH_L>8 to meet false alarm rate requirements. +// Assumed 3 by 3GPP when NR_POLAR_PBCH_L>8 to meet false alarm rate requirements. -//Sec. 7.1.4: Channel Coding -#define NR_POLAR_PBCH_N_MAX 9 //uint8_t -#define NR_POLAR_PBCH_I_IL 1 //uint8_t -#define NR_POLAR_PBCH_I_SEG 0 //uint8_t -#define NR_POLAR_PBCH_N_PC 0 //uint8_t -#define NR_POLAR_PBCH_N_PC_WM 0 //uint8_t -//#define NR_POLAR_PBCH_N 512 //uint16_t +// Sec. 7.1.4: Channel Coding +#define NR_POLAR_PBCH_N_MAX 9 // uint8_t +#define NR_POLAR_PBCH_I_IL 1 // uint8_t +#define NR_POLAR_PBCH_I_SEG 0 // uint8_t +#define NR_POLAR_PBCH_N_PC 0 // uint8_t +#define NR_POLAR_PBCH_N_PC_WM 0 // uint8_t +// #define NR_POLAR_PBCH_N 512 //uint16_t -//Sec. 7.1.5: Rate Matching -#define NR_POLAR_PBCH_I_BIL 0 //uint8_t -#define NR_POLAR_PBCH_E 864 //uint16_t +// Sec. 7.1.5: Rate Matching +#define NR_POLAR_PBCH_I_BIL 0 // uint8_t +#define NR_POLAR_PBCH_E 864 // uint16_t #define NR_POLAR_PBCH_E_DWORD 27 // NR_POLAR_PBCH_E/32 -#define NR_POLAR_PSBCH_E 1792 //uint16_t +#define NR_POLAR_PSBCH_E 1792 // uint16_t #define NR_POLAR_PSBCH_E_DWORD 56 // NR_POLAR_PSBCH_E/32 /* * TEST CODE */ -//#define DEBUG_POLAR -// Usage in code: -//#ifdef DEBUG_POLAR +// #define DEBUG_POLAR +// Usage in code: +// #ifdef DEBUG_POLAR //... -//#endif +// #endif -//unsigned int testPayload0=0x00000000, testPayload1=0xffffffff; //payload1=~payload0; -//unsigned int testPayload2=0xa5a5a5a5; //testPayload3=0xb3f02c82; +// unsigned int testPayload0=0x00000000, testPayload1=0xffffffff; //payload1=~payload0; +// unsigned int testPayload2=0xa5a5a5a5; //testPayload3=0xb3f02c82; -//double testReceivedPayload3[NR_POLAR_PBCH_E] = {-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, 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, 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, -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, 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, 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, -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, 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, 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, -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, -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, -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, 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, -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, 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, -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, -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, -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, -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, 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, -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, -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, -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, 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, 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, -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, -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, 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, -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, -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, 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, -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}; +// double testReceivedPayload3[NR_POLAR_PBCH_E] = {-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, 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, 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, -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, 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, 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, -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, 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, 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, +// -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, -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, -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, 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, +// -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, 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, -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, -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, +// -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, -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, 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, -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, -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, -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, 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, 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, -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, -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, 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, -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, -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, 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, -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}; #endif diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_procedures.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_procedures.c index 1a1a3fb830..cf1df52ac0 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_procedures.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_procedures.c @@ -89,8 +89,7 @@ void nr_polar_generate_u(uint64_t *u, } } -static -void encode_packed_byte(uint8_t* in_out) +static void encode_packed_byte(uint8_t *in_out) { // *in_out ^= 0xAA & (*in_out << 1); // *in_out ^= 0xCC & (*in_out << 2); @@ -101,36 +100,33 @@ void encode_packed_byte(uint8_t* in_out) *in_out ^= *in_out >> 4; } -static -void polar_encode_bits(uint8_t* in_out, size_t N) +static void polar_encode_bits(uint8_t *in_out, size_t N) { size_t const num_bytes_per_block = N >> 3; - for(size_t i = 0; i < num_bytes_per_block; ++i){ + for (size_t i = 0; i < num_bytes_per_block; ++i) { encode_packed_byte(&in_out[i]); } } -static -uint32_t log2_floor(uint32_t x) +static uint32_t log2_floor(uint32_t x) { - if(x == 0) - return 0; + if (x == 0) + return 0; uint32_t clz = __builtin_clz(x); return 31U - clz; } -static -void polar_encode_bytes(uint8_t* in_out, size_t N) +static void polar_encode_bytes(uint8_t *in_out, size_t N) { size_t brnch_sz = 1; size_t n_brnch = N >> 4; - size_t const blck_pwr = log2_floor(N); + size_t const blck_pwr = log2_floor(N); for (size_t stage = 3; stage < blck_pwr; ++stage) { for (size_t brnch = 0; brnch < n_brnch; ++brnch) { - for(size_t byte = 0; byte < brnch_sz; ++byte){ - size_t const dst = 2*brnch_sz*brnch + byte; - in_out[dst] ^= in_out[dst + brnch_sz]; - } + for (size_t byte = 0; byte < brnch_sz; ++byte) { + size_t const dst = 2 * brnch_sz * brnch + byte; + in_out[dst] ^= in_out[dst + brnch_sz]; + } } n_brnch >>= 1; brnch_sz <<= 1; @@ -139,12 +135,12 @@ void polar_encode_bytes(uint8_t* in_out, size_t N) void nr_polar_uxG(uint8_t const *u, size_t N, uint8_t *D2) { - assert(N > 7); - uint8_t tmp[N/8]; - for(int i = 0; i < N/8; ++i) - tmp[i] = u[N/8 - 1 - i]; + assert(N > 7); + uint8_t tmp[N / 8]; + for (int i = 0; i < N / 8; ++i) + tmp[i] = u[N / 8 - 1 - i]; - reverse_bits_u8(tmp, N/8, D2); + reverse_bits_u8(tmp, N / 8, D2); // Do the encoding/xor for the bottom 3 levels of the tree. // Thus, data remaining to encode, is in 2^3 type. @@ -153,49 +149,40 @@ void nr_polar_uxG(uint8_t const *u, size_t N, uint8_t *D2) polar_encode_bytes(D2, N); } -void nr_polar_bit_insertion(uint8_t *input, - uint8_t *output, - uint16_t N, - uint16_t K, - int16_t *Q_I_N, - int16_t *Q_PC_N, - uint8_t n_PC) +void nr_polar_bit_insertion(uint8_t *input, uint8_t *output, uint16_t N, uint16_t K, int16_t *Q_I_N, int16_t *Q_PC_N, uint8_t n_PC) { int k = 0; - if (n_PC>0) { + if (n_PC > 0) { /* * */ } else { - for (int n=0; n<=N-1; n++) { + for (int n = 0; n <= N - 1; n++) { output[n] = 0; - for (int m=0; m<=(K+n_PC)-1; m++) { - if ( n == Q_I_N[m]) { + for (int m = 0; m <= (K + n_PC) - 1; m++) { + if (n == Q_I_N[m]) { output[n] = input[k]; k++; break; - } + } } } } } - -uint32_t nr_polar_output_length(uint16_t K, - uint16_t E, - uint8_t n_max) +uint32_t nr_polar_output_length(uint16_t K, uint16_t E, uint8_t n_max) { int n_1, n_2, n_min = 5; - double R_min=1.0/8; - - if ( (E <= (9.0/8)*pow(2,ceil(log2(E))-1)) && (K/E < 9.0/16) ) { - n_1 = ceil(log2(E))-1; + double R_min = 1.0 / 8; + + if ((E <= (9.0 / 8) * pow(2, ceil(log2(E)) - 1)) && (K / E < 9.0 / 16)) { + n_1 = ceil(log2(E)) - 1; } else { n_1 = ceil(log2(E)); } - - n_2 = ceil(log2(K/R_min)); + + n_2 = ceil(log2(K / R_min)); int n = n_max; if (n > n_1) @@ -206,9 +193,9 @@ uint32_t nr_polar_output_length(uint16_t K, n = n_min; /*printf("nr_polar_output_length: K %d, E %d, n %d (n_max %d,n_min %d, n_1 %d,n_2 %d)\n", - K,E,n,n_max,n_min,n_1,n_2); - exit(-1);*/ - return ((uint32_t) pow(2.0,n)); //=polar_code_output_length + K,E,n,n_max,n_min,n_1,n_2); + exit(-1);*/ + return ((uint32_t)pow(2.0, n)); //=polar_code_output_length } void nr_polar_info_bit_pattern(uint8_t *ibp, @@ -269,7 +256,7 @@ void nr_polar_info_bit_pattern(uint8_t *ibp, const int end = Q_Ftmp_N[N]; int m; for (m = 0; m <= end; m++) { - AssertFatal(m < N+1, "Buffer boundary overflow"); + AssertFatal(m < N + 1, "Buffer boundary overflow"); if (Q_0_Nminus1[n] == Q_Ftmp_N[m]) { break; } @@ -309,7 +296,6 @@ void nr_polar_info_bit_pattern(uint8_t *ibp, // Information and Parity Chack Bit Pattern for (int n = 0; n <= N - 1; n++) { - ibp[n] = 0; for (int m = 0; m <= (K + n_PC) - 1; m++) { if (n == Q_I_N[m]) { @@ -328,11 +314,7 @@ void nr_polar_info_bit_pattern(uint8_t *ibp, } } - -void nr_polar_info_bit_extraction(uint8_t *input, - uint8_t *output, - uint8_t *pattern, - uint16_t size) +void nr_polar_info_bit_extraction(uint8_t *input, uint8_t *output, uint8_t *pattern, uint16_t size) { uint16_t j = 0; for (int i = 0; i < size; i++) { @@ -343,13 +325,7 @@ void nr_polar_info_bit_extraction(uint8_t *input, } } - -void nr_polar_rate_matching_pattern(uint16_t *rmp, - uint16_t *J, - const uint8_t *P_i_, - uint16_t K, - uint16_t N, - uint16_t E) +void nr_polar_rate_matching_pattern(uint16_t *rmp, uint16_t *J, const uint8_t *P_i_, uint16_t K, uint16_t N, uint16_t E) { uint16_t d[N]; for (int m = 0; m < N; m++) @@ -357,54 +333,49 @@ void nr_polar_rate_matching_pattern(uint16_t *rmp, uint16_t y[N]; memset(y, 0, sizeof(y)); - for (int m=0; m<=N-1; m++){ + for (int m = 0; m <= N - 1; m++) { int i = floor((32 * m) / N); - J[m] = (P_i_[i]*(N/32)) + (m%(N/32)); + J[m] = (P_i_[i] * (N / 32)) + (m % (N / 32)); y[m] = d[J[m]]; } - if (E>=N) { //repetition - for (int k=0; k<=E-1; k++) { + if (E >= N) { // repetition + for (int k = 0; k <= E - 1; k++) { int ind = (k % N); - rmp[k]=y[ind]; + rmp[k] = y[ind]; } } else { - if ( (K/(double)E) <= (7.0/16) ) { //puncturing - for (int k=0; k<=E-1; k++) { - rmp[k]=y[k+N-E]; + if ((K / (double)E) <= (7.0 / 16)) { // puncturing + for (int k = 0; k <= E - 1; k++) { + rmp[k] = y[k + N - E]; } - } else { //shortening - for (int k=0; k<=E-1; k++) { - rmp[k]=y[k]; + } else { // shortening + for (int k = 0; k <= E - 1; k++) { + rmp[k] = y[k]; } } } } - -void nr_polar_rate_matching(double *input, - double *output, - uint16_t *rmp, - uint16_t K, - uint16_t N, - uint16_t E) +void nr_polar_rate_matching(double *input, double *output, uint16_t *rmp, uint16_t K, uint16_t N, uint16_t E) { - if (E>=N) { //repetition - for (int i=0; i<=N-1; i++) output[i]=0; - for (int i=0; i<=E-1; i++){ - output[rmp[i]]+=input[i]; + if (E >= N) { // repetition + for (int i = 0; i <= N - 1; i++) + output[i] = 0; + for (int i = 0; i <= E - 1; i++) { + output[rmp[i]] += input[i]; } } else { - if ( (K/(double)E) <= (7.0/16) ) { //puncturing + if ((K / (double)E) <= (7.0 / 16)) { // puncturing for (int i = 0; i <= N - 1; i++) output[i] = 0; - } else { //shortening + } else { // shortening for (int i = 0; i <= N - 1; i++) output[i] = INFINITY; } - for (int i=0; i<=E-1; i++){ - output[rmp[i]]=input[i]; + for (int i = 0; i <= E - 1; i++) { + output[rmp[i]] = input[i]; } } } diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_pucch_defs.h b/openair1/PHY/CODING/nrPolar_tools/nr_polar_pucch_defs.h index cf23982752..2b1fa8c6a7 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_pucch_defs.h +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_pucch_defs.h @@ -7,22 +7,21 @@ #define NR_POLAR_PUCCH_PAYLOAD_BITS 16 -//Ref. 38-212 v15.0.1 -#define NR_POLAR_PUCCH_N_MAX 10 //uint8_t <------ -#define NR_POLAR_PUCCH_I_IL 1 //uint8_t <--- interleaving: if 0 no interleaving -#define NR_POLAR_PUCCH_N_PC 3 //uint8_t <-- or zero ?? -#define NR_POLAR_PUCCH_N_PC_WM 0 //uint8_t -//#define NR_POLAR_PUCCH_N 512 //uint16_t - -//Ref. 38-212 v15.0.1, Section 7.1.5: Rate Matching -#define NR_POLAR_PUCCH_I_BIL 0 //uint8_t -#define NR_POLAR_PUCCH_E 864 //uint16_t +// Ref. 38-212 v15.0.1 +#define NR_POLAR_PUCCH_N_MAX 10 // uint8_t <------ +#define NR_POLAR_PUCCH_I_IL 1 // uint8_t <--- interleaving: if 0 no interleaving +#define NR_POLAR_PUCCH_N_PC 3 // uint8_t <-- or zero ?? +#define NR_POLAR_PUCCH_N_PC_WM 0 // uint8_t +// #define NR_POLAR_PUCCH_N 512 //uint16_t +// Ref. 38-212 v15.0.1, Section 7.1.5: Rate Matching +#define NR_POLAR_PUCCH_I_BIL 0 // uint8_t +#define NR_POLAR_PUCCH_E 864 // uint16_t /* * TEST CODE */ -//unsigned int testPayload0=0x00000000, testPayload1=0xffffffff; //payload1=~payload0; -//unsigned int testPayload2=0xa5a5a5a5, testPayload3=0xb3f02c82; +// unsigned int testPayload0=0x00000000, testPayload1=0xffffffff; //payload1=~payload0; +// unsigned int testPayload2=0xa5a5a5a5, testPayload3=0xb3f02c82; #endif diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_rate_match.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_rate_match.c index ffa37c9549..f5bca4a9b7 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_rate_match.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_rate_match.c @@ -22,7 +22,8 @@ #include #include "PHY/CODING/nrPolar_tools/nr_polar_defs.h" -void nr_polar_rate_matching_pattern(uint16_t *rmp, uint16_t *J, const uint8_t *P_i_, uint16_t K, uint16_t N, uint16_t E){ +void nr_polar_rate_matching_pattern(uint16_t *rmp, uint16_t *J, const uint8_t *P_i_, uint16_t K, uint16_t N, uint16_t E) +{ int d[N]; int y[N]; @@ -53,8 +54,8 @@ void nr_polar_rate_matching_pattern(uint16_t *rmp, uint16_t *J, const uint8_t *P } } - -void nr_polar_rate_matching(double *input, double *output, uint16_t *rmp, uint16_t K, uint16_t N, uint16_t E){ +void nr_polar_rate_matching(double *input, double *output, uint16_t *rmp, uint16_t K, uint16_t N, uint16_t E) +{ if (E >= N) { // repetition for (int i = 0; i <= N - 1; i++) output[i] = 0; diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_sequence_pattern.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_sequence_pattern.c index 2a64925fde..e4633c91a3 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_sequence_pattern.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_sequence_pattern.c @@ -21,16 +21,103 @@ #include "PHY/CODING/nrPolar_tools/nr_polar_defs.h" -static const uint16_t Q_0_Nminus1_1[2] = { 0, 1 }; -static const uint16_t Q_0_Nminus1_2[4] = { 0, 1, 2, 3 }; -static const uint16_t Q_0_Nminus1_3[8] = { 0, 1, 2, 4, 3, 5, 6, 7 }; -static const uint16_t Q_0_Nminus1_4[16] = { 0, 1, 2, 4, 8, 3, 5, 9, 6, 10, 12, 7, 11, 13, 14, 15 }; -static const uint16_t Q_0_Nminus1_5[32] = { 0, 1, 2, 4, 8, 16, 3, 5, 9, 6, 17, 10, 18, 12, 20, 24, 7, 11, 19, 13, 14, 21, 26, 25, 22, 28, 15, 23, 27, 29, 30, 31 }; -static const uint16_t Q_0_Nminus1_6[64] = { 0, 1, 2, 4, 8, 16, 32, 3, 5, 9, 6, 17, 10, 18, 12, 33, 20, 34, 24, 36, 7, 11, 40, 19, 13, 48, 14, 21, 35, 26, 37, 25, 22, 38, 41, 28, 42, 49, 44, 50, 15, 52, 23, 56, 27, 39, 29, 43, 30, 45, 51, 46, 53, 54, 57, 58, 60, 31, 47, 55, 59, 61, 62, 63 }; -static const uint16_t Q_0_Nminus1_7[128] = { 0, 1, 2, 4, 8, 16, 32, 3, 5, 64, 9, 6, 17, 10, 18, 12, 33, 65, 20, 34, 24, 36, 7, 66, 11, 40, 68, 19, 13, 48, 14, 72, 21, 35, 26, 80, 37, 25, 22, 38, 96, 67, 41, 28, 69, 42, 49, 74, 70, 44, 81, 50, 73, 15, 52, 23, 76, 82, 56, 27, 97, 39, 84, 29, 43, 98, 88, 30, 71, 45, 100, 51, 46, 75, 104, 53, 77, 54, 83, 57, 112, 78, 85, 58, 99, 86, 60, 89, 101, 31, 90, 102, 105, 92, 47, 106, 55, 113, 79, 108, 59, 114, 87, 116, 61, 91, 120, 62, 103, 93, 107, 94, 109, 115, 110, 117, 118, 121, 122, 63, 124, 95, 111, 119, 123, 125, 126, 127 }; -static const uint16_t Q_0_Nminus1_8[256] = { 0, 1, 2, 4, 8, 16, 32, 3, 5, 64, 9, 6, 17, 10, 18, 128, 12, 33, 65, 20, 34, 24, 36, 7, 129, 66, 11, 40, 68, 130, 19, 13, 48, 14, 72, 21, 132, 35, 26, 80, 37, 25, 22, 136, 38, 96, 67, 41, 144, 28, 69, 42, 49, 74, 160, 192, 70, 44, 131, 81, 50, 73, 15, 133, 52, 23, 134, 76, 137, 82, 56, 27, 97, 39, 84, 138, 145, 29, 43, 98, 88, 140, 30, 146, 71, 161, 45, 100, 51, 148, 46, 75, 104, 162, 53, 193, 152, 77, 164, 54, 83, 57, 112, 135, 78, 194, 85, 58, 168, 139, 99, 86, 60, 89, 196, 141, 101, 147, 176, 142, 31, 200, 90, 149, 102, 105, 163, 92, 47, 208, 150, 153, 165, 106, 55, 113, 154, 79, 108, 224, 166, 195, 59, 169, 114, 156, 87, 197, 116, 170, 61, 177, 91, 198, 172, 120, 201, 62, 143, 103, 178, 93, 202, 107, 180, 151, 209, 94, 204, 155, 210, 109, 184, 115, 167, 225, 157, 110, 117, 212, 171, 226, 216, 158, 118, 173, 121, 199, 179, 228, 174, 122, 203, 63, 181, 232, 124, 205, 182, 211, 185, 240, 206, 95, 213, 186, 227, 111, 214, 188, 217, 229, 159, 119, 218, 230, 233, 175, 123, 220, 183, 234, 125, 241, 207, 187, 236, 126, 242, 244, 189, 215, 219, 231, 248, 190, 221, 235, 222, 237, 243, 238, 245, 127, 191, 246, 249, 250, 252, 223, 239, 251, 247, 253, 254, 255 }; -static const uint16_t Q_0_Nminus1_9[512] = { 0, 1, 2, 4, 8, 16, 32, 3, 5, 64, 9, 6, 17, 10, 18, 128, 12, 33, 65, 20, 256, 34, 24, 36, 7, 129, 66, 11, 40, 68, 130, 19, 13, 48, 14, 72, 257, 21, 132, 35, 258, 26, 80, 37, 25, 22, 136, 260, 264, 38, 96, 67, 41, 144, 28, 69, 42, 49, 74, 272, 160, 288, 192, 70, 44, 131, 81, 50, 73, 15, 320, 133, 52, 23, 134, 384, 76, 137, 82, 56, 27, 97, 39, 259, 84, 138, 145, 261, 29, 43, 98, 88, 140, 30, 146, 71, 262, 265, 161, 45, 100, 51, 148, 46, 75, 266, 273, 104, 162, 53, 193, 152, 77, 164, 268, 274, 54, 83, 57, 112, 135, 78, 289, 194, 85, 276, 58, 168, 139, 99, 86, 60, 280, 89, 290, 196, 141, 101, 147, 176, 142, 321, 31, 200, 90, 292, 322, 263, 149, 102, 105, 304, 296, 163, 92, 47, 267, 385, 324, 208, 386, 150, 153, 165, 106, 55, 328, 113, 154, 79, 269, 108, 224, 166, 195, 270, 275, 291, 59, 169, 114, 277, 156, 87, 197, 116, 170, 61, 281, 278, 177, 293, 388, 91, 198, 172, 120, 201, 336, 62, 282, 143, 103, 178, 294, 93, 202, 323, 392, 297, 107, 180, 151, 209, 284, 94, 204, 298, 400, 352, 325, 155, 210, 305, 300, 109, 184, 115, 167, 225, 326, 306, 157, 329, 110, 117, 212, 171, 330, 226, 387, 308, 216, 416, 271, 279, 158, 337, 118, 332, 389, 173, 121, 199, 179, 228, 338, 312, 390, 174, 393, 283, 122, 448, 353, 203, 63, 340, 394, 181, 295, 285, 232, 124, 205, 182, 286, 299, 354, 211, 401, 185, 396, 344, 240, 206, 95, 327, 402, 356, 307, 301, 417, 213, 186, 404, 227, 418, 302, 360, 111, 331, 214, 309, 188, 449, 217, 408, 229, 159, 420, 310, 333, 119, 339, 218, 368, 230, 391, 313, 450, 334, 233, 175, 123, 341, 220, 314, 424, 395, 355, 287, 183, 234, 125, 342, 316, 241, 345, 452, 397, 403, 207, 432, 357, 187, 236, 126, 242, 398, 346, 456, 358, 405, 303, 244, 189, 361, 215, 348, 419, 406, 464, 362, 409, 219, 311, 421, 410, 231, 248, 369, 190, 364, 335, 480, 315, 221, 370, 422, 425, 451, 235, 412, 343, 372, 317, 222, 426, 453, 237, 433, 347, 243, 454, 318, 376, 428, 238, 359, 457, 399, 434, 349, 245, 458, 363, 127, 191, 407, 436, 465, 246, 350, 460, 249, 411, 365, 440, 374, 423, 466, 250, 371, 481, 413, 366, 468, 429, 252, 373, 482, 427, 414, 223, 472, 455, 377, 435, 319, 484, 430, 488, 239, 378, 459, 437, 380, 461, 496, 351, 467, 438, 251, 462, 442, 441, 469, 247, 367, 253, 375, 444, 470, 483, 415, 485, 473, 474, 254, 379, 431, 489, 486, 476, 439, 490, 463, 381, 497, 492, 443, 382, 498, 445, 471, 500, 446, 475, 487, 504, 255, 477, 491, 478, 383, 493, 499, 502, 494, 501, 447, 505, 506, 479, 508, 495, 503, 507, 509, 510, 511 }; -static const uint16_t Q_0_Nminus1_10[1024] = { 0, 1, 2, 4, 8, 16, 32, 3, 5, 64, 9, 6, 17, 10, 18, 128, 12, 33, 65, 20, 256, 34, 24, 36, 7, 129, 66, 512, 11, 40, 68, 130, 19, 13, 48, 14, 72, 257, 21, 132, 35, 258, 26, 513, 80, 37, 25, 22, 136, 260, 264, 38, 514, 96, 67, 41, 144, 28, 69, 42, 516, 49, 74, 272, 160, 520, 288, 528, 192, 544, 70, 44, 131, 81, 50, 73, 15, 320, 133, 52, 23, 134, 384, 76, 137, 82, 56, 27, 97, 39, 259, 84, 138, 145, 261, 29, 43, 98, 515, 88, 140, 30, 146, 71, 262, 265, 161, 576, 45, 100, 640, 51, 148, 46, 75, 266, 273, 517, 104, 162, 53, 193, 152, 77, 164, 768, 268, 274, 518, 54, 83, 57, 521, 112, 135, 78, 289, 194, 85, 276, 522, 58, 168, 139, 99, 86, 60, 280, 89, 290, 529, 524, 196, 141, 101, 147, 176, 142, 530, 321, 31, 200, 90, 545, 292, 322, 532, 263, 149, 102, 105, 304, 296, 163, 92, 47, 267, 385, 546, 324, 208, 386, 150, 153, 165, 106, 55, 328, 536, 577, 548, 113, 154, 79, 269, 108, 578, 224, 166, 519, 552, 195, 270, 641, 523, 275, 580, 291, 59, 169, 560, 114, 277, 156, 87, 197, 116, 170, 61, 531, 525, 642, 281, 278, 526, 177, 293, 388, 91, 584, 769, 198, 172, 120, 201, 336, 62, 282, 143, 103, 178, 294, 93, 644, 202, 592, 323, 392, 297, 770, 107, 180, 151, 209, 284, 648, 94, 204, 298, 400, 608, 352, 325, 533, 155, 210, 305, 547, 300, 109, 184, 534, 537, 115, 167, 225, 326, 306, 772, 157, 656, 329, 110, 117, 212, 171, 776, 330, 226, 549, 538, 387, 308, 216, 416, 271, 279, 158, 337, 550, 672, 118, 332, 579, 540, 389, 173, 121, 553, 199, 784, 179, 228, 338, 312, 704, 390, 174, 554, 581, 393, 283, 122, 448, 353, 561, 203, 63, 340, 394, 527, 582, 556, 181, 295, 285, 232, 124, 205, 182, 643, 562, 286, 585, 299, 354, 211, 401, 185, 396, 344, 586, 645, 593, 535, 240, 206, 95, 327, 564, 800, 402, 356, 307, 301, 417, 213, 568, 832, 588, 186, 646, 404, 227, 896, 594, 418, 302, 649, 771, 360, 539, 111, 331, 214, 309, 188, 449, 217, 408, 609, 596, 551, 650, 229, 159, 420, 310, 541, 773, 610, 657, 333, 119, 600, 339, 218, 368, 652, 230, 391, 313, 450, 542, 334, 233, 555, 774, 175, 123, 658, 612, 341, 777, 220, 314, 424, 395, 673, 583, 355, 287, 183, 234, 125, 557, 660, 616, 342, 316, 241, 778, 563, 345, 452, 397, 403, 207, 674, 558, 785, 432, 357, 187, 236, 664, 624, 587, 780, 705, 126, 242, 565, 398, 346, 456, 358, 405, 303, 569, 244, 595, 189, 566, 676, 361, 706, 589, 215, 786, 647, 348, 419, 406, 464, 680, 801, 362, 590, 409, 570, 788, 597, 572, 219, 311, 708, 598, 601, 651, 421, 792, 802, 611, 602, 410, 231, 688, 653, 248, 369, 190, 364, 654, 659, 335, 480, 315, 221, 370, 613, 422, 425, 451, 614, 543, 235, 412, 343, 372, 775, 317, 222, 426, 453, 237, 559, 833, 804, 712, 834, 661, 808, 779, 617, 604, 433, 720, 816, 836, 347, 897, 243, 662, 454, 318, 675, 618, 898, 781, 376, 428, 665, 736, 567, 840, 625, 238, 359, 457, 399, 787, 591, 678, 434, 677, 349, 245, 458, 666, 620, 363, 127, 191, 782, 407, 436, 626, 571, 465, 681, 246, 707, 350, 599, 668, 790, 460, 249, 682, 573, 411, 803, 789, 709, 365, 440, 628, 689, 374, 423, 466, 793, 250, 371, 481, 574, 413, 603, 366, 468, 655, 900, 805, 615, 684, 710, 429, 794, 252, 373, 605, 848, 690, 713, 632, 482, 806, 427, 904, 414, 223, 663, 692, 835, 619, 472, 455, 796, 809, 714, 721, 837, 716, 864, 810, 606, 912, 722, 696, 377, 435, 817, 319, 621, 812, 484, 430, 838, 667, 488, 239, 378, 459, 622, 627, 437, 380, 818, 461, 496, 669, 679, 724, 841, 629, 351, 467, 438, 737, 251, 462, 442, 441, 469, 247, 683, 842, 738, 899, 670, 783, 849, 820, 728, 928, 791, 367, 901, 630, 685, 844, 633, 711, 253, 691, 824, 902, 686, 740, 850, 375, 444, 470, 483, 415, 485, 905, 795, 473, 634, 744, 852, 960, 865, 693, 797, 906, 715, 807, 474, 636, 694, 254, 717, 575, 913, 798, 811, 379, 697, 431, 607, 489, 866, 723, 486, 908, 718, 813, 476, 856, 839, 725, 698, 914, 752, 868, 819, 814, 439, 929, 490, 623, 671, 739, 916, 463, 843, 381, 497, 930, 821, 726, 961, 872, 492, 631, 729, 700, 443, 741, 845, 920, 382, 822, 851, 730, 498, 880, 742, 445, 471, 635, 932, 687, 903, 825, 500, 846, 745, 826, 732, 446, 962, 936, 475, 853, 867, 637, 907, 487, 695, 746, 828, 753, 854, 857, 504, 799, 255, 964, 909, 719, 477, 915, 638, 748, 944, 869, 491, 699, 754, 858, 478, 968, 383, 910, 815, 976, 870, 917, 727, 493, 873, 701, 931, 756, 860, 499, 731, 823, 922, 874, 918, 502, 933, 743, 760, 881, 494, 702, 921, 501, 876, 847, 992, 447, 733, 827, 934, 882, 937, 963, 747, 505, 855, 924, 734, 829, 965, 938, 884, 506, 749, 945, 966, 755, 859, 940, 830, 911, 871, 639, 888, 479, 946, 750, 969, 508, 861, 757, 970, 919, 875, 862, 758, 948, 977, 923, 972, 761, 877, 952, 495, 703, 935, 978, 883, 762, 503, 925, 878, 735, 993, 885, 939, 994, 980, 926, 764, 941, 967, 886, 831, 947, 507, 889, 984, 751, 942, 996, 971, 890, 509, 949, 973, 1000, 892, 950, 863, 759, 1008, 510, 979, 953, 763, 974, 954, 879, 981, 982, 927, 995, 765, 956, 887, 985, 997, 986, 943, 891, 998, 766, 511, 988, 1001, 951, 1002, 893, 975, 894, 1009, 955, 1004, 1010, 957, 983, 958, 987, 1012, 999, 1016, 767, 989, 1003, 990, 1005, 959, 1011, 1013, 895, 1006, 1014, 1017, 1018, 991, 1020, 1007, 1015, 1019, 1021, 1022, 1023 }; +static const uint16_t Q_0_Nminus1_1[2] = {0, 1}; +static const uint16_t Q_0_Nminus1_2[4] = {0, 1, 2, 3}; +static const uint16_t Q_0_Nminus1_3[8] = {0, 1, 2, 4, 3, 5, 6, 7}; +static const uint16_t Q_0_Nminus1_4[16] = {0, 1, 2, 4, 8, 3, 5, 9, 6, 10, 12, 7, 11, 13, 14, 15}; +static const uint16_t Q_0_Nminus1_5[32] = {0, 1, 2, 4, 8, 16, 3, 5, 9, 6, 17, 10, 18, 12, 20, 24, + 7, 11, 19, 13, 14, 21, 26, 25, 22, 28, 15, 23, 27, 29, 30, 31}; +static const uint16_t Q_0_Nminus1_6[64] = {0, 1, 2, 4, 8, 16, 32, 3, 5, 9, 6, 17, 10, 18, 12, 33, 20, 34, 24, 36, 7, 11, + 40, 19, 13, 48, 14, 21, 35, 26, 37, 25, 22, 38, 41, 28, 42, 49, 44, 50, 15, 52, 23, 56, + 27, 39, 29, 43, 30, 45, 51, 46, 53, 54, 57, 58, 60, 31, 47, 55, 59, 61, 62, 63}; +static const uint16_t Q_0_Nminus1_7[128] = { + 0, 1, 2, 4, 8, 16, 32, 3, 5, 64, 9, 6, 17, 10, 18, 12, 33, 65, 20, 34, 24, 36, 7, 66, 11, 40, + 68, 19, 13, 48, 14, 72, 21, 35, 26, 80, 37, 25, 22, 38, 96, 67, 41, 28, 69, 42, 49, 74, 70, 44, 81, 50, + 73, 15, 52, 23, 76, 82, 56, 27, 97, 39, 84, 29, 43, 98, 88, 30, 71, 45, 100, 51, 46, 75, 104, 53, 77, 54, + 83, 57, 112, 78, 85, 58, 99, 86, 60, 89, 101, 31, 90, 102, 105, 92, 47, 106, 55, 113, 79, 108, 59, 114, 87, 116, + 61, 91, 120, 62, 103, 93, 107, 94, 109, 115, 110, 117, 118, 121, 122, 63, 124, 95, 111, 119, 123, 125, 126, 127}; +static const uint16_t Q_0_Nminus1_8[256] = { + 0, 1, 2, 4, 8, 16, 32, 3, 5, 64, 9, 6, 17, 10, 18, 128, 12, 33, 65, 20, 34, 24, 36, 7, + 129, 66, 11, 40, 68, 130, 19, 13, 48, 14, 72, 21, 132, 35, 26, 80, 37, 25, 22, 136, 38, 96, 67, 41, + 144, 28, 69, 42, 49, 74, 160, 192, 70, 44, 131, 81, 50, 73, 15, 133, 52, 23, 134, 76, 137, 82, 56, 27, + 97, 39, 84, 138, 145, 29, 43, 98, 88, 140, 30, 146, 71, 161, 45, 100, 51, 148, 46, 75, 104, 162, 53, 193, + 152, 77, 164, 54, 83, 57, 112, 135, 78, 194, 85, 58, 168, 139, 99, 86, 60, 89, 196, 141, 101, 147, 176, 142, + 31, 200, 90, 149, 102, 105, 163, 92, 47, 208, 150, 153, 165, 106, 55, 113, 154, 79, 108, 224, 166, 195, 59, 169, + 114, 156, 87, 197, 116, 170, 61, 177, 91, 198, 172, 120, 201, 62, 143, 103, 178, 93, 202, 107, 180, 151, 209, 94, + 204, 155, 210, 109, 184, 115, 167, 225, 157, 110, 117, 212, 171, 226, 216, 158, 118, 173, 121, 199, 179, 228, 174, 122, + 203, 63, 181, 232, 124, 205, 182, 211, 185, 240, 206, 95, 213, 186, 227, 111, 214, 188, 217, 229, 159, 119, 218, 230, + 233, 175, 123, 220, 183, 234, 125, 241, 207, 187, 236, 126, 242, 244, 189, 215, 219, 231, 248, 190, 221, 235, 222, 237, + 243, 238, 245, 127, 191, 246, 249, 250, 252, 223, 239, 251, 247, 253, 254, 255}; +static const uint16_t Q_0_Nminus1_9[512] = { + 0, 1, 2, 4, 8, 16, 32, 3, 5, 64, 9, 6, 17, 10, 18, 128, 12, 33, 65, 20, 256, 34, 24, 36, 7, + 129, 66, 11, 40, 68, 130, 19, 13, 48, 14, 72, 257, 21, 132, 35, 258, 26, 80, 37, 25, 22, 136, 260, 264, 38, + 96, 67, 41, 144, 28, 69, 42, 49, 74, 272, 160, 288, 192, 70, 44, 131, 81, 50, 73, 15, 320, 133, 52, 23, 134, + 384, 76, 137, 82, 56, 27, 97, 39, 259, 84, 138, 145, 261, 29, 43, 98, 88, 140, 30, 146, 71, 262, 265, 161, 45, + 100, 51, 148, 46, 75, 266, 273, 104, 162, 53, 193, 152, 77, 164, 268, 274, 54, 83, 57, 112, 135, 78, 289, 194, 85, + 276, 58, 168, 139, 99, 86, 60, 280, 89, 290, 196, 141, 101, 147, 176, 142, 321, 31, 200, 90, 292, 322, 263, 149, 102, + 105, 304, 296, 163, 92, 47, 267, 385, 324, 208, 386, 150, 153, 165, 106, 55, 328, 113, 154, 79, 269, 108, 224, 166, 195, + 270, 275, 291, 59, 169, 114, 277, 156, 87, 197, 116, 170, 61, 281, 278, 177, 293, 388, 91, 198, 172, 120, 201, 336, 62, + 282, 143, 103, 178, 294, 93, 202, 323, 392, 297, 107, 180, 151, 209, 284, 94, 204, 298, 400, 352, 325, 155, 210, 305, 300, + 109, 184, 115, 167, 225, 326, 306, 157, 329, 110, 117, 212, 171, 330, 226, 387, 308, 216, 416, 271, 279, 158, 337, 118, 332, + 389, 173, 121, 199, 179, 228, 338, 312, 390, 174, 393, 283, 122, 448, 353, 203, 63, 340, 394, 181, 295, 285, 232, 124, 205, + 182, 286, 299, 354, 211, 401, 185, 396, 344, 240, 206, 95, 327, 402, 356, 307, 301, 417, 213, 186, 404, 227, 418, 302, 360, + 111, 331, 214, 309, 188, 449, 217, 408, 229, 159, 420, 310, 333, 119, 339, 218, 368, 230, 391, 313, 450, 334, 233, 175, 123, + 341, 220, 314, 424, 395, 355, 287, 183, 234, 125, 342, 316, 241, 345, 452, 397, 403, 207, 432, 357, 187, 236, 126, 242, 398, + 346, 456, 358, 405, 303, 244, 189, 361, 215, 348, 419, 406, 464, 362, 409, 219, 311, 421, 410, 231, 248, 369, 190, 364, 335, + 480, 315, 221, 370, 422, 425, 451, 235, 412, 343, 372, 317, 222, 426, 453, 237, 433, 347, 243, 454, 318, 376, 428, 238, 359, + 457, 399, 434, 349, 245, 458, 363, 127, 191, 407, 436, 465, 246, 350, 460, 249, 411, 365, 440, 374, 423, 466, 250, 371, 481, + 413, 366, 468, 429, 252, 373, 482, 427, 414, 223, 472, 455, 377, 435, 319, 484, 430, 488, 239, 378, 459, 437, 380, 461, 496, + 351, 467, 438, 251, 462, 442, 441, 469, 247, 367, 253, 375, 444, 470, 483, 415, 485, 473, 474, 254, 379, 431, 489, 486, 476, + 439, 490, 463, 381, 497, 492, 443, 382, 498, 445, 471, 500, 446, 475, 487, 504, 255, 477, 491, 478, 383, 493, 499, 502, 494, + 501, 447, 505, 506, 479, 508, 495, 503, 507, 509, 510, 511}; +static const uint16_t Q_0_Nminus1_10[1024] = { + 0, 1, 2, 4, 8, 16, 32, 3, 5, 64, 9, 6, 17, 10, 18, 128, 12, 33, 65, 20, 256, 34, + 24, 36, 7, 129, 66, 512, 11, 40, 68, 130, 19, 13, 48, 14, 72, 257, 21, 132, 35, 258, 26, 513, + 80, 37, 25, 22, 136, 260, 264, 38, 514, 96, 67, 41, 144, 28, 69, 42, 516, 49, 74, 272, 160, 520, + 288, 528, 192, 544, 70, 44, 131, 81, 50, 73, 15, 320, 133, 52, 23, 134, 384, 76, 137, 82, 56, 27, + 97, 39, 259, 84, 138, 145, 261, 29, 43, 98, 515, 88, 140, 30, 146, 71, 262, 265, 161, 576, 45, 100, + 640, 51, 148, 46, 75, 266, 273, 517, 104, 162, 53, 193, 152, 77, 164, 768, 268, 274, 518, 54, 83, 57, + 521, 112, 135, 78, 289, 194, 85, 276, 522, 58, 168, 139, 99, 86, 60, 280, 89, 290, 529, 524, 196, 141, + 101, 147, 176, 142, 530, 321, 31, 200, 90, 545, 292, 322, 532, 263, 149, 102, 105, 304, 296, 163, 92, 47, + 267, 385, 546, 324, 208, 386, 150, 153, 165, 106, 55, 328, 536, 577, 548, 113, 154, 79, 269, 108, 578, 224, + 166, 519, 552, 195, 270, 641, 523, 275, 580, 291, 59, 169, 560, 114, 277, 156, 87, 197, 116, 170, 61, 531, + 525, 642, 281, 278, 526, 177, 293, 388, 91, 584, 769, 198, 172, 120, 201, 336, 62, 282, 143, 103, 178, 294, + 93, 644, 202, 592, 323, 392, 297, 770, 107, 180, 151, 209, 284, 648, 94, 204, 298, 400, 608, 352, 325, 533, + 155, 210, 305, 547, 300, 109, 184, 534, 537, 115, 167, 225, 326, 306, 772, 157, 656, 329, 110, 117, 212, 171, + 776, 330, 226, 549, 538, 387, 308, 216, 416, 271, 279, 158, 337, 550, 672, 118, 332, 579, 540, 389, 173, 121, + 553, 199, 784, 179, 228, 338, 312, 704, 390, 174, 554, 581, 393, 283, 122, 448, 353, 561, 203, 63, 340, 394, + 527, 582, 556, 181, 295, 285, 232, 124, 205, 182, 643, 562, 286, 585, 299, 354, 211, 401, 185, 396, 344, 586, + 645, 593, 535, 240, 206, 95, 327, 564, 800, 402, 356, 307, 301, 417, 213, 568, 832, 588, 186, 646, 404, 227, + 896, 594, 418, 302, 649, 771, 360, 539, 111, 331, 214, 309, 188, 449, 217, 408, 609, 596, 551, 650, 229, 159, + 420, 310, 541, 773, 610, 657, 333, 119, 600, 339, 218, 368, 652, 230, 391, 313, 450, 542, 334, 233, 555, 774, + 175, 123, 658, 612, 341, 777, 220, 314, 424, 395, 673, 583, 355, 287, 183, 234, 125, 557, 660, 616, 342, 316, + 241, 778, 563, 345, 452, 397, 403, 207, 674, 558, 785, 432, 357, 187, 236, 664, 624, 587, 780, 705, 126, 242, + 565, 398, 346, 456, 358, 405, 303, 569, 244, 595, 189, 566, 676, 361, 706, 589, 215, 786, 647, 348, 419, 406, + 464, 680, 801, 362, 590, 409, 570, 788, 597, 572, 219, 311, 708, 598, 601, 651, 421, 792, 802, 611, 602, 410, + 231, 688, 653, 248, 369, 190, 364, 654, 659, 335, 480, 315, 221, 370, 613, 422, 425, 451, 614, 543, 235, 412, + 343, 372, 775, 317, 222, 426, 453, 237, 559, 833, 804, 712, 834, 661, 808, 779, 617, 604, 433, 720, 816, 836, + 347, 897, 243, 662, 454, 318, 675, 618, 898, 781, 376, 428, 665, 736, 567, 840, 625, 238, 359, 457, 399, 787, + 591, 678, 434, 677, 349, 245, 458, 666, 620, 363, 127, 191, 782, 407, 436, 626, 571, 465, 681, 246, 707, 350, + 599, 668, 790, 460, 249, 682, 573, 411, 803, 789, 709, 365, 440, 628, 689, 374, 423, 466, 793, 250, 371, 481, + 574, 413, 603, 366, 468, 655, 900, 805, 615, 684, 710, 429, 794, 252, 373, 605, 848, 690, 713, 632, 482, 806, + 427, 904, 414, 223, 663, 692, 835, 619, 472, 455, 796, 809, 714, 721, 837, 716, 864, 810, 606, 912, 722, 696, + 377, 435, 817, 319, 621, 812, 484, 430, 838, 667, 488, 239, 378, 459, 622, 627, 437, 380, 818, 461, 496, 669, + 679, 724, 841, 629, 351, 467, 438, 737, 251, 462, 442, 441, 469, 247, 683, 842, 738, 899, 670, 783, 849, 820, + 728, 928, 791, 367, 901, 630, 685, 844, 633, 711, 253, 691, 824, 902, 686, 740, 850, 375, 444, 470, 483, 415, + 485, 905, 795, 473, 634, 744, 852, 960, 865, 693, 797, 906, 715, 807, 474, 636, 694, 254, 717, 575, 913, 798, + 811, 379, 697, 431, 607, 489, 866, 723, 486, 908, 718, 813, 476, 856, 839, 725, 698, 914, 752, 868, 819, 814, + 439, 929, 490, 623, 671, 739, 916, 463, 843, 381, 497, 930, 821, 726, 961, 872, 492, 631, 729, 700, 443, 741, + 845, 920, 382, 822, 851, 730, 498, 880, 742, 445, 471, 635, 932, 687, 903, 825, 500, 846, 745, 826, 732, 446, + 962, 936, 475, 853, 867, 637, 907, 487, 695, 746, 828, 753, 854, 857, 504, 799, 255, 964, 909, 719, 477, 915, + 638, 748, 944, 869, 491, 699, 754, 858, 478, 968, 383, 910, 815, 976, 870, 917, 727, 493, 873, 701, 931, 756, + 860, 499, 731, 823, 922, 874, 918, 502, 933, 743, 760, 881, 494, 702, 921, 501, 876, 847, 992, 447, 733, 827, + 934, 882, 937, 963, 747, 505, 855, 924, 734, 829, 965, 938, 884, 506, 749, 945, 966, 755, 859, 940, 830, 911, + 871, 639, 888, 479, 946, 750, 969, 508, 861, 757, 970, 919, 875, 862, 758, 948, 977, 923, 972, 761, 877, 952, + 495, 703, 935, 978, 883, 762, 503, 925, 878, 735, 993, 885, 939, 994, 980, 926, 764, 941, 967, 886, 831, 947, + 507, 889, 984, 751, 942, 996, 971, 890, 509, 949, 973, 1000, 892, 950, 863, 759, 1008, 510, 979, 953, 763, 974, + 954, 879, 981, 982, 927, 995, 765, 956, 887, 985, 997, 986, 943, 891, 998, 766, 511, 988, 1001, 951, 1002, 893, + 975, 894, 1009, 955, 1004, 1010, 957, 983, 958, 987, 1012, 999, 1016, 767, 989, 1003, 990, 1005, 959, 1011, 1013, 895, + 1006, 1014, 1017, 1018, 991, 1020, 1007, 1015, 1019, 1021, 1022, 1023}; static const uint16_t* const Q_0_Nminus1[11] = {NULL, Q_0_Nminus1_1, @@ -44,6 +131,7 @@ static const uint16_t* const Q_0_Nminus1[11] = {NULL, Q_0_Nminus1_9, Q_0_Nminus1_10}; -const uint16_t* nr_polar_sequence_pattern(uint8_t n){ - return Q_0_Nminus1[n]; +const uint16_t* nr_polar_sequence_pattern(uint8_t n) +{ + return Q_0_Nminus1[n]; } diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h b/openair1/PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h index 1ab664e5a2..d08862bb13 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h @@ -20,32 +20,32 @@ */ /*! \file PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h -* \brief Defines the constant variables for polar coding of the UCI from 38-212, V15.1.1 2018-04. -* \author -* \date 2018 -* \version 0.1 -* \company Eurecom -* \email: -* \note -* \warning -*/ + * \brief Defines the constant variables for polar coding of the UCI from 38-212, V15.1.1 2018-04. + * \author + * \date 2018 + * \version 0.1 + * \company Eurecom + * \email: + * \note + * \warning + */ #ifndef __NR_POLAR_UCI_DEFS__H__ #define __NR_POLAR_UCI_DEFS__H__ -#define NR_POLAR_UCI_PUCCH_MESSAGE_TYPE 2 //int8_t +#define NR_POLAR_UCI_PUCCH_MESSAGE_TYPE 2 // int8_t #define NR_POLAR_PUCCH_CRC_ERROR_CORRECTION_BITS 3 #define NR_POLAR_PUCCH_PAYLOAD_BITS 32 #define NR_POLAR_PUCCH_E 32 -//Ref. 38-212, Section 6.3.1.2.1 +// Ref. 38-212, Section 6.3.1.2.1 #define NR_POLAR_PUCCH_CRC_PARITY_BITS_SHORT 6 #define NR_POLAR_PUCCH_CRC_PARITY_BITS_LONG 11 #define NR_POLAR_PUCCH_I_SEG_LONG 1 #define NR_POLAR_PUCCH_I_SEG_SHORT 0 -//Ref. 38-212, Section 6.3.1.3.1 +// Ref. 38-212, Section 6.3.1.3.1 #define NR_POLAR_PUCCH_N_MAX 10 #define NR_POLAR_PUCCH_I_IL 0 #define NR_POLAR_PUCCH_N_PC_SHORT 3 @@ -53,9 +53,7 @@ #define NR_POLAR_PUCCH_N_PC_WM_LONG 0 #define NR_POLAR_PUCCH_N_PC_WM_SHORT 1 -//Ref. 38-212, Section 6.3.1.4.1 +// Ref. 38-212, Section 6.3.1.4.1 #define NR_POLAR_PUCCH_I_BIL 1 - - #endif diff --git a/openair1/PHY/CODING/nr_polar_init.c b/openair1/PHY/CODING/nr_polar_init.c index 899aa5447f..ca982d79bf 100644 --- a/openair1/PHY/CODING/nr_polar_init.c +++ b/openair1/PHY/CODING/nr_polar_init.c @@ -34,15 +34,17 @@ #include "PHY/NR_TRANSPORT/nr_dci.h" #include "nrPolar_tools/nr_polar_psbch_defs.h" -#define PolarKey ((messageType<<24)|(messageLength<<8)|aggregation_level) -static t_nrPolar_params * PolarList=NULL; -pthread_mutex_t PolarListMutex=PTHREAD_MUTEX_INITIALIZER; +#define PolarKey ((messageType << 24) | (messageLength << 8) | aggregation_level) +static t_nrPolar_params *PolarList = NULL; +pthread_mutex_t PolarListMutex = PTHREAD_MUTEX_INITIALIZER; -static int intcmp(const void *p1,const void *p2) { - return(*(int16_t *)p1 > *(int16_t *)p2); +static int intcmp(const void *p1, const void *p2) +{ + return (*(int16_t *)p1 > *(int16_t *)p2); } -static void nr_polar_delete_list(t_nrPolar_params * polarParams) { +static void nr_polar_delete_list(t_nrPolar_params *polarParams) +{ if (!polarParams) return; if (polarParams->nextPtr) @@ -64,11 +66,12 @@ static void nr_polar_delete_list(t_nrPolar_params * polarParams) { free(polarParams); } -static void nr_polar_delete(void) { +static void nr_polar_delete(void) +{ pthread_mutex_lock(&PolarListMutex); nr_polar_delete_list(PolarList); - PolarList=NULL; - pthread_mutex_unlock(&PolarListMutex); + PolarList = NULL; + pthread_mutex_unlock(&PolarListMutex); } t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, uint8_t aggregation_level) @@ -76,34 +79,35 @@ t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, ui // The lock is weak, because we never delete in the list, only at exit time // therefore, returning t_nrPolar_params * from the list is safe for future usage pthread_mutex_lock(&PolarListMutex); - if(!PolarList) + if (!PolarList) atexit(nr_polar_delete); - + t_nrPolar_params *currentPtr = PolarList; - //Parse the list. If the node is already created, return without initialization. + // Parse the list. If the node is already created, return without initialization. while (currentPtr != NULL) { - //printf("currentPtr->idx %d, (%d,%d)\n",currentPtr->idx,currentPtr->payloadBits,currentPtr->encoderLength); - //LOG_D(PHY,"Looking for index %d\n",(messageType * messageLength * aggregation_prime)); - if (currentPtr->busy == false && currentPtr->idx == PolarKey ) { - currentPtr->busy=true; + // printf("currentPtr->idx %d, (%d,%d)\n",currentPtr->idx,currentPtr->payloadBits,currentPtr->encoderLength); + // LOG_D(PHY,"Looking for index %d\n",(messageType * messageLength * aggregation_prime)); + if (currentPtr->busy == false && currentPtr->idx == PolarKey) { + currentPtr->busy = true; pthread_mutex_unlock(&PolarListMutex); - return currentPtr ; - } - else + return currentPtr; + } else currentPtr = currentPtr->nextPtr; } // printf("currentPtr %p (polarParams %p)\n",currentPtr,polarParams); - //Else, initialize and add node to the end of the linked list. + // Else, initialize and add node to the end of the linked list. t_nrPolar_params *newPolarInitNode = malloc(sizeof(t_nrPolar_params)); AssertFatal(newPolarInitNode, "[nr_polar_init] New t_nrPolar_params * could not be created"); *newPolarInitNode = (t_nrPolar_params){.busy = true, .nextPtr = PolarList, .tree_linearization.is_initialized = false}; PolarList = newPolarInitNode; pthread_mutex_unlock(&PolarListMutex); - // LOG_D(PHY,"Setting new polarParams index %d, messageType %d, messageLength %d, aggregation_prime %d\n",(messageType * messageLength * aggregation_prime),messageType,messageLength,aggregation_prime); + // LOG_D(PHY,"Setting new polarParams index %d, messageType %d, messageLength %d, aggregation_prime %d\n",(messageType * + // messageLength * aggregation_prime),messageType,messageLength,aggregation_prime); newPolarInitNode->idx = PolarKey; - //printf("newPolarInitNode->idx %d, (%d,%d,%d:%d)\n",newPolarInitNode->idx,messageType,messageLength,aggregation_prime,aggregation_level); + // printf("newPolarInitNode->idx %d, + // (%d,%d,%d:%d)\n",newPolarInitNode->idx,messageType,messageLength,aggregation_prime,aggregation_level); if (messageType == NR_POLAR_PBCH_MESSAGE_TYPE) { newPolarInitNode->n_max = NR_POLAR_PBCH_N_MAX; @@ -117,7 +121,8 @@ t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, ui newPolarInitNode->encoderLength = NR_POLAR_PBCH_E; newPolarInitNode->crcCorrectionBits = NR_POLAR_PBCH_CRC_ERROR_CORRECTION_BITS; newPolarInitNode->crc_generator_matrix = crc24c_generator_matrix(newPolarInitNode->payloadBits); // G_P - //printf("Initializing polar parameters for PBCH (K %d, E %d)\n",newPolarInitNode->payloadBits,newPolarInitNode->encoderLength); + // printf("Initializing polar parameters for PBCH (K %d, E + // %d)\n",newPolarInitNode->payloadBits,newPolarInitNode->encoderLength); } else if (messageType == NR_POLAR_DCI_MESSAGE_TYPE) { newPolarInitNode->n_max = NR_POLAR_DCI_N_MAX; @@ -130,11 +135,15 @@ t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, ui newPolarInitNode->payloadBits = messageLength; newPolarInitNode->encoderLength = aggregation_level * 108; newPolarInitNode->crcCorrectionBits = NR_POLAR_DCI_CRC_ERROR_CORRECTION_BITS; - newPolarInitNode->crc_generator_matrix = crc24c_generator_matrix(newPolarInitNode->payloadBits + newPolarInitNode->crcParityBits); // G_P - //printf("Initializing polar parameters for DCI (K %d, E %d, L %d)\n",newPolarInitNode->payloadBits,newPolarInitNode->encoderLength,aggregation_level); + newPolarInitNode->crc_generator_matrix = + crc24c_generator_matrix(newPolarInitNode->payloadBits + newPolarInitNode->crcParityBits); // G_P + // printf("Initializing polar parameters for DCI (K %d, E %d, L + // %d)\n",newPolarInitNode->payloadBits,newPolarInitNode->encoderLength,aggregation_level); } else if (messageType == NR_POLAR_UCI_PUCCH_MESSAGE_TYPE) { - AssertFatal(aggregation_level > 2, "Aggregation level (%d) for PUCCH 2 encoding is NPRB and should be > 2\n", aggregation_level); + AssertFatal(aggregation_level > 2, + "Aggregation level (%d) for PUCCH 2 encoding is NPRB and should be > 2\n", + aggregation_level); AssertFatal(messageLength > 11, "Message length %d is too short for polar encoding of UCI\n", messageLength); // TS 38.212 - Section 6.3.1.2.1 UCI encoded by Polar code @@ -175,7 +184,7 @@ t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, ui newPolarInitNode->i_bil = NR_POLAR_PUCCH_I_BIL; newPolarInitNode->payloadBits = messageLength; newPolarInitNode->crcCorrectionBits = NR_POLAR_PUCCH_CRC_ERROR_CORRECTION_BITS; - //LOG_D(PHY,"New polar node, encoderLength %d, aggregation_level %d\n",newPolarInitNode->encoderLength,aggregation_level); + // LOG_D(PHY,"New polar node, encoderLength %d, aggregation_level %d\n",newPolarInitNode->encoderLength,aggregation_level); } else if (messageType == SL_NR_POLAR_PSBCH_MESSAGE_TYPE) { // PSBCH newPolarInitNode->n_max = SL_NR_POLAR_PSBCH_N_MAX; newPolarInitNode->i_il = SL_NR_POLAR_PSBCH_I_IL; @@ -197,17 +206,13 @@ t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, ui } newPolarInitNode->K = newPolarInitNode->payloadBits + newPolarInitNode->crcParityBits; // Number of bits to encode. - newPolarInitNode->N = nr_polar_output_length(newPolarInitNode->K, - newPolarInitNode->encoderLength, - newPolarInitNode->n_max); + newPolarInitNode->N = nr_polar_output_length(newPolarInitNode->K, newPolarInitNode->encoderLength, newPolarInitNode->n_max); newPolarInitNode->n = log2(newPolarInitNode->N); newPolarInitNode->G_N = nr_polar_kronecker_power_matrices(newPolarInitNode->n); // polar_encoder vectors: newPolarInitNode->Q_0_Nminus1 = nr_polar_sequence_pattern(newPolarInitNode->n); newPolarInitNode->interleaving_pattern = malloc(sizeof(uint16_t) * newPolarInitNode->K); - nr_polar_interleaving_pattern(newPolarInitNode->K, - newPolarInitNode->i_il, - newPolarInitNode->interleaving_pattern); + nr_polar_interleaving_pattern(newPolarInitNode->K, newPolarInitNode->i_il, newPolarInitNode->interleaving_pattern); newPolarInitNode->rate_matching_pattern = malloc(sizeof(uint16_t) * newPolarInitNode->encoderLength); uint16_t J[newPolarInitNode->N]; @@ -224,8 +229,9 @@ t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, ui newPolarInitNode->information_bit_pattern = malloc(sizeof(uint8_t) * newPolarInitNode->N); newPolarInitNode->parity_check_bit_pattern = malloc(sizeof(uint8_t) * newPolarInitNode->N); newPolarInitNode->Q_I_N = malloc(sizeof(int16_t) * (newPolarInitNode->K + newPolarInitNode->n_pc)); - newPolarInitNode->Q_F_N = malloc( sizeof(int16_t) * (newPolarInitNode->N + 1)); // Last element shows the final array index assigned a value. - newPolarInitNode->Q_PC_N = malloc( sizeof(int16_t) * (newPolarInitNode->n_pc)); + newPolarInitNode->Q_F_N = + malloc(sizeof(int16_t) * (newPolarInitNode->N + 1)); // Last element shows the final array index assigned a value. + newPolarInitNode->Q_PC_N = malloc(sizeof(int16_t) * (newPolarInitNode->n_pc)); for (int i = 0; i <= newPolarInitNode->N; i++) newPolarInitNode->Q_F_N[i] = -1; // Empty array. @@ -244,22 +250,26 @@ t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, ui newPolarInitNode->n_pc_wm); // sort the Q_I_N array in ascending order (first K positions) - qsort((void *)newPolarInitNode->Q_I_N,newPolarInitNode->K,sizeof(int16_t),intcmp); + qsort((void *)newPolarInitNode->Q_I_N, newPolarInitNode->K, sizeof(int16_t), intcmp); build_polar_tables(newPolarInitNode); return newPolarInitNode; } -void nr_polar_print_polarParams() { +void nr_polar_print_polarParams() +{ uint8_t i = 0; if (PolarList == NULL) { printf("polarParams is empty.\n"); } else { - t_nrPolar_params * polarParams=PolarList; + t_nrPolar_params *polarParams = PolarList; while (polarParams != NULL) { - printf("polarParams[%d] = %d, %d, %d\n", i, - polarParams->idx>>24, (polarParams->idx>>8)&0xFFFF, polarParams->idx&0xFF); + printf("polarParams[%d] = %d, %d, %d\n", + i, + polarParams->idx >> 24, + (polarParams->idx >> 8) & 0xFFFF, + polarParams->idx & 0xFF); polarParams = polarParams->nextPtr; i++; } @@ -268,11 +278,18 @@ void nr_polar_print_polarParams() { return; } -uint16_t nr_polar_aggregation_prime (uint8_t aggregation_level) { - if (aggregation_level == 0) return 0; - else if (aggregation_level == 1) return NR_POLAR_AGGREGATION_LEVEL_1_PRIME; - else if (aggregation_level == 2) return NR_POLAR_AGGREGATION_LEVEL_2_PRIME; - else if (aggregation_level == 4) return NR_POLAR_AGGREGATION_LEVEL_4_PRIME; - else if (aggregation_level == 8) return NR_POLAR_AGGREGATION_LEVEL_8_PRIME; - else return NR_POLAR_AGGREGATION_LEVEL_16_PRIME; //aggregation_level == 16 +uint16_t nr_polar_aggregation_prime(uint8_t aggregation_level) +{ + if (aggregation_level == 0) + return 0; + else if (aggregation_level == 1) + return NR_POLAR_AGGREGATION_LEVEL_1_PRIME; + else if (aggregation_level == 2) + return NR_POLAR_AGGREGATION_LEVEL_2_PRIME; + else if (aggregation_level == 4) + return NR_POLAR_AGGREGATION_LEVEL_4_PRIME; + else if (aggregation_level == 8) + return NR_POLAR_AGGREGATION_LEVEL_8_PRIME; + else + return NR_POLAR_AGGREGATION_LEVEL_16_PRIME; // aggregation_level == 16 } From 0e93a8b4cfe6ba88089d00413fa84a42bc1074d9 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 7 Nov 2024 09:45:01 +0100 Subject: [PATCH 34/75] Move nr_polar_init.c to nrPolar_tools/ --- CMakeLists.txt | 2 +- openair1/PHY/CODING/{ => nrPolar_tools}/nr_polar_init.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename openair1/PHY/CODING/{ => nrPolar_tools}/nr_polar_init.c (99%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ac21ab5d5..e4ab080a2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -772,7 +772,7 @@ set(PHY_TURBOSRC ${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder.c ) set(PHY_POLARSRC - ${OPENAIR1_DIR}/PHY/CODING/nr_polar_init.c + ${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/nr_polar_init.c ${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/nr_bitwise_operations.c ${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/nr_crc_byte.c ${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/nr_polar_decoder.c diff --git a/openair1/PHY/CODING/nr_polar_init.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_init.c similarity index 99% rename from openair1/PHY/CODING/nr_polar_init.c rename to openair1/PHY/CODING/nrPolar_tools/nr_polar_init.c index ca982d79bf..609f4b4a8f 100644 --- a/openair1/PHY/CODING/nr_polar_init.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_init.c @@ -30,9 +30,9 @@ * \warning */ -#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h" +#include "nr_polar_defs.h" +#include "nr_polar_psbch_defs.h" #include "PHY/NR_TRANSPORT/nr_dci.h" -#include "nrPolar_tools/nr_polar_psbch_defs.h" #define PolarKey ((messageType << 24) | (messageLength << 8) | aggregation_level) static t_nrPolar_params *PolarList = NULL; From a650dcc8ab8c5fec0ea9bfca25d788805ee9da26 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 6 Nov 2024 13:43:28 +0100 Subject: [PATCH 35/75] Remove Interop-F1/Accelleran-CU testing pipeline We don't have access to the images for the Accelleran CU anymore, so we can't run the test. Remove the pipeline from the repository. --- ci-scripts/Jenkinsfile-GitLab-Container | 23 -- .../gnb-du.band78.106prb.rfsim.conf | 225 ------------------ .../container_5g_rfsim_f1_accelleran.xml | 92 ------- .../docker-compose.yaml | 38 --- doc/TESTBenches.md | 5 - 5 files changed, 383 deletions(-) delete mode 100644 ci-scripts/conf_files/gnb-du.band78.106prb.rfsim.conf delete mode 100644 ci-scripts/xml_files/container_5g_rfsim_f1_accelleran.xml delete mode 100644 ci-scripts/yaml_files/5g_rfsimulator_accelleran/docker-compose.yaml diff --git a/ci-scripts/Jenkinsfile-GitLab-Container b/ci-scripts/Jenkinsfile-GitLab-Container index f5b83ec071..5a4e27ed19 100644 --- a/ci-scripts/Jenkinsfile-GitLab-Container +++ b/ci-scripts/Jenkinsfile-GitLab-Container @@ -493,29 +493,6 @@ pipeline { } } } - stage ("Interop-F1") { - when { expression {do5Gtest} } - steps { - script { - triggerSlaveJob ('RAN-Interop-F1', 'Interop-F1') - } - } - post { - always { - script { - // Using a unique variable name for each test stage to avoid overwriting on a global variable - // due to parallel-time concurrency - f1InteropStatus = finalizeSlaveJob('RAN-Interop-F1') - } - } - failure { - script { - currentBuild.result = 'FAILURE' - failingStages += f1InteropStatus - } - } - } - } stage ("Sanity-Check OAI-CN5G") { when { expression {do5Gtest} } steps { diff --git a/ci-scripts/conf_files/gnb-du.band78.106prb.rfsim.conf b/ci-scripts/conf_files/gnb-du.band78.106prb.rfsim.conf deleted file mode 100644 index 3ee42b4510..0000000000 --- a/ci-scripts/conf_files/gnb-du.band78.106prb.rfsim.conf +++ /dev/null @@ -1,225 +0,0 @@ -Active_gNBs = ( "du-rfsim"); -# Asn1_verbosity, choice in: none, info, annoying -Asn1_verbosity = "none"; - -gNBs = -( - { - ////////// Identification parameters: - gNB_ID = 0xe00; - gNB_DU_ID = 0xe00; - -# cell_type = "CELL_MACRO_GNB"; - - gNB_name = "du-rfsim"; - - // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = 1; - plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ({ sst = 1, sd = 0xffffff }) }); - - - nr_cellid = 12345678L; - - ////////// Physical parameters: - - min_rxtxtime = 6; - - servingCellConfigCommon = ( - { - #spCellConfigCommon - - physCellId = 0; - -# downlinkConfigCommon - #frequencyInfoDL - # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) - absoluteFrequencySSB = 641280; - dl_frequencyBand = 78; - # this is 3600 MHz - dl_absoluteFrequencyPointA = 640008; - #scs-SpecificCarrierList - dl_offstToCarrier = 0; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - dl_subcarrierSpacing = 1; - dl_carrierBandwidth = 106; - #initialDownlinkBWP - #genericParameters - # this is RBstart=27,L=48 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 28875; # 6366 12925 12956 28875 12952 -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - initialDLBWPsubcarrierSpacing = 1; - #pdcch-ConfigCommon - initialDLBWPcontrolResourceSetZero = 12; - initialDLBWPsearchSpaceZero = 0; - - #uplinkConfigCommon - #frequencyInfoUL - ul_frequencyBand = 78; - #scs-SpecificCarrierList - ul_offstToCarrier = 0; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - ul_subcarrierSpacing = 1; - ul_carrierBandwidth = 106; - pMax = 20; - #initialUplinkBWP - #genericParameters - initialULBWPlocationAndBandwidth = 28875; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - initialULBWPsubcarrierSpacing = 1; - #rach-ConfigCommon - #rach-ConfigGeneric - prach_ConfigurationIndex = 98; -#prach_msg1_FDM -#0 = one, 1=two, 2=four, 3=eight - prach_msg1_FDM = 0; - prach_msg1_FrequencyStart = 0; - zeroCorrelationZoneConfig = 13; - preambleReceivedTargetPower = -96; -#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) - preambleTransMax = 6; -#powerRampingStep -# 0=dB0,1=dB2,2=dB4,3=dB6 - powerRampingStep = 1; -#ra_ReponseWindow -#1,2,4,8,10,20,40,80 - ra_ResponseWindow = 4; -#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR -#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen - ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; -#oneHalf (0..15) 4,8,12,16,...60,64 - ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14; -#ra_ContentionResolutionTimer -#(0..7) 8,16,24,32,40,48,56,64 - ra_ContentionResolutionTimer = 7; - rsrp_ThresholdSSB = 19; -#prach-RootSequenceIndex_PR -#1 = 839, 2 = 139 - prach_RootSequenceIndex_PR = 2; - prach_RootSequenceIndex = 1; - # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex - # - msg1_SubcarrierSpacing = 1, -# restrictedSetConfig -# 0=unrestricted, 1=restricted type A, 2=restricted type B - restrictedSetConfig = 0, - - msg3_DeltaPreamble = 1; - p0_NominalWithGrant =-90; - -# pucch-ConfigCommon setup : -# pucchGroupHopping -# 0 = neither, 1= group hopping, 2=sequence hopping - pucchGroupHopping = 0; - hoppingId = 40; - p0_nominal = -90; - - ssb_PositionsInBurst_Bitmap = 1; - -# ssb_periodicityServingCell -# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 - ssb_periodicityServingCell = 2; - -# dmrs_TypeA_position -# 0 = pos2, 1 = pos3 - dmrs_TypeA_Position = 0; - -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - subcarrierSpacing = 1; - - - #tdd-UL-DL-ConfigurationCommon -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - referenceSubcarrierSpacing = 1; - # pattern1 - # dl_UL_TransmissionPeriodicity - # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 - dl_UL_TransmissionPeriodicity = 6; - nrofDownlinkSlots = 7; - nrofDownlinkSymbols = 6; - nrofUplinkSlots = 2; - nrofUplinkSymbols = 4; - - ssPBCH_BlockPower = -25; - } - - ); - - - # ------- SCTP definitions - SCTP : - { - # Number of streams to use in input/output - SCTP_INSTREAMS = 2; - SCTP_OUTSTREAMS = 2; - }; - } -); - -MACRLCs = ( - { - num_cc = 1; - tr_s_preference = "local_L1"; - tr_n_preference = "f1"; - local_n_address = "192.168.72.142"; - remote_n_address = "192.168.72.140"; - local_n_portc = 500; - local_n_portd = 2152; - remote_n_portc = 501; - remote_n_portd = 2152; - pusch_TargetSNRx10 = 200; - pucch_TargetSNRx10 = 200; - } -); - -L1s = ( -{ - num_cc = 1; - tr_n_preference = "local_mac"; - prach_dtx_threshold = 200; - pucch0_dtx_threshold = 150; - ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 -} -); - -RUs = ( - { - local_rf = "yes" - nb_tx = 1 - nb_rx = 1 - att_tx = 0 - att_rx = 0; - bands = [78]; - max_pdschReferenceSignalPower = -27; - max_rxgain = 114; - eNB_instances = [0]; - clock_src = "internal"; - } -); - - -rfsimulator: { - serveraddr = "server"; - serverport = 4043; - options = (); #("saviq"); or/and "chanmod" - modelname = "AWGN"; - IQfile = "/tmp/rfsimulator.iqs" -} - -log_config : -{ - global_log_level = "info"; - hw_log_level = "info"; - nr_phy_log_level = "info"; - nr_mac_log_level = "info"; - rlc_log_level = "info"; - pdcp_log_level = "info"; - rrc_log_level = "info"; - f1ap_log_level = "info"; - ngap_log_level = "debug"; -}; diff --git a/ci-scripts/xml_files/container_5g_rfsim_f1_accelleran.xml b/ci-scripts/xml_files/container_5g_rfsim_f1_accelleran.xml deleted file mode 100644 index c8dc1cf9b2..0000000000 --- a/ci-scripts/xml_files/container_5g_rfsim_f1_accelleran.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - rfsim-5gnr-f1-accelleran - F1 DU Interop Accelleran CU - wrench - - 111111 - 800813 - 000020 - 000021 - 020021 - 100021 - 100022 - 222222 - - - - - Pull_Local_Registry - Pull Images from Local Registry - 0 - oai-gnb oai-nr-ue - - - Create_Workspace - Create new Workspace - 0 - 0 - - - Deploy_Object - Deploy OAI-DU+nrUE - ci-scripts/yaml_files/5g_rfsimulator_accelleran - oai-du oai-nr-ue - 0 - 0 - - - - Attach_UE - Attach OAI UE (Wait for IP) - rfsim5g_ue - ofqot - - - - Ping - Test Connectivity (ping) - rfsim5g_ue - ofqot - -c 20 12.1.1.1 - 0 - - - - Undeploy_Object - true - Undeploy all OAI 5G stack - ci-scripts/yaml_files/5g_rfsimulator_accelleran - 0 - 0 - - - - Clean_Test_Server_Images - true - Clean Test Images on Test Server - 0 - - - diff --git a/ci-scripts/yaml_files/5g_rfsimulator_accelleran/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_accelleran/docker-compose.yaml deleted file mode 100644 index 8ecb2f9c91..0000000000 --- a/ci-scripts/yaml_files/5g_rfsimulator_accelleran/docker-compose.yaml +++ /dev/null @@ -1,38 +0,0 @@ -services: - oai-du: - image: ${REGISTRY:-oaisoftwarealliance}/${GNB_IMG:-oai-gnb}:${TAG:-develop} - container_name: rfsim5g-oai-du - cap_drop: - - ALL - network_mode: "host" - environment: - USE_ADDITIONAL_OPTIONS: --sa --rfsim --MACRLCs.[0].local_n_address 172.21.16.109 --MACRLCs.[0].remote_n_address 172.21.6.22 --log_config.global_log_options level,nocolor,time - volumes: - - ../../conf_files/gnb-du.band78.106prb.rfsim.conf:/opt/oai-gnb/etc/gnb.conf - healthcheck: - test: /bin/bash -c "pgrep nr-softmodem" - interval: 10s - timeout: 5s - retries: 5 - oai-nr-ue: - image: ${REGISTRY:-oaisoftwarealliance}/${NRUE_IMG:-oai-nr-ue}:${TAG:-develop} - container_name: rfsim5g-oai-nr-ue - cap_drop: - - ALL - cap_add: - - NET_ADMIN # for interface bringup - - NET_RAW # for ping - network_mode: "host" - environment: - USE_ADDITIONAL_OPTIONS: --sa --rfsim -r 106 --numerology 1 -C 3619200000 --uicc0.imsi 208990100001140 --rfsimulator.serveraddr 127.0.0.1 --log_config.global_log_options level,nocolor,time - depends_on: - - oai-du - devices: - - /dev/net/tun:/dev/net/tun - volumes: - - ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf - healthcheck: - test: /bin/bash -c "pgrep nr-uesoftmodem" - interval: 10s - timeout: 5s - retries: 5 diff --git a/doc/TESTBenches.md b/doc/TESTBenches.md index 7e67e78d41..6d3e71877f 100644 --- a/doc/TESTBenches.md +++ b/doc/TESTBenches.md @@ -132,11 +132,6 @@ information on how the images are built. ~5G-NR - caracal + N310 - pure performance test through phy-test scheduler, see command line for more details -- [RAN-Interop-F1](https://jenkins-oai.eurecom.fr/job/RAN-Interop-F1/) - ~5G-NR - - ofqot (DU, 1x UE) - - F1 interoperability: set up connection between Accelleran CU and OAI DU and pass all traffic over F1 - - 3rd-party gNB/CU interoperability: set up connection between Accelleran CU and OAI UE and test connectivity - [RAN-L2-Sim-Test-4G](https://jenkins-oai.eurecom.fr/job/RAN-L2-Sim-Test-4G/) ~4G-LTE - obelix (eNB, 1x UE, OAI EPC) From 76c3e4b72e2d451b812db4ccd7de83d82f8e96e7 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 7 Nov 2024 12:41:45 +0100 Subject: [PATCH 36/75] Remove x86-specific instructions from telnet server telnetsrv uses the Intel/AMD-specific "cpuid" instruction, which is not available on ARM machines. Remove the call. The previous code was checking for the number of cores, which is retained by a call to get_nprocs(). I did not find an equivalent for the number of threads in C. In C++, there would be https://en.cppreference.com/w/cpp/thread/thread/hardware_concurrency, in case it's relevant for anybody. --- common/utils/telnetsrv/telnetsrv_proccmd.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/common/utils/telnetsrv/telnetsrv_proccmd.c b/common/utils/telnetsrv/telnetsrv_proccmd.c index 4255b20956..f081bb66a1 100644 --- a/common/utils/telnetsrv/telnetsrv_proccmd.c +++ b/common/utils/telnetsrv/telnetsrv_proccmd.c @@ -32,6 +32,7 @@ #define _GNU_SOURCE #include #include +#include #include #include #include @@ -222,11 +223,8 @@ char aname[256]; tdata->numlines = 0; } - unsigned int eax = 11, ebx = 0, ecx = 1, edx = 0; - - asm volatile("cpuid" : "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx) : "0"(eax), "2"(ecx) :); - - prnt("System has %d cores %d threads %d Actual threads", eax, ebx, edx); + int nprocs = get_nprocs(); + prnt("System has %d cores", nprocs); prnt("\n id name state USRmod KRNmod prio nice vsize proc pol \n\n"); snprintf(aname, sizeof(aname), "/proc/%d/stat", getpid()); From 2204fc13db87d5347d46d9e183c4d14ce78cc8b0 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 7 Nov 2024 12:44:26 +0100 Subject: [PATCH 37/75] Compile telnetsrv in cross-compilation pipeline --- docker/Dockerfile.build.ubuntu22.cross-arm64 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile.build.ubuntu22.cross-arm64 b/docker/Dockerfile.build.ubuntu22.cross-arm64 index 7b145fdc5b..97dbee50e8 100644 --- a/docker/Dockerfile.build.ubuntu22.cross-arm64 +++ b/docker/Dockerfile.build.ubuntu22.cross-arm64 @@ -36,7 +36,7 @@ RUN /bin/sh oaienv && \ cd cmake_targets && \ mkdir -p log ran_build/build ran_build/build-cross && \ cd ran_build/build && \ - cmake ../../.. -GNinja && \ + cmake ../../.. -GNinja -DENABLE_TELNETSRV=ON && \ echo "====== Start of log for host-tools ======" && \ ninja ldpc_generators generate_T > ../../log/host-tools.txt 2>&1 && \ echo "====== End of log for host-tools ======" && \ @@ -48,7 +48,7 @@ RUN /bin/sh oaienv && \ -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror" && \ echo "====== Start of log for cross-build executables ======" && \ # making always passing so we can analyze the all.txt file - ninja dlsim ulsim ldpctest polartest smallblocktest nr_pbchsim nr_dlschsim nr_ulschsim nr_dlsim nr_ulsim nr_pucchsim nr_prachsim lte-softmodem nr-softmodem nr-cuup oairu lte-uesoftmodem nr-uesoftmodem params_libconfig coding rfsimulator > ../../log/all.txt 2>&1; \ + ninja dlsim ulsim ldpctest polartest smallblocktest nr_pbchsim nr_dlschsim nr_ulschsim nr_dlsim nr_ulsim nr_pucchsim nr_prachsim lte-softmodem nr-softmodem nr-cuup oairu lte-uesoftmodem nr-uesoftmodem params_libconfig coding rfsimulator telnetsrv > ../../log/all.txt 2>&1; \ # displaying errors and warnings grep -E -A3 "warning:|error:" ../../log/all.txt || true && \ # will fail only if string "errors:" is found From 49584e6cb3a85863787980829c6fd14eb7eefcf4 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 7 Nov 2024 13:17:21 +0100 Subject: [PATCH 38/75] fixup --- docker/Dockerfile.build.ubuntu22.cross-arm64 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile.build.ubuntu22.cross-arm64 b/docker/Dockerfile.build.ubuntu22.cross-arm64 index 97dbee50e8..91b53ff6b4 100644 --- a/docker/Dockerfile.build.ubuntu22.cross-arm64 +++ b/docker/Dockerfile.build.ubuntu22.cross-arm64 @@ -36,14 +36,14 @@ RUN /bin/sh oaienv && \ cd cmake_targets && \ mkdir -p log ran_build/build ran_build/build-cross && \ cd ran_build/build && \ - cmake ../../.. -GNinja -DENABLE_TELNETSRV=ON && \ + cmake ../../.. -GNinja && \ echo "====== Start of log for host-tools ======" && \ ninja ldpc_generators generate_T > ../../log/host-tools.txt 2>&1 && \ echo "====== End of log for host-tools ======" && \ cd ../build-cross/ && \ # install missing libyaml-cpp-dev for arm64 apt install -y libyaml-cpp-dev:arm64 && \ - cmake ../../.. -GNinja \ + cmake ../../.. -GNinja -DENABLE_TELNETSRV=ON \ -DCMAKE_TOOLCHAIN_FILE=../../../cmake_targets/cross-arm.cmake -DNATIVE_DIR=../build \ -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror" && \ echo "====== Start of log for cross-build executables ======" && \ From 9f9299706b79f4d8f8c2c03d8f8305bf54036bb3 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 6 Nov 2024 09:53:34 +0100 Subject: [PATCH 39/75] Improve cross-compile documentation - Give introductory line - Reformulate headers to clarify steps - Reference dockerfiles for further information --- doc/cross-compile.md | 47 ++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/doc/cross-compile.md b/doc/cross-compile.md index 1054abbc1f..0a0ce3b1ba 100644 --- a/doc/cross-compile.md +++ b/doc/cross-compile.md @@ -1,15 +1,23 @@ +OpenAirInterface Cross-Compiler User Guide: explains how to build OAI for ARM64 +(using the instruction set aarch64). + [[_TOC_]] +# Environment -# OpenAirInterface Cross-Compiler User Guide +Tested on Ubuntu 22. Newer version of Ubuntu should work as well, please file a +bug report if not (Gitlab Issues page). -## Environment +You should be able to compile OAI on the host (i.e., for x86). To do so, +install the dependencies, if not done already: -- OS: ubuntu 22.04 +```shell +cmake_targets/build_oai -I +``` -### Set up the environment +# Install ARM64 dependencies -Set up for install the package for aarch64. +Set up for install the package for ARM64. ```shell sudo dpkg --add-architecture arm64 @@ -46,21 +54,12 @@ sudo apt-get install -y \ ``` The above enables apt to download packages for arm64. It also installs -gcc cross-compilers for aarch64 in version 11. This version needs to match the +gcc cross-compilers for ARM64 in version 11. This version needs to match the versions of gcc defined in the cmake cross-compilation file (`cross-arm.cmake`). -## Install and Build +# Build for ARM64 -### Install required packages - -Use the host compiler to install its dependencies. - -```shell -cd cmake_targets -./build_oai -I -``` - -### Build the LDPC generators +## Build code generation tools for host Use the x86 compiler to build the `ldpc_generators` and generate the header file in the `ran_build/build` folder. They are necessary during a build for @@ -77,7 +76,7 @@ cmake ../../.. make -j`nproc` ldpc_generators generate_T ``` -### Build the Other Executables for aarch64 +## Build executables for ARM64 Switch to the `ran_build/build-cross` folder to build the target executables for ARM. The `cross-arm.cmake` file defines some ARM-specific build tools @@ -90,7 +89,13 @@ be defined in order to tell cmake where the host tools have been built. cd ../build-cross cmake ../../.. -GNinja -DCMAKE_TOOLCHAIN_FILE=../../../cmake_targets/cross-arm.cmake -DNATIVE_DIR=../build -ninja -j`nproc` dlsim ulsim ldpctest polartest smallblocktest nr_pbchsim nr_dlschsim nr_ulschsim nr_dlsim nr_ulsim nr_pucchsim nr_prachsim -ninja -j`nproc` lte-softmodem nr-softmodem nr-cuup oairu lte-uesoftmodem nr-uesoftmodem -ninja -j`nproc` params_libconfig coding rfsimulator +ninja dlsim ulsim ldpctest polartest smallblocktest nr_pbchsim nr_dlschsim nr_ulschsim nr_dlsim nr_ulsim nr_pucchsim nr_prachsim +ninja lte-softmodem nr-softmodem nr-cuup oairu lte-uesoftmodem nr-uesoftmodem +ninja params_libconfig coding rfsimulator ``` + +# Further information + +You can do the above steps using docker, see dockerfiles +`docker/Dockerfile.base.ubuntu22.cross-arm64` and +`docker/Dockerfile.build.ubuntu22.cross-arm64` for more information. From ac06f107dd7bc26ec048b1e9443ae3914d18fa88 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Thu, 31 Oct 2024 14:50:25 +0100 Subject: [PATCH 40/75] add a optimzed complex vector multiplication function --- .../NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 56 ++------------- openair1/PHY/TOOLS/tests/CMakeLists.txt | 7 ++ openair1/PHY/TOOLS/tests/test_vector_op.cpp | 70 +++++++++++++++++++ openair1/PHY/TOOLS/tools_defs.h | 68 ++++++++++++++++++ openair1/PHY/TOOLS/tools_extern.h | 21 ------ 5 files changed, 151 insertions(+), 71 deletions(-) create mode 100644 openair1/PHY/TOOLS/tests/test_vector_op.cpp delete mode 100644 openair1/PHY/TOOLS/tools_extern.h diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index f17e309a6d..f3d0c2a7fd 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -1333,50 +1333,6 @@ void nr_a_sum_b(c16_t *input_x, c16_t *input_y, unsigned short nb_rb) } } -/* Zero Forcing Rx function: nr_a_mult_b() - * Compute the complex Multiplication c=a*b - * - * */ -void nr_a_mult_b(c16_t *a, c16_t *b, c16_t *c, unsigned short nb_rb, unsigned char output_shift0) -{ - //This function is used to compute complex multiplications - short nr_conjugate[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1}; - unsigned short rb; - simde__m128i *a_128,*b_128, *c_128, mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3; - - a_128 = (simde__m128i *)a; - b_128 = (simde__m128i *)b; - - c_128 = (simde__m128i *)c; - - for (rb=0; rb<3*nb_rb; rb++) { - // the real part - mmtmpD0 = simde_mm_sign_epi16(a_128[0],*(simde__m128i*)&nr_conjugate[0]); - mmtmpD0 = simde_mm_madd_epi16(mmtmpD0,b_128[0]); //Re: (a_re*b_re - a_im*b_im) - - // the imag part - mmtmpD1 = simde_mm_shufflelo_epi16(a_128[0],SIMDE_MM_SHUFFLE(2,3,0,1)); - mmtmpD1 = simde_mm_shufflehi_epi16(mmtmpD1,SIMDE_MM_SHUFFLE(2,3,0,1)); - mmtmpD1 = simde_mm_madd_epi16(mmtmpD1,b_128[0]);//Im: (x_im*y_re + x_re*y_im) - - mmtmpD0 = simde_mm_srai_epi32(mmtmpD0,output_shift0); - mmtmpD1 = simde_mm_srai_epi32(mmtmpD1,output_shift0); - mmtmpD2 = simde_mm_unpacklo_epi32(mmtmpD0,mmtmpD1); - mmtmpD3 = simde_mm_unpackhi_epi32(mmtmpD0,mmtmpD1); - - c_128[0] = simde_mm_packs_epi32(mmtmpD2,mmtmpD3); - - /*printf("\n Computing mult \n"); - print_shorts("a:",(int16_t*)&a_128[0]); - print_shorts("b:",(int16_t*)&b_128[0]); - print_shorts("pack:",(int16_t*)&c_128[0]);*/ - - a_128+=1; - b_128+=1; - c_128+=1; - } -} - /* Zero Forcing Rx function: nr_element_sign() * Compute b=sign*a * @@ -1448,7 +1404,7 @@ static void nr_determin(int size, nb_rb, ((rtx & 1) == 1 ? -1 : 1) * ((ctx & 1) == 1 ? -1 : 1) * sign, shift0); - nr_a_mult_b(a44[ctx][rtx], outtemp, rtx == 0 ? ad_bc : outtemp1, nb_rb, shift0); + mult_complex_vectors(a44[ctx][rtx], outtemp, rtx == 0 ? ad_bc : outtemp1, sizeofArray(outtemp1), shift0); if (rtx != 0) nr_a_sum_b(ad_bc, outtemp1, nb_rb); @@ -1759,11 +1715,11 @@ static void nr_dlsch_mmse(uint32_t rx_size_symbol, // printf("Computing r_%d c_%d\n",rtx,ctx); // print_shorts(" H_h_H=",(int16_t*)&conjH_H_elements[ctx*nl+rtx][0][0]); // print_shorts(" Inv_H_h_H=",(int16_t*)&inv_H_h_H[ctx*nl+rtx][0]); - nr_a_mult_b(inv_H_h_H[ctx][rtx], - (c16_t *)(rxdataF_comp[ctx][0] + symbol * rx_size_symbol), - outtemp, - nb_rb_0, - shift - (fp_flag == 1 ? 2 : 0)); + mult_complex_vectors(inv_H_h_H[ctx][rtx], + (c16_t *)(rxdataF_comp[ctx][0] + symbol * rx_size_symbol), + outtemp, + sizeofArray(outtemp), + shift - (fp_flag == 1 ? 2 : 0)); nr_a_sum_b(rxdataF_zforcing[rtx], outtemp, nb_rb_0); // a = a + b } #ifdef DEBUG_DLSCH_DEMOD diff --git a/openair1/PHY/TOOLS/tests/CMakeLists.txt b/openair1/PHY/TOOLS/tests/CMakeLists.txt index 9480af781f..f5bdf24421 100644 --- a/openair1/PHY/TOOLS/tests/CMakeLists.txt +++ b/openair1/PHY/TOOLS/tests/CMakeLists.txt @@ -16,8 +16,15 @@ add_dependencies(tests test_log2_approx) add_test(NAME test_log2_approx COMMAND ./test_log2_approx --gtest_filter=-log2_approx.complete) + add_executable(dft_test test_dft.c ../dfts_load.c) target_link_libraries(dft_test minimal_lib shlib_loader SIMU m) add_dependencies(tests dft_test) add_dependencies(dft_test dfts) # trigger build of dfts (shared lib for DFT) add_test(NAME dft_test COMMAND ./dft_test) + +add_executable(test_vector_op test_vector_op.cpp) +target_link_libraries(test_vector_op PRIVATE LOG minimal_lib) +add_dependencies(tests test_vector_op) +add_test(NAME test_vector_op + COMMAND test_vector_op) diff --git a/openair1/PHY/TOOLS/tests/test_vector_op.cpp b/openair1/PHY/TOOLS/tests/test_vector_op.cpp new file mode 100644 index 0000000000..6173c40e7e --- /dev/null +++ b/openair1/PHY/TOOLS/tests/test_vector_op.cpp @@ -0,0 +1,70 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include +#include +#include +#include +extern "C" { +#include "openair1/PHY/TOOLS/tools_defs.h" +struct configmodule_interface_s; +struct configmodule_interface_s *uniqCfg = NULL; +void exit_function(const char *file, const char *function, const int line, const char *s, const int assert) +{ + if (assert) { + abort(); + } else { + exit(EXIT_SUCCESS); + } +} +} +#include +#include "common/utils/LOG/log.h" +#include "openair1/PHY/TOOLS/phy_test_tools.hpp" + +int main() +{ + const int shift = 15; // it should always be 15 to keep int16 in same range + for (int vector_size = 1237; vector_size < 1237 + 8; vector_size++) { + auto input1 = generate_random_c16(vector_size); + auto input2 = generate_random_c16(vector_size); + AlignedVector512 output; + output.resize(vector_size); + mult_complex_vectors(input1.data(), input2.data(), output.data(), vector_size, shift); + for (int i = 0; i < vector_size; i++) { + c16_t res = c16mulShift(input1[i], input2[i], shift); + if (output[i].r != res.r || output[i].i != res.i) { + printf("Error at %d: (%d,%d) * (%d,%d) = (%d,%d) (should be (%d,%d))\n", + i, + input1[i].r, + input1[i].i, + input2[i].r, + input2[i].i, + output[i].r, + output[i].i, + res.r, + res.i); + return 1; + } + } + } + return 0; +} diff --git a/openair1/PHY/TOOLS/tools_defs.h b/openair1/PHY/TOOLS/tools_defs.h index 58af33020a..279cfd0e51 100644 --- a/openair1/PHY/TOOLS/tools_defs.h +++ b/openair1/PHY/TOOLS/tools_defs.h @@ -357,6 +357,74 @@ static __attribute__((always_inline)) inline void multadd_real_four_symbols_vect simde_mm_storeu_si128((simd_q15_t *)y, y_128); } +// Multiply two vectors of complex int16 and take the most significant bits (shift by 15 in normal case) +// works only with little endian storage (for big endian, modify the srai/ssli at the end) +static __attribute__((always_inline)) inline void mult_complex_vectors(const c16_t *in1, + const c16_t *in2, + c16_t *out, + const int size, + const int shift) +{ + const simde__m256i complex_shuffle256 = simde_mm256_set_epi8(29, + 28, + 31, + 30, + 25, + 24, + 27, + 26, + 21, + 20, + 23, + 22, + 17, + 16, + 19, + 18, + 13, + 12, + 15, + 14, + 9, + 8, + 11, + 10, + 5, + 4, + 7, + 6, + 1, + 0, + 3, + 2); + const simde__m256i conj256 = simde_mm256_set_epi16(-1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1); + int i; + // do 8 multiplications at a time + for (i = 0; i < size - 7; i += 8) { + const simde__m256i i1 = simde_mm256_loadu_epi32((simde__m256i *)(in1 + i)); + const simde__m256i i2 = simde_mm256_loadu_epi32((simde__m256i *)(in2 + i)); + const simde__m256i i2swap = simde_mm256_shuffle_epi8(i2, complex_shuffle256); + const simde__m256i i2conj = simde_mm256_sign_epi16(i2, conj256); + const simde__m256i re = simde_mm256_madd_epi16(i1, i2conj); + const simde__m256i im = simde_mm256_madd_epi16(i1, i2swap); + simde_mm256_storeu_si256( + (simde__m256i *)(out + i), + simde_mm256_blend_epi16(simde_mm256_srai_epi32(re, shift), simde_mm256_slli_epi32(im, 16 - shift), 0xAA)); + } + if (size - i > 4) { + const simde__m128i i1 = simde_mm_loadu_epi32((simde__m128i *)(in1 + i)); + const simde__m128i i2 = simde_mm_loadu_epi32((simde__m128i *)(in2 + i)); + const simde__m128i i2swap = simde_mm_shuffle_epi8(i2, *(simde__m128i *)&complex_shuffle256); + const simde__m128i i2conj = simde_mm_sign_epi16(i2, *(simde__m128i *)&conj256); + const simde__m128i re = simde_mm_madd_epi16(i1, i2conj); + const simde__m128i im = simde_mm_madd_epi16(i1, i2swap); + simde_mm_storeu_si128((simde__m128i *)(out + i), + simde_mm_blend_epi16(simde_mm_srai_epi32(re, shift), simde_mm_slli_epi32(im, 16 - shift), 0xAA)); + i += 4; + } + for (; i < size; i++) + out[i] = c16mulShift(in1[i], in2[i], shift); +} /*!\fn void multadd_complex_vector_real_scalar(int16_t *x,int16_t alpha,int16_t *y,uint8_t zero_flag,uint32_t N) This function performs componentwise multiplication and accumulation of a real scalar and a complex vector. @param x Vector input (Q1.15) in the format |Re0 Im0|Re1 Im 1| ... diff --git a/openair1/PHY/TOOLS/tools_extern.h b/openair1/PHY/TOOLS/tools_extern.h deleted file mode 100644 index 4690bba42e..0000000000 --- a/openair1/PHY/TOOLS/tools_extern.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - From 89b7ce5eb9359cc8f699c0da126cc10c235bed8b Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Thu, 31 Oct 2024 14:51:51 +0100 Subject: [PATCH 41/75] small fix of rotate vector unit test --- openair1/PHY/TOOLS/tests/benchmark_rotate_vector.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair1/PHY/TOOLS/tests/benchmark_rotate_vector.cpp b/openair1/PHY/TOOLS/tests/benchmark_rotate_vector.cpp index 6f4ea89643..25f1756e76 100644 --- a/openair1/PHY/TOOLS/tests/benchmark_rotate_vector.cpp +++ b/openair1/PHY/TOOLS/tests/benchmark_rotate_vector.cpp @@ -45,7 +45,7 @@ static void BM_rotate_cpx_vector(benchmark::State &state) { int vector_size = state.range(0); auto input_complex_16 = generate_random_c16(vector_size); - auto input_alpha = generate_random_c16(vector_size); + auto input_alpha = generate_random_c16(1); AlignedVector512 output; output.resize(vector_size); int shift = 2; From 07b9daa762d200791fe232bf4d345cc3fd0b37cb Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Thu, 31 Oct 2024 15:03:50 +0100 Subject: [PATCH 42/75] fix blocking bugs in command nr_dlsim -n100 -e27 -s35 -b 273 -R273 -x4 -y4 -z4 use a better complex vector multiplication function --- .../NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 29 +++++++------- .../PHY/nr_phy_common/src/nr_phy_common.c | 7 ++-- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 16 ++++++-- openair1/SIMULATION/NR_PHY/dlsim.c | 39 ++++++++++++------- 4 files changed, 56 insertions(+), 35 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index f3d0c2a7fd..9bc764fa35 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -589,20 +589,21 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, symbol, nb_re_pdsch); if (nl >= 2) // Apply MMSE for 2, 3, and 4 Tx layers - nr_dlsch_mmse(rx_size_symbol, - n_rx, - nl, - rxdataF_comp, - dl_ch_mag, - dl_ch_magb, - dl_ch_magr, - dl_ch_estimates_ext, - nb_rb_pdsch, - dlsch_config->qamModOrder, - *log2_maxh, - symbol, - nb_re_pdsch, - nvar); + if (nb_re_pdsch) + nr_dlsch_mmse(rx_size_symbol, + n_rx, + nl, + rxdataF_comp, + dl_ch_mag, + dl_ch_magb, + dl_ch_magr, + dl_ch_estimates_ext, + nb_rb_pdsch, + dlsch_config->qamModOrder, + *log2_maxh, + symbol, + nb_re_pdsch, + nvar); } stop_meas_nr_ue_phy(ue, DLSCH_MRC_MMSE_STATS); diff --git a/openair1/PHY/nr_phy_common/src/nr_phy_common.c b/openair1/PHY/nr_phy_common/src/nr_phy_common.c index ef10837d2d..11a40fd69e 100644 --- a/openair1/PHY/nr_phy_common/src/nr_phy_common.c +++ b/openair1/PHY/nr_phy_common/src/nr_phy_common.c @@ -141,14 +141,13 @@ void nr_64qam_llr(int32_t *rxdataF_comp, int32_t *ch_mag, int32_t *ch_mag2, int1 int32_t *llr_32 = (int32_t *)llr; #ifndef USE_128BIT - simde__m256i xmm0, xmm1, xmm2; for (int i = 0; i < (nb_re >> 3); i++) { - xmm0 = *rxF; + simde__m256i xmm0 = simde_mm256_loadu_si256(rxF); // registers of even index in xmm0-> |y_R|, registers of odd index in xmm0-> |y_I| - xmm1 = simde_mm256_abs_epi16(xmm0); + simde__m256i xmm1 = simde_mm256_abs_epi16(xmm0); // registers of even index in xmm0-> |y_R|-|h|^2, registers of odd index in xmm0-> |y_I|-|h|^2 xmm1 = simde_mm256_subs_epi16(*ch_maga, xmm1); - xmm2 = simde_mm256_abs_epi16(xmm1); + simde__m256i xmm2 = simde_mm256_abs_epi16(xmm1); xmm2 = simde_mm256_subs_epi16(*ch_magb, xmm2); // xmm0 |1st 4th 7th 10th 13th 16th 19th 22ed| // xmm1 |2ed 5th 8th 11th 14th 17th 20th 23rd| diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index cf1ebf8319..edad325089 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -505,8 +505,8 @@ static int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, dlsch0->Nl); const uint32_t pdsch_est_size = ((ue->frame_parms.symbols_per_slot * ue->frame_parms.ofdm_symbol_size + 15) / 16) * 16; - __attribute__((aligned(32))) int32_t pdsch_dl_ch_estimates[ue->frame_parms.nb_antennas_rx * dlsch0->Nl][pdsch_est_size]; - memset(pdsch_dl_ch_estimates, 0, sizeof(int32_t) * ue->frame_parms.nb_antennas_rx * dlsch0->Nl * pdsch_est_size); + fourDimArray_t *toFree = NULL; + allocCast2D(pdsch_dl_ch_estimates, int32_t, toFree, ue->frame_parms.nb_antennas_rx * dlsch0->Nl, pdsch_est_size, false); c16_t ptrs_phase_per_slot[ue->frame_parms.nb_antennas_rx][NR_SYMBOLS_PER_SLOT]; memset(ptrs_phase_per_slot, 0, sizeof(ptrs_phase_per_slot)); @@ -515,8 +515,14 @@ static int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, memset(ptrs_re_per_slot, 0, sizeof(ptrs_re_per_slot)); const uint32_t rx_size_symbol = (dlsch[0].dlsch_config.number_rbs * NR_NB_SC_PER_RB + 15) & ~15; - __attribute__((aligned(32))) int32_t rxdataF_comp[dlsch[0].Nl][ue->frame_parms.nb_antennas_rx][rx_size_symbol * NR_SYMBOLS_PER_SLOT]; - memset(rxdataF_comp, 0, sizeof(rxdataF_comp)); + fourDimArray_t *toFree2 = NULL; + allocCast3D(rxdataF_comp, + int32_t, + toFree2, + dlsch[0].Nl, + ue->frame_parms.nb_antennas_rx, + rx_size_symbol * NR_SYMBOLS_PER_SLOT, + false); uint32_t nvar = 0; @@ -620,6 +626,8 @@ static int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, return -1; } // CRNTI active stop_meas_nr_ue_phy(ue, RX_PDSCH_STATS); + free(toFree); + free(toFree2); } return 0; } diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 9ab2de4215..6766b94ad1 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -858,15 +858,12 @@ int main(int argc, char **argv) UE_mac->if_module = nr_ue_if_module_init(0); unsigned int available_bits=0; - unsigned char *estimated_output_bit; - unsigned char *test_input_bit; + unsigned char *estimated_output_bit=NULL; + unsigned char *test_input_bit=NULL; unsigned int errors_bit = 0; initFloatingCoresTpool(dlsch_threads, &nrUE_params.Tpool, false, "UE-tpool"); - test_input_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384); - estimated_output_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384); - // generate signal AssertFatal(input_fd==NULL,"Not ready for input signal file\n"); @@ -905,13 +902,14 @@ int main(int argc, char **argv) gNB->msgDataTx = msgDataTx; // Buffers to store internal memory of slot process - int rx_size = (((14 * frame_parms->N_RB_DL * 12 * sizeof(int32_t)) + 15) >> 4) << 4; - UE->phy_sim_rxdataF = calloc(sizeof(int32_t *) * frame_parms->nb_antennas_rx * g_nrOfLayers, frame_parms->samples_per_slot_wCP * sizeof(int32_t)); + int rx_size = (((14 * UE->frame_parms.N_RB_DL * 12 * sizeof(int32_t)) + 15) >> 4) << 4; + UE->phy_sim_rxdataF = calloc(sizeof(int32_t *) * UE->frame_parms.nb_antennas_rx * g_nrOfLayers, + UE->frame_parms.samples_per_slot_wCP * sizeof(int32_t)); UE->phy_sim_pdsch_llr = calloc(1, (8 * (3 * 8 * 8448)) * sizeof(int16_t)); // Max length - UE->phy_sim_pdsch_rxdataF_ext = calloc(sizeof(int32_t *) * frame_parms->nb_antennas_rx * g_nrOfLayers, rx_size); - UE->phy_sim_pdsch_rxdataF_comp = calloc(sizeof(int32_t *) * frame_parms->nb_antennas_rx * g_nrOfLayers, rx_size); - UE->phy_sim_pdsch_dl_ch_estimates = calloc(sizeof(int32_t *) * frame_parms->nb_antennas_rx * g_nrOfLayers, rx_size); - UE->phy_sim_pdsch_dl_ch_estimates_ext = calloc(sizeof(int32_t *) * frame_parms->nb_antennas_rx * g_nrOfLayers, rx_size); + UE->phy_sim_pdsch_rxdataF_ext = calloc(sizeof(int32_t *) * UE->frame_parms.nb_antennas_rx * g_nrOfLayers, rx_size); + UE->phy_sim_pdsch_rxdataF_comp = calloc(sizeof(int32_t *) * UE->frame_parms.nb_antennas_rx * g_nrOfLayers, rx_size); + UE->phy_sim_pdsch_dl_ch_estimates = calloc(sizeof(int32_t *) * UE->frame_parms.nb_antennas_rx * g_nrOfLayers, rx_size); + UE->phy_sim_pdsch_dl_ch_estimates_ext = calloc(sizeof(int32_t *) * UE->frame_parms.nb_antennas_rx * g_nrOfLayers, rx_size); int a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS; //number of segments to be allocated if (g_rbSize != 273) { a_segments = a_segments*g_rbSize; @@ -1118,7 +1116,17 @@ int main(int argc, char **argv) // Apply MIMO Channel multipath_channel(gNB2UE, s_re, s_im, r_re, r_im, slot_length, 0, (n_trials == 1) ? 1 : 0); - add_noise(UE->common_vars.rxdata, (const double **) r_re, (const double **) r_im, sigma2, slot_length, slot_offset, ts, delay, pdu_bit_map, 0x1, frame_parms->nb_antennas_rx); + add_noise(UE->common_vars.rxdata, + (const double **)r_re, + (const double **)r_im, + sigma2, + slot_length, + slot_offset, + ts, + delay, + pdu_bit_map, + 0x1, + UE->frame_parms.nb_antennas_rx); dl_config.sfn = frame; dl_config.slot = slot; ue_dci_configuration(UE_mac, &dl_config, frame, slot); @@ -1168,6 +1176,10 @@ int main(int argc, char **argv) round++; } // round + if (test_input_bit == NULL) { + test_input_bit = (unsigned char *)malloc16(sizeof(unsigned char) * TBS); + estimated_output_bit = (unsigned char *)malloc16(sizeof(unsigned char) * TBS); + } for (i = 0; i < TBS; i++) { estimated_output_bit[i] = (UE->phy_sim_dlsch_b[i/8] & (1 << (i & 7))) >> (i & 7); @@ -1226,10 +1238,11 @@ int main(int argc, char **argv) fprintf(csv_file,"%.2f,%.4f,%.2f,%u\n", roundStats, effRate, effRate / TBS * 100, TBS); } if (print_perf==1) { - printf("\ngNB TX function statistics (per %d us slot, NPRB %d, mcs %d, block %d)\n", + printf("\ngNB TX function statistics (per %d us slot, NPRB %d, mcs %d, C %d, block %d)\n", 1000 >> *scc->ssbSubcarrierSpacing, g_rbSize, g_mcsIndex, + UE->dl_harq_processes[0][slot].C, msgDataTx->dlsch[0][0].harq_process.pdsch_pdu.pdsch_pdu_rel15.TBSize[0] << 3); printDistribution(&gNB->phy_proc_tx,table_tx,"PHY proc tx"); printStatIndent2(&gNB->dlsch_encoding_stats,"DLSCH encoding time"); From fd83be4e77be5421f6d191d0ca36bfb63b2bc543 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Mon, 4 Nov 2024 16:07:26 +0100 Subject: [PATCH 43/75] change the alignment of OAI mutli-dim arrays from 16 to 32 bytes --- openair1/PHY/TOOLS/tools_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair1/PHY/TOOLS/tools_defs.h b/openair1/PHY/TOOLS/tools_defs.h index 279cfd0e51..772dd54e8b 100644 --- a/openair1/PHY/TOOLS/tools_defs.h +++ b/openair1/PHY/TOOLS/tools_defs.h @@ -90,7 +90,7 @@ extern "C" { int dim2; int dim3; int dim4; - uint8_t data[]; + uint8_t data[] __attribute__((aligned(32))); } fourDimArray_t; static inline fourDimArray_t *allocateFourDimArray(int elmtSz, int dim1, int dim2, int dim3, int dim4) From 486cebce06bca3e99e08d40a6870086f9c775b01 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Wed, 6 Nov 2024 15:45:27 +0100 Subject: [PATCH 44/75] replace a printf() by a cleaner call to AssertFatal() --- openair1/PHY/TOOLS/tools_defs.h | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/openair1/PHY/TOOLS/tools_defs.h b/openair1/PHY/TOOLS/tools_defs.h index 772dd54e8b..8799188c99 100644 --- a/openair1/PHY/TOOLS/tools_defs.h +++ b/openair1/PHY/TOOLS/tools_defs.h @@ -618,17 +618,15 @@ typedef enum dft_size_idx { case Sz: \ return DFT_##Sz; \ break; -static inline -dft_size_idx_t get_dft(int ofdm_symbol_size) +static inline dft_size_idx_t get_dft(int size) { - switch (ofdm_symbol_size) { + switch (size) { FOREACH_DFTSZ(FIND_ENUM) default: - printf("function get_dft : unsupported ofdm symbol size \n"); - assert(0); + AssertFatal(false, "function get_dft : unsupported DFT size %d\n", size); break; } - return DFT_SIZE_IDXTABLESIZE; // never reached and will trigger assertion in idft function; + return DFT_SIZE_IDXTABLESIZE; } #define SZ_iENUM(Sz) IDFT_##Sz, @@ -678,14 +676,12 @@ struct { return IDFT_##iSz; \ break; -static inline -idft_size_idx_t get_idft(int ofdm_symbol_size) +static inline idft_size_idx_t get_idft(int size) { - switch (ofdm_symbol_size) { + switch (size) { FOREACH_IDFTSZ(FIND_iENUM) default: - printf("function get_idft : unsupported ofdm symbol size \n"); - assert(0); + AssertFatal(false, "function get_idft : unsupported iDFT size %d\n", size); break; } return IDFT_SIZE_IDXTABLESIZE; // never reached and will trigger assertion in idft function From f75e107d0854afc7478c50d4ebc410aa0981748e Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Wed, 16 Oct 2024 12:14:38 +0200 Subject: [PATCH 45/75] CI: remove unused Run_NRulsimTest --- ci-scripts/cls_physim.py | 38 ----------------------------------- ci-scripts/main.py | 4 +--- ci-scripts/xml_class_list.yml | 1 - 3 files changed, 1 insertion(+), 42 deletions(-) diff --git a/ci-scripts/cls_physim.py b/ci-scripts/cls_physim.py index ccdd34e9a9..b10c31f566 100644 --- a/ci-scripts/cls_physim.py +++ b/ci-scripts/cls_physim.py @@ -123,33 +123,6 @@ class PhySim: HTML.CreateHtmlTestRowQueue(self.runargs, 'KO', [info + '\n' + error_msg]) return success - def __CheckResults_NRulsimTest(self, HTML, CONST, testcase_id): - #retrieve run log file and store it locally - mySSH = sshconnection.SSHConnection() - filename = self.__workSpacePath + self.__runLogFile - ret = mySSH.copyin(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord, filename, '.') - if ret != 0: - error_msg = f'could not recover test result file {filename}' - logging.error(error_msg) - HTML.CreateHtmlTestRowQueue("could not recover results", 'KO', [error_msg]) - return False - - PUSCH_OK = False - with open(self.__runLogFile) as f: - PUSCH_OK = 'PUSCH test OK' in f.read() - - # once parsed move the local logfile to its folder for tidiness - os.system(f'mv {self.__runLogFile} {self.__runLogPath}/.') - - #updating the HTML with results - if PUSCH_OK: - HTML.CreateHtmlTestRowQueue(self.runargs, 'OK', 1, ["succeeded"]) - else: - error_msg = 'error: no "PUSCH test OK"' - logging.error(error_msg) - HTML.CreateHtmlTestRowQueue(self.runargs, 'KO', 1, [error_msg]) - return PUSCH_OK - def __CheckBuild_PhySim(self, HTML, CONST): self.__workSpacePath=self.eNBSourceCodePath+'/cmake_targets/' mySSH = sshconnection.SSHConnection() @@ -249,14 +222,3 @@ class PhySim: mySSH.run(f'sudo {self.__workSpacePath}ran_build/build/{self.runsim} {self.runargs} > {self.__workSpacePath}{self.__runLogFile} 2>&1') mySSH.close() return self.__CheckResults_LDPCt2Test(htmlObj,constObj,testcase_id) - - def Run_NRulsimTest(self, htmlObj, constObj, testcase_id): - self.__workSpacePath=self.eNBSourceCodePath+'/cmake_targets/' - os.system(f'mkdir -p ./{self.__runLogPath}') - self.__runLogFile = f'physim_{testcase_id}.log' - mySSH = sshconnection.SSHConnection() - mySSH.open(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord) - mySSH.command(f'cd {self.__workSpacePath}', '\$', 5) - mySSH.command(f'sudo {self.__workSpacePath}ran_build/build/nr_ulsim {self.runargs} > {self.__runLogFile} 2>&1', '\$', 30) - mySSH.close() - return self.__CheckResults_NRulsimTest(htmlObj, constObj, testcase_id) diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 3904ac908d..b1b0cb77a5 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -377,14 +377,12 @@ def ExecuteActionWithParam(action): elif action == 'Create_Workspace': success = CONTAINERS.Create_Workspace(HTML) - elif action == 'Run_CUDATest' or action == 'Run_NRulsimTest' or action == 'Run_T2Test': + elif action == 'Run_CUDATest' or action == 'Run_T2Test': ldpc.runargs = test.findtext('physim_run_args') ldpc.runsim = test.findtext('physim_run') ldpc.timethrs = test.findtext('physim_time_threshold') if action == 'Run_CUDATest': success = ldpc.Run_CUDATest(HTML,CONST,id) - elif action == 'Run_NRulsimTest': - success = ldpc.Run_NRulsimTest(HTML,CONST,id) elif action == 'Run_T2Test': success = ldpc.Run_T2Test(HTML,CONST,id) diff --git a/ci-scripts/xml_class_list.yml b/ci-scripts/xml_class_list.yml index 325797c29e..9b1f7e4bec 100755 --- a/ci-scripts/xml_class_list.yml +++ b/ci-scripts/xml_class_list.yml @@ -4,7 +4,6 @@ - Build_PhySim - Run_CUDATest - Run_T2Test - - Run_NRulsimTest - Build_eNB - Initialize_eNB - Terminate_eNB From d0f9d4c028c1ad3888a65f8c6ed9b6ed58b60bc3 Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Tue, 29 Oct 2024 09:23:30 +0100 Subject: [PATCH 46/75] CI: Remove unused Build_Physim --- ci-scripts/cls_physim.py | 76 -------------------- ci-scripts/main.py | 12 ---- ci-scripts/xml_class_list.yml | 1 - ci-scripts/xml_files/physim_build_source.xml | 35 --------- 4 files changed, 124 deletions(-) delete mode 100644 ci-scripts/xml_files/physim_build_source.xml diff --git a/ci-scripts/cls_physim.py b/ci-scripts/cls_physim.py index b10c31f566..209611bf6f 100644 --- a/ci-scripts/cls_physim.py +++ b/ci-scripts/cls_physim.py @@ -40,21 +40,13 @@ import re class PhySim: def __init__(self): - self.buildargs = "" self.runargs = "" self.eNBIpAddr = "" self.eNBUserName = "" self.eNBPassWord = "" self.eNBSourceCodePath = "" - self.ranRepository = "" - self.ranBranch = "" - self.ranCommitID= "" - self.ranAllowMerge= "" - self.ranTargetBranch= "" - self.forced_workspace_cleanup=False #private attributes self.__workSpacePath='' - self.__buildLogFile='compile_phy_sim.log' self.__runLogFile='' self.__runLogPath='phy_sim_logs' @@ -123,77 +115,9 @@ class PhySim: HTML.CreateHtmlTestRowQueue(self.runargs, 'KO', [info + '\n' + error_msg]) return success - def __CheckBuild_PhySim(self, HTML, CONST): - self.__workSpacePath=self.eNBSourceCodePath+'/cmake_targets/' - mySSH = sshconnection.SSHConnection() - mySSH.open(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord) - #retrieve compile log file and store it locally - mySSH.copyin(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord, self.__workSpacePath+self.__buildLogFile, '.') - #delete older run log file - mySSH.command('rm ' + self.__workSpacePath+self.__runLogFile, '\$', 5) - mySSH.close() - #check build result from local compile log file - with open(self.__buildLogFile) as f: - if 'BUILD SHOULD BE SUCCESSFUL' in f.read(): - HTML.CreateHtmlTestRow(self.buildargs, 'OK', CONST.ALL_PROCESSES_OK, 'PhySim') - return True - logging.error('\u001B[1m Building Physical Simulators Failed\u001B[0m') - HTML.CreateHtmlTestRow(self.buildargs, 'KO', CONST.ALL_PROCESSES_OK, 'LDPC') - HTML.CreateHtmlTabFooter(False) - return False - - #-----------------$ #PUBLIC Methods$ #-----------------$ - - def Build_PhySim(self,htmlObj,constObj): - mySSH = sshconnection.SSHConnection() - mySSH.open(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord) - - #create working dir - mySSH.command('mkdir -p ' + self.eNBSourceCodePath, '\$', 5) - mySSH.command('cd ' + self.eNBSourceCodePath, '\$', 5) - - if not self.ranRepository.lower().endswith('.git'): - self.ranRepository+='.git' - - #git clone - mySSH.command('if [ ! -e .git ]; then stdbuf -o0 git clone ' + self.ranRepository + ' .; else stdbuf -o0 git fetch --prune; fi', '\$', 600) - #git config - mySSH.command('git config user.email "jenkins@openairinterface.org"', '\$', 5) - mySSH.command('git config user.name "OAI Jenkins"', '\$', 5) - - #git clean depending on self.forced_workspace_cleanup captured in xml - if self.forced_workspace_cleanup==True: - logging.info('Cleaning workspace ...') - mySSH.command('echo ' + self.eNBPassWord + ' | sudo -S git clean -x -d -ff', '\$', 30) - else: - logging.info('Workspace cleaning was disabled') - - # if the commit ID is provided, use it to point to it - if self.ranCommitID != '': - mySSH.command('git checkout -f ' + self.ranCommitID, '\$', 30) - # if the branch is not develop, then it is a merge request and we need to do - # the potential merge. Note that merge conflicts should have already been checked earlier - if (self.ranAllowMerge): - if self.ranTargetBranch == '': - if (self.ranBranch != 'develop') and (self.ranBranch != 'origin/develop'): - mySSH.command('git merge --ff origin/develop -m "Temporary merge for CI"', '\$', 30) - else: - logging.info('Merging with the target branch: ' + self.ranTargetBranch) - mySSH.command('git merge --ff origin/' + self.ranTargetBranch + ' -m "Temporary merge for CI"', '\$', 30) - - #build - mySSH.command('source oaienv', '\$', 5) - mySSH.command('cd cmake_targets', '\$', 5) - mySSH.command('mkdir -p log', '\$', 5) - mySSH.command(f'./build_oai {self.buildargs} 2>&1 | tee {self.__buildLogFile}', '\$', 1500) - - mySSH.close() - return __CheckBuild_PhySim(htmlObj,constObj) - - def Run_CUDATest(self,htmlObj,constObj,testcase_id): self.__workSpacePath = self.eNBSourceCodePath+'/cmake_targets/' #create run logs folder locally diff --git a/ci-scripts/main.py b/ci-scripts/main.py index b1b0cb77a5..e5c2f221f2 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -289,18 +289,6 @@ def ExecuteActionWithParam(action): st = test.findtext('idle_sleep_time_in_sec') or "5" success = cls_oaicitest.IdleSleep(HTML, int(st)) - elif action == 'Build_PhySim': - ldpc.buildargs = test.findtext('physim_build_args') - forced_workspace_cleanup = test.findtext('forced_workspace_cleanup') - if (forced_workspace_cleanup is None): - ldpc.forced_workspace_cleanup=False - else: - if re.match('true', forced_workspace_cleanup, re.IGNORECASE): - ldpc.forced_workspace_cleanup=True - else: - ldpc.forced_workspace_cleanup=False - success = ldpc.Build_PhySim(HTML,CONST) - elif action == 'Deploy_Run_PhySim': success = PHYSIM.Deploy_PhySim(HTML) diff --git a/ci-scripts/xml_class_list.yml b/ci-scripts/xml_class_list.yml index 9b1f7e4bec..27b179c8f8 100755 --- a/ci-scripts/xml_class_list.yml +++ b/ci-scripts/xml_class_list.yml @@ -1,7 +1,6 @@ - Build_Proxy - Build_Cluster_Image - Pull_Cluster_Image - - Build_PhySim - Run_CUDATest - Run_T2Test - Build_eNB diff --git a/ci-scripts/xml_files/physim_build_source.xml b/ci-scripts/xml_files/physim_build_source.xml deleted file mode 100644 index 7ba2a06800..0000000000 --- a/ci-scripts/xml_files/physim_build_source.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - build-offload - Build physical simulators - tasks - 000001 - - - - Build_PhySim - Build physical simulators - --phy_simulators --ninja --noavx512 - FALSE - - From d585aa0041389e0167025312a240ebed8ba6bde0 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Wed, 6 Nov 2024 10:33:02 +0100 Subject: [PATCH 47/75] Add UL PRBs Blacklist section to NR_SA_Tutorial_COTS_UE.md --- doc/NR_SA_Tutorial_COTS_UE.md | 34 +++++++++++++++++++++++++++++++- doc/images/USRP_tune_offset.png | Bin 0 -> 9354 bytes 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 doc/images/USRP_tune_offset.png diff --git a/doc/NR_SA_Tutorial_COTS_UE.md b/doc/NR_SA_Tutorial_COTS_UE.md index 7fc8b27a9a..73e3bffea5 100644 --- a/doc/NR_SA_Tutorial_COTS_UE.md +++ b/doc/NR_SA_Tutorial_COTS_UE.md @@ -193,7 +193,39 @@ sudo ethtool -G enp1s0f0 tx 4096 rx 4096 - You can also reduce the number of LDPC decoder iterations, which will make the LDPC decoder take less time: `--L1s.[0].max_ldpc_iterations 4`. ## 6.3 Uplink issues related with noise on the DC carriers -- There is noise on the DC carriers on N300 and especially the X300 in UL. To avoid their use or shift them away from the center to use more UL spectrum, use the `--tune-offset ` command line switch, where `` is ideally half the bandwidth, or possibly less. + +With devices like the USRP N300 and especially the X300, there is noise in the DC carriers: this can cause uplink PRBs that overlap with the DC carrier to experience interference and increased noise. + +There are two possible solution that can be enabled in OAI: + +* `--tune-offset`: it consists in shifting away the operational bandwidth to avoid the center frequency +* `ul_prbblacklist`: can be used to define specific PRBs that should not be used for uplink scheduling + +A spectrum clean from the noisy PRBs will eventually result in an enhanced UL throughput. + +Using `--tune-offset`, `ul_prbblacklist` or none at all is depending on the combination of the USRP model, the operational bandwidth configuration and the bandwidth of the daughterboard. + +There are two main points to keep in mind: + +- USRPs come with various daughterboards, each with its own specific bandwidth (see datasheets). +- Using `--tune-offset` to shift the entire operational bandwidth to avoid the center frequency could exceed the device capabilities: if the shifted operational bandwidth falls entirely within the bandwidth of the daughterboard, than `--tune-offset` is sufficient, otherwise `--tune-offset` is ineffective and `ul_prbblacklist` is needed. + +The option `ul_prbblacklist` is more relevant when using high-bandwidth configurations (e.g., 100 MHz) with devices like the USRP N310 or X310: in this scenarios, `--tune-offset` could not be sufficient to get rid of the noisy PRBs in the center frequency entirely, because it is not possible to shift the DC carriers out of the bandwidth (tune offset shall be smaller than half the bandwidth of the board). + +## 6.3.1 Tune offset + +The value passed to the command line option `--tune-offset ` will be calling an UHD API. It represents the LO offset frequency in Hz. +The API (tune_request_t class) will send a frequency tuning request (`tx_tune_req`, `rx_tune_req`) to the USRP device, in order to configure the target baseband tx/rx frequency, therefore shifting the tx/rx signal spectrum. + +The value passed to this option should be ideally equal to half the operational bandwidth, or possibly less, depending on the bandwidth configuration, and also it shall be lower or equal than half the bandwidth of the board. + +A visual representation of the impact of tune-offset with a 120 MHz bandwidth daughterboard: + +![Tune_Offset](./images/USRP_tune_offset.png) + +## 6.3.2 UL PRBs Blacklist + +To use this option, in the configuration file, e.g. 100 MHz bandwidth setup: `ul_prbblacklist = "135,136,137,138"`. ## 6.4 Lower latency on user plane - To lower latency on the user plane, you can force the UE to be scheduled constantly in uplink: `--MACRLCs.[0].ulsch_max_frame_inactivity 0` . diff --git a/doc/images/USRP_tune_offset.png b/doc/images/USRP_tune_offset.png new file mode 100644 index 0000000000000000000000000000000000000000..1372373503b78deae810e6b3ea176ae1005783f2 GIT binary patch literal 9354 zcmeHtXHb*dw|5c(1QZEHKxz;WK|zqJv;azPid1Q$f>c485K4k5SODorKY#(1YUmLO zHj02iAoOxXdJ_dgF>p6}?w5Dw&b;T&+;9I6nPl>;wb$BvmHk_5JrB)HbXk~rnIRAe zi@x54%Mb{35`2yz7{EW5GCsJ1FD4&78$Sqy_1eJ)TC7pz27#a;`WG~>+;v#aW_gqP zlh)GIbFU~N+2Uky$9uguiR+iOKPwuxx@79Go{o}#Ja{F2Fx7^&Lz{_>Pb4a5E%00DclJ}UCA4X!!RTk0!Ja)&?JBO??+fHBMdP}=l>`Q{13=cPCI{o zphb@qipW6a~Pf6J1~UuG!!3vjm`S?jfdG` zn?s7OU0D^9CSJl2Ts{+OGCyGrib#$l&Gi&`y^CV9w6Sq3wXK%4*Zg)Em{J^zZH&e; zqfxq(gfHrZBLe3KA00jAxzP7Q@$Pr0ZeTl!6IiS{zg-3w7tV&@Vza+TD=?rgj|@mk zO1^W4RNsfdA05YHAHVz9j65lT3#aW2Ee#P0U>OP?pXB}L&64Ec?3xg$`0>M6jxWMf z&p3Jus02R2|Ml~s+gu5ic{n!^Y+#uUAEt@q(FlKIfA{bEeElhIb0{rcG2w0}7^1Fu zZVLtfDqImx3mLf{ujV=5`<(A)tGvHzXd69DUkr;);yt#Iat!u!rjt+}L0hb@NpqX) z@TcR=&;(20(=2LhJ1*lhiO!V0u2Y)g%zNIZGG7rHlLUdqC7lS?%+rItvMhbQxjZrg zbatnSlDjX$rhO3b3lJzH=joRj>M(P>QRUz7qX$N0@PCoHgKXhY5OM2th`XW{ch{V+ z*5A2l!J_ko=h`7|>8e-dZ-*QF=hy z-Dc^JhQJp@Kr{#;^^j0_R-TjDQABb&1ST!(^g0?X3rG6MRw;AAu5qAA*IMF-i=IGW zCN^ldBk%=bz$N%^xzZy+q@oT3Wu7QsGDLjP#IpJDbGFgJWWjc1aiV+(I0#xsr0C0Z z0YIcuiGL0P8ib^13=nK4Q_KuEFoHnScw~mO^LT(|cx?F(;VOWSRZQtFo9jTJMW^%R z8DSfM%b)e%av5oYbb(}m!ufTwipAhxQ6z-&kw@R4xO4<+G98`B0*8UTLx*6u=r{rn zE8CiU`A>Rd2Zj+VIh(XvAFo49NlbtxU8sHkE zgZ(=$hi+L552XnNM@DK| zpv;^>EPTMW3Bo=CijUo2tr1biz!m};?zv|H?@j3QbI4-g7I+N$UvfDyX8HXd9zOQHeUu+7Ht015$=8uWrBKc+Q{;av=9v$t)KbAJbOF`woU9^2B9D z0^YcjfmM-D_MK;WWA77GNsW~4jli)0mjTDyHG!ozY0@r!vl(8s_SVaJH4Y%hoEenh zgjI74>XClVJc||ZpuB!QWFPcQz!yH4Xn;PhzG*Edb(BB+uE{&&4AJVEzEi?ruUaro z1r!Qq0eicqvl#H{n9H!g#U)&*_MG4_e^9q(y~55jxlR*R*(h6c-FSeVbhkKJa2fC) zu<)+zR@S>S#|UJT&&Ixq?@&I=)h-P_3u7Zo3A*o!<*L^~dd6s*HY2yrLYcN?l{Vgl ze3tV1%&H-O^-a3M#MATbyQ`Vi?kQIZj@9j+gifuOY5`Jmz;#?EIT>*~2t88yIp`U( z=J0ZfoAG69c$NOjbXuoFXpiS=q{u18#>&k0hi5)p-8CAxH@$xx+0X z3RA;msI5f}O~q#lgxu0oC@Q-NT=4VZtgoo=O**6*IDe^Ns;|J>eQt+}A%g3OG;zsU zW2>1pU(&L!)A9D(Z9K6tAVzIxuAnEr7oX|9uo5-=IZl1&mJ)dZZ|hMw;DG7Go8}4% zPzkxTj-ET72b zx4SDA_2d3z<4bBs&V57Hvi(93X`3Sjp$}O2xCDOo8lJh>q_S8-@Z4RlrA{=DUQBl8 zp{*}WH>vlbDuKWC>oc1A6#F=8yO~jFP^xy+S%?^IndR4Y&Ra3?_DIA& ztzbeRpzo4J{=lqb*haq|<*H}pMbU|$Uo-nCk_H2=5BN3v$(PSqVCwXznQqT3M(777dK*JEwkGcd zE|%8n;JS;quyjW%0Mxn7nNEL*Yp_#kV#)iy+UQFCY>r-ysRqqowAHae*KK8vQXTPk z&Vtyvcp;6q3xr^((2St^kEqPI*{Z>>y$GF(J$kkgNgou>?>oZ6-= zOb7zd@=Z1)G%YQN^jvrndr!BYtV=4wt`b+(sgtF+z*1t0OBCiSMPqL*-d2~ydsJhE zq7?8%=lS;f3(S=nu%TJO*w80o>pi+XF}AQAIoCL%R3IK>-M6tK5qtHbd1w38>2Kx^ zBoW=XCpW_KiP1Htx#}x%IdYyPEVL(v*nr*N{t}_HUtSfmv2g1{DVq;Kj$;IwRGkg7 zEXN6>3QFnKwAupHg3`4KHrN&b`V>f-%nHXqZdcjTDa|eaHTKrIuTeh|4us zt0=Dm97|=Xpf+)WdVDCm6gu%Xte|?LD_bQk!c`t-G95(VjMXAN&ojtD-azg}jyWH?Z&$`vp7E4KGtsnTg5t}JQN`1SpL z;A$haft#T;mJ(}vZaO*E`&w_8du*PV-SQ1e*&_GYz0;o>(k@l`l-u`BocEtYmNG8Z zh?efUv)JmBhlWd@Z_Li-M!a1Jl%N?C0m3&|k~#e`>@bwO<=~$d z`~{MN775B&{>DO=G(BzXhAd74&{>mFlO%y~4$c5M@BOpOC^LZe?U48zLQ&Wxfn0e1 zk$>Oa2&FX4^Lun_@+{`qT@FUvB4h-H2rW3gu2`-a zp*Wm`Nt?=CHe&`-kZxKbh(2*}uTn0m#Lw18|MI9^1&TY&{!Axpi`q!l@2(JyHA0%B z9Q1_Qf)*)KA)&4oTBJ5++enXlSPp*vm#Jzn;1kpVg9hHUnN>n((u>9Wh#?WH9Ijb< zyT&TuG&Tce_9DlE=6gS8H0a*?p;-9igUI@2q|Y2%;oghmX7;4jmD*h6JFF$$aaaNFU}%>zorHkNMy^5u5-p zaz{xFF$z!KXc5<}*8YS054;m7{=fFl*C?mzwPbUX$|O_uden(#fhg>~L(j^YMVuVJ zNpQoek*$%~jmmQ?C7P(~@x zjZa(`fZMT`++fB%0LQ{Im0D~nJbB@Mfow_-)pz_&a1C`FGxAhe+jEkHqu`A*Ki#PB zab@%IJlTeT#ezl%-umR%(76keu}UqBg)KZ8w;A zIB7@N>s_zu>Ud+4?ZpLp+#IHM|E0xd%=NW4mrR?RBQ-Ay@>j2cGbzZG$JeB!P@I=- z`RXUaYh<2#^;Io(sjTwT3eU~&*0qNTEgJID3k82m=-~_i?HJ>NZ(8Q1u(B^Z_gy-C zky!M5#L~3-X8vwZVDl$qABB=o^?qg8wpY$>gD01g^eJ@#Bs4ZAnuX7$KqvOKvC>#o zUdDi=lTF0NLO=aYWV+)m9|ey}H|}eoD5)OR=u9w^UFWzEsU;t_)WM2yvcG7}=VE zol2I59r-KTyv2weO?q}1;}hHU2wP;F$u&kd`gDF;E3zF?hcw`)!<_|ozX>yzjXnPK zC{&60GE_*1M34T8L?k~3(Z}u9?gknIqdXywpfXVjPXjMI&C^zRP<5(;CW$IP=rmP=+OE<`H0hv>UxVn7)_g>{5g)WrhhQ`IuPgnJ zmOn#H-u*5zc~?2{5Zqb#DLu3W_Q>cB(0FZ9_rIw@(H5CtWMG7~d2$!xszVB)`@C4* zlr!A2`;jcr`cVn=XjNdzthgU+txvF@qmvU+-9DhW{CjCj6s`qY7}}3{HjEW;ubH>{ ztvW|X>`L6o{N_rAH%?h)1k5{AN^Him%86Y@x82=)-Yspmo z>#(gpyZc?6s;)!T(xIx``>kGx>m{ycU@m6b6q(fTN9=kL;?>W3OpGtZD&1)sSREzW zj2*J;+}m~ZE62-H`J2xS57gQIa6^1B0b7YnJ}eCMyLt4xCgU^O9`)R_I6l|SR*{+U z3h$M$7?(p_p~4ypvxF~qj$@V;{8riIiK}l%BgBnlRDOLwv*$pwet4z))$V(t1;#s@ zL-nEio3*16m`!==cY8vb!&&NH_o%CGoP5&O{*DzPY*Th|xPR&A7rzZ5)xo7U@lI)C zhv&~uKXyy?^A5+;2KAA8D3BgWd1lX-*uNil(zg=%GX1%;X7Jrot4L>;#zcv!5MlpU z%hKR=zq6@48~JOC`xu^@ZI$un)%&XzV!G_MsctqoyK)L-yO?(dk@M%Uc%ofo_6#53y;)+twS*AG>4 z)pRP3gfi{wdJnt%QSX=Sef_qvI6(aQkvC|?S6nDCo!!H$iW)qx_UOzBk)+D!u4J1FH$8o2F~IVz+%9~@D@tY0GB4*R@BoKUD8>0O#H@>@QB z^a6Uew^~}qvH$*;2UWdN`tp9C*`xw+79#Um_0NbhueRAkvac_mPot>Ta$Tw96yhww zY6Ou@lSVBn&PU%EA=_uKg4!c+qu)w5TT5V;M91ns;YNKv{xp?%>Q_&J?nsZW&~g{s zifEEX?M}0a%@d z^)S)&*s zd#=_`Z_!2rz!8l+m2cgiH;r)D6$nTU+uxli-=Wd5syYRY2N%T(X^daHef=PhPyCuu z>Y32+H)Kz92zg=e`|;>Cy2q89&CFZZlrC<>5zm%O_g-AN@V%JGtUmQbF8@@0!pb4l zp0L0BE0g!8@MQ1C4a%IKRfEJU<1zn?^SM#4;*@T*KE2gvmxgr=o<54%r%?;u1O|zx z4(klcetJ-HRxhsvmZLs4+8BIJ-(7(EfbUL0pU|F+xRF>XVQ(dwitir3po)>XF zyo-67^-Ui4`fOaEN!h!v9M0lnV&zNaAl$(GS_{xMpO%aen->4eL;jVUw^#n<-k7Te zo?dTytL{#`by1q|RCK})mDto*&xq%=dI^$0RkXK{&YGN;u;RXa6enhwnhp;sc44>c zJ!gI|iNjR2av?o!^!^v^xa}eD8g02Jvkiw(EZ(9wo*T3rRG$f1VpmzBdWb zr$k%qMdlmeCFgJX6jWtiEhzVj%D(@U{?sHW%cye`##xn7E+SwB30! zkh@+&QvWWIg>1%NQPyQ!>n#vwdB!Gu*x0;rA@JUU`riNyol9KU_NFcR+ouo<=VxtJ z4wbQ0#HGBMt>ftS3EGfmN?424coG`{SKXx8T1zEeW{R zcTE0AwxXA93O1m6KzGqVI&8^1!K|p=RC9l9OnPnbdi=%g1URk^^p)!#COYO|qkJUQZgK9szN+!ExHzUPzpBe8ixO_P^KgVk!q+{-M&gVU%|Sq? zr88Sa$@cTp?w=x)4fs5TVN2b>4D?fqD5OFHq7xewW*0XIsI|5R; z67S%xnpNU3_he#M@cA<{N(G?cAA0Az!lhWs>LHK8jWnw_k7cBC``DXzC$5Qko8r0} zZ5-MS-(VMac5XG;2z-n7mRg8YS&4}n{J5O>W+ubqc>UX%6}mUGIhcI6xzLx=PWHiL z;k(N{dNr>`R4>P1T|pyhxrXxKj6L$(fcDlSZPdYhNjmYHIX5l?w)Zo4pP%JU_&3Vv zYQtjL+$etfT?KaYDJ_kB#I(awU=jX z+ps`xGaZ@jKPR7(UpQ68P{P7&+jQ5;^qa5#qG*57hwTP!&{zLG&bcH6mFk}t*T8Od zj4|N-G8v>Ak_wxM9}Ocg?PF(8)Vs&WDiUX?y(e#b<%N7utGn3Z?qWvnKA*P0Un1dE z%H(n5mF8m?t`z?)c)4cM%K4sbNrS{122C5IW@hEb&H0`40LYVtuG=DTs$d-8_&jmPK^8%D=F}3Gz4bhac8x*Kht%+)m)9+D*j4mQP7;HD%`hq819TRGbe@gKmUN4id7m0U7Z3eryuQ~ zdC*DpaCQSQrjwVsa*75PtIN-S$92ZR^Pop3Itu35FR7P{av7we(3=NijE`Ad;!#-m zD8bd#W2~VXbglMZgMQ=%k%=0w5!;(LpT~mU)6V+*b+{ Date: Fri, 8 Nov 2024 11:59:23 +0100 Subject: [PATCH 48/75] nr rlc: hotfix: test allocation valid before use and simplify a bit (DevAssert instead of goto/exit) --- openair2/LAYER2/nr_rlc/nr_rlc_sdu.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_sdu.c b/openair2/LAYER2/nr_rlc/nr_rlc_sdu.c index a5c722a036..60f50d0afd 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_sdu.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_sdu.c @@ -32,13 +32,14 @@ nr_rlc_sdu_segment_t *nr_rlc_new_sdu( { /* allocate sdu header and data together */ nr_rlc_sdu_t *sdu = malloc(sizeof(nr_rlc_sdu_t) + size); + nr_rlc_sdu_segment_t *ret = calloc(1, sizeof(nr_rlc_sdu_segment_t)); + + DevAssert(sdu != NULL); + DevAssert(ret != NULL); + /* only memset the header */ memset(sdu, 0 , sizeof(*sdu)); - nr_rlc_sdu_segment_t *ret = calloc(1, sizeof(nr_rlc_sdu_segment_t)); - if (sdu == NULL || ret == NULL) - goto oom; - sdu->ref_count = 1; sdu->sn = -1; /* set later */ sdu->upper_layer_id = upper_layer_id; @@ -54,10 +55,6 @@ nr_rlc_sdu_segment_t *nr_rlc_new_sdu( ret->is_last = 1; return ret; - -oom: - LOG_E(RLC, "%s:%d:%s: out of memory\n", __FILE__, __LINE__, __FUNCTION__); - exit(1); } int nr_rlc_free_sdu_segment(nr_rlc_sdu_segment_t *sdu) From 8f688c0064caee9f06c00678379622a66442d453 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Fri, 8 Nov 2024 12:19:23 +0100 Subject: [PATCH 49/75] replace assert by error logging when we call DFT with impossible size to deal with existing LTE UE --- openair1/PHY/LTE_UE_TRANSPORT/ulsch_modulation.c | 5 +++++ openair1/PHY/TOOLS/tools_defs.h | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/openair1/PHY/LTE_UE_TRANSPORT/ulsch_modulation.c b/openair1/PHY/LTE_UE_TRANSPORT/ulsch_modulation.c index 9d555c62fe..9c4ccf0679 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/ulsch_modulation.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/ulsch_modulation.c @@ -93,6 +93,11 @@ void dft_lte(int32_t *z,struct complex16 *input, int32_t Msc_PUSCH, uint8_t Nsym // printf("\n"); dft_size_idx_t dftsize = get_dft(Msc_PUSCH); + if (dftsize == DFT_SIZE_IDXTABLESIZE) { + LOG_E(PHY, "Internal error, not modulating the slot, Msc_PUSCH = %d\n", Msc_PUSCH); + return; + } + switch (Msc_PUSCH) { case 12: dft(dftsize, (int16_t *)dft_in0, (int16_t *)dft_out0, 0); diff --git a/openair1/PHY/TOOLS/tools_defs.h b/openair1/PHY/TOOLS/tools_defs.h index 8799188c99..41af6ba0a9 100644 --- a/openair1/PHY/TOOLS/tools_defs.h +++ b/openair1/PHY/TOOLS/tools_defs.h @@ -38,6 +38,7 @@ #include #include #include +#include "common/utils/LOG/log.h" #define simd_q15_t simde__m128i #define simdshort_q15_t simde__m64 @@ -623,7 +624,7 @@ static inline dft_size_idx_t get_dft(int size) switch (size) { FOREACH_DFTSZ(FIND_ENUM) default: - AssertFatal(false, "function get_dft : unsupported DFT size %d\n", size); + LOG_E(UTIL, "function get_dft : unsupported DFT size %d\n", size); break; } return DFT_SIZE_IDXTABLESIZE; From 5b0b2ab359fb71222cb463c3bbac055638aaa4f4 Mon Sep 17 00:00:00 2001 From: Reem Bahsoun Date: Fri, 8 Nov 2024 15:21:16 +0100 Subject: [PATCH 50/75] Delete 5g_l2sim related files --- .../gnb.sa.band78.106prb.l2sim.conf | 213 ---------- .../xml_files/container_5g_l2sim_tdd.xml | 133 ------ ci-scripts/yaml_files/5g_l2sim_tdd/README.md | 396 ------------------ .../5g_l2sim_tdd/docker-compose.yaml | 165 -------- doc/README.md | 1 - 5 files changed, 908 deletions(-) delete mode 100644 ci-scripts/conf_files/gnb.sa.band78.106prb.l2sim.conf delete mode 100644 ci-scripts/xml_files/container_5g_l2sim_tdd.xml delete mode 100644 ci-scripts/yaml_files/5g_l2sim_tdd/README.md delete mode 100644 ci-scripts/yaml_files/5g_l2sim_tdd/docker-compose.yaml diff --git a/ci-scripts/conf_files/gnb.sa.band78.106prb.l2sim.conf b/ci-scripts/conf_files/gnb.sa.band78.106prb.l2sim.conf deleted file mode 100644 index 6b3f490a82..0000000000 --- a/ci-scripts/conf_files/gnb.sa.band78.106prb.l2sim.conf +++ /dev/null @@ -1,213 +0,0 @@ -Active_gNBs = ( "gnb-l2sim-vnf"); -# Asn1_verbosity, choice in: none, info, annoying -Asn1_verbosity = "none"; - -gNBs = -( - { - ////////// Identification parameters: - gNB_ID = 0xe00; - gNB_name = "gnb-l2sim-vnf"; - - // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = 1; - plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ({ sst = 1, sd = 0xffffff }) }); - - nr_cellid = 12345678L; - - ////////// Physical parameters: - - min_rxtxtime = 6; - - servingCellConfigCommon = ( - { - #spCellConfigCommon - - physCellId = 0; - -# downlinkConfigCommon - #frequencyInfoDL - # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) - absoluteFrequencySSB = 641280; - dl_frequencyBand = 78; - # this is 3600 MHz - dl_absoluteFrequencyPointA = 640008; - #scs-SpecificCarrierList - dl_offstToCarrier = 0; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - dl_subcarrierSpacing = 1; - dl_carrierBandwidth = 106; - #initialDownlinkBWP - #genericParameters - # this is RBstart=27,L=48 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 12952; # 6366 12925 12956 28875 12952 -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - initialDLBWPsubcarrierSpacing = 1; - #pdcch-ConfigCommon - initialDLBWPcontrolResourceSetZero = 12; - initialDLBWPsearchSpaceZero = 0; - - #uplinkConfigCommon - #frequencyInfoUL - ul_frequencyBand = 78; - #scs-SpecificCarrierList - ul_offstToCarrier = 0; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - ul_subcarrierSpacing = 1; - ul_carrierBandwidth = 106; - pMax = 20; - #initialUplinkBWP - #genericParameters - initialULBWPlocationAndBandwidth = 12952; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - initialULBWPsubcarrierSpacing = 1; - #rach-ConfigCommon - #rach-ConfigGeneric - prach_ConfigurationIndex = 98; -#prach_msg1_FDM -#0 = one, 1=two, 2=four, 3=eight - prach_msg1_FDM = 0; - prach_msg1_FrequencyStart = 0; - zeroCorrelationZoneConfig = 13; - preambleReceivedTargetPower = -96; -#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) - preambleTransMax = 6; -#powerRampingStep -# 0=dB0,1=dB2,2=dB4,3=dB6 - powerRampingStep = 1; -#ra_ReponseWindow -#1,2,4,8,10,20,40,80 - ra_ResponseWindow = 4; -#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR -#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen - ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; -#oneHalf (0..15) 4,8,12,16,...60,64 - ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14; -#ra_ContentionResolutionTimer -#(0..7) 8,16,24,32,40,48,56,64 - ra_ContentionResolutionTimer = 7; - rsrp_ThresholdSSB = 19; -#prach-RootSequenceIndex_PR -#1 = 839, 2 = 139 - prach_RootSequenceIndex_PR = 2; - prach_RootSequenceIndex = 1; - # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex - # - msg1_SubcarrierSpacing = 1, -# restrictedSetConfig -# 0=unrestricted, 1=restricted type A, 2=restricted type B - restrictedSetConfig = 0, - - msg3_DeltaPreamble = 1; - p0_NominalWithGrant =-90; - -# pucch-ConfigCommon setup : -# pucchGroupHopping -# 0 = neither, 1= group hopping, 2=sequence hopping - pucchGroupHopping = 0; - hoppingId = 40; - p0_nominal = -90; - - ssb_PositionsInBurst_Bitmap = 1; - -# ssb_periodicityServingCell -# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 - ssb_periodicityServingCell = 2; - -# dmrs_TypeA_position -# 0 = pos2, 1 = pos3 - dmrs_TypeA_Position = 0; - -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - subcarrierSpacing = 1; - - - #tdd-UL-DL-ConfigurationCommon -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - referenceSubcarrierSpacing = 1; - # pattern1 - # dl_UL_TransmissionPeriodicity - # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 - dl_UL_TransmissionPeriodicity = 6; - nrofDownlinkSlots = 7; - nrofDownlinkSymbols = 6; - nrofUplinkSlots = 2; - nrofUplinkSymbols = 4; - - ssPBCH_BlockPower = -25; - } - - ); - - - # ------- SCTP definitions - SCTP : - { - # Number of streams to use in input/output - SCTP_INSTREAMS = 2; - SCTP_OUTSTREAMS = 2; - }; - - - ////////// AMF parameters: - amf_ip_address = ({ ipv4 = "192.168.71.132"; }); - - - NETWORK_INTERFACES : - { - GNB_IPV4_ADDRESS_FOR_NG_AMF = "172.21.16.128"; - GNB_IPV4_ADDRESS_FOR_NGU = "172.21.16.128"; - GNB_PORT_FOR_NGU = 2152; # Spec 2152 - }; - - } -); - -MACRLCs = ( - { - num_cc = 1; - remote_s_address = "127.0.0.1"; // pnf addr [!] - local_s_address = "127.0.0.2"; // vnf addr - local_s_portc = 50601; // vnf p5 port - remote_s_portc = 50600; // pnf p5 port [!] - local_s_portd = 50611; // vnf p7 port [!] - remote_s_portd = 50610; // pnf p7 port [!] - tr_s_preference = "nfapi"; - tr_n_preference = "local_RRC"; - } -); - -security = { - # preferred ciphering algorithms - # the first one of the list that an UE supports in chosen - # valid values: nea0, nea1, nea2, nea3 - ciphering_algorithms = ( "nea0" ); - - # preferred integrity algorithms - # the first one of the list that an UE supports in chosen - # valid values: nia0, nia1, nia2, nia3 - integrity_algorithms = ( "nia2", "nia0" ); - - # setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter - # what 'ciphering_algorithms' configures; same thing for 'drb_integrity' - drb_ciphering = "yes"; - drb_integrity = "no"; -}; - - log_config : - { - global_log_level ="info"; - hw_log_level ="info"; - phy_log_level ="info"; - mac_log_level ="info"; - rlc_log_level ="info"; - pdcp_log_level ="info"; - rrc_log_level ="info"; - ngap_log_level ="debug"; - }; diff --git a/ci-scripts/xml_files/container_5g_l2sim_tdd.xml b/ci-scripts/xml_files/container_5g_l2sim_tdd.xml deleted file mode 100644 index c3e4662294..0000000000 --- a/ci-scripts/xml_files/container_5g_l2sim_tdd.xml +++ /dev/null @@ -1,133 +0,0 @@ - - - l2sim-5gnr-tdd - Testing 5G NR L2 sim - TDD gNB - wrench - - 111111 - 800813 - 000000 - 000001 - 000002 - 000003 - 000004 - 020001 - 020002 - 100001 - 222222 - - - - - Pull_Local_Registry - Pull Images from Local Registry - 0 - oai-gnb-asan oai-nr-ue-asan - - - Create_Workspace - Create new Workspace - 0 - 0 - - - Deploy_Object - Deploy MySql Database - ci-scripts/yaml_files/5g_l2sim_tdd - mysql - 0 - 0 - - - - Deploy_Object - Deploy OAI 5G CoreNetwork - ci-scripts/yaml_files/5g_l2sim_tdd - oai-amf oai-smf oai-upf oai-ext-dn - 0 - 0 - - - - Deploy_Object - Deploy OAI 5G gNB L2 sim SA - ci-scripts/yaml_files/5g_l2sim_tdd - oai-gnb - 0 - 0 - - - - Deploy_Object - Deploy OAI 5G NR-UE L2 sim SA and Proxy - ci-scripts/yaml_files/5g_l2sim_tdd - proxy oai-nr-ue0 - 0 - 0 - - - - Attach_UE - Attach OAI UE - l2sim5g_ue - localhost - - - - Ping - Ping ext-dn from NR-UE - l2sim5g_ue - localhost - -c 20 192.168.72.135 - 5 - - - - Ping - Ping NR-UE from ext-dn - l2sim5g_ext_dn - localhost - -c 20 12.1.1.2 - 5 - - - - Undeploy_Object - true - Undeploy all OAI 5G stack - ci-scripts/yaml_files/5g_l2sim_tdd - 20,50,100,100 - 0,0,0,0 - 0 - 0 - - - - Clean_Test_Server_Images - true - Clean Test Images on Test Server - 0 - - - diff --git a/ci-scripts/yaml_files/5g_l2sim_tdd/README.md b/ci-scripts/yaml_files/5g_l2sim_tdd/README.md deleted file mode 100644 index 6579fcac5f..0000000000 --- a/ci-scripts/yaml_files/5g_l2sim_tdd/README.md +++ /dev/null @@ -1,396 +0,0 @@ - - - - - -
- - - - - - OAI Full Stack 5G-NR L2 simulation with containers and a proxy -
- -It is also valid for `Ubuntu 22.04`. - -# 1. Adapt the `docker-compose` to your environment # -The yaml file is in the following directory: `ci-scripts/yaml_files/5g_l2sim_tdd` - -In the `SMF` section, provide your own DNS IP address: - -```yaml - DEFAULT_DNS_IPV4_ADDRESS=172.21.3.100 -``` -gNB section: - -All the parameter values will be taken from the mounted config file: - -```yaml -oai-gnb: - [...] - volumes: - - ../../conf_files/gnb.sa.band78.106prb.l2sim.conf:/opt/oai-gnb/etc/gnb.conf -``` - -You need to provide your docker-host primary IP address and interface name: in our case `172.21.16.128` and `eno1`. -The following refers to the contents of the previously mentioned .conf file - -```yaml - GNB_NGA_IF_NAME: eno1 - GNB_NGA_IP_ADDRESS: 172.21.16.128 - GNB_NGU_IF_NAME: eno1 - GNB_NGU_IP_ADDRESS: 172.21.16.128 -``` - -For the UE, all the parameter values will be taken from the mounted config -file, in the section `oai-nr-ue0`: - -```yaml - oai-nr-ue0: - [...] - volumes: - - ../../conf_files/nrue.band78.106prb.l2sim.conf:/opt/oai-nr-ue/etc/nr-ue.conf - - ../../../openair1/SIMULATION/LTE_PHY/BLER_SIMULATIONS/AWGN/AWGN_results:/opt/oai-nr-ue/openair1/SIMULATION/LTE_PHY/BLER_SIMULATIONS/AWGN/AWGN_results -``` - -In this section, you need to set the proper value `remote_n_address` -where the UE configuration (mounted to `/opt/oai-nr-ue/etc/nr-ue.conf`) reads: - -```libconfig -MACRLCs = ( - { - num_cc = 1; - tr_n_preference = "nfapi"; - remote_n_address = "127.0.0.1"; //Proxy IP - local_n_address = "127.0.0.1"; - ... -``` - -This tutorial is a first draft. This nFAPI feature and the proxy are still under development. - -At time of writing, we were able to run in `host-mode`, 1 `NR-UE` and just ping traffic. - - - - -# 2. Retrieving the images on Docker-Hub # - -Currently the images are hosted under the team account `oaisoftwarealliance`. They were previously hosted under the user account `rdefosseoai`. - -Once again you may need to log on [docker-hub](https://hub.docker.com/) if your organization has reached pulling limit as `anonymous`. - -```bash -docker login -``` -```bash -Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one. -Username: -Password: -``` - -Now pull images. - -```bash -docker pull mysql:8.0 -docker pull oaisoftwarealliance/oai-amf:v2.0.0 -docker pull oaisoftwarealliance/oai-smf:v2.0.0 -docker pull oaisoftwarealliance/oai-upf:v2.0.0 -docker pull oaisoftwarealliance/trf-gen-cn5g:focal - -docker pull oaisoftwarealliance/oai-gnb:develop -docker pull oaisoftwarealliance/oai-nr-ue:develop -docker pull oaisoftwarealliance/proxy:develop -``` - -And **re-tag** them for tutorials' docker-compose file to work. - -```bash -docker image tag oaisoftwarealliance/proxy:develop oai-lte-multi-ue-proxy:latest -``` - -```bash -docker logout -``` - -Note that the proxy image is based on the source available at [https://github.com/EpiSci/oai-lte-5g-multi-ue-proxy](https://github.com/EpiSci/oai-lte-5g-multi-ue-proxy). - -At time of writing, the `latest` tag corresponded to `56cfdc046a5f96d5e67d42a2fc2bf6ba2fe58b41` commit. - -# 3. Deploy containers # - -**CAUTION: this SHALL be done in multiple steps.** - -**Just `docker-compose up -d` WILL NOT WORK!** - -All the following commands **SHALL** be run from the `ci-scripts/yaml_files/5g_l2sim_tdd` folder. - -The `gNB`, `proxy` and `NR-UE` containers will be deployed in `host`-mode. It will use the host loopback interface to connect. - -```bash -sudo ifconfig lo: 127.0.0.2 netmask 255.0.0.0 up -``` - -## 3.1. Deploy OAI 5G Core Network ## - -```bash -cd ci-scripts/yaml_files/5g_l2sim_tdd -docker-compose up -d mysql oai-amf oai-smf oai-upf oai-ext-dn -``` -```bash -Creating network "l2sim-oai-public-net" with driver "bridge" -Creating network "l2sim-oai-traffic_net-net" with driver "bridge" -Creating l2sim-mysql ... done -Creating l2sim-oai-upf ... done -Creating l2sim-oai-amf ... done -Creating l2sim-oai-smf ... done -Creating l2sim-oai-ext-dn ... done -``` - -Wait for a bit. - -```bash -docker-compose ps -a -``` -```bash - Name Command State Ports -------------------------------------------------------------------------------------------------- -l2sim-mysql docker-entrypoint.sh mysqld Up (healthy) 3306/tcp, 33060/tcp -l2sim-oai-amf /bin/bash /openair-amf/bin ... Up (healthy) 38412/sctp, 80/tcp, 9090/tcp -l2sim-oai-ext-dn /bin/bash -c apt update; ... Up (healthy) -l2sim-oai-smf /bin/bash /openair-smf/bin ... Up (healthy) 80/tcp, 8805/udp, 9090/tcp -l2sim-oai-upf /bin/bash /openair-upf/bin ... Up (healthy) 2152/udp, 8805/udp -``` - -At this point, you can prepare a capture on the newly-created public docker bridges: - -```bash -ifconfig -``` -```bash -... -l2sim-public: flags=4163 mtu 1500 - inet 192.168.71.129 netmask 255.255.255.192 broadcast 192.168.71.191 - inet6 fe80::42:c4ff:fe2b:3d38 prefixlen 64 scopeid 0x20 - ether 02:42:c4:2b:3d:38 txqueuelen 0 (Ethernet) - RX packets 4 bytes 112 (112.0 B) - RX errors 0 dropped 0 overruns 0 frame 0 - TX packets 7 bytes 626 (626.0 B) - TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 - -l2sim-traffic: flags=4163 mtu 1500 - inet 192.168.72.129 netmask 255.255.255.192 broadcast 192.168.72.191 - inet6 fe80::42:b5ff:fed3:e732 prefixlen 64 scopeid 0x20 - ether 02:42:b5:d3:e7:32 txqueuelen 0 (Ethernet) - RX packets 2652 bytes 142335 (142.3 KB) - RX errors 0 dropped 0 overruns 0 frame 0 - TX packets 3999 bytes 23367972 (23.3 MB) - TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 -... -``` -```bash -sudo nohup tshark -f "(host 192.168.72.135 and icmp) or (not host 192.168.72.135 and not arp and not port 53 and not port 2152 and not port 2153)" -i l2sim-public -i l2sim-traffic -w /tmp/capture_5g_l2sim_tdd.pcap > /tmp/tshark.log 2>&1 & -``` - -## 3.2. Deploy OAI gNB in Standalone Mode as a VNF ## - -**CAUTION: To execute this 2nd step, the whole `CN5G` SHALL be in `healthy` state (especially the `mysql` container).** - -```bash -docker-compose up -d oai-gnb -``` -```bash -l2sim-oai-upf is up-to-date -l2sim-oai-ext-dn is up-to-date -Creating l2sim-oai-gnb ... done -``` - -Wait for a bit. - -```bash -$ docker-compose ps -a -``` -```bash - Name Command State Ports -------------------------------------------------------------------------------------------------- -l2sim-mysql docker-entrypoint.sh mysqld Up (healthy) 3306/tcp, 33060/tcp -l2sim-oai-amf /bin/bash /openair-amf/bin ... Up (healthy) 38412/sctp, 80/tcp, 9090/tcp -l2sim-oai-ext-dn /bin/bash -c apt update; ... Up (healthy) -l2sim-oai-gnb /opt/oai-gnb/bin/entrypoin ... Up (healthy) -l2sim-oai-smf /bin/bash /openair-smf/bin ... Up (healthy) 80/tcp, 8805/udp, 9090/tcp -l2sim-oai-upf /bin/bash /openair-upf/bin ... Up (healthy) 2152/udp, 8805/udp -``` - -You can verify that the `gNB` is connected with the `AMF`: - -```bash -docker logs l2sim-oai-amf -``` -```bash -... -[AMF] [amf_app] [info ] |----------------------------------------------------gNBs' information-------------------------------------------| -[AMF] [amf_app] [info ] | Index | Status | Global ID | gNB Name | PLMN | -[AMF] [amf_app] [info ] | 1 | Connected | 0x0 | gnb-l2sim-vnf | 208, 99 | -[AMF] [amf_app] [info ] |----------------------------------------------------------------------------------------------------------------| -... -``` - -## 3.3. Deploy OAI NR-UE and proxy - -```bash -docker-compose up -d proxy oai-nr-ue -``` -```bash -l2sim-mysql is up-to-date -l2sim-oai-amf is up-to-date -l2sim-oai-smf is up-to-date -l2sim-oai-upf is up-to-date -l2sim-oai-ext-dn is up-to-date -l2sim-oai-gnb is up-to-date -Creating l2sim-oai-nr-ue ... done -Creating l2sim-proxy ... done -``` - -Wait for a bit. - -```bash -docker-compose ps -a -``` -```bash - Name Command State Ports -------------------------------------------------------------------------------------------------- -l2sim-mysql docker-entrypoint.sh mysqld Up (healthy) 3306/tcp, 33060/tcp -l2sim-oai-amf /bin/bash /openair-amf/bin ... Up (healthy) 38412/sctp, 80/tcp, 9090/tcp -l2sim-oai-ext-dn /bin/bash -c apt update; ... Up (healthy) -l2sim-oai-gnb /opt/oai-gnb/bin/entrypoin ... Up (healthy) -l2sim-oai-nr-ue0 /opt/oai-nr-ue/bin/entrypo ... Up (healthy) -l2sim-oai-smf /bin/bash /openair-smf/bin ... Up (healthy) 80/tcp, 8805/udp, 9090/tcp -l2sim-oai-upf /bin/bash /openair-upf/bin ... Up (healthy) 2152/udp, 8805/udp -l2sim-proxy /oai-lte-multi-ue-proxy/bi ... Up (healthy) -``` -```bash -docker stats --no-stream --format "table {{.Container}}\t{{.CPUPerc}} {{.MemUsage}}\t{{.MemPerc}}" l2sim-mysql l2sim-oai-amf l2sim-oai-ext-dn l2sim-oai-gnb l2sim-oai-nr-ue0 l2sim-oai-smf l2sim-oai-upf l2sim-proxy -``` -```bash -CONTAINER CPU % MEM USAGE / LIMIT MEM % -l2sim-mysql 0.03% 206.7MiB / 62.54GiB 0.32% -l2sim-oai-amf 4.05% 29.49MiB / 62.54GiB 0.05% -l2sim-oai-ext-dn 0.00% 31.27MiB / 62.54GiB 0.05% -l2sim-oai-gnb 1.29% 1.853GiB / 62.54GiB 2.96% -l2sim-oai-nr-ue0 1.43% 350.8MiB / 62.54GiB 0.55% -l2sim-oai-smf 3.24% 30.23MiB / 62.54GiB 0.05% -l2sim-oai-upf 0.00% 11.78MiB / 62.54GiB 0.02% -l2sim-proxy 6.97% 290.4MiB / 62.54GiB 0.45% -``` - -**CAUTION: As you can see the CPU usage is not that important compared to a 5G RF simulator equivalent.** - -But the CPU speed matters; I am running on a fast server: - -```bash -lscpu -``` -```bash -Architecture: x86_64 -CPU(s): 16 -... -Model name: Intel(R) Xeon(R) Silver 4215R CPU @ 3.20GHz -``` - -I tried on a slower server with more CPUs and it did not work: - -```bash -oaici@orion:~$ lscpu -Architecture: x86_64 -CPU(s): 48 -... -Model name: Intel(R) Xeon(R) CPU E5-2658 v3 @ 2.20GHz -``` - -We will work on this issue. - - -Making sure the OAI UE is connected: - -```bash -docker exec -it l2sim-oai-nr-ue0 /bin/bash -``` -```bash -root@bb4d400a832d:/opt/oai-nr-ue# ifconfig -eth0: flags=4163 mtu 1500 - inet 192.168.71.137 netmask 255.255.255.192 broadcast 192.168.71.191 - ether 02:42:c0:a8:47:89 txqueuelen 0 (Ethernet) - RX packets 224259 bytes 5821372018 (5.8 GB) - RX errors 0 dropped 0 overruns 0 frame 0 - TX packets 235916 bytes 7848786376 (7.8 GB) - TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 - -lo: flags=73 mtu 65536 - inet 127.0.0.1 netmask 255.0.0.0 - loop txqueuelen 1000 (Local Loopback) - RX packets 0 bytes 0 (0.0 B) - RX errors 0 dropped 0 overruns 0 frame 0 - TX packets 0 bytes 0 (0.0 B) - TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 - -oaitun_ue1: flags=4305 mtu 1500 - inet 12.1.1.2 netmask 255.255.255.0 destination 12.1.1.2 - unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 500 (UNSPEC) - RX packets 0 bytes 0 (0.0 B) - RX errors 0 dropped 0 overruns 0 frame 0 - TX packets 0 bytes 0 (0.0 B) - TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 -``` - -# 4. Check traffic # - -## 4.1. Check your Internet connectivity ## - -You can also check with the `ext-dn` container (IP address is `192.168.72.135` in docker-compose) - -```bash -docker exec -it l2sim-oai-nr-ue0 /bin/bash -``` -```bash -ping -I oaitun_ue1 -c 20 192.168.72.135 -``` -```bash -root@bb4d400a832d# ping -I oaitun_ue1 -c 20 192.168.72.135 -PING 192.168.72.135 (192.168.72.135) from 12.1.1.2 oaitun_ue1: 56(84) bytes of data. -64 bytes from 192.168.72.135: icmp_seq=1 ttl=63 time=65.1 ms -64 bytes from 192.168.72.135: icmp_seq=2 ttl=63 time=74.2 ms -... -64 bytes from 192.168.72.135: icmp_seq=19 ttl=63 time=25.0 ms -64 bytes from 192.168.72.135: icmp_seq=20 ttl=63 time=34.7 ms - ---- 192.168.72.135 ping statistics --- -20 packets transmitted, 20 received, 0% packet loss, time 19025ms -rtt min/avg/max/mdev = 16.413/120.639/209.673/57.159 ms -``` - -# 5. Un-deployment # - -```bash -docker-compose down -``` -```bash -Stopping l2sim-oai-nr-ue2 ... done -Stopping l2sim-oai-nr-ue ... done -Stopping l2sim-oai-gnb ... done -Stopping l2sim-oai-ext-dn ... done -Stopping l2sim-oai-upf ... done -Stopping l2sim-oai-smf ... done -Stopping l2sim-oai-amf ... done -Stopping l2sim-mysql ... done -Removing l2sim-oai-nr-ue2 ... done -Removing l2sim-oai-nr-ue ... done -Removing l2sim-oai-gnb ... done -Removing l2sim-oai-ext-dn ... done -Removing l2sim-oai-upf ... done -Removing l2sim-oai-smf ... done -Removing l2sim-oai-amf ... done -Removing l2sim-mysql ... done -Removing network l2sim-oai-public-net -Removing network l2sim-oai-traffic-net -``` - diff --git a/ci-scripts/yaml_files/5g_l2sim_tdd/docker-compose.yaml b/ci-scripts/yaml_files/5g_l2sim_tdd/docker-compose.yaml deleted file mode 100644 index 67f64983d2..0000000000 --- a/ci-scripts/yaml_files/5g_l2sim_tdd/docker-compose.yaml +++ /dev/null @@ -1,165 +0,0 @@ -services: - mysql: - container_name: "l2sim-mysql" - image: mysql:8.0 - volumes: - - ../5g_rfsimulator/oai_db.sql:/docker-entrypoint-initdb.d/oai_db.sql - - ../5g_rfsimulator/mysql-healthcheck.sh:/tmp/mysql-healthcheck.sh - environment: - - TZ=Europe/Paris - - MYSQL_DATABASE=oai_db - - MYSQL_USER=test - - MYSQL_PASSWORD=test - - MYSQL_ROOT_PASSWORD=linux - healthcheck: - test: /bin/bash -c "/tmp/mysql-healthcheck.sh" - interval: 10s - timeout: 5s - retries: 30 - networks: - public_net: - ipv4_address: 192.168.71.131 - oai-amf: - container_name: "l2sim-oai-amf" - image: oaisoftwarealliance/oai-amf:v2.0.0 - environment: - - TZ=Europe/paris - volumes: - - ../5g_rfsimulator/mini_nonrf_config.yaml:/openair-amf/etc/config.yaml - depends_on: - - mysql - networks: - public_net: - ipv4_address: 192.168.71.132 - oai-smf: - container_name: "l2sim-oai-smf" - image: oaisoftwarealliance/oai-smf:v2.0.0 - environment: - - TZ=Europe/Paris - volumes: - - ../5g_rfsimulator/mini_nonrf_config.yaml:/openair-smf/etc/config.yaml - depends_on: - - oai-amf - networks: - public_net: - ipv4_address: 192.168.71.133 - oai-upf: - container_name: "l2sim-oai-upf" - image: oaisoftwarealliance/oai-upf:v2.0.0 - environment: - - TZ=Europe/Paris - volumes: - - ../5g_rfsimulator/mini_nonrf_config.yaml:/openair-upf/etc/config.yaml - depends_on: - - oai-smf - cap_add: - - NET_ADMIN - - SYS_ADMIN - cap_drop: - - ALL - privileged: true - networks: - public_net: - ipv4_address: 192.168.71.134 - traffic_net: - ipv4_address: 192.168.72.134 - oai-ext-dn: - privileged: true - container_name: "l2sim-oai-ext-dn" - image: oaisoftwarealliance/trf-gen-cn5g:focal - entrypoint: /bin/bash -c \ - "iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;"\ - "ip route add 12.1.1.0/24 via 192.168.72.134 dev eth0; sleep infinity" - depends_on: - - oai-upf - networks: - traffic_net: - ipv4_address: 192.168.72.135 - healthcheck: - test: /bin/bash -c "ping -c 2 192.168.72.134" - interval: 10s - timeout: 5s - retries: 5 - oai-gnb: - image: ${REGISTRY:-oaisoftwarealliance}/${GNB_IMG:-oai-gnb}:${TAG:-develop} - container_name: "l2sim-oai-gnb" - cap_drop: - - ALL - network_mode: "host" - environment: - TZ: Europe/Paris - USE_ADDITIONAL_OPTIONS: --sa --nfapi VNF --emulate-l1 --log_config.global_log_options level,time,thread_id,nocolor - ASAN_OPTIONS: detect_leaks=0 - depends_on: - - oai-upf - - oai-amf - volumes: - - ../../conf_files/gnb.sa.band78.106prb.l2sim.conf:/opt/oai-gnb/etc/gnb.conf - healthcheck: - test: /bin/bash -c "pgrep nr-softmodem" - interval: 10s - timeout: 5s - retries: 5 - - proxy: - image: oai-lte-multi-ue-proxy:latest - container_name: "l2sim-proxy" - cap_drop: - - ALL - network_mode: "host" - environment: - TZ: Europe/Paris - command: "/oai-lte-multi-ue-proxy/bin/proxy 1 --nr" - depends_on: - - oai-gnb - healthcheck: - test: /bin/bash -c "pgrep proxy" - interval: 10s - timeout: 5s - retries: 5 - - oai-nr-ue0: - image: ${REGISTRY:-oaisoftwarealliance}/${NRUE_IMG:-oai-nr-ue}:${TAG:-develop} - container_name: "l2sim-oai-nr-ue0" - cap_drop: - - ALL - cap_add: - - NET_ADMIN # for interface bringup - - NET_RAW # for ping - network_mode: "host" - environment: - TZ: Europe/Paris - OPENAIR_DIR: /opt/oai-nr-ue - USE_ADDITIONAL_OPTIONS: --nfapi STANDALONE_PNF --node-number 2 --sa --emulate-l1 --log_config.global_log_options level,time,thread_id,nocolor - ASAN_OPTIONS: detect_leaks=0 - devices: - - /dev/net/tun:/dev/net/tun - volumes: - - ../../conf_files/nrue.band78.106prb.l2sim.conf:/opt/oai-nr-ue/etc/nr-ue.conf - - ../../../openair1/SIMULATION/LTE_PHY/BLER_SIMULATIONS/AWGN/AWGN_results:/opt/oai-nr-ue/openair1/SIMULATION/LTE_PHY/BLER_SIMULATIONS/AWGN/AWGN_results - depends_on: - - oai-gnb - - proxy - healthcheck: - test: /bin/bash -c "pgrep nr-uesoftmodem" - interval: 10s - timeout: 5s - retries: 5 - -networks: - public_net: - driver: bridge - name: l2sim-oai-public-net - ipam: - config: - - subnet: 192.168.71.128/26 - driver_opts: - com.docker.network.bridge.name: "l2sim-public" - traffic_net: - driver: bridge - name: l2sim-oai-traffic-net - ipam: - config: - - subnet: 192.168.72.128/26 - driver_opts: - com.docker.network.bridge.name: "l2sim-traffic" diff --git a/doc/README.md b/doc/README.md index 7fc28f061a..3219c849cb 100644 --- a/doc/README.md +++ b/doc/README.md @@ -80,7 +80,6 @@ Legacy unmaintained files: - [How to build images](../docker/README.md) - [How to run 5G with the RFsimulator from images](../ci-scripts/yaml_files/5g_rfsimulator/README.md) - [How to run 4G with the RFsimulator from images](../ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/README.md) -- [How to run 5G with the L2simulator from images](../ci-scripts/yaml_files/5g_l2sim_tdd/README.md) - [How to run physical simulators in OpenShift](../openshift/README.md) # Libraries From 980cc02b1aa5b34cd33d21fcadbd390b84acf2c3 Mon Sep 17 00:00:00 2001 From: Reem Bahsoun Date: Fri, 8 Nov 2024 18:21:02 +0100 Subject: [PATCH 51/75] Delete 5g_l2sim components in ci_infra --- ci-scripts/ci_infra.yaml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/ci-scripts/ci_infra.yaml b/ci-scripts/ci_infra.yaml index 65c7c464b6..cf6e0cad11 100644 --- a/ci-scripts/ci_infra.yaml +++ b/ci-scripts/ci_infra.yaml @@ -382,20 +382,6 @@ rfsim4g_ue_fembms: CmdPrefix: docker exec rfsim4g-oai-lte-ue0 IF: oaitun_uem1 -l2sim5g_ue: - Host: "%%current_host%%" - AttachScript: docker start l2sim-oai-nr-ue0 - DetachScript: docker stop l2sim-oai-nr-ue0 - NetworkScript: docker exec l2sim-oai-nr-ue0 ip a show dev oaitun_ue1 - CmdPrefix: docker exec l2sim-oai-nr-ue0 - IF: oaitun_ue1 - MTU: 1500 - -l2sim5g_ext_dn: - Host: "%%current_host%%" - NetworkScript: docker exec l2sim-oai-ext-dn ip a show dev eth0 - CmdPrefix: docker exec l2sim-oai-ext-dn - l2sim4g_ue: Host: "%%current_host%%" AttachScript: docker start l2sim4g-oai-lte-ue1 From 019778e9271a3f8ae9a1e3d4033ef1ffb017d255 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 8 Nov 2024 15:00:09 +0100 Subject: [PATCH 52/75] Simplify create_workspace.sh: remove unnecessary checkout create_workspace.sh used to check out develop by default. However, this is unnecessary because the script later checks out a specific reference (which can be a commit ID, which is not accepted by git clone, the reason we don't check out during clone); the repository will simply be empty in the beginning, which should not be a problem. Further, it is problematic because we use this script for the build of the L2sim proxy, and the repository does not have develop; thus, without this modification, L2sim proxy build will always fail. --- ci-scripts/scripts/create_workspace.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/scripts/create_workspace.sh b/ci-scripts/scripts/create_workspace.sh index 925f606b16..c8410802db 100755 --- a/ci-scripts/scripts/create_workspace.sh +++ b/ci-scripts/scripts/create_workspace.sh @@ -15,7 +15,7 @@ ref=$3 merge=$4 rm -rf ${dir} -git clone --filter=blob:none -n -b develop ${repo} ${dir} +git clone --filter=blob:none -n ${repo} ${dir} cd ${dir} git config user.email "jenkins@openairinterface.org" git config user.name "OAI Jenkins" From 9d4337c55d00671af24304770fd3cf28245e7143 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 6 Nov 2024 13:52:00 +0100 Subject: [PATCH 53/75] Do not retrieve deployment logs during DeployObject Since commit 041b2b2d7a5173feb8dbeddccc42f30fe321573d, the CI main loop iterates over all steps, even if there has been a problem during an earlier XML step. In all cases, UndeployObject() is marked to always run, as we always need to make sure that all deployed services are terminated. UndeployObject() always recovers logs. Hence, it's not necessary to do it here as well; it leads to duplicated logs. This is visible in all pipeline with a failed deployment: the logs appear twice. --- ci-scripts/cls_containerize.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 029a970acd..fa4afb865c 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -1027,10 +1027,6 @@ class Containerize(): containerName = GetContainerName(ssh, svc, f"{wd}/docker-compose.y*ml") healthy = GetContainerHealth(ssh, containerName) if not healthy: - tgtlogfile = f'{svc}-{HTML.testCase_id}.log' - logging.warning(f"Deployment Failed: Trying to copy container logs to {tgtlogfile}") - yaml_dir = yaml.split('/')[-1] - CopyinContainerLog(ssh, lSourcePath, yaml_dir, containerName, tgtlogfile) imagesInfo += [f"Failed to deploy: service {svc}"] fstatus = False else: From a3a59e4a97fc724e72ec9b90aa23d65a8f22f959 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 8 Nov 2024 07:37:05 +0100 Subject: [PATCH 54/75] Update CI unit test README.md with all tests --- ci-scripts/tests/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ci-scripts/tests/README.md b/ci-scripts/tests/README.md index f926ea4ac5..f4e31074ca 100644 --- a/ci-scripts/tests/README.md +++ b/ci-scripts/tests/README.md @@ -6,9 +6,10 @@ scripts. There are some unit tests. From the parent directory, i.e., `ci-scripts/`, start with + python tests/cmd.py -v python tests/deployment.py -v - python tests/ping-iperf.py -v python tests/iperf-analysis.py -v + python tests/ping-iperf.py -v It will indicate if all tests passed. It assumes that these images are present: From 5078fcccbce4b58bab9518bd40f721315bb2b763 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Sat, 9 Nov 2024 10:15:26 +0100 Subject: [PATCH 55/75] CI test deployment.py: auto-pull missing images if necessary --- ci-scripts/tests/README.md | 6 +++++- ci-scripts/tests/deployment.py | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/ci-scripts/tests/README.md b/ci-scripts/tests/README.md index f4e31074ca..dc8f9ea80a 100644 --- a/ci-scripts/tests/README.md +++ b/ci-scripts/tests/README.md @@ -11,11 +11,15 @@ start with python tests/iperf-analysis.py -v python tests/ping-iperf.py -v -It will indicate if all tests passed. It assumes that these images are present: +It will indicate if all tests passed. `tests/deployment.py` requires these +images to be present: - `oai-ci/oai-nr-ue:develop-12345678` - `oai-ci/oai-gnb:develop-12345678` +It will try to download `oaisoftwarealliance/oai-{gnb,nr-ue}:develop` +automatically and retag the images. + # test-runner test This is not a true test, because the results need to be manually inspected. To diff --git a/ci-scripts/tests/deployment.py b/ci-scripts/tests/deployment.py index a6cf8e06b0..47e459d6a4 100644 --- a/ci-scripts/tests/deployment.py +++ b/ci-scripts/tests/deployment.py @@ -15,9 +15,24 @@ import cls_oai_html import cls_oaicitest import cls_containerize import ran +import cls_cmd class TestDeploymentMethods(unittest.TestCase): + def _pull_image(self, cmd, image): + ret = cmd.run(f"docker inspect oai-ci/{image}:develop-12345678") + if ret.returncode == 0: # exists + return + ret = cmd.run(f"docker pull oaisoftwarealliance/{image}:develop") + self.assertEqual(ret.returncode, 0) + ret = cmd.run(f"docker tag oaisoftwarealliance/{image}:develop oai-ci/{image}:develop-12345678") + self.assertEqual(ret.returncode, 0) + ret = cmd.run(f"docker rmi oaisoftwarealliance/{image}:develop") + self.assertEqual(ret.returncode, 0) + def setUp(self): + with cls_cmd.getConnection("localhost") as cmd: + self._pull_image(cmd, "oai-gnb") + self._pull_image(cmd, "oai-nr-ue") self.html = cls_oai_html.HTMLManagement() self.html.testCaseId = "000000" self.ci = cls_oaicitest.OaiCiTest() From 7d7011f3f8a53ecf1a5ac6e888b4d8ac91ce6a53 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 5 Nov 2024 16:28:36 +0100 Subject: [PATCH 56/75] Remove use of SSHConnection(): not used in this file --- ci-scripts/main.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 3904ac908d..2e163f28ba 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -46,7 +46,6 @@ import cls_physim1 #class PhySim for physical simulators deploy and run import cls_cluster # class for building/deploying on cluster import cls_native # class for all native/source-based operations -import sshconnection import epc import ran import cls_oai_html @@ -100,7 +99,6 @@ def AssignParams(params_dict): def ExecuteActionWithParam(action): - global SSH global EPC global RAN global HTML @@ -484,7 +482,6 @@ mode = '' CiTestObj = cls_oaicitest.OaiCiTest() -SSH = sshconnection.SSHConnection() EPC = epc.EPCManagement() RAN = ran.RANManagement() HTML = cls_oai_html.HTMLManagement() From 4e08542231b94969e4e2f16fb2d7c0000a60d2eb Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 12 Nov 2024 09:52:57 +0100 Subject: [PATCH 57/75] Remove link to old 5g_l2sim_tdd docker deployment --- doc/L2NFAPI.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/doc/L2NFAPI.md b/doc/L2NFAPI.md index d7bba0bfeb..95127d524b 100644 --- a/doc/L2NFAPI.md +++ b/doc/L2NFAPI.md @@ -42,6 +42,8 @@ Normally it should be fine to run both executables on the same host using the `l ## 5G L2 nFAPI simulator +**Note: L2 simulator does not work anymore.** + ### Download and Build the Proxy Server (from EpiSci) ```bash @@ -76,13 +78,10 @@ This proxy allows to perform L2 nFAPI simulator for: * 5G-SA ### L2 Simulator as Docker Containers -Another tutorial for 5G SA mode with 1 User is available [here](../ci-scripts/yaml_files/5g_l2sim_tdd/README.md). - ----- - -[oai wiki home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) - -[oai softmodem features](FEATURE_SET.md) - -[oai softmodem build procedure](BUILD.md) +There used to be docker deployment with L2sim that was run in the CI. Since L2 +simulator does not work anymore, it has been removed. However, you can see the +old `README.md` from tag `2024.w44` +[here](https://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/2024.w44/ci-scripts/yaml_files/5g_l2sim_tdd/README.md). +In the same directory is a `docker-compose.yaml` file that can be used to run +L2sim. From 14a41df0ec7f1eabfaf89f43b354623631aeb540 Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Tue, 29 Oct 2024 10:40:26 +0100 Subject: [PATCH 58/75] CI: Harmonize LDPC CUDA and T2 test/analysis in physim - Introduce "Run_Physim" function for running ldpctest (with CUDA) and nr_dlsim/nr_ulsim (with T2) in RAN-gNB-N300-Timing-Phytest-LDPC test pipeline. - Create "cls_analysis.py" and introduce "analyze_physim" for log analysis of physim tests. - Define patterns to be searched in the physim logs. - Extract and print information about total gNB RX/TX PHY processing time from nr_ulsim/nr_dlsim logs. - Remove "cls_physim.py" as it is not used anymore, cleanup "main.py". --- ci-scripts/args_parse.py | 11 +- ci-scripts/cls_analysis.py | 82 ++++++++++ ci-scripts/cls_native.py | 20 +++ ci-scripts/cls_physim.py | 148 ------------------ ci-scripts/main.py | 24 +-- ci-scripts/xml_class_list.yml | 3 +- ci-scripts/xml_files/ldpc_gpu_test.xml | 80 +++++++--- .../xml_files/t2_offload_dec_nr_ulsim.xml | 72 ++++----- .../xml_files/t2_offload_enc_nr_dlsim.xml | 96 ++++++------ 9 files changed, 254 insertions(+), 282 deletions(-) create mode 100644 ci-scripts/cls_analysis.py delete mode 100644 ci-scripts/cls_physim.py diff --git a/ci-scripts/args_parse.py b/ci-scripts/args_parse.py index 8bac1f6a92..7d753d21c7 100644 --- a/ci-scripts/args_parse.py +++ b/ci-scripts/args_parse.py @@ -41,7 +41,7 @@ import constants as CONST #----------------------------------------------------------- -def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM,CLUSTER): +def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,CONTAINERS,HELP,SCA,PHYSIM,CLUSTER): py_param_file_present = False @@ -78,7 +78,6 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM,CLUST CiTestObj.ranRepository = matchReg.group(1) RAN.ranRepository=matchReg.group(1) HTML.ranRepository=matchReg.group(1) - ldpc.ranRepository=matchReg.group(1) CONTAINERS.ranRepository=matchReg.group(1) SCA.ranRepository=matchReg.group(1) PHYSIM.ranRepository=matchReg.group(1) @@ -89,7 +88,6 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM,CLUST else: matchReg = re.match('^\-\-ranAllowMerge=(.+)$', myArgv, re.IGNORECASE) doMerge = matchReg.group(1) - ldpc.ranAllowMerge=matchReg.group(1) if ((doMerge == 'true') or (doMerge == 'True')): CiTestObj.ranAllowMerge = True RAN.ranAllowMerge=True @@ -106,7 +104,6 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM,CLUST CiTestObj.ranBranch = matchReg.group(1) RAN.ranBranch=matchReg.group(1) HTML.ranBranch=matchReg.group(1) - ldpc.ranBranch=matchReg.group(1) CONTAINERS.ranBranch=matchReg.group(1) SCA.ranBranch=matchReg.group(1) PHYSIM.ranBranch=matchReg.group(1) @@ -119,7 +116,6 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM,CLUST CiTestObj.ranCommitID = matchReg.group(1) RAN.ranCommitID=matchReg.group(1) HTML.ranCommitID=matchReg.group(1) - ldpc.ranCommitID=matchReg.group(1) CONTAINERS.ranCommitID=matchReg.group(1) SCA.ranCommitID=matchReg.group(1) PHYSIM.ranCommitID=matchReg.group(1) @@ -132,7 +128,6 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM,CLUST CiTestObj.ranTargetBranch = matchReg.group(1) RAN.ranTargetBranch=matchReg.group(1) HTML.ranTargetBranch=matchReg.group(1) - ldpc.ranTargetBranch=matchReg.group(1) CONTAINERS.ranTargetBranch=matchReg.group(1) SCA.ranTargetBranch=matchReg.group(1) PHYSIM.ranTargetBranch=matchReg.group(1) @@ -141,7 +136,6 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM,CLUST if re.match('^\-\-eNBIPAddress=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNBIPAddress=(.+)$', myArgv, re.IGNORECASE) RAN.eNBIPAddress=matchReg.group(1) - ldpc.eNBIpAddr=matchReg.group(1) CONTAINERS.eNBIPAddress=matchReg.group(1) SCA.eNBIPAddress=matchReg.group(1) PHYSIM.eNBIPAddress=matchReg.group(1) @@ -158,7 +152,6 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM,CLUST if re.match('^\-\-eNBUserName=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNBUserName=(.+)$', myArgv, re.IGNORECASE) RAN.eNBUserName=matchReg.group(1) - ldpc.eNBUserName=matchReg.group(1) CONTAINERS.eNBUserName=matchReg.group(1) SCA.eNBUserName=matchReg.group(1) PHYSIM.eNBUserName=matchReg.group(1) @@ -175,7 +168,6 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM,CLUST if re.match('^\-\-eNBPassword=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNBPassword=(.+)$', myArgv, re.IGNORECASE) RAN.eNBPassword=matchReg.group(1) - ldpc.eNBPassWord=matchReg.group(1) CONTAINERS.eNBPassword=matchReg.group(1) SCA.eNBPassword=matchReg.group(1) PHYSIM.eNBPassword=matchReg.group(1) @@ -192,7 +184,6 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM,CLUST if re.match('^\-\-eNBSourceCodePath=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNBSourceCodePath=(.+)$', myArgv, re.IGNORECASE) RAN.eNBSourceCodePath=matchReg.group(1) - ldpc.eNBSourceCodePath=matchReg.group(1) CONTAINERS.eNBSourceCodePath=matchReg.group(1) SCA.eNBSourceCodePath=matchReg.group(1) PHYSIM.eNBSourceCodePath=matchReg.group(1) diff --git a/ci-scripts/cls_analysis.py b/ci-scripts/cls_analysis.py new file mode 100644 index 0000000000..25d9b0c659 --- /dev/null +++ b/ci-scripts/cls_analysis.py @@ -0,0 +1,82 @@ +#/* +# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more +# * contributor license agreements. See the NOTICE file distributed with +# * this work for additional information regarding copyright ownership. +# * The OpenAirInterface Software Alliance licenses this file to You under +# * the OAI Public License, Version 1.1 (the "License"); you may not use this file +# * except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * http://www.openairinterface.org/?page_id=698 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# *------------------------------------------------------------------------------- +# * For more information about the OpenAirInterface (OAI) Software Alliance: +# * contact@openairinterface.org +# */ +#--------------------------------------------------------------------- + +import logging +import re + +# Define the mapping of physim_test values to search patterns +PHYSIM_PATTERN_MAPPING = { + 'nr_ulsim': [ + r'(Total PHY proc rx)\s+(\d+\.\d+)\s+us', # Pattern for RX PHY processing time + r'(ULSCH total decoding time)\s+(\d+\.\d+)\s+us', # Pattern for ULSCH decoding time + ], + 'nr_dlsim': [ + r'(PHY proc tx)\s+(\d+\.\d+)\s+us', # Pattern for TX PHY processing time + r'(DLSCH encoding time)\s+(\d+\.\d+)\s+us', # Pattern for DLSCH encoding time + ], + 'ldpctest': [ + r'(Encoding time mean):\s+(\d+\.\d+)\s+us', # Pattern for encoding time mean + r'(Decoding time mean):\s+(\d+\.\d+)\s+us', # Pattern for decoding time mean + ], +} +# Define test conditions based on the simulation type +PHYSIM_TEST_CONDITION = { + 'nr_ulsim': 'test OK', # For nr_ulsim, check if 'test OK' is present + 'nr_dlsim': 'test OK', # For nr_dlsim, check if 'test OK' is present + 'ldpctest': None, # No condition for ldpctest, just process the patterns +} + +class Analysis(): + + def analyze_physim(log, physim_test, options, threshold): + search_patterns = PHYSIM_PATTERN_MAPPING.get(physim_test) + test_condition = PHYSIM_TEST_CONDITION.get(physim_test) + success = False + msg = '' + + try: + with open(log, 'r') as f: + log_content = f.read() + except FileNotFoundError as e: + msg = f'{log} file not found, exception: {e}' + return False, msg + except Exception as e: + msg = f'Error while parsing log file {log}: exception: {e}' + return False, msg + + if test_condition and test_condition not in log_content: + msg = f"Test did not succeed, '{test_condition}' not found in log file {log}." + return False, msg + + time1_match = re.search(search_patterns[0], log_content) + time2_match = re.search(search_patterns[1], log_content) + if not(time1_match and time2_match): + msg = f"Processing time not found in log file {log}." + return False, msg + + success = float(time2_match.group(2)) < float(threshold) + if success: + msg = f'{time1_match.group(1)}: {time1_match.group(2)} us\n{time2_match.group(1)}: {time2_match.group(2)} us' + else: + msg = f'{time1_match.group(1)}: {time1_match.group(2)} us\n{time2_match.group(1)}: {time2_match.group(2)} us exceeds a limit of {threshold} us' + + return success,msg diff --git a/ci-scripts/cls_native.py b/ci-scripts/cls_native.py index d9c281907a..8f4d90ea84 100644 --- a/ci-scripts/cls_native.py +++ b/ci-scripts/cls_native.py @@ -22,11 +22,15 @@ import logging import re +import os import cls_cmd import cls_oai_html +import cls_analysis import constants as CONST +LOG_PATH_PHYSIM = 'phy_sim_logs' + class Native(): def Build(test_case, HTML, host, directory, options): @@ -62,3 +66,19 @@ class Native(): logging.error('\u001B[1m Building OAI Failed\u001B[0m') HTML.CreateHtmlTestRow(options, 'KO', CONST.ALL_PROCESSES_OK) return success + + def Run_Physim(HTML, host, directory, options, physim_test, threshold): + logging.debug(f'Runnin {physim_test} on server: {host}') + workSpacePath = f'{directory}/cmake_targets' + os.system(f'mkdir -p ./{LOG_PATH_PHYSIM}') + runLogFile=f'physim_{HTML.testCase_id}.log' + with cls_cmd.getConnection(host) as cmd: + cmd.run(f'sudo {workSpacePath}/ran_build/build/{physim_test} {options} >> {workSpacePath}/{runLogFile}') + cmd.copyin(src=f'{workSpacePath}/{runLogFile}', tgt=f'{LOG_PATH_PHYSIM}/{runLogFile}') + success, msg = cls_analysis.Analysis.analyze_physim(f'{LOG_PATH_PHYSIM}/{runLogFile}', physim_test, options, threshold) + if success: + HTML.CreateHtmlTestRowQueue(options, 'OK', [msg]) + else: + logging.error(msg) + HTML.CreateHtmlTestRowQueue(options, 'KO', [msg]) + return success diff --git a/ci-scripts/cls_physim.py b/ci-scripts/cls_physim.py deleted file mode 100644 index 209611bf6f..0000000000 --- a/ci-scripts/cls_physim.py +++ /dev/null @@ -1,148 +0,0 @@ -# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more -# * contributor license agreements. See the NOTICE file distributed with -# * this work for additional information regarding copyright ownership. -# * The OpenAirInterface Software Alliance licenses this file to You under -# * the OAI Public License, Version 1.1 (the "License"); you may not use this file -# * except in compliance with the License. -# * You may obtain a copy of the License at -# * -# * http://www.openairinterface.org/?page_id=698 -# * -# * Unless required by applicable law or agreed to in writing, software -# * distributed under the License is distributed on an "AS IS" BASIS, -# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# * See the License for the specific language governing permissions and -# * limitations under the License. -# *------------------------------------------------------------------------------- -# * For more information about the OpenAirInterface (OAI) Software Alliance: -# * contact@openairinterface.org -# */ -#--------------------------------------------------------------------- -# Python for CI of OAI-eNB + COTS-UE -# -# Required Python Version -# Python 3.x -# -# Required Python Package -# pexpect -#--------------------------------------------------------------------- - -#to use logging.info() -import logging -#to create a SSH object locally in the methods -import sshconnection -#to update the HTML object -import cls_oai_html -import cls_cmd -#for log folder maintenance -import os -import re - -class PhySim: - def __init__(self): - self.runargs = "" - self.eNBIpAddr = "" - self.eNBUserName = "" - self.eNBPassWord = "" - self.eNBSourceCodePath = "" - #private attributes - self.__workSpacePath='' - self.__runLogFile='' - self.__runLogPath='phy_sim_logs' - - -#----------------- -#PRIVATE Methods -#----------------- - - def __CheckResults_LDPCcudaTest(self,HTML,CONST,testcase_id): - mySSH = sshconnection.SSHConnection() - mySSH.open(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord) - #retrieve run log file and store it locally$ - mySSH.copyin(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord, self.__workSpacePath+self.__runLogFile, '.') - mySSH.close() - #parse results looking for Encoding and Decoding mean values - runResults=[] - with open(self.__runLogFile) as f: - for line in f: - if 'mean' in line: - runResults.append(line) - #the values are appended for each mean value (2), so we take these 2 values from the list - info = runResults[0] + runResults[1] - - #once parsed move the local logfile to its folder for tidiness - os.system('mv '+self.__runLogFile+' '+ self.__runLogPath+'/.') - - HTML.CreateHtmlTestRowQueue(self.runargs, 'OK', [info]) - return True - - def __CheckResults_LDPCt2Test(self,HTML,CONST,testcase_id): - thrs_KO = int(self.timethrs) - mySSH = cls_cmd.getConnection(self.eNBIpAddr) - #retrieve run log file and store it locally$ - mySSH.copyin(f'{self.__workSpacePath}{self.__runLogFile}', f'{self.__runLogFile}') - mySSH.close() - #parse results looking for encoder/decoder processing time values - - with open(self.__runLogFile) as g: - for line in g: - res_enc = re.search(r"DLSCH encoding time\s+(\d+\.\d+)\s+us",line) - res_dec = re.search(r'ULSCH total decoding time\s+(\d+\.\d+)\s+us',line) - if res_dec is not None: - time = res_dec.group(1) - info = res_dec.group(0) - break - if res_enc is not None: - time = res_enc.group(1) - info = res_enc.group(0) - break - - # In case the T2 board does work properly, there is no statistics - if res_enc is None and res_dec is None: - logging.error(f'no statistics: res_enc {res_enc} res_dec {res_dec}') - HTML.CreateHtmlTestRowQueue(self.runargs, 'KO', ['no statistics']) - os.system(f'mv {self.__runLogFile} {self.__runLogPath}/.') - return False - - #once parsed move the local logfile to its folder - os.system(f'mv {self.__runLogFile} {self.__runLogPath}/.') - success = float(time) < thrs_KO - if success: - HTML.CreateHtmlTestRowQueue(self.runargs, 'OK', [info]) - else: - error_msg = f'Processing time exceeds a limit of {thrs_KO} us' - logging.error(error_msg) - HTML.CreateHtmlTestRowQueue(self.runargs, 'KO', [info + '\n' + error_msg]) - return success - -#-----------------$ -#PUBLIC Methods$ -#-----------------$ - def Run_CUDATest(self,htmlObj,constObj,testcase_id): - self.__workSpacePath = self.eNBSourceCodePath+'/cmake_targets/' - #create run logs folder locally - os.system('mkdir -p ./'+self.__runLogPath) - #log file is tc_.log remotely - self.__runLogFile='physim_'+str(testcase_id)+'.log' - #open a session for test run - mySSH = sshconnection.SSHConnection() - mySSH.open(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord) - mySSH.command('cd '+self.__workSpacePath,'\$',5) - #run and redirect the results to a log file - mySSH.command(self.__workSpacePath+'ran_build/build/ldpctest ' + self.runargs + ' >> '+self.__runLogFile, '\$', 30) - mySSH.close() - return self.__CheckResults_LDPCcudaTest(htmlObj,constObj,testcase_id) - - def Run_T2Test(self,htmlObj,constObj,testcase_id): - self.__workSpacePath = f'{self.eNBSourceCodePath}/cmake_targets/' - #create run logs folder locally - os.system(f'mkdir -p ./{self.__runLogPath}') - #log file is tc_.log remotely - self.__runLogFile=f'physim_{str(testcase_id)}.log' - #open a session for test run - mySSH = cls_cmd.getConnection(self.eNBIpAddr) - mySSH.run(f'cd {self.__workSpacePath}') - #run and redirect the results to a log file - mySSH.run(f'sudo {self.__workSpacePath}ran_build/build/{self.runsim} {self.runargs} > {self.__workSpacePath}{self.__runLogFile} 2>&1') - mySSH.close() - return self.__CheckResults_LDPCt2Test(htmlObj,constObj,testcase_id) diff --git a/ci-scripts/main.py b/ci-scripts/main.py index e5c2f221f2..6ef49877c6 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -39,7 +39,6 @@ import constants as CONST import cls_oaicitest #main class for OAI CI test framework -import cls_physim #class PhySim for physical simulators build and test import cls_containerize #class Containerize for all container-based operations on RAN/UE objects import cls_static_code_analysis #class for static code analysis import cls_physim1 #class PhySim for physical simulators deploy and run @@ -87,7 +86,6 @@ def CheckClassValidity(xml_class_list,action,id): resp=True return resp - #assigning parameters to object instance attributes (even if the attributes do not exist !!) def AssignParams(params_dict): @@ -95,9 +93,6 @@ def AssignParams(params_dict): setattr(CiTestObj, key, value) setattr(RAN, key, value) setattr(HTML, key, value) - setattr(ldpc, key, value) - - def ExecuteActionWithParam(action): global SSH @@ -108,7 +103,6 @@ def ExecuteActionWithParam(action): global SCA global PHYSIM global CLUSTER - global ldpc if action == 'Build_eNB' or action == 'Build_Image' or action == 'Build_Proxy' or action == "Build_Cluster_Image" or action == "Build_Run_Tests": RAN.Build_eNB_args=test.findtext('Build_eNB_args') CONTAINERS.imageKind=test.findtext('kind') @@ -365,14 +359,11 @@ def ExecuteActionWithParam(action): elif action == 'Create_Workspace': success = CONTAINERS.Create_Workspace(HTML) - elif action == 'Run_CUDATest' or action == 'Run_T2Test': - ldpc.runargs = test.findtext('physim_run_args') - ldpc.runsim = test.findtext('physim_run') - ldpc.timethrs = test.findtext('physim_time_threshold') - if action == 'Run_CUDATest': - success = ldpc.Run_CUDATest(HTML,CONST,id) - elif action == 'Run_T2Test': - success = ldpc.Run_T2Test(HTML,CONST,id) + elif action == 'Run_Physim': + physim_options = test.findtext('physim_run_args') + physim_test = test.findtext('physim_test') + physim_threshold = test.findtext('physim_time_threshold') or 'inf' + success = cls_native.Native.Run_Physim(HTML, RAN.eNBIPAddress, RAN.eNBSourceCodePath, physim_options, physim_test, physim_threshold) elif action == 'LicenceAndFormattingCheck': success = SCA.LicenceAndFormattingCheck(HTML) @@ -479,15 +470,12 @@ SCA = cls_static_code_analysis.StaticCodeAnalysis() PHYSIM = cls_physim1.PhySim() CLUSTER = cls_cluster.Cluster() -ldpc=cls_physim.PhySim() #create an instance for LDPC test using GPU or CPU build - - #----------------------------------------------------------- # Parsing Command Line Arguments #----------------------------------------------------------- import args_parse -py_param_file_present, py_params, mode = args_parse.ArgsParse(sys.argv,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM,CLUSTER) +py_param_file_present, py_params, mode = args_parse.ArgsParse(sys.argv,CiTestObj,RAN,HTML,EPC,CONTAINERS,HELP,SCA,PHYSIM,CLUSTER) diff --git a/ci-scripts/xml_class_list.yml b/ci-scripts/xml_class_list.yml index 27b179c8f8..a526058af0 100755 --- a/ci-scripts/xml_class_list.yml +++ b/ci-scripts/xml_class_list.yml @@ -1,8 +1,7 @@ - Build_Proxy - Build_Cluster_Image - Pull_Cluster_Image - - Run_CUDATest - - Run_T2Test + - Run_Physim - Build_eNB - Initialize_eNB - Terminate_eNB diff --git a/ci-scripts/xml_files/ldpc_gpu_test.xml b/ci-scripts/xml_files/ldpc_gpu_test.xml index d50a841b16..f129d6bd2b 100644 --- a/ci-scripts/xml_files/ldpc_gpu_test.xml +++ b/ci-scripts/xml_files/ldpc_gpu_test.xml @@ -29,122 +29,162 @@ - Run_CUDATest + Run_Physim Run LDPC Test with CPU + true + ldpctest -l 3872 -s10 -n100 - Run_CUDATest + Run_Physim Run LDPC Test with GPU + true + ldpctest -l 3872 -s10 -n100 -G 1 - Run_CUDATest + Run_Physim Run LDPC Test with CPU + true + ldpctest -l 4224 -s10 -n100 - Run_CUDATest + Run_Physim Run LDPC Test with GPU + true + ldpctest -l 4224 -s10 -n100 -G 1 - Run_CUDATest + Run_Physim Run LDPC Test with CPU + true + ldpctest -l 4576 -s10 -n100 - Run_CUDATest + Run_Physim Run LDPC Test with GPU + true + ldpctest -l 4576 -s10 -n100 -G 1 - Run_CUDATest + Run_Physim Run LDPC Test with CPU + true + ldpctest -l 4928 -s10 -n100 - Run_CUDATest + Run_Physim Run LDPC Test with GPU + true + ldpctest -l 4928 -s10 -n100 -G 1 - Run_CUDATest + Run_Physim Run LDPC Test with CPU + true + ldpctest -l 5280 -s10 -n100 - Run_CUDATest + Run_Physim Run LDPC Test with GPU + true + ldpctest -l 5280 -s10 -n100 -G 1 - Run_CUDATest + Run_Physim Run LDPC Test with CPU + true + ldpctest -l 5632 -s10 -n100 - Run_CUDATest + Run_Physim Run LDPC Test with GPU + true + ldpctest -l 5632 -s10 -n100 -G 1 - Run_CUDATest + Run_Physim Run LDPC Test with CPU + true + ldpctest -l 6336 -s10 -n100 - Run_CUDATest + Run_Physim Run LDPC Test with GPU + true + ldpctest -l 6336 -s10 -n100 -G 1 - Run_CUDATest + Run_Physim Run LDPC Test with CPU + true + ldpctest -l 7040 -s10 -n100 - Run_CUDATest + Run_Physim Run LDPC Test with GPU + true + ldpctest -l 7040 -s10 -n100 -G 1 - Run_CUDATest + Run_Physim Run LDPC Test with CPU + true + ldpctest -l 7744 -s10 -n100 - Run_CUDATest + Run_Physim Run LDPC Test with GPU + true + ldpctest -l 7744 -s10 -n100 -G 1 - Run_CUDATest + Run_Physim Run LDPC Test with CPU + true + ldpctest -l 8448 -s10 -n100 - Run_CUDATest + Run_Physim Run LDPC Test with GPU + true + ldpctest -l 8448 -s10 -n100 -G 1 diff --git a/ci-scripts/xml_files/t2_offload_dec_nr_ulsim.xml b/ci-scripts/xml_files/t2_offload_dec_nr_ulsim.xml index 4e44f7f853..8fe7fcf126 100644 --- a/ci-scripts/xml_files/t2_offload_dec_nr_ulsim.xml +++ b/ci-scripts/xml_files/t2_offload_dec_nr_ulsim.xml @@ -31,163 +31,163 @@ - Run_T2Test + Run_Physim Run nr_ulsim with CPU: SNR = 30, MCS = 5, 106 PRBs, 1 layer true - nr_ulsim + nr_ulsim 300 -n100 -s30 -S30.2 -m5 -r106 -R106 -C10 -P - Run_T2Test + Run_Physim Run nr_ulsim with T2 LDPC offload: SNR = 30, MCS = 5, 106 PRBs, 1 layer true - nr_ulsim + nr_ulsim 100 -n100 -s30 -S30.2 -m5 -r106 -R106 -o -P --ldpc_offload.dpdk_dev d8:00.0 - Run_T2Test + Run_Physim Run nr_ulsim with CPU: SNR = 30, MCS = 15, 106 PRBs, 1 layer true - nr_ulsim + nr_ulsim 300 -n100 -s30 -S30.2 -m15 -r106 -R106 -C10 -P - Run_T2Test + Run_Physim Run nr_ulsim with T2 LDPC offload: SNR = 30, MCS = 15, 106 PRBs, 1 layer true - nr_ulsim + nr_ulsim 150 -n100 -s30 -S30.2 -m15 -r106 -R106 -o -P --ldpc_offload.dpdk_dev d8:00.0 - Run_T2Test + Run_Physim Run nr_ulsim with CPU: SNR = 30, MCS = 25, 106 PRBs, 1 layer true - nr_ulsim + nr_ulsim 250 -n100 -s30 -S30.2 -m25 -r106 -R106 -C10 -P - Run_T2Test + Run_Physim Run nr_ulsim with T2 LDPC offload: SNR = 30, MCS = 25, 106 PRBs, 1 layer true - nr_ulsim + nr_ulsim 250 -n100 -s30 -S30.2 -m25 -r106 -R106 -o -P --ldpc_offload.dpdk_dev d8:00.0 - Run_T2Test + Run_Physim Run nr_ulsim with CPU: SNR = 30, MCS = 5, 273 PRBs, 1 layer true - nr_ulsim + nr_ulsim 300 -n100 -s30 -S30.2 -m5 -r273 -R273 -C10 -P - Run_T2Test + Run_Physim Run nr_ulsim with T2 LDPC offload: SNR = 30, MCS = 5, 273 PRBs, 1 layer true - nr_ulsim + nr_ulsim 150 -n100 -s30 -S30.2 -m5 -r273 -R273 -o -P --ldpc_offload.dpdk_dev d8:00.0 - Run_T2Test + Run_Physim Run nr_ulsim with CPU: SNR = 30, MCS = 15, 273 PRBs, 1 layer true - nr_ulsim + nr_ulsim 400 -n100 -s30 -S30.2 -m15 -r273 -R273 -C10 -P - Run_T2Test + Run_Physim Run nr_ulsim with T2 LDPC offload: SNR = 30, MCS = 15, 273 PRBs, 1 layer true - nr_ulsim + nr_ulsim 350 -n100 -s30 -S30.2 -m15 -r273 -R273 -o -P --ldpc_offload.dpdk_dev d8:00.0 - Run_T2Test + Run_Physim Run nr_ulsim with CPU: SNR = 30, MCS = 25, 273 PRBs, 1 layer true - nr_ulsim + nr_ulsim 400 -n100 -s30 -S30.2 -m25 -r273 -R273 -C10 -P - Run_T2Test + Run_Physim Run nr_ulsim with T2 LDPC offload: SNR = 30, MCS = 25, 273 PRBs, 1 layer true - nr_ulsim + nr_ulsim 550 -n100 -s30 -S30.2 -m25 -r273 -R273 -o -P --ldpc_offload.dpdk_dev d8:00.0 - Run_T2Test + Run_Physim Run nr_ulsim with CPU: SNR = 30, MCS = 5, 273 PRBs, 2 layers true - nr_ulsim + nr_ulsim 300 -n100 -s30 -S30.2 -m5 -r273 -R273 -C10 -W2 -z2 -y2 -P - Run_T2Test + Run_Physim Run nr_ulsim with T2 LDPC offload: SNR = 30, MCS = 5, 273 PRBs, 2 layers true - nr_ulsim + nr_ulsim 250 -n100 -s30 -S30.2 -m5 -r273 -R273 -o -W2 -z2 -y2 -P --ldpc_offload.dpdk_dev d8:00.0 - Run_T2Test + Run_Physim Run nr_ulsim with CPU: SNR = 30, MCS = 15, 273 PRBs, 2 layers true - nr_ulsim + nr_ulsim 600 -n100 -s30 -S30.2 -m15 -r273 -R273 -C10 -W2 -z2 -y2 -P - Run_T2Test + Run_Physim Run nr_ulsim with T2 LDPC offload: SNR = 30, MCS = 15, 273 PRBs, 2 layers true - nr_ulsim + nr_ulsim 650 -n100 -s30 -S30.2 -m15 -r273 -R273 -o -W2 -z2 -y2 -P --ldpc_offload.dpdk_dev d8:00.0 - Run_T2Test + Run_Physim Run nr_ulsim with CPU: SNR = 30, MCS = 25, 273 PRBs, 2 layers true - nr_ulsim + nr_ulsim 650 -n100 -s30 -S30.2 -m25 -r273 -R273 -C10 -W2 -z2 -y2 -P - Run_T2Test + Run_Physim Run nr_ulsim with T2 LDPC offload: SNR = 30, MCS = 25, 273 PRBs, 2 layers true - nr_ulsim + nr_ulsim 1100 -n100 -s30 -S30.2 -m25 -r273 -R273 -o -W2 -z2 -y2 -P --ldpc_offload.dpdk_dev d8:00.0 diff --git a/ci-scripts/xml_files/t2_offload_enc_nr_dlsim.xml b/ci-scripts/xml_files/t2_offload_enc_nr_dlsim.xml index cff66b56a4..df6c613393 100644 --- a/ci-scripts/xml_files/t2_offload_enc_nr_dlsim.xml +++ b/ci-scripts/xml_files/t2_offload_enc_nr_dlsim.xml @@ -32,217 +32,217 @@ - Run_T2Test + Run_Physim Run nr_dlsim with CPU: SNR = 30, MCS = 5, 106 PRBs, 1 layer true - nr_dlsim + nr_dlsim 230 -n100 -s30 -S30.2 -e5 -b106 -R106 -X 8,9,10,11,12 -P - Run_T2Test + Run_Physim Run nr_dlsim with T2 LDPC offload: SNR = 30, MCS = 5, 106 PRBs, 1 layer true - nr_dlsim + nr_dlsim 100 -n100 -s30 -S30.2 -e5 -b106 -R106 -c -P --ldpc_offload.dpdk_dev d8:00.0 - Run_T2Test + Run_Physim Run nr_dlsim with CPU: SNR = 30, MCS = 15, 106 PRBs, 1 layer true - nr_dlsim + nr_dlsim 300 -n100 -s30 -S30.2 -e15 -b106 -R106 -X 8,9,10,11,12 -P - Run_T2Test + Run_Physim Run nr_dlsim with T2 LDPC offload: SNR = 30, MCS = 15, 106 PRBs, 1 layer true - nr_dlsim + nr_dlsim 100 -n100 -s30 -S30.2 -e15 -b106 -R106 -c -P --ldpc_offload.dpdk_dev d8:00.0 - Run_T2Test + Run_Physim Run nr_dlsim with CPU: SNR = 30, MCS = 25, 106 PRBs, 1 layer true - nr_dlsim + nr_dlsim 350 -n100 -s30 -S30.2 -e25 -b106 -R106 -X 8,9,10,11,12 -P - Run_T2Test + Run_Physim Run nr_dlsim with T2 LDPC offload: SNR = 30, MCS = 25, 106 PRBs, 1 layer true - nr_dlsim + nr_dlsim 200 -n100 -s30 -S30.2 -e25 -b106 -R106 -c -P --ldpc_offload.dpdk_dev d8:00.0 - Run_T2Test + Run_Physim Run nr_dlsim with CPU: SNR = 30, MCS = 5, 273 PRBs, 1 layer true - nr_dlsim + nr_dlsim 300 -n100 -s30 -S30.2 -e5 -b273 -R273 -X 8,9,10,11,12 -P - Run_T2Test + Run_Physim Run nr_dlsim with T2 LDPC offload: SNR = 30, MCS = 5, 273 PRBs, 1 layer true - nr_dlsim + nr_dlsim 150 -n100 -s30 -S30.2 -e5 -b273 -R273 -c -P --ldpc_offload.dpdk_dev d8:00.0 - Run_T2Test + Run_Physim Run nr_dlsim with CPU: SNR = 30, MCS = 15, 273 PRBs, 1 layer true - nr_dlsim + nr_dlsim 350 -n100 -s30 -S30.2 -e15 -b273 -R273 -X 8,9,10,11,12 -P - Run_T2Test + Run_Physim Run nr_dlsim with T2 LDPC offload: SNR = 30, MCS = 15, 273 PRBs, 1 layer true - nr_dlsim + nr_dlsim 250 -n100 -s30 -S30.2 -e15 -b273 -R273 -c -P --ldpc_offload.dpdk_dev d8:00.0 - Run_T2Test + Run_Physim Run nr_dlsim with CPU: SNR = 30, MCS = 25, 273 PRBs, 1 layer true - nr_dlsim + nr_dlsim 400 -n100 -s30 -S30.2 -e25 -b273 -R273 -X 8,9,10,11,12 -P - Run_T2Test + Run_Physim Run nr_dlsim with T2 LDPC offload: SNR = 30, MCS = 25, 273 PRBs, 1 layer true - nr_dlsim + nr_dlsim 400 -n100 -s30 -S30.2 -e25 -b273 -R273 -c -P --ldpc_offload.dpdk_dev d8:00.0 - Run_T2Test + Run_Physim Run nr_dlsim with CPU: SNR = 30, MCS = 5, 273 PRBs, 2 layers true - nr_dlsim + nr_dlsim 400 -n100 -s30 -S30.2 -e5 -b273 -R273 -X 8,9,10,11,12 -x2 -z2 -y2 -P - Run_T2Test + Run_Physim Run nr_dlsim with T2 LDPC offload: SNR = 30, MCS = 5, 273 PRBs, 2 layers true - nr_dlsim + nr_dlsim 200 -n100 -s30 -S30.2 -e5 -b273 -R273 -c -x2 -z2 -y2 -P --ldpc_offload.dpdk_dev d8:00.0 - Run_T2Test + Run_Physim Run nr_dlsim with CPU: SNR = 30, MCS = 15, 273 PRBs, 2 layers true - nr_dlsim + nr_dlsim 450 -n100 -s30 -S30.2 -e15 -b273 -R273 -X 8,9,10,11,12 -x2 -z2 -y2 -P - Run_T2Test + Run_Physim Run nr_dlsim with T2 LDPC offload: SNR = 30, MCS = 15, 273 PRBs, 2 layers true - nr_dlsim + nr_dlsim 500 -n100 -s30 -S30.2 -e15 -b273 -R273 -c -x2 -z2 -y2 -P --ldpc_offload.dpdk_dev d8:00.0 - Run_T2Test + Run_Physim Run nr_dlsim with CPU: SNR = 30, MCS = 25, 273 PRBs, 2 layers true - nr_dlsim + nr_dlsim 500 -n100 -s30 -S30.2 -e25 -b273 -R273 -X 8,9,10,11,12 -x2 -z2 -y2 -P - Run_T2Test + Run_Physim Run nr_dlsim with T2 LDPC offload: SNR = 30, MCS = 25, 273 PRBs, 2 layers true - nr_dlsim + nr_dlsim 500 -n100 -s30 -S30.2 -e25 -b273 -R273 -c -x2 -z2 -y2 -P --ldpc_offload.dpdk_dev d8:00.0 - Run_T2Test + Run_Physim Run nr_dlsim with CPU: SNR = 30, MCS = 5, 273 PRBs, 2 layers, 4 antennas true - nr_dlsim + nr_dlsim 400 -n100 -s30 -S30.2 -e5 -b273 -R273 -X8,9,10,11,12 -x2 -z4 -y4 -P - Run_T2Test + Run_Physim Run nr_dlsim with T2 LDPC offload: SNR = 30, MCS = 5, 273 PRBs, 2 layers, 4 antennas true - nr_dlsim + nr_dlsim 150 -n100 -s30 -S30.2 -e5 -b273 -R273 -c -x2 -z4 -y4 -P --ldpc_offload.dpdk_dev d8:00.0 - Run_T2Test + Run_Physim Run nr_dlsim with CPU: SNR = 30, MCS = 20, 273 PRBs, 2 layers, 4 antennas true - nr_dlsim + nr_dlsim 400 -n100 -s30 -S30.2 -e15 -b273 -R273 -X8,9,10,11,12 -x2 -z4 -y4 -P - Run_T2Test + Run_Physim Run nr_dlsim with T2 LDPC offload: SNR = 30, MCS = 20, 273 PRBs, 2 layers, 4 antennas true - nr_dlsim + nr_dlsim 300 -n100 -s30 -S30.2 -e15 -b273 -R273 -c -x2 -z4 -y4 -P --ldpc_offload.dpdk_dev d8:00.0 - Run_T2Test + Run_Physim Run nr_dlsim with CPU: SNR = 30, MCS = 27, 273 PRBs, 2 layers, 4 antennas true - nr_dlsim + nr_dlsim 450 -n100 -s30 -S30.2 -e25 -b273 -R273 -X8,9,10,11,12 -x2 -z4 -y4 -P - Run_T2Test + Run_Physim Run nr_dlsim with T2 LDPC offload: SNR = 30, MCS = 27, 273 PRBs, 2 layers, 4 antennas true - nr_dlsim + nr_dlsim 450 -n100 -s30 -S30.2 -e25 -b273 -R273 -c -x2 -z4 -y4 -P --ldpc_offload.dpdk_dev d8:00.0 From fff605eab9b389a93f5932d438af5043bf2f6b1f Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Fri, 8 Nov 2024 21:15:35 +0100 Subject: [PATCH 59/75] Add measurement of total gNB TX processing time for nr_dlsim --- openair1/SIMULATION/NR_PHY/dlsim.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 9ab2de4215..70d1578a31 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -942,6 +942,7 @@ int main(int argc, char **argv) for (SNR = snr0; SNR < snr1; SNR += .2) { varArray_t *table_tx=initVarArray(1000,sizeof(double)); + reset_meas(&gNB->phy_proc_tx); reset_meas(&gNB->dlsch_scrambling_stats); reset_meas(&gNB->dlsch_interleaving_stats); reset_meas(&gNB->dlsch_rate_matching_stats); @@ -1035,11 +1036,13 @@ int main(int argc, char **argv) msgDataTx->ssb[0].ssb_pdu.ssb_pdu_rel15.bchPayload=0x001234; msgDataTx->ssb[0].ssb_pdu.ssb_pdu_rel15.SsbBlockIndex = 0; msgDataTx->gNB = gNB; - if (run_initial_sync) + if (run_initial_sync) { nr_common_signal_procedures(gNB,frame,slot,msgDataTx->ssb[0].ssb_pdu); - else + } else { + start_meas(&gNB->phy_proc_tx); phy_procedures_gNB_TX(msgDataTx,frame,slot,1); - + stop_meas(&gNB->phy_proc_tx); + } int txdataF_offset = slot * frame_parms->samples_per_slot_wCP; if (n_trials==1) { From e0e1ca65834266227a1f676f9ba399ba7385cbbc Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 22 Oct 2024 10:29:31 +0200 Subject: [PATCH 60/75] Make SA the default mode, remove corresponding option --- executables/nr-softmodem.c | 12 +++++------- executables/nr-ue.c | 8 ++++---- executables/nr-uesoftmodem.c | 2 +- executables/softmodem-common.h | 6 ++---- openair1/PHY/INIT/nr_init_ue.c | 2 +- openair1/PHY/NR_TRANSPORT/nr_pbch.c | 2 +- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 2 +- openair1/SIMULATION/NR_PHY/pbchsim.c | 1 - openair2/GNB_APP/gnb_app.c | 3 ++- openair2/GNB_APP/gnb_config.c | 16 ++++++++-------- openair2/LAYER2/NR_MAC_UE/main_ue_nr.c | 2 +- openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c | 2 +- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 2 +- openair2/LAYER2/NR_MAC_gNB/config.c | 6 +++--- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 6 +++--- .../LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 2 +- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 2 +- openair2/RRC/NR/nr_rrc_config.c | 2 +- openair2/RRC/NR/rrc_gNB_du.c | 4 ++-- openair2/RRC/NR/rrc_gNB_internode.c | 4 ++-- openair2/RRC/NR/rrc_gNB_nsa.c | 4 ++-- openair2/RRC/NR_UE/rrc_UE.c | 6 +++--- 24 files changed, 48 insertions(+), 52 deletions(-) diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 47548239b9..e952a525a4 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -304,15 +304,14 @@ static int create_gNB_tasks(ngran_node_t node_type, configmodule_interface_t *cf init_pdcp(); } - if (is_x2ap_enabled() ) { //&& !NODE_IS_DU(node_type) + if (get_softmodem_params()->nsa) { //&& !NODE_IS_DU(node_type) LOG_I(X2AP, "X2AP enabled \n"); __attribute__((unused)) uint32_t x2_register_gnb_pending = gNB_app_register_x2 (gnb_id_start, gnb_id_end); } /* For the CU case the gNB registration with the AMF might have to take place after the F1 setup, as the PLMN info * can originate from the DU. Add check on whether x2ap is enabled to account for ENDC NSA scenario.*/ - if ((get_softmodem_params()->sa || is_x2ap_enabled()) && - !NODE_IS_DU(node_type)) { + if (IS_SA_MODE(get_softmodem_params()) && !NODE_IS_DU(node_type)) { /* Try to register each gNB */ //registered_gnb = 0; __attribute__((unused)) uint32_t register_gnb_pending = gNB_app_register (gnb_id_start, gnb_id_end); @@ -324,7 +323,7 @@ static int create_gNB_tasks(ngran_node_t node_type, configmodule_interface_t *cf return -1; } - if (is_x2ap_enabled()) { + if (get_softmodem_params()->nsa) { if(itti_create_task(TASK_X2AP, x2ap_task, NULL) < 0) { LOG_E(X2AP, "Create task for X2AP failed\n"); } @@ -333,8 +332,7 @@ static int create_gNB_tasks(ngran_node_t node_type, configmodule_interface_t *cf } } - if (get_softmodem_params()->sa && - !NODE_IS_DU(node_type)) { + if (IS_SA_MODE(get_softmodem_params()) && !NODE_IS_DU(node_type)) { char* gnb_ipv4_address_for_NGU = NULL; uint32_t gnb_port_for_NGU = 0; @@ -383,7 +381,7 @@ static int create_gNB_tasks(ngran_node_t node_type, configmodule_interface_t *cf } //Use check on x2ap to consider the NSA scenario - if((is_x2ap_enabled() || get_softmodem_params()->sa) && (node_type != ngran_gNB_CUCP)) { + if((is_x2ap_enabled() || IS_SA_MODE(get_softmodem_params())) && (node_type != ngran_gNB_CUCP)) { if (itti_create_task (TASK_GTPV1_U, >pv1uTask, NULL) < 0) { LOG_E(GTPU, "Create task for GTPV1U failed\n"); return -1; diff --git a/executables/nr-ue.c b/executables/nr-ue.c index a06c13a59a..bd64a9d361 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -286,7 +286,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) LOG_D(NR_MAC, "The received sfn/slot [%d %d] from proxy\n", frame, slot); - if (get_softmodem_params()->sa && mac->mib == NULL) { + if (IS_SA_MODE(get_softmodem_params()) && mac->mib == NULL) { LOG_D(NR_MAC, "We haven't gotten MIB. Lets see if we received it\n"); nr_ue_dl_indication(&mac->dl_info); process_queued_nr_nfapi_msgs(mac, sfn_slot); @@ -392,7 +392,7 @@ static void UE_synch(void *arg) { ret = sl_nr_slss_search(UE, &syncD->proc, SL_NR_SSB_REPETITION_IN_FRAMES); } else { nr_get_carrier_frequencies(UE, &dl_carrier, &ul_carrier); - ret = nr_initial_sync(&syncD->proc, UE, 2, get_softmodem_params()->sa, syncD->gscnInfo, syncD->numGscn); + ret = nr_initial_sync(&syncD->proc, UE, 2, IS_SA_MODE(get_softmodem_params()), syncD->gscnInfo, syncD->numGscn); } if (ret.cell_detected) { @@ -601,7 +601,7 @@ static int UE_dl_preprocessing(PHY_VARS_NR_UE *UE, const UE_nr_rxtx_proc_t *proc if (UE->sl_mode == 2) fp = &UE->SL_UE_PHY_PARAMS.sl_frame_params; - if (IS_SOFTMODEM_NOS1 || get_softmodem_params()->sa) { + if (IS_SOFTMODEM_NOS1 || IS_SA_MODE(get_softmodem_params())) { // Start synchronization with a target gNB if (UE->synch_request.received_synch_request == 1) { @@ -1056,7 +1056,7 @@ void init_NR_UE(int nb_inst, char *uecap_file, char *reconfig_file, char *rbconf NR_UE_MAC_INST_t *mac = get_mac_inst(i); mac->if_module = nr_ue_if_module_init(i); AssertFatal(mac->if_module, "can not initialize IF module\n"); - if (!get_softmodem_params()->sa || !get_softmodem_params()->sl_mode) { + if (!IS_SA_MODE(get_softmodem_params()) || !get_softmodem_params()->sl_mode) { init_nsa_message(&rrc_inst[i], reconfig_file, rbconfig_file); nr_rlc_activate_srb0(mac_inst[i].crnti, NULL, send_srb0_rrc); } diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 4e5e1a19f9..51520d031f 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -480,7 +480,7 @@ int main(int argc, char **argv) NR_UE_MAC_INST_t *mac = get_mac_inst(inst); init_nr_ue_phy_cpu_stats(&UE[CC_id]->phy_cpu_stats); - if (get_softmodem_params()->sa || get_softmodem_params()->sl_mode) { // set frame config to initial values from command line + if (IS_SA_MODE(get_softmodem_params()) || get_softmodem_params()->sl_mode) { // set frame config to initial values from command line // and assume that the SSB is centered on the grid uint16_t nr_band = get_softmodem_params()->band; mac->nr_band = nr_band; diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index b6bbc11a2e..ee2339b85c 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -123,7 +123,6 @@ extern "C" #define CONTINUOUS_TX softmodem_params.continuous_tx #define PHY_TEST softmodem_params.phy_test #define DO_RA softmodem_params.do_ra -#define SA softmodem_params.sa #define SL_MODE softmodem_params.sl_mode #define WAIT_FOR_SYNC softmodem_params.wait_for_sync #define CHAIN_OFFSET softmodem_params.chain_offset @@ -155,7 +154,6 @@ extern int usrp_tx_thread; {"thread-pool", CONFIG_HLP_TPOOL, 0, .strptr=&TP_CONFIG, .defstrval="-1,-1,-1,-1,-1,-1,-1,-1", TYPE_STRING, 0}, \ {"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, .iptr=&PHY_TEST, .defintval=0, TYPE_INT, 0}, \ {"do-ra", CONFIG_HLP_DORA, PARAMFLAG_BOOL, .iptr=&DO_RA, .defintval=0, TYPE_INT, 0}, \ - {"sa", CONFIG_HLP_SA, PARAMFLAG_BOOL, .iptr=&SA, .defintval=0, TYPE_INT, 0}, \ {"sl-mode", CONFIG_HLP_SL_MODE, 0, .u8ptr=&SL_MODE, .defintval=0, TYPE_UINT8, 0}, \ {"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, .u8ptr=&USIM_TEST, .defintval=0, TYPE_UINT8, 0}, \ {"clock-source", CONFIG_HLP_CLK, 0, .uptr=&CLOCK_SOURCE, .defintval=0, TYPE_UINT, 0}, \ @@ -224,7 +222,6 @@ extern int usrp_tx_thread; { .s5 = { NULL } }, \ { .s5 = { NULL } }, \ { .s5 = { NULL } }, \ - { .s5 = { NULL } }, \ { .s3a = { config_checkstr_assign_integer, \ {"MONOLITHIC", "PNF", "VNF", "AERIAL","UE_STUB_PNF","UE_STUB_OFFNET","STANDALONE_PNF"}, \ {NFAPI_MONOLITHIC, NFAPI_MODE_PNF, NFAPI_MODE_VNF, NFAPI_MODE_AERIAL,NFAPI_UE_STUB_PNF,NFAPI_UE_STUB_OFFNET,NFAPI_MODE_STANDALONE_PNF}, \ @@ -305,7 +302,6 @@ typedef struct { char *threadPoolConfig; int phy_test; int do_ra; - int sa; uint8_t sl_mode; uint8_t usim_test; int emulate_rf; @@ -333,6 +329,8 @@ typedef struct { int threequarter_fs; } softmodem_params_t; +#define IS_SA_MODE(sM_params) (!(sM_params)->phy_test && !(sM_params)->do_ra && !(sM_params)->nsa) + uint64_t get_softmodem_optmask(void); uint64_t set_softmodem_optmask(uint64_t bitmask); uint64_t clear_softmodem_optmask(uint64_t bitmask); diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index 577f7a44d8..dd5446be71 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -283,7 +283,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) init_timeshift_rotation(fp); // initialize to false only for SA since in do-ra and phy-test it is already set to true before getting here - if (get_softmodem_params()->sa) + if (IS_SA_MODE(get_softmodem_params())) ue->received_config_request = false; return 0; diff --git a/openair1/PHY/NR_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_TRANSPORT/nr_pbch.c index a7507c2679..4cc55c1345 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_pbch.c @@ -271,7 +271,7 @@ void nr_generate_pbch(PHY_VARS_gNB *gNB, pbch_a |= ((pbch_pdu[i >> 3] >> (7 - (i & 7))) & 1) << i; // NSA to signal no coreset0 - const int ssb_sc_offset = get_softmodem_params()->sa ? config->ssb_table.ssb_subcarrier_offset.value : 31; + const int ssb_sc_offset = IS_SA_MODE(get_softmodem_params()) ? config->ssb_table.ssb_subcarrier_offset.value : 31; #ifdef DEBUG_PBCH_ENCODING for (int i = 0; i < 3; i++) diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 7148b28fe7..a56c01ce99 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -95,7 +95,7 @@ void nr_common_signal_procedures(PHY_VARS_gNB *gNB, int frame, int slot, nfapi_n const int sc_offset = (fp->freq_range == FR1) ? pdu->SsbSubcarrierOffset >> scs : pdu->SsbSubcarrierOffset; fp->ssb_start_subcarrier = (12 * prb_offset + sc_offset); - if (fp->print_ue_help_cmdline_log && get_softmodem_params()->sa) { + if (fp->print_ue_help_cmdline_log && IS_SA_MODE(get_softmodem_params())) { fp->print_ue_help_cmdline_log = false; if (fp->dl_CarrierFreq != fp->ul_CarrierFreq) LOG_A(PHY, diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index c0b1cbf5bb..4489c3e7bb 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -153,7 +153,6 @@ int main(int argc, char **argv) int ssb_scan_threads = 0; channel_desc_t *gNB2UE; - get_softmodem_params()->sa = 1; get_softmodem_params()->usim_test = 1; //uint8_t extended_prefix_flag=0; diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index 49b53aa572..98775b3908 100644 --- a/openair2/GNB_APP/gnb_app.c +++ b/openair2/GNB_APP/gnb_app.c @@ -71,7 +71,8 @@ uint32_t gNB_app_register(uint32_t gnb_id_start, uint32_t gnb_id_end)//, const E for (gnb_id = gnb_id_start; (gnb_id < gnb_id_end) ; gnb_id++) { { - if(get_softmodem_params()->sa){ + if (IS_SA_MODE(get_softmodem_params())) { + // note: there is an implicit relationship between the data structure and the message name msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, NGAP_REGISTER_GNB_REQ); //Message Temporarily reuse diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 08e4d97a31..82b2d7b486 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1003,7 +1003,7 @@ static NR_ServingCellConfigCommon_t *get_scc_config(configmodule_interface_t *cf *scc->ssbSubcarrierSpacing, *frequencyInfoDL->absoluteFrequencySSB); LOG_I(RRC, "absoluteFrequencySSB %ld corresponds to %lu Hz\n", *frequencyInfoDL->absoluteFrequencySSB, ssb_freq); - if (get_softmodem_params()->sa) + if (IS_SA_MODE(get_softmodem_params())) check_ssb_raster(ssb_freq, *frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); fix_scc(scc, ssb_bitmap); } @@ -1226,7 +1226,7 @@ static f1ap_setup_req_t *RC_read_F1Setup(uint64_t id, req->cell[0].info.measurement_timing_config = mtc_buf; req->cell[0].info.measurement_timing_config_len = len; - if (get_softmodem_params()->sa) { + if (IS_SA_MODE(get_softmodem_params())) { // in NSA we don't transmit SIB1, so cannot fill DU system information // so cannot send MIB either @@ -1503,7 +1503,7 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg) f1ap_served_cell_info_t info; read_du_cell_info(cfg, NODE_IS_DU(node_type), &gnb_id, &gnb_du_id, &name, &info, 1); - if (get_softmodem_params()->sa) { + if (IS_SA_MODE(get_softmodem_params())) { nr_mac_configure_sib1(RC.nrmac[0], &info.plmn, info.nr_cellid, *info.tac); if (scc->ext2 && scc->ext2->ntn_Config_r17) nr_mac_configure_sib19(RC.nrmac[0]); @@ -1826,7 +1826,7 @@ void RCconfig_NRRRC(gNB_RRC_INST *rrc) config_getlist(config_get_if(), &GNBParamList, GNBParams, sizeofArray(GNBParams), NULL); if (GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr == NULL) { // Calculate a default gNB ID - if (get_softmodem_params()->sa) { + if (IS_SA_MODE(get_softmodem_params())) { uint32_t hash; hash = ngap_generate_gNB_id (); gnb_id = i + (hash & 0xFFFFFF8); @@ -1978,7 +1978,7 @@ int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) { for (k = 0; k < GNBParamList.numelt; k++) { if (GNBParamList.paramarray[k][GNB_GNB_ID_IDX].uptr == NULL) { // Calculate a default gNB ID - if (get_softmodem_params()->sa) { + if (IS_SA_MODE(get_softmodem_params())) { uint32_t hash; hash = ngap_generate_gNB_id (); @@ -2119,7 +2119,7 @@ int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) { // SCTP SETTING NGAP_REGISTER_GNB_REQ (msg_p).sctp_out_streams = SCTP_OUT_STREAMS; NGAP_REGISTER_GNB_REQ (msg_p).sctp_in_streams = SCTP_IN_STREAMS; - if (get_softmodem_params()->sa) { + if (IS_SA_MODE(get_softmodem_params())) { sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,k,GNB_CONFIG_STRING_SCTP_CONFIG); config_get(config_get_if(), SCTPParams, sizeofArray(SCTPParams), aprefix); NGAP_REGISTER_GNB_REQ (msg_p).sctp_in_streams = (uint16_t)*(SCTPParams[GNB_SCTP_INSTREAMS_IDX].uptr); @@ -2208,7 +2208,7 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) { for (k = 0; k < GNBParamList.numelt; k++) { if (GNBParamList.paramarray[k][GNB_GNB_ID_IDX].uptr == NULL) { // Calculate a default eNB ID - if (get_softmodem_params()->sa) { + if (IS_SA_MODE(get_softmodem_params())) { uint32_t hash; hash = ngap_generate_gNB_id (); gnb_id = k + (hash & 0xFFFFFF8); @@ -2343,7 +2343,7 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) { X2AP_REGISTER_ENB_REQ (msg_p).sctp_out_streams = SCTP_OUT_STREAMS; X2AP_REGISTER_ENB_REQ (msg_p).sctp_in_streams = SCTP_IN_STREAMS; - if (get_softmodem_params()->sa) { + if (IS_SA_MODE(get_softmodem_params())) { sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,k,GNB_CONFIG_STRING_SCTP_CONFIG); config_get(config_get_if(), SCTPParams, sizeofArray(SCTPParams), aprefix); X2AP_REGISTER_ENB_REQ (msg_p).sctp_in_streams = (uint16_t)*(SCTPParams[GNB_SCTP_INSTREAMS_IDX].uptr); diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c index a60d8d2c43..66a06b5f48 100644 --- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -160,7 +160,7 @@ NR_UE_MAC_INST_t *nr_l2_init_ue(int nb_inst) mac->ue_id = j; nr_ue_init_mac(mac); nr_ue_mac_default_configs(mac); - if (get_softmodem_params()->sa) + if (IS_SA_MODE(get_softmodem_params())) ue_init_config_request(mac, get_softmodem_params()->numerology); } diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index da183b3b14..493d90eaf6 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -783,7 +783,7 @@ void nr_ue_get_rach(NR_UE_MAC_INST_t *mac, int CC_id, frame_t frame, uint8_t gNB ra->Msg3_size = size_sdu + sizeof(NR_MAC_SUBHEADER_SHORT) + sizeof(NR_MAC_SUBHEADER_SHORT); } - } else if (!get_softmodem_params()->sa) { + } else if (!IS_SA_MODE(get_softmodem_params())) { uint8_t temp_pdu[16] = {0}; size_sdu = nr_write_ce_ulsch_pdu(temp_pdu, mac, 0, &(mac->crnti), NULL, NULL, NULL); ra->Msg3_size = size_sdu; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index d61cbef202..bd233f2163 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -3810,7 +3810,7 @@ int nr_write_ce_ulsch_pdu(uint8_t *mac_ce, pdu, mac_ce); } - if (crnti && (!get_softmodem_params()->sa && get_softmodem_params()->do_ra && mac->ra.ra_state != nrRA_SUCCEEDED)) { + if (crnti && (!IS_SA_MODE(get_softmodem_params()) && get_softmodem_params()->do_ra && mac->ra.ra_state != nrRA_SUCCEEDED)) { LOG_D(NR_MAC, "In %s: generating C-RNTI MAC CE with C-RNTI %x\n", __FUNCTION__, (*crnti)); // MAC CE fixed subheader diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 7baca618d1..67a19d3d0e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -437,7 +437,7 @@ static void config_common(gNB_MAC_INST *nrmac, + (get_N_RA_RB(cfg->prach_config.prach_sub_c_spacing.value, frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) * i); - if (get_softmodem_params()->sa) { + if (IS_SA_MODE(get_softmodem_params())) { prach_fd_occasion->k1.value = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) + rach_ConfigCommon->rach_ConfigGeneric.msg1_FrequencyStart @@ -751,7 +751,7 @@ void nr_fill_sched_osi(gNB_MAC_INST *nrmac, const struct NR_SetupRelease_PDCCH_C void nr_mac_configure_sib1(gNB_MAC_INST *nrmac, const f1ap_plmn_t *plmn, uint64_t cellID, int tac) { - AssertFatal(get_softmodem_params()->sa > 0, "error: SIB1 only applicable for SA\n"); + AssertFatal(IS_SA_MODE(get_softmodem_params()), "error: SIB1 only applicable for SA\n"); NR_COMMON_channels_t *cc = &nrmac->common_channels[0]; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; @@ -763,7 +763,7 @@ void nr_mac_configure_sib1(gNB_MAC_INST *nrmac, const f1ap_plmn_t *plmn, uint64_ void nr_mac_configure_sib19(gNB_MAC_INST *nrmac) { - AssertFatal(get_softmodem_params()->sa > 0, "error: SIB19 only applicable for SA\n"); + AssertFatal(IS_SA_MODE(get_softmodem_params()), "error: SIB19 only applicable for SA\n"); NR_COMMON_channels_t *cc = &nrmac->common_channels[0]; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; NR_BCCH_DL_SCH_Message_t *sib19 = get_SIB19_NR(scc); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index af07ecfb54..bcd5cfb26c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -221,7 +221,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_ // This schedules SIB1 // SIB19 will be scheduled if ntn_Config_r17 is initialized - if (get_softmodem_params()->sa == 1) { + if (IS_SA_MODE(get_softmodem_params())) { schedule_nr_sib1(module_idP, frame, slot, &sched_info->DL_req, &sched_info->TX_req); if (cc->sib19) schedule_nr_sib19(module_idP, frame, slot, &sched_info->DL_req, &sched_info->TX_req, cc->sib19_bcch_length, cc->sib19_bcch_pdu); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 9dd76099d9..0a51c9c803 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -2291,7 +2291,7 @@ void nr_clear_ra_proc(NR_RA_t *ra) NR_SCHED_ENSURE_LOCKED(&RC.nrmac[0]->sched_lock); memset(ra, 0, sizeof(*ra)); ra->ra_state = nrRA_gNB_IDLE; - if (get_softmodem_params()->sa) { // in SA, prefill with allowed preambles + if (IS_SA_MODE(get_softmodem_params())) { // in SA, prefill with allowed preambles ra->preambles.num_preambles = MAX_NUM_NR_PRACH_PREAMBLES; for (int i = 0; i < MAX_NUM_NR_PRACH_PREAMBLES; i++) ra->preambles.preamble_list[i] = i; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 60e3fb00a1..9c69c2660c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -187,7 +187,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, const int prb_offset = offset_pointa >> scs; schedule_ssb(frameP, slotP, scc, dl_req, i_ssb, beam_index, ssbSubcarrierOffset, offset_pointa, mib_pdu); fill_ssb_vrb_map(cc, prb_offset, ssbSubcarrierOffset, ssb_start_symbol, CC_id, beam.idx); - if (get_softmodem_params()->sa == 1) { + if (IS_SA_MODE(get_softmodem_params())) { get_type0_PDCCH_CSS_config_parameters(&gNB->type0_PDCCH_CSS_config[i_ssb], frameP, mib, @@ -219,7 +219,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, const int prb_offset = offset_pointa >> scs; schedule_ssb(frameP, slotP, scc, dl_req, i_ssb, beam_index, ssbSubcarrierOffset, offset_pointa, mib_pdu); fill_ssb_vrb_map(cc, prb_offset, ssbSubcarrierOffset, ssb_start_symbol, CC_id, beam.idx); - if (get_softmodem_params()->sa == 1) { + if (IS_SA_MODE(get_softmodem_params())) { get_type0_PDCCH_CSS_config_parameters(&gNB->type0_PDCCH_CSS_config[i_ssb], frameP, mib, @@ -251,7 +251,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, const int prb_offset = offset_pointa >> (scs-2); // reference 60kHz schedule_ssb(frameP, slotP, scc, dl_req, i_ssb, beam_index, ssbSubcarrierOffset, offset_pointa, mib_pdu); fill_ssb_vrb_map(cc, prb_offset, ssbSubcarrierOffset >> (scs - 2), ssb_start_symbol, CC_id, beam.idx); - if (get_softmodem_params()->sa == 1) { + if (IS_SA_MODE(get_softmodem_params())) { get_type0_PDCCH_CSS_config_parameters(&gNB->type0_PDCCH_CSS_config[i_ssb], frameP, mib, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 5930ef7f44..dc442bedd0 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -3004,7 +3004,7 @@ static void nr_mac_apply_cellgroup(gNB_MAC_INST *mac, NR_UE_info_t *UE, frame_t reset_srs_stats(UE); - if (get_softmodem_params()->sa) { + if (IS_SA_MODE(get_softmodem_params())) { // add all available DL,UL HARQ processes for this UE in SA create_dl_harq_list(sched_ctrl, &UE->sc_info); create_ul_harq_list(sched_ctrl, &UE->sc_info); diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index c4faefa0fa..7cd16ef8bf 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -343,7 +343,7 @@ static bool is_my_dci(NR_UE_MAC_INST_t *mac, nfapi_nr_dl_dci_pdu_t *received_pdu (received_pdu->RNTI != mac->ra.ra_rnti || mac->ra.RA_RAPID_found)) return false; } - if (get_softmodem_params()->sa) { + if (IS_SA_MODE(get_softmodem_params())) { if (mac->state == UE_NOT_SYNC) return false; if (received_pdu->RNTI == 0xFFFF) diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index cae49d3f53..6966394667 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -1835,7 +1835,7 @@ NR_BCCH_BCH_Message_t *get_new_MIB_NR(const NR_ServingCellConfigCommon_t *scc) AssertFatal(scc->ssbSubcarrierSpacing != NULL, "scc->ssbSubcarrierSpacing is null\n"); int ssb_subcarrier_offset = 31; // default value for NSA - if (get_softmodem_params()->sa) { + if (IS_SA_MODE(get_softmodem_params())) { ssb_subcarrier_offset = get_ssb_subcarrier_offset(*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB, scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA, *scc->ssbSubcarrierSpacing); diff --git a/openair2/RRC/NR/rrc_gNB_du.c b/openair2/RRC/NR/rrc_gNB_du.c index 82b18f124b..98cdb313df 100644 --- a/openair2/RRC/NR/rrc_gNB_du.c +++ b/openair2/RRC/NR/rrc_gNB_du.c @@ -340,7 +340,7 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *req, sctp_assoc_t assoc_id) NR_MIB_t *mib = NULL; NR_SIB1_t *sib1 = NULL; - if (sys_info != NULL && sys_info->mib != NULL && !(sys_info->sib1 == NULL && get_softmodem_params()->sa)) { + if (sys_info != NULL && sys_info->mib != NULL && !(sys_info->sib1 == NULL && IS_SA_MODE(get_softmodem_params()))) { if (!extract_sys_info(sys_info, &mib, &sib1)) { LOG_W(RRC, "rejecting DU ID %ld\n", req->gNB_DU_id); fail.cause = F1AP_CauseProtocol_semantic_error; @@ -491,7 +491,7 @@ void rrc_gNB_process_f1_du_configuration_update(f1ap_gnb_du_configuration_update const f1ap_gnb_du_system_info_t *sys_info = conf_up->cell_to_modify[0].sys_info; - if (sys_info != NULL && sys_info->mib != NULL && !(sys_info->sib1 == NULL && get_softmodem_params()->sa)) { + if (sys_info != NULL && sys_info->mib != NULL && !(sys_info->sib1 == NULL && IS_SA_MODE(get_softmodem_params()))) { // MIB is mandatory, so will be overwritten. SIB1 is optional, so will // only be overwritten if present in sys_info ASN_STRUCT_FREE(asn_DEF_NR_MIB, du->mib); diff --git a/openair2/RRC/NR/rrc_gNB_internode.c b/openair2/RRC/NR/rrc_gNB_internode.c index add6823e15..6b001e16fd 100644 --- a/openair2/RRC/NR/rrc_gNB_internode.c +++ b/openair2/RRC/NR/rrc_gNB_internode.c @@ -96,7 +96,7 @@ NR_CG_Config_t *generate_CG_Config(const NR_RRCReconfiguration_t *reconfig, cons (enc_rval.encoded+7)>>3); FILE *fd; // file to be generated for nr-ue - if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra > 0 || get_softmodem_params()->sa == 1) { + if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra > 0) { // This is for phytest only, emulate first X2 message if uecap.raw file is present LOG_I(RRC,"Dumping NR_RRCReconfiguration message (%jd bytes)\n",(enc_rval.encoded+7)>>3); for (int i=0; i<(enc_rval.encoded+7)>>3; i++) { @@ -121,7 +121,7 @@ NR_CG_Config_t *generate_CG_Config(const NR_RRCReconfiguration_t *reconfig, cons - if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra > 0 || get_softmodem_params()->sa == 1) { + if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra > 0) { LOG_I(RRC,"Dumping scg_RB_Config message (%jd bytes)\n",(enc_rval.encoded+7)>>3); for (int i=0; i<(enc_rval.encoded+7)>>3; i++) { diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index ceae4703f6..73509f6d72 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -116,7 +116,7 @@ RB_PROTOTYPE(rrc_nr_ue_tree_s, rrc_gNB_ue_context_s, entries, void rrc_add_nsa_user(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p, x2ap_ENDC_sgnb_addition_req_t *m) { - AssertFatal(!get_softmodem_params()->sa, "%s() cannot be called in SA mode, it is intrinsically for NSA\n", __func__); + AssertFatal(!IS_SA_MODE(get_softmodem_params()), "%s() cannot be called in SA mode, it is intrinsically for NSA\n", __func__); // generate nr-Config-r15 containers for LTE RRC : inside message for X2 EN-DC (CG-Config Message from 38.331) const nr_mac_config_t *configuration = &RC.nrmac[0]->radio_config; MessageDef *msg; @@ -153,7 +153,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p, x2a } // NR RRCReconfiguration - if (get_softmodem_params()->phy_test == 1 || get_softmodem_params()->do_ra == 1 || get_softmodem_params()->sa == 1){ + if (get_softmodem_params()->phy_test == 1 || get_softmodem_params()->do_ra == 1) { UE->rb_config = get_default_rbconfig(10 /* EPS bearer ID */, 1 /* drb ID */, NR_CipheringAlgorithm_nea0, NR_SecurityConfig__keyToUse_master); } else { /* TODO: handle more than one bearer */ diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 61f8391586..53364b0768 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -223,7 +223,7 @@ static void nr_rrc_ue_process_rrcReconfiguration(NR_UE_RRC_INST_t *rrc, nr_rrc_cellgroup_configuration(rrc, cellGroupConfig); - AssertFatal(!get_softmodem_params()->sa, "secondaryCellGroup only used in NSA for now\n"); + AssertFatal(!IS_SA_MODE(get_softmodem_params()), "secondaryCellGroup only used in NSA for now\n"); nr_rrc_mac_config_req_cg(rrc->ue_id, 0, cellGroupConfig, rrc->UECap.UE_NR_Capability); asn1cFreeStruc(asn_DEF_NR_CellGroupConfig, cellGroupConfig); } @@ -551,7 +551,7 @@ static void nr_rrc_ue_decode_NR_BCCH_BCH_Message(NR_UE_RRC_INST_t *rrc, } int get_sib = 0; - if (get_softmodem_params()->sa && bcch_message->message.present == NR_BCCH_BCH_MessageType_PR_mib + if (IS_SA_MODE(get_softmodem_params()) && bcch_message->message.present == NR_BCCH_BCH_MessageType_PR_mib && bcch_message->message.choice.mib->cellBarred == NR_MIB__cellBarred_notBarred && rrc->nrRrcState != RRC_STATE_DETACH_NR) { NR_UE_RRC_SI_INFO *SI_info = &rrc->perNB[gNB_index].SInfo; // to schedule MAC to get SI if required @@ -994,7 +994,7 @@ static void rrc_ue_generate_RRCSetupComplete(const NR_UE_RRC_INST_t *rrc, const const char *nas_msg; int nas_msg_length; - if (get_softmodem_params()->sa) { + if (IS_SA_MODE(get_softmodem_params())) { as_nas_info_t initialNasMsg; nr_ue_nas_t *nas = get_ue_nas_info(rrc->ue_id); generateRegistrationRequest(&initialNasMsg, nas); From 5d2a1ace17a524287aec5572c1bfba0752e0a164 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 22 Oct 2024 10:32:35 +0200 Subject: [PATCH 61/75] nr-{ue,}softmodem: Check for correct modes THere are four possibilities, for the three options (phy_test, do_ra, nsa): - None is set -> SA - Only one is set of each -> corresponding mode Introduce a function softmodem_verify_mode() to check for these. --- executables/nr-softmodem.c | 6 +----- executables/nr-uesoftmodem.c | 9 +++------ executables/softmodem-common.c | 18 ++++++++++++++++++ executables/softmodem-common.h | 1 + 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index e952a525a4..c402b0ed08 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -605,11 +605,7 @@ int main( int argc, char **argv ) { LOG_W(UTIL, "no SYS_NICE capability: cannot set thread priority and affinity, consider running with sudo for optimum performance\n"); - if (get_softmodem_params()->do_ra) - AssertFatal(get_softmodem_params()->phy_test == 0,"RA and phy_test are mutually exclusive\n"); - - if (get_softmodem_params()->sa) - AssertFatal(get_softmodem_params()->phy_test == 0,"Standalone mode and phy_test are mutually exclusive\n"); + softmodem_verify_mode(get_softmodem_params()); #if T_TRACER T_Config_Init(); diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 51520d031f..519c7ffbc4 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -407,6 +407,9 @@ int main(int argc, char **argv) get_common_options(uniqCfg, SOFTMODEM_5GUE_BIT); CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP); + + softmodem_verify_mode(get_softmodem_params()); + #if T_TRACER T_Config_Init(); #endif @@ -461,12 +464,6 @@ int main(int argc, char **argv) get_channel_model_mode(uniqCfg); } - if (get_softmodem_params()->do_ra) - AssertFatal(get_softmodem_params()->phy_test == 0,"RA and phy_test are mutually exclusive\n"); - - if (get_softmodem_params()->sa) - AssertFatal(get_softmodem_params()->phy_test == 0,"Standalone mode and phy_test are mutually exclusive\n"); - if (!get_softmodem_params()->nsa && get_softmodem_params()->emulate_l1) start_oai_nrue_threads(); diff --git a/executables/softmodem-common.c b/executables/softmodem-common.c index d566767902..394235e8f0 100644 --- a/executables/softmodem-common.c +++ b/executables/softmodem-common.c @@ -174,6 +174,24 @@ void get_common_options(configmodule_interface_t *cfg, uint32_t execmask) if (stats_disabled) set_softmodem_optmask(SOFTMODEM_NOSTATS_BIT); } + +void softmodem_verify_mode(const softmodem_params_t *p) +{ + if (IS_SA_MODE(p)) { + LOG_I(UTIL, "running in SA mode (no --phy-test, --do-ra, --nsa option present)\n"); + return; + } + + if (p->phy_test) + LOG_I(UTIL, "running in phy-test mode (--phy-test)\n"); + if (p->do_ra) + LOG_I(UTIL, "running in do-ra mode (--do-ra)\n"); + if (p->nsa) + LOG_I(UTIL, "running in NSA mode (--nsa)\n"); + int num_modes = p->phy_test + p->do_ra + p->nsa; + AssertFatal(num_modes == 1, "--phy-test, --do-ra, and --nsa are mutually exclusive\n"); +} + void softmodem_printresources(int sig, telnet_printfunc_t pf) { struct rusage usage; struct timespec stop; diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index ee2339b85c..6707e38c2e 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -330,6 +330,7 @@ typedef struct { } softmodem_params_t; #define IS_SA_MODE(sM_params) (!(sM_params)->phy_test && !(sM_params)->do_ra && !(sM_params)->nsa) +void softmodem_verify_mode(const softmodem_params_t *p); uint64_t get_softmodem_optmask(void); uint64_t set_softmodem_optmask(uint64_t bitmask); From c4d9d277024924ec46a6afcd17099eb93c3553f2 Mon Sep 17 00:00:00 2001 From: Reem Bahsoun Date: Thu, 24 Oct 2024 09:54:58 +0200 Subject: [PATCH 62/75] Remove sa param from some CI conf files + remove 'sa' flag from docker-compose files --- ci-scripts/cls_oaicitest.py | 2 +- ci-scripts/conf_files/gnb-cucp.sa.f1.conf | 1 - .../conf_files/gnb-cucp.sa.f1.quectel.conf | 1 - ci-scripts/conf_files/gnb-cuup.sa.f1.conf | 1 - .../conf_files/gnb-cuup.sa.f1.quectel.conf | 1 - ...du.sa.band78.106prb.rfsim.accelleran.conf} | 0 .../gnb-vnf.sa.band78.273prb.aerial.conf | 1 - .../gnb.sa.band261.u3.32prb.rfsim.conf | 2 -- .../gnb.sa.band77.162prb.usrpn310.2x2.conf | 1 - .../gnb.sa.band77.273prb.usrpn310.2x2.conf | 1 - .../5g_f1_rfsimulator/docker-compose.yaml | 8 +++---- .../5g_fdd_rfsimulator/docker-compose.yaml | 6 ++--- .../5g_l2sim_tdd/docker-compose.yaml | 4 ++-- .../yaml_files/5g_rfsimulator/README.md | 2 +- .../5g_rfsimulator/docker-compose.yaml | 22 +++++++++---------- .../5g_rfsimulator/local-override-ue-gdb.yaml | 2 +- .../5g_rfsimulator_24prb/docker-compose.yaml | 4 ++-- .../5g_rfsimulator_2x2/docker-compose.yaml | 4 ++-- .../docker-compose.yaml | 6 ++--- .../5g_rfsimulator_e1/docker-compose.yaml | 20 ++++++++--------- .../docker-compose.yaml | 4 ++-- .../docker-compose.yaml | 4 ++-- .../docker-compose.yaml | 4 ++-- .../5g_sa_n310_gnb/docker-compose.yml | 2 +- .../5g_sa_n310_nrue/docker-compose.yml | 2 +- .../sa_aw2s_2x2_gnb/docker-compose.yml | 1 - .../yaml_files/sa_aw2s_gnb/docker-compose.yml | 1 - .../yaml_files/sa_b200_gnb/docker-compose.yml | 2 +- .../sa_e1_b200_gnb/docker-compose.yml | 9 +++----- .../sa_f1_b200_gnb/docker-compose.yml | 5 ++--- .../docker-compose.yml | 2 +- .../sa_fhi_7.2_vvdn_gnb/docker-compose.yml | 2 +- .../sa_sc_b200_gnb/docker-compose.yml | 2 +- 33 files changed, 57 insertions(+), 72 deletions(-) rename ci-scripts/conf_files/{gnb-du.band78.106prb.rfsim.conf => gnb-du.sa.band78.106prb.rfsim.accelleran.conf} (100%) diff --git a/ci-scripts/cls_oaicitest.py b/ci-scripts/cls_oaicitest.py index f286aa9558..a4fdd20ae0 100644 --- a/ci-scripts/cls_oaicitest.py +++ b/ci-scripts/cls_oaicitest.py @@ -649,7 +649,7 @@ class OaiCiTest(): result = re.search('warning: discard PDU, sn out of window', str(line)) if result is not None: nbPduDiscard += 1 - result = re.search('--nfapi STANDALONE_PNF --node-number 2 --sa', str(line)) + result = re.search('--nfapi STANDALONE_PNF --node-number 2', str(line)) if result is not None: frequency_found = True result = re.search('Exiting OAI softmodem', str(line)) diff --git a/ci-scripts/conf_files/gnb-cucp.sa.f1.conf b/ci-scripts/conf_files/gnb-cucp.sa.f1.conf index 66e3522181..586c5d5134 100644 --- a/ci-scripts/conf_files/gnb-cucp.sa.f1.conf +++ b/ci-scripts/conf_files/gnb-cucp.sa.f1.conf @@ -2,7 +2,6 @@ Active_gNBs = ( "gNB-OAI"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; Num_Threads_PUSCH = 8; -sa = 1; gNBs = ( diff --git a/ci-scripts/conf_files/gnb-cucp.sa.f1.quectel.conf b/ci-scripts/conf_files/gnb-cucp.sa.f1.quectel.conf index 153e7f77a3..a0744de01f 100644 --- a/ci-scripts/conf_files/gnb-cucp.sa.f1.quectel.conf +++ b/ci-scripts/conf_files/gnb-cucp.sa.f1.quectel.conf @@ -2,7 +2,6 @@ Active_gNBs = ( "gNB-OAI"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; Num_Threads_PUSCH = 8; -sa = 1; gNBs = ( diff --git a/ci-scripts/conf_files/gnb-cuup.sa.f1.conf b/ci-scripts/conf_files/gnb-cuup.sa.f1.conf index a7e2daa298..5dd6c77a9c 100644 --- a/ci-scripts/conf_files/gnb-cuup.sa.f1.conf +++ b/ci-scripts/conf_files/gnb-cuup.sa.f1.conf @@ -1,7 +1,6 @@ Active_gNBs = ( "gNB-OAI"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; -sa = 1; gNBs = ( diff --git a/ci-scripts/conf_files/gnb-cuup.sa.f1.quectel.conf b/ci-scripts/conf_files/gnb-cuup.sa.f1.quectel.conf index fa6532be7b..b9f65cdf53 100644 --- a/ci-scripts/conf_files/gnb-cuup.sa.f1.quectel.conf +++ b/ci-scripts/conf_files/gnb-cuup.sa.f1.quectel.conf @@ -1,7 +1,6 @@ Active_gNBs = ( "gNB-OAI"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; -sa = 1; gNBs = ( diff --git a/ci-scripts/conf_files/gnb-du.band78.106prb.rfsim.conf b/ci-scripts/conf_files/gnb-du.sa.band78.106prb.rfsim.accelleran.conf similarity index 100% rename from ci-scripts/conf_files/gnb-du.band78.106prb.rfsim.conf rename to ci-scripts/conf_files/gnb-du.sa.band78.106prb.rfsim.accelleran.conf diff --git a/ci-scripts/conf_files/gnb-vnf.sa.band78.273prb.aerial.conf b/ci-scripts/conf_files/gnb-vnf.sa.band78.273prb.aerial.conf index 4250ec5571..c035882d36 100644 --- a/ci-scripts/conf_files/gnb-vnf.sa.band78.273prb.aerial.conf +++ b/ci-scripts/conf_files/gnb-vnf.sa.band78.273prb.aerial.conf @@ -2,7 +2,6 @@ Active_gNBs = ( "gNB-OAI"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; -sa = 1; nfapi = "AERIAL"; gNBs = diff --git a/ci-scripts/conf_files/gnb.sa.band261.u3.32prb.rfsim.conf b/ci-scripts/conf_files/gnb.sa.band261.u3.32prb.rfsim.conf index 2e707d9765..ee34e315bb 100644 --- a/ci-scripts/conf_files/gnb.sa.band261.u3.32prb.rfsim.conf +++ b/ci-scripts/conf_files/gnb.sa.band261.u3.32prb.rfsim.conf @@ -2,8 +2,6 @@ Active_gNBs = ( "gNB-OAI"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; -sa = 1; - gNBs = ( { diff --git a/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.2x2.conf b/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.2x2.conf index 1612b12ebd..dee3042a41 100644 --- a/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.2x2.conf +++ b/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.2x2.conf @@ -2,7 +2,6 @@ Active_gNBs = ( "gNB-OAI"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; -sa = 1; usrp-tx-thread-config = 1; tune-offset = 30720000; diff --git a/ci-scripts/conf_files/gnb.sa.band77.273prb.usrpn310.2x2.conf b/ci-scripts/conf_files/gnb.sa.band77.273prb.usrpn310.2x2.conf index f993f225c9..93e2f8fbc0 100644 --- a/ci-scripts/conf_files/gnb.sa.band77.273prb.usrpn310.2x2.conf +++ b/ci-scripts/conf_files/gnb.sa.band77.273prb.usrpn310.2x2.conf @@ -2,7 +2,6 @@ Active_gNBs = ( "gNB-OAI"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; -sa = 1; usrp-tx-thread-config = 1; gNBs = ( diff --git a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml index 16d78139b1..31d2c8bd75 100644 --- a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml @@ -87,8 +87,8 @@ services: container_name: rfsim5g-oai-cu cap_drop: - ALL - environment: - USE_ADDITIONAL_OPTIONS: --sa --log_config.global_log_options level,nocolor,time + environment: + USE_ADDITIONAL_OPTIONS: --log_config.global_log_options level,nocolor,time ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-ext-dn @@ -109,7 +109,7 @@ services: cap_drop: - ALL environment: - USE_ADDITIONAL_OPTIONS: --sa --rfsim + USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time --rfsimulator.options chanmod --telnetsrv --telnetsrv.listenaddr 192.168.71.171 @@ -137,7 +137,7 @@ services: - NET_ADMIN # for interface bringup - NET_RAW # for ping environment: - USE_ADDITIONAL_OPTIONS: --sa --rfsim --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time -r 106 --numerology 1 -C 3619200000 --uicc0.imsi 208990100001100 --rfsimulator.serveraddr 192.168.71.171 diff --git a/ci-scripts/yaml_files/5g_fdd_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_fdd_rfsimulator/docker-compose.yaml index d284312482..a6103a3815 100644 --- a/ci-scripts/yaml_files/5g_fdd_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_fdd_rfsimulator/docker-compose.yaml @@ -86,7 +86,7 @@ services: cap_drop: - ALL environment: - USE_ADDITIONAL_OPTIONS: --sa -E --rfsim --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: -E --rfsim --log_config.global_log_options level,nocolor,time ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-ext-dn @@ -108,8 +108,8 @@ services: cap_add: - NET_ADMIN # for interface bringup - NET_RAW # for ping - environment: - USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001100 --band 66 -C 2169090000 --CO -400000000 --ssb 378 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + environment: + USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001100 --band 66 -C 2169090000 --CO -400000000 --ssb 378 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb networks: diff --git a/ci-scripts/yaml_files/5g_l2sim_tdd/docker-compose.yaml b/ci-scripts/yaml_files/5g_l2sim_tdd/docker-compose.yaml index 67f64983d2..d37fea78ee 100644 --- a/ci-scripts/yaml_files/5g_l2sim_tdd/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_l2sim_tdd/docker-compose.yaml @@ -88,7 +88,7 @@ services: network_mode: "host" environment: TZ: Europe/Paris - USE_ADDITIONAL_OPTIONS: --sa --nfapi VNF --emulate-l1 --log_config.global_log_options level,time,thread_id,nocolor + USE_ADDITIONAL_OPTIONS: --nfapi VNF --emulate-l1 --log_config.global_log_options level,time,thread_id,nocolor ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-upf @@ -130,7 +130,7 @@ services: environment: TZ: Europe/Paris OPENAIR_DIR: /opt/oai-nr-ue - USE_ADDITIONAL_OPTIONS: --nfapi STANDALONE_PNF --node-number 2 --sa --emulate-l1 --log_config.global_log_options level,time,thread_id,nocolor + USE_ADDITIONAL_OPTIONS: --nfapi STANDALONE_PNF --node-number 2 --emulate-l1 --log_config.global_log_options level,time,thread_id,nocolor ASAN_OPTIONS: detect_leaks=0 devices: - /dev/net/tun:/dev/net/tun diff --git a/ci-scripts/yaml_files/5g_rfsimulator/README.md b/ci-scripts/yaml_files/5g_rfsimulator/README.md index e815047bda..0f71ce2780 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/README.md +++ b/ci-scripts/yaml_files/5g_rfsimulator/README.md @@ -244,7 +244,7 @@ Create the entry for the second UE in `docker-compose.yaml` file as follows: - NET_ADMIN # for interface bringup - NET_RAW # for ping environment: - USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 -C 3619200000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 -C 3619200000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb devices: diff --git a/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml index 448bf45dc4..c563461af8 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml @@ -86,7 +86,7 @@ services: cap_drop: - ALL environment: - USE_ADDITIONAL_OPTIONS: --sa -E --rfsim --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: -E --rfsim --log_config.global_log_options level,nocolor,time ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-ext-dn @@ -109,7 +109,7 @@ services: - NET_ADMIN # for interface bringup - NET_RAW # for ping environment: - USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001100 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001100 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb networks: @@ -133,7 +133,7 @@ services: - NET_ADMIN # for interface bringup - NET_RAW # for ping environment: - USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001101 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001101 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb networks: @@ -157,7 +157,7 @@ services: - NET_ADMIN # for interface bringup - NET_RAW # for ping environment: - USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001102 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001102 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb networks: @@ -181,7 +181,7 @@ services: - NET_ADMIN # for interface bringup - NET_RAW # for ping environment: - USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001103 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001103 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb networks: @@ -205,7 +205,7 @@ services: - NET_ADMIN # for interface bringup - NET_RAW # for ping environment: - USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001104 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001104 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb networks: @@ -229,7 +229,7 @@ services: - NET_ADMIN # for interface bringup - NET_RAW # for ping environment: - USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001105 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001105 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb networks: @@ -253,7 +253,7 @@ services: - NET_ADMIN # for interface bringup - NET_RAW # for ping environment: - USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001106 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001106 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb networks: @@ -277,7 +277,7 @@ services: - NET_ADMIN # for interface bringup - NET_RAW # for ping environment: - USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001107 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001107 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb networks: @@ -301,7 +301,7 @@ services: - NET_ADMIN # for interface bringup - NET_RAW # for ping environment: - USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001108 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001108 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb networks: @@ -325,7 +325,7 @@ services: - NET_ADMIN # for interface bringup - NET_RAW # for ping environment: - USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001109 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001109 -C 3319680000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb networks: diff --git a/ci-scripts/yaml_files/5g_rfsimulator/local-override-ue-gdb.yaml b/ci-scripts/yaml_files/5g_rfsimulator/local-override-ue-gdb.yaml index 83498e44f7..0b2b60210a 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/local-override-ue-gdb.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator/local-override-ue-gdb.yaml @@ -3,4 +3,4 @@ services: privileged: true stdin_open: true tty: true - command: gdb --args /opt/oai-nr-ue/bin/nr-uesoftmodem -O /opt/oai-nr-ue/etc/nr-ue.conf -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001100 -C 3619200000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + command: gdb --args /opt/oai-nr-ue/bin/nr-uesoftmodem -O /opt/oai-nr-ue/etc/nr-ue.conf -E --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001100 -C 3619200000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time diff --git a/ci-scripts/yaml_files/5g_rfsimulator_24prb/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_24prb/docker-compose.yaml index 29f2618365..ae74649a83 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_24prb/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_24prb/docker-compose.yaml @@ -86,7 +86,7 @@ services: cap_drop: - ALL environment: - USE_ADDITIONAL_OPTIONS: --sa --rfsim --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-ext-dn @@ -109,7 +109,7 @@ services: - NET_ADMIN # for interface bringup - NET_RAW # for ping environment: - USE_ADDITIONAL_OPTIONS: --sa --rfsim -r 24 --ssb 24 --numerology 1 -C 3604800000 --uicc0.imsi 208990100001100 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --rfsim -r 24 --ssb 24 --numerology 1 -C 3604800000 --uicc0.imsi 208990100001100 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb networks: diff --git a/ci-scripts/yaml_files/5g_rfsimulator_2x2/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_2x2/docker-compose.yaml index e611ec3a1a..a291046b47 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_2x2/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_2x2/docker-compose.yaml @@ -86,7 +86,7 @@ services: cap_drop: - ALL environment: - USE_ADDITIONAL_OPTIONS: --sa --rfsim --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-ext-dn @@ -110,7 +110,7 @@ services: - NET_ADMIN # for interface bringup - NET_RAW # for ping environment: - USE_ADDITIONAL_OPTIONS: --sa --rfsim -r 273 --numerology 1 --band 78 -C 3450720000 --ssb 1518 --ue-nb-ant-tx 2 --uicc0.imsi 208990100001100 --ue-nb-ant-rx 2 --uecap_file /opt/oai-nr-ue/etc/uecap.xml --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --rfsim -r 273 --numerology 1 --band 78 -C 3450720000 --ssb 1518 --ue-nb-ant-tx 2 --uicc0.imsi 208990100001100 --ue-nb-ant-rx 2 --uecap_file /opt/oai-nr-ue/etc/uecap.xml --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb networks: diff --git a/ci-scripts/yaml_files/5g_rfsimulator_accelleran/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_accelleran/docker-compose.yaml index 8ecb2f9c91..cefcd951d9 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_accelleran/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_accelleran/docker-compose.yaml @@ -6,9 +6,9 @@ services: - ALL network_mode: "host" environment: - USE_ADDITIONAL_OPTIONS: --sa --rfsim --MACRLCs.[0].local_n_address 172.21.16.109 --MACRLCs.[0].remote_n_address 172.21.6.22 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --rfsim --MACRLCs.[0].local_n_address 172.21.16.109 --MACRLCs.[0].remote_n_address 172.21.6.22 --log_config.global_log_options level,nocolor,time volumes: - - ../../conf_files/gnb-du.band78.106prb.rfsim.conf:/opt/oai-gnb/etc/gnb.conf + - ../../conf_files/gnb-du.sa.band78.106prb.rfsim.accelleran.conf:/opt/oai-gnb/etc/gnb.conf healthcheck: test: /bin/bash -c "pgrep nr-softmodem" interval: 10s @@ -24,7 +24,7 @@ services: - NET_RAW # for ping network_mode: "host" environment: - USE_ADDITIONAL_OPTIONS: --sa --rfsim -r 106 --numerology 1 -C 3619200000 --uicc0.imsi 208990100001140 --rfsimulator.serveraddr 127.0.0.1 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --rfsim -r 106 --numerology 1 -C 3619200000 --uicc0.imsi 208990100001140 --rfsimulator.serveraddr 127.0.0.1 --log_config.global_log_options level,nocolor,time depends_on: - oai-du devices: diff --git a/ci-scripts/yaml_files/5g_rfsimulator_e1/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_e1/docker-compose.yaml index c5d4d3aa61..b74aace725 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_e1/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_e1/docker-compose.yaml @@ -70,7 +70,7 @@ services: cap_drop: - ALL environment: - USE_ADDITIONAL_OPTIONS: --sa --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --log_config.global_log_options level,nocolor,time --gNBs.[0].E1_INTERFACE.[0].ipv4_cucp 192.168.77.2 --gNBs.[0].local_s_address 192.168.72.2 ASAN_OPTIONS: detect_leaks=0 @@ -97,7 +97,7 @@ services: cap_drop: - ALL environment: - USE_ADDITIONAL_OPTIONS: --sa --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --log_config.global_log_options level,nocolor,time --gNBs.[0].E1_INTERFACE.[0].ipv4_cucp 192.168.77.2 --gNBs.[0].E1_INTERFACE.[0].ipv4_cuup 192.168.77.3 --gNBs.[0].local_s_address 192.168.73.2 @@ -126,7 +126,7 @@ services: cap_drop: - ALL environment: - USE_ADDITIONAL_OPTIONS: --sa --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --log_config.global_log_options level,nocolor,time --gNBs.[0].gNB_CU_UP_ID 0xe01 --gNBs.[0].E1_INTERFACE.[0].ipv4_cucp 192.168.77.2 --gNBs.[0].E1_INTERFACE.[0].ipv4_cuup 192.168.77.4 @@ -158,7 +158,7 @@ services: cap_drop: - ALL environment: - USE_ADDITIONAL_OPTIONS: --sa --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --log_config.global_log_options level,nocolor,time --gNBs.[0].gNB_CU_UP_ID 0xe02 --gNBs.[0].E1_INTERFACE.[0].ipv4_cucp 192.168.77.2 --gNBs.[0].E1_INTERFACE.[0].ipv4_cuup 192.168.77.5 @@ -190,7 +190,7 @@ services: cap_drop: - ALL environment: - USE_ADDITIONAL_OPTIONS: --sa --rfsim --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time --MACRLCs.[0].local_n_address 192.168.72.3 --MACRLCs.[0].remote_n_address oai-cucp --MACRLCs.[0].local_n_address_f1u 192.168.73.3 @@ -219,7 +219,7 @@ services: cap_drop: - ALL environment: - USE_ADDITIONAL_OPTIONS: --sa --rfsim --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time --gNBs.[0].gNB_DU_ID 0xe01 --gNBs.[0].nr_cellid 87654321 --gNBs.[0].servingCellConfigCommon.[0].physCellId 1 @@ -251,7 +251,7 @@ services: cap_drop: - ALL environment: - USE_ADDITIONAL_OPTIONS: --sa --rfsim --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time --gNBs.[0].gNB_DU_ID 0xe02 --gNBs.[0].nr_cellid 11111111 --gNBs.[0].servingCellConfigCommon.[0].physCellId 2 @@ -286,7 +286,7 @@ services: - NET_ADMIN # for interface bringup - NET_RAW # for ping environment: - USE_ADDITIONAL_OPTIONS: --sa --rfsim --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time -r 106 --numerology 1 -C 3619200000 --uicc0.imsi 208990100001100 --rfsimulator.serveraddr oai-du @@ -314,7 +314,7 @@ services: - NET_ADMIN # for interface bringup - NET_RAW # for ping environment: - USE_ADDITIONAL_OPTIONS: --sa --rfsim --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time -r 106 --numerology 1 -C 3619200000 --uicc0.imsi 208990100001101 --uicc0.nssai_sst 2 --rfsimulator.serveraddr 192.168.78.3 @@ -342,7 +342,7 @@ services: - NET_ADMIN # for interface bringup - NET_RAW # for ping environment: - USE_ADDITIONAL_OPTIONS: --sa --rfsim --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time -r 106 --numerology 1 -C 3619200000 --uicc0.imsi 208990100001102 --uicc0.nssai_sst 3 --rfsimulator.serveraddr 192.168.78.4 diff --git a/ci-scripts/yaml_files/5g_rfsimulator_fr2_32prb/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_fr2_32prb/docker-compose.yaml index de43f8742e..91d7b7c246 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_fr2_32prb/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_fr2_32prb/docker-compose.yaml @@ -87,7 +87,7 @@ services: cap_drop: - ALL environment: - USE_ADDITIONAL_OPTIONS: --sa --rfsim --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time ASAN_OPTIONS: detect_leaks=0 networks: public_net: @@ -109,7 +109,7 @@ services: - NET_ADMIN # for interface bringup - NET_RAW # for ping environment: - USE_ADDITIONAL_OPTIONS: --sa --rfsim + USE_ADDITIONAL_OPTIONS: --rfsim --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time -r 32 --numerology 3 --band 261 -C 27533160000 --ssb 73 ASAN_OPTIONS: detect_leaks=0 diff --git a/ci-scripts/yaml_files/5g_rfsimulator_ntn_geo/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_ntn_geo/docker-compose.yaml index 581dd266c0..5876f5683c 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_ntn_geo/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_ntn_geo/docker-compose.yaml @@ -86,7 +86,7 @@ services: cap_drop: - ALL environment: - USE_ADDITIONAL_OPTIONS: --sa --rfsim --rfsimulator.prop_delay 238.74 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --rfsim --rfsimulator.prop_delay 238.74 --log_config.global_log_options level,nocolor,time ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-ext-dn @@ -110,7 +110,7 @@ services: - NET_ADMIN # for interface bringup - NET_RAW # for ping environment: - USE_ADDITIONAL_OPTIONS: --band 66 -C 2152680000 --CO -400000000 -r 25 --numerology 0 --ssb 48 --sa --rfsim --rfsimulator.prop_delay 238.74 --ntn-koffset 478 --ntn-ta-common 477.48 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --band 66 -C 2152680000 --CO -400000000 -r 25 --numerology 0 --ssb 48 --rfsim --rfsimulator.prop_delay 238.74 --ntn-koffset 478 --ntn-ta-common 477.48 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb networks: diff --git a/ci-scripts/yaml_files/5g_rfsimulator_u0_25prb/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_u0_25prb/docker-compose.yaml index 197c43a476..50871c5131 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_u0_25prb/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_u0_25prb/docker-compose.yaml @@ -86,7 +86,7 @@ services: cap_drop: - ALL environment: - USE_ADDITIONAL_OPTIONS: --sa --rfsim --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-ext-dn @@ -110,7 +110,7 @@ services: - NET_ADMIN # for interface bringup - NET_RAW # for ping environment: - USE_ADDITIONAL_OPTIONS: --sa --rfsim -r 25 --numerology 0 --uicc0.imsi 208990100001100 --band 66 -C 2152680000 --CO -400000000 --ssb 48 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --rfsim -r 25 --numerology 0 --uicc0.imsi 208990100001100 --band 66 -C 2152680000 --CO -400000000 --ssb 48 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb networks: diff --git a/ci-scripts/yaml_files/5g_sa_n310_gnb/docker-compose.yml b/ci-scripts/yaml_files/5g_sa_n310_gnb/docker-compose.yml index 330b4b022b..e93152bd37 100644 --- a/ci-scripts/yaml_files/5g_sa_n310_gnb/docker-compose.yml +++ b/ci-scripts/yaml_files/5g_sa_n310_gnb/docker-compose.yml @@ -12,7 +12,7 @@ services: core: -1 # for core dumps environment: TZ: Europe/Paris - USE_ADDITIONAL_OPTIONS: --sa --tune-offset 20000000 -A 90 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --tune-offset 20000000 -A 90 --log_config.global_log_options level,nocolor,time volumes: - ../../conf_files/gnb.sa.band78.106prb.n310.7ds2u.conf:/opt/oai-gnb/etc/gnb.conf healthcheck: diff --git a/ci-scripts/yaml_files/5g_sa_n310_nrue/docker-compose.yml b/ci-scripts/yaml_files/5g_sa_n310_nrue/docker-compose.yml index 0cf5db7dc4..a0a15ac11e 100644 --- a/ci-scripts/yaml_files/5g_sa_n310_nrue/docker-compose.yml +++ b/ci-scripts/yaml_files/5g_sa_n310_nrue/docker-compose.yml @@ -17,7 +17,7 @@ services: #entrypoint: /bin/bash -c "sleep infinity" environment: TZ: Europe/Paris - USE_ADDITIONAL_OPTIONS: --usrp-args type=n3xx,name=ni-n3xx-31641B9,addr=192.168.10.2 -r 106 --numerology 1 --band 78 -C 3511200000 --sa --ue-fo-compensation --ue-rxgain 65 --tune-offset 20000000 -A 90 --log_config.global_log_options level,nocolor,time --uicc0.imsi 001020000000111 --uicc0.nssai_sd 16777215 + USE_ADDITIONAL_OPTIONS: --usrp-args type=n3xx,name=ni-n3xx-31641B9,addr=192.168.10.2 -r 106 --numerology 1 --band 78 -C 3511200000 --ue-fo-compensation --ue-rxgain 65 --tune-offset 20000000 -A 90 --log_config.global_log_options level,nocolor,time --uicc0.imsi 001020000000111 --uicc0.nssai_sd 16777215 volumes: - ../../conf_files/ue.sa.conf:/opt/oai-nr-ue/etc/nr-ue.conf healthcheck: diff --git a/ci-scripts/yaml_files/sa_aw2s_2x2_gnb/docker-compose.yml b/ci-scripts/yaml_files/sa_aw2s_2x2_gnb/docker-compose.yml index d1f5ae2475..a1baef974a 100644 --- a/ci-scripts/yaml_files/sa_aw2s_2x2_gnb/docker-compose.yml +++ b/ci-scripts/yaml_files/sa_aw2s_2x2_gnb/docker-compose.yml @@ -12,7 +12,6 @@ services: core: -1 # for core dumps environment: TZ: Europe/Paris - USE_ADDITIONAL_OPTIONS: --sa volumes: - ../../conf_files/gnb.sa.band78.51prb.aw2s.ddsuu.2x2.conf:/opt/oai-gnb-aw2s/etc/gnb.conf healthcheck: diff --git a/ci-scripts/yaml_files/sa_aw2s_gnb/docker-compose.yml b/ci-scripts/yaml_files/sa_aw2s_gnb/docker-compose.yml index 03b9914404..9530b3cd5c 100644 --- a/ci-scripts/yaml_files/sa_aw2s_gnb/docker-compose.yml +++ b/ci-scripts/yaml_files/sa_aw2s_gnb/docker-compose.yml @@ -12,7 +12,6 @@ services: core: -1 # for core dumps environment: TZ: Europe/Paris - USE_ADDITIONAL_OPTIONS: --sa volumes: - ../../conf_files/gnb.sa.band78.51prb.aw2s.ddsuu.conf:/opt/oai-gnb-aw2s/etc/gnb.conf healthcheck: diff --git a/ci-scripts/yaml_files/sa_b200_gnb/docker-compose.yml b/ci-scripts/yaml_files/sa_b200_gnb/docker-compose.yml index b11fc2d7fa..7fe7db5317 100644 --- a/ci-scripts/yaml_files/sa_b200_gnb/docker-compose.yml +++ b/ci-scripts/yaml_files/sa_b200_gnb/docker-compose.yml @@ -11,7 +11,7 @@ services: core: -1 # for core dumps environment: USE_B2XX: 'yes' - USE_ADDITIONAL_OPTIONS: --sa --RUs.[0].sdr_addrs serial=30C51D4 --telnetsrv --telnetsrv.shrmod ci --continuous-tx --log_config.global_log_options level,nocolor,time,line_num,function + USE_ADDITIONAL_OPTIONS: --RUs.[0].sdr_addrs serial=30C51D4 --telnetsrv --telnetsrv.shrmod ci --continuous-tx --log_config.global_log_options level,nocolor,time,line_num,function devices: - /dev/bus/usb/:/dev/bus/usb/ volumes: diff --git a/ci-scripts/yaml_files/sa_e1_b200_gnb/docker-compose.yml b/ci-scripts/yaml_files/sa_e1_b200_gnb/docker-compose.yml index e1893765d1..6c3940d306 100644 --- a/ci-scripts/yaml_files/sa_e1_b200_gnb/docker-compose.yml +++ b/ci-scripts/yaml_files/sa_e1_b200_gnb/docker-compose.yml @@ -7,8 +7,7 @@ services: ulimits: core: -1 # for core dumps environment: - USE_ADDITIONAL_OPTIONS: --sa - --telnetsrv --telnetsrv.listenport 9090 --telnetsrv.shrmod ci + USE_ADDITIONAL_OPTIONS: --telnetsrv --telnetsrv.listenport 9090 --telnetsrv.shrmod ci --log_config.global_log_options level,nocolor,time,line_num,function volumes: - ../../conf_files/gnb-cucp.sa.f1.quectel.conf:/opt/oai-gnb/etc/gnb.conf @@ -35,8 +34,7 @@ services: ulimits: core: -1 # for core dumps environment: - USE_ADDITIONAL_OPTIONS: --sa - --log_config.global_log_options level,nocolor,time,line_num,function + USE_ADDITIONAL_OPTIONS: --log_config.global_log_options level,nocolor,time,line_num,function volumes: - ../../conf_files/gnb-cuup.sa.f1.quectel.conf:/opt/oai-gnb/etc/gnb.conf # for performance reasons, we use host mode: in bridge mode, we have @@ -63,8 +61,7 @@ services: core: -1 # for core dumps environment: USE_B2XX: 'yes' - USE_ADDITIONAL_OPTIONS: --sa - --RUs.[0].sdr_addrs serial=30C51D4 + USE_ADDITIONAL_OPTIONS: --RUs.[0].sdr_addrs serial=30C51D4 --continuous-tx -E --telnetsrv --telnetsrv.listenport 9091 --telnetsrv.shrmod ci --log_config.global_log_options level,nocolor,time,line_num,function diff --git a/ci-scripts/yaml_files/sa_f1_b200_gnb/docker-compose.yml b/ci-scripts/yaml_files/sa_f1_b200_gnb/docker-compose.yml index 4965111c32..2c1ab75e92 100644 --- a/ci-scripts/yaml_files/sa_f1_b200_gnb/docker-compose.yml +++ b/ci-scripts/yaml_files/sa_f1_b200_gnb/docker-compose.yml @@ -7,8 +7,7 @@ services: ulimits: core: -1 # for core dumps environment: - USE_ADDITIONAL_OPTIONS: --sa - --telnetsrv --telnetsrv.listenport 9090 --telnetsrv.shrmod ci + USE_ADDITIONAL_OPTIONS: --telnetsrv --telnetsrv.listenport 9090 --telnetsrv.shrmod ci --log_config.global_log_options level,nocolor,time,line_num,function volumes: - ../../conf_files/gnb-cu.sa.f1.conf:/opt/oai-gnb/etc/gnb.conf @@ -37,7 +36,7 @@ services: core: -1 # for core dumps environment: USE_B2XX: 'yes' - USE_ADDITIONAL_OPTIONS: --sa --RUs.[0].sdr_addrs serial=30C51D4 --continuous-tx + USE_ADDITIONAL_OPTIONS: --RUs.[0].sdr_addrs serial=30C51D4 --continuous-tx --telnetsrv --telnetsrv.listenport 9091 --telnetsrv.shrmod ci --gNBs.[0].min_rxtxtime 2 --gNBs.[0].do_CSIRS 1 --gNBs.[0].do_SRS 0 --L1s.[0].max_ldpc_iterations 20 --log_config.global_log_options level,nocolor,time,line_num,function diff --git a/ci-scripts/yaml_files/sa_fhi_7.2_benetel550_gnb/docker-compose.yml b/ci-scripts/yaml_files/sa_fhi_7.2_benetel550_gnb/docker-compose.yml index 1228160fbb..a0bc415730 100644 --- a/ci-scripts/yaml_files/sa_fhi_7.2_benetel550_gnb/docker-compose.yml +++ b/ci-scripts/yaml_files/sa_fhi_7.2_benetel550_gnb/docker-compose.yml @@ -10,7 +10,7 @@ services: container_name: oai-gnb environment: TZ: Europe/Paris - USE_ADDITIONAL_OPTIONS: --sa --thread-pool 6,7,8,9 + USE_ADDITIONAL_OPTIONS: --thread-pool 6,7,8,9 devices: - /dev/vfio:/dev/vfio/ volumes: diff --git a/ci-scripts/yaml_files/sa_fhi_7.2_vvdn_gnb/docker-compose.yml b/ci-scripts/yaml_files/sa_fhi_7.2_vvdn_gnb/docker-compose.yml index 4ea7498639..7ea8b576d4 100644 --- a/ci-scripts/yaml_files/sa_fhi_7.2_vvdn_gnb/docker-compose.yml +++ b/ci-scripts/yaml_files/sa_fhi_7.2_vvdn_gnb/docker-compose.yml @@ -10,7 +10,7 @@ services: container_name: oai-gnb environment: TZ: Europe/Paris - USE_ADDITIONAL_OPTIONS: --sa --thread-pool 6,7,8,9 + USE_ADDITIONAL_OPTIONS: --thread-pool 6,7,8,9 devices: - /dev/vfio:/dev/vfio/ volumes: diff --git a/ci-scripts/yaml_files/sa_sc_b200_gnb/docker-compose.yml b/ci-scripts/yaml_files/sa_sc_b200_gnb/docker-compose.yml index 70773fd1a9..f0b86f4c33 100644 --- a/ci-scripts/yaml_files/sa_sc_b200_gnb/docker-compose.yml +++ b/ci-scripts/yaml_files/sa_sc_b200_gnb/docker-compose.yml @@ -11,7 +11,7 @@ services: core: -1 # for core dumps environment: USE_B2XX: 'yes' - USE_ADDITIONAL_OPTIONS: --sa --RUs.[0].sdr_addrs serial=30C51D4 --telnetsrv --telnetsrv.shrmod ci --continuous-tx --log_config.global_log_options level,nocolor,time,line_num,function -E + USE_ADDITIONAL_OPTIONS: --RUs.[0].sdr_addrs serial=30C51D4 --telnetsrv --telnetsrv.shrmod ci --continuous-tx --log_config.global_log_options level,nocolor,time,line_num,function -E devices: - /dev/bus/usb/:/dev/bus/usb/ volumes: From dc7e6e5638fe5a1e86d56c301995177d45a27b5f Mon Sep 17 00:00:00 2001 From: Reem Bahsoun Date: Thu, 24 Oct 2024 10:09:36 +0200 Subject: [PATCH 63/75] remove sa param from some targets/PROJECTS/GENERIC-NR-5GC/ conf files --- .../GENERIC-NR-5GC/CONF/gnb-vnf.sa.band78.273prb.aerial.conf | 1 - .../PROJECTS/GENERIC-NR-5GC/CONF/gnb-vnf.sa.cbrs.aerial.conf | 1 - .../GENERIC-NR-5GC/CONF/gnb.sa.band1.u0.52PRB.usrpb210.conf | 2 -- .../GENERIC-NR-5GC/CONF/gnb.sa.band257.u3.32prb.usrpx410.conf | 2 -- .../GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.52PRB.usrpb210.conf | 2 +- 5 files changed, 1 insertion(+), 7 deletions(-) diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-vnf.sa.band78.273prb.aerial.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-vnf.sa.band78.273prb.aerial.conf index 20ba798023..b149913224 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-vnf.sa.band78.273prb.aerial.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-vnf.sa.band78.273prb.aerial.conf @@ -2,7 +2,6 @@ Active_gNBs = ( "gNB-OAI"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; -sa = 1; nfapi = "AERIAL"; pdcp-drop = 1; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-vnf.sa.cbrs.aerial.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-vnf.sa.cbrs.aerial.conf index 5346a58aae..8a058b9f92 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-vnf.sa.cbrs.aerial.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-vnf.sa.cbrs.aerial.conf @@ -2,7 +2,6 @@ Active_gNBs = ( "gNB-OAI"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; -sa = 1; nfapi = "AERIAL"; gNBs = diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band1.u0.52PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band1.u0.52PRB.usrpb210.conf index c5657670a8..1c15b40967 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band1.u0.52PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band1.u0.52PRB.usrpb210.conf @@ -2,8 +2,6 @@ Active_gNBs = ( "gNB-OAI"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; -sa = 1; - gNBs = ( { diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band257.u3.32prb.usrpx410.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band257.u3.32prb.usrpx410.conf index 27f69605b2..d12752130f 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band257.u3.32prb.usrpx410.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band257.u3.32prb.usrpx410.conf @@ -2,8 +2,6 @@ Active_gNBs = ( "gNB-OAI"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; -sa = 1; - gNBs = ( { diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.52PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.52PRB.usrpb210.conf index 9e6f84f37b..6ef35cb6c8 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.52PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.52PRB.usrpb210.conf @@ -1,5 +1,5 @@ # This file is derived from ./phy-demo/oai/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.24PRB.usrpb210.conf -# ./nr-uesoftmodem -r 24 --numerology 1 --band 41 -C 2593320000 --ssb 24 --rfsim --sa +# ./nr-uesoftmodem -r 24 --numerology 1 --band 41 -C 2593320000 --ssb 24 --rfsim Active_gNBs = ( "gNB-OAI"); # Asn1_verbosity, choice in: none, info, annoying From 7dcf80398a4195932b6c5426184d0ae71ef5a2f4 Mon Sep 17 00:00:00 2001 From: Reem Bahsoun Date: Tue, 8 Oct 2024 09:01:29 +0200 Subject: [PATCH 64/75] Update docs and README files to align with modifications in config files --- common/utils/LOG/DOC/lttng_logs.md | 2 +- common/utils/telnetsrv/telnetsrv_rrc.c | 2 +- common/utils/websrv/DOC/websrvuse.md | 2 +- doc/E1AP/E1-design.md | 8 ++--- doc/F1AP/F1-design.md | 4 +-- doc/L2NFAPI.md | 4 +-- doc/LDPC_T2_OFFLOAD_SETUP.md | 2 +- doc/NR_SA_Tutorial_COTS_UE.md | 6 ++-- doc/NR_SA_Tutorial_OAI_nrUE.md | 16 ++++----- doc/ORAN_FHI7.2_Tutorial.md | 4 +-- doc/RUNMODEM.md | 33 ++++++++++--------- doc/RUN_NR_multiple_BWPs.md | 4 +-- doc/TESTBenches.md | 4 +-- doc/TESTING_GNB_W_COTS_UE.md | 2 +- doc/handover-tutorial.md | 8 ++--- doc/iqrecordplayer_usage.md | 4 +-- docker/README.md | 2 +- openair1/PHY/CODING/DOC/LDPCImplementation.md | 4 +-- .../TOOLS/DOC/channel_simulation.md | 6 ++-- openair2/E2AP/README.md | 14 ++++---- radio/rfsimulator/README.md | 2 +- 21 files changed, 68 insertions(+), 65 deletions(-) diff --git a/common/utils/LOG/DOC/lttng_logs.md b/common/utils/LOG/DOC/lttng_logs.md index 4b4eda43f5..8918cbffe4 100644 --- a/common/utils/LOG/DOC/lttng_logs.md +++ b/common/utils/LOG/DOC/lttng_logs.md @@ -65,7 +65,7 @@ Note: only LTTng 2.3.8 is supported. 1. **Run gNB:** ```bash - ./$binary_path -O $configuration_file PARALLEL_SINGLE_THREAD --rfsimulator.serveraddr server --rfsim --sa -E + ./$binary_path -O $configuration_file PARALLEL_SINGLE_THREAD --rfsimulator.serveraddr server --rfsim -E ``` ## Verifying Tracepoints diff --git a/common/utils/telnetsrv/telnetsrv_rrc.c b/common/utils/telnetsrv/telnetsrv_rrc.c index 1c5e3765cb..d7e72983f7 100644 --- a/common/utils/telnetsrv/telnetsrv_rrc.c +++ b/common/utils/telnetsrv/telnetsrv_rrc.c @@ -49,7 +49,7 @@ * ./build_oai --build-lib telnetsrv * * Loading the module: - * sudo ./nr-softmodem --sa -E --rfsim --log_config.global_log_options level,nocolor,time -O ~/gnb.sa.band78.106prb.rfsim.conf --telnetsrv --telnetsrv.shrmod rrc + * sudo ./nr-softmodem -E --rfsim --log_config.global_log_options level,nocolor,time -O ~/gnb.sa.band78.106prb.rfsim.conf --telnetsrv --telnetsrv.shrmod rrc */ static int get_single_ue_id(void) diff --git a/common/utils/websrv/DOC/websrvuse.md b/common/utils/websrv/DOC/websrvuse.md index 23a59065f0..5e3b4dac21 100644 --- a/common/utils/websrv/DOC/websrvuse.md +++ b/common/utils/websrv/DOC/websrvuse.md @@ -277,7 +277,7 @@ To trigger the back-end use the `--websrv` option, possibly modifying the parame `./nr-softmodem -O /usr/local/oai/conf/gnb.band78.sa.fr1.106PRB.usrpb210.conf --rfsim --rfsimulator.serveraddr server --telnetsrv --telnetsrv.listenstdin --websrv --rfsimulator.options chanmod` -.`/nr-uesoftmodem -O /usr/local/oai/conf/nrue_sim.conf --sa --numerology 1 -r 106 -C 3649440000 --rfsim --rfsimulator.serveraddr 127.0.0.1 --websrv --telnetsrv --websrv.listenport 8092 --telnetsrv.listenport 8091` +`./nr-uesoftmodem -O /usr/local/oai/conf/nrue_sim.conf --numerology 1 -r 106 -C 3649440000 --rfsim --rfsimulator.serveraddr 127.0.0.1 --websrv --telnetsrv --websrv.listenport 8092 --telnetsrv.listenport 8091` diff --git a/doc/E1AP/E1-design.md b/doc/E1AP/E1-design.md index 4dd042f87d..e98c0ac581 100644 --- a/doc/E1AP/E1-design.md +++ b/doc/E1AP/E1-design.md @@ -139,7 +139,7 @@ Note: A 5G core must be running at this point. Steps to start the OAI 5G core ca 1. Start the CUCP first by running the following command ``` -sudo ./nr-softmodem -O ../../../ci-scripts/conf_files/gnb-cucp.sa.f1.conf --gNBs.[0].min_rxtxtime 6 --sa +sudo ./nr-softmodem -O ../../../ci-scripts/conf_files/gnb-cucp.sa.f1.conf --gNBs.[0].min_rxtxtime 6 ``` Note that `min_rxtxtime` should be set to `6` only when you are connecting an OAI UE to the gNB. @@ -148,12 +148,12 @@ Note that `min_rxtxtime` should be set to `6` only when you are connecting an OA CUUP (has its own executable): ``` -sudo ./nr-cuup -O ../../../ci-scripts/conf_files/gnb-cuup.sa.f1.conf --sa +sudo ./nr-cuup -O ../../../ci-scripts/conf_files/gnb-cuup.sa.f1.conf ``` DU: ``` -sudo ./nr-softmodem -O ../../../ci-scripts/conf_files/gNB_SA_DU.conf --rfsim --sa +sudo ./nr-softmodem -O ../../../ci-scripts/conf_files/gNB_SA_DU.conf --rfsim ``` You need to use `--rfsim` if you are running the test with rfsimulator. @@ -162,7 +162,7 @@ You need to use `--rfsim` if you are running the test with rfsimulator. OAI UE: ``` -sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --sa --rfsimulator.serveraddr 127.0.0.1 +sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --rfsimulator.serveraddr 127.0.0.1 ``` # 3. Configuration file IP addresses of network functions diff --git a/doc/F1AP/F1-design.md b/doc/F1AP/F1-design.md index 06f8a3115b..762eb67903 100644 --- a/doc/F1AP/F1-design.md +++ b/doc/F1AP/F1-design.md @@ -185,8 +185,8 @@ To start CU/DU, you use `./nr-softmodem` with the appropriate configuration files, for instance: ``` -sudo cmake_targets/ran_build/build/nr-softmodem --sa -O ci-scripts/conf_files/gnb-cu.sa.band78.106prb.conf -sudo cmake_targets/ran_build/build/nr-softmodem --sa -O ci-scripts/conf_files/gnb-du.sa.band78.106prb.rfsim.conf +sudo cmake_targets/ran_build/build/nr-softmodem -O ci-scripts/conf_files/gnb-cu.sa.band78.106prb.conf +sudo cmake_targets/ran_build/build/nr-softmodem -O ci-scripts/conf_files/gnb-du.sa.band78.106prb.rfsim.conf ``` These files are tested in the CI, and are configured for use in docker, diff --git a/doc/L2NFAPI.md b/doc/L2NFAPI.md index d7bba0bfeb..5ade1d494b 100644 --- a/doc/L2NFAPI.md +++ b/doc/L2NFAPI.md @@ -60,11 +60,11 @@ $ sudo -E ./build/proxy $number_of_ues --nr ### Start gNB ```bash -$ sudo -E ./nr-softmodem -O ../ci-scripts/conf_files/episci/proxy_rcc.band78.tm1.106PRB.nfapi.conf --nfapi VNF --noS1 --sa --emulate-l1 +$ sudo -E ./nr-softmodem -O ../ci-scripts/conf_files/episci/proxy_rcc.band78.tm1.106PRB.nfapi.conf --nfapi VNF --noS1 --emulate-l1 ``` ### Start UE ```bash -$ sudo -E ./nr-uesoftmodem -O ../ci-scripts/conf_files/nrue.uicc.conf --nfapi STANDALONE_PNF --node-number 2 --sa --emulate-l1 +$ sudo -E ./nr-uesoftmodem -O ../ci-scripts/conf_files/nrue.uicc.conf --nfapi STANDALONE_PNF --node-number 2 --emulate-l1 ``` ### EpiSci's Documentation A more detailed tutorial is available on the [EpiSci GitHub Repository](https://github.com/EpiSci/oai-lte-5g-multi-ue-proxy#readme). diff --git a/doc/LDPC_T2_OFFLOAD_SETUP.md b/doc/LDPC_T2_OFFLOAD_SETUP.md index df78590b5d..93d72284f9 100644 --- a/doc/LDPC_T2_OFFLOAD_SETUP.md +++ b/doc/LDPC_T2_OFFLOAD_SETUP.md @@ -132,7 +132,7 @@ Offload of the channel encoding and decoding to the AMD Xilinx T2 card is enable cd ~/openairinterface5g source oaienv cd cmake_targets/ran_build/build -sudo ./nr-softmodem --sa -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --ldpc-offload-enable --ldpc_offload.dpdk_dev 01:00.0 +sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --ldpc-offload-enable --ldpc_offload.dpdk_dev 01:00.0 ``` # Limitations diff --git a/doc/NR_SA_Tutorial_COTS_UE.md b/doc/NR_SA_Tutorial_COTS_UE.md index 7fc8b27a9a..cccbdd183a 100644 --- a/doc/NR_SA_Tutorial_COTS_UE.md +++ b/doc/NR_SA_Tutorial_COTS_UE.md @@ -106,18 +106,18 @@ docker compose up -d ### USRP B210 ```bash cd ~/openairinterface5g/cmake_targets/ran_build/build -sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --sa -E --continuous-tx +sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf -E --continuous-tx ``` ### USRP N300 ```bash cd ~/openairinterface5g/cmake_targets/ran_build/build -sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band77.fr1.273PRB.2x2.usrpn300.conf --sa --usrp-tx-thread-config 1 +sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band77.fr1.273PRB.2x2.usrpn300.conf --usrp-tx-thread-config 1 ``` ### USRP X300 ```bash cd ~/openairinterface5g/cmake_targets/ran_build/build -sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band77.fr1.273PRB.2x2.usrpn300.conf --sa --usrp-tx-thread-config 1 -E --continuous-tx +sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band77.fr1.273PRB.2x2.usrpn300.conf --usrp-tx-thread-config 1 -E --continuous-tx ``` # 5. Run UE diff --git a/doc/NR_SA_Tutorial_OAI_nrUE.md b/doc/NR_SA_Tutorial_OAI_nrUE.md index 23b50c4ab4..34f36c6bf6 100644 --- a/doc/NR_SA_Tutorial_OAI_nrUE.md +++ b/doc/NR_SA_Tutorial_OAI_nrUE.md @@ -97,24 +97,24 @@ docker compose up -d ### USRP B210 ```bash cd ~/openairinterface5g/cmake_targets/ran_build/build -sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --gNBs.[0].min_rxtxtime 6 --sa -E --continuous-tx +sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --gNBs.[0].min_rxtxtime 6 -E --continuous-tx ``` ### USRP N300 ```bash cd ~/openairinterface5g/cmake_targets/ran_build/build -sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band77.fr1.273PRB.2x2.usrpn300.conf --gNBs.[0].min_rxtxtime 6 --sa --usrp-tx-thread-config 1 +sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band77.fr1.273PRB.2x2.usrpn300.conf --gNBs.[0].min_rxtxtime 6 --usrp-tx-thread-config 1 ``` ### USRP X300 ```bash cd ~/openairinterface5g/cmake_targets/ran_build/build -sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band77.fr1.273PRB.2x2.usrpn300.conf --gNBs.[0].min_rxtxtime 6 --sa --usrp-tx-thread-config 1 -E --continuous-tx +sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band77.fr1.273PRB.2x2.usrpn300.conf --gNBs.[0].min_rxtxtime 6 --usrp-tx-thread-config 1 -E --continuous-tx ``` ### RFsimulator ```bash cd ~/openairinterface5g/cmake_targets/ran_build/build -sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --gNBs.[0].min_rxtxtime 6 --rfsim --sa +sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --gNBs.[0].min_rxtxtime 6 --rfsim ``` ### RFsimulator in FR2 @@ -134,7 +134,7 @@ Important notes: Run OAI nrUE with USRP B210 ```bash cd ~/openairinterface5g/cmake_targets/ran_build/build -sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --ue-fo-compensation --sa -E --uicc0.imsi 001010000000001 +sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --ue-fo-compensation -E --uicc0.imsi 001010000000001 ``` ### RFsimulator @@ -145,7 +145,7 @@ Important notes: Run OAI nrUE with RFsimulator ```bash cd ~/openairinterface5g/cmake_targets/ran_build/build -sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --sa --uicc0.imsi 001010000000001 --rfsim +sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --uicc0.imsi 001010000000001 --rfsim ``` ### RFsimulator in FR2 @@ -156,7 +156,7 @@ Important notes: Run OAI nrUE with RFsimulator in FR2 ```bash cd ~/openairinterface5g/cmake_targets/ran_build/build -sudo ./nr-uesoftmodem -r 32 --numerology 3 --band 257 -C 27533280000 --sa --uicc0.imsi 001010000000001 --ssb 72 --rfsim +sudo ./nr-uesoftmodem -r 32 --numerology 3 --band 257 -C 27533280000 --uicc0.imsi 001010000000001 --ssb 72 --rfsim ``` ### Connection to an NG-Core @@ -188,7 +188,7 @@ The UE configuration must match the one of the network's AMF. The nrUE can conne When running the `nr-uesoftmodem`, one can specify the nrUE configuration file using the `-O` option. E.g.: ```bash -sudo ./nr-uesoftmodem --rfsim --rfsimulator.serveraddr 127.0.0.1 --sa -r 106 --numerology 1 --band 78 -C 3619200000 -O ~/nrue.uicc.conf +sudo ./nr-uesoftmodem --rfsim --rfsimulator.serveraddr 127.0.0.1 -r 106 --numerology 1 --band 78 -C 3619200000 -O ~/nrue.uicc.conf ``` The CL option `--uicc0.imsi` can override the IMSI value in the configuration file if necessary (e.g. when running multiple UEs): `--uicc0.imsi 001010000000001`. diff --git a/doc/ORAN_FHI7.2_Tutorial.md b/doc/ORAN_FHI7.2_Tutorial.md index 1b74e6cdd3..a077778162 100644 --- a/doc/ORAN_FHI7.2_Tutorial.md +++ b/doc/ORAN_FHI7.2_Tutorial.md @@ -821,13 +821,13 @@ xRAN SRS reception is not supported. Run the `nr-softmodem` from the build directory: ```bash cd ~/openairinterface5g/cmake_targets/ran_build/build -sudo ./nr-softmodem -O --sa --thread-pool +sudo ./nr-softmodem -O --thread-pool ``` **Warning**: Make sure that the configuration file you add after the `-O` option is adapted to your machine, especially to its isolated cores. **Note**: You may run OAI with O-RAN 7.2 Fronthaul without a RU attached (e.g. for benchmarking). -In such case, you would generate artificial traffic by replacing the `--sa` option by the `--phy-test` option. +In such case, you would generate artificial traffic by adding the `--phy-test` option. You have to set the thread pool option to non-isolated CPUs, since the thread pool is used for L1 processing which should not interfere with DPDK threads. diff --git a/doc/RUNMODEM.md b/doc/RUNMODEM.md index fef128e2f7..f20e5829dc 100644 --- a/doc/RUNMODEM.md +++ b/doc/RUNMODEM.md @@ -62,6 +62,8 @@ OAI supports different radio heads, the following are tested in the CI: ## NSA setup with COTS UE This setup requires an EPC, an OAI eNB and gNB, and a COTS Phone. A dedicated page describe the setup can be found [here](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home/gNB-COTS-UE-testing). +The `--nsa` flag must be used to run gNB in non-standalone mode. + ### Launch eNB @@ -72,29 +74,30 @@ sudo ./lte-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7 ### Launch gNB ```bash -sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf +sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf --nsa ``` You should see the X2 messages in Wireshark and at the eNB. ## SA setup with OAI NR-UE -The sa flag is used to run gNB in standalone mode. +The standalone mode is the default mode. -In order to run gNB and UE in standalone mode, the `--sa` flag is needed. +It is not necessary to run either the gNB or the UE using the `--sa` flag in the command line for standalone mode. -At the gNB the `--sa` flag does the following: -- The RRC encodes SIB1 according to the configuration file and transmits it through NR-BCCH-DL-SCH. +The default (SA) mode does the following: +- At the gNB: +* The RRC encodes SIB1 according to the configuration file and transmits it through NR-BCCH-DL-SCH. -At the UE the --sa flag will: -- Decode SIB1 and starts the 5G NR Initial Access Procedure for SA: +- At the UE: +* Decode SIB1 and starts the 5G NR Initial Access Procedure for SA: 1) 5G-NR RRC Connection Setup 2) NAS Authentication and Security 3) 5G-NR AS Security Procedure 4) 5G-NR RRC Reconfiguration 5) Start Downlink and Uplink Data Transfer -Command line parameters for UE in `--sa` mode: +Command line parameters for UE in standalone mode: - `-C` : downlink carrier frequency in Hz (default value 0) - `--CO` : uplink frequency offset for FDD in Hz (default value 0) - `--numerology` : numerology index (default value 1) @@ -111,8 +114,8 @@ To simplify the configuration for the user testing OAI UE with OAI gNB, the latt You can run this, using USRPs, on two separate machines: ```shell -sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --gNBs.[0].min_rxtxtime 6 --sa -sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --ssb 516 --sa +sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --gNBs.[0].min_rxtxtime 6 +sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --ssb 516 ``` With the **RFsimulator** (on the same machine), just add the option `--rfsim` to both gNB and NR UE command lines. @@ -159,7 +162,7 @@ This option is available for the following combinations of operation modes and g e.g. ```shell -sudo ./nr-uesoftmodem --sa -r 106 --numerology 1 --band 78 -C 3319680000 --ue-nb-ant-tx 2 --ue-nb-ant-rx 2 --uecap_file /opt/oai-nr-ue/etc/uecap.xml +sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3319680000 --ue-nb-ant-tx 2 --ue-nb-ant-rx 2 --uecap_file /opt/oai-nr-ue/etc/uecap.xml ``` ## How to run a NTN configuration @@ -257,7 +260,7 @@ To enable this feature, the `disable_harq` flag has to be added to the gNB conf So with these modifications to the file `targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.25PRB.usrpx300.conf` an example gNB command for FDD, 5 MHz BW, 15 kHz SCS, transparent GEO satellite 5G NR NTN is this: ``` cd cmake_targets -sudo ./ran_build/build/nr-softmodem -O ../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.25PRB.usrpx300.conf --sa --rfsim --rfsimulator.prop_delay 238.74 +sudo ./ran_build/build/nr-softmodem -O ../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.25PRB.usrpx300.conf --rfsim --rfsimulator.prop_delay 238.74 ``` To configure NTN gNB with 32 HARQ processes in downlink and uplink, add these settings in conf files under section `gNBs.[0]` @@ -276,7 +279,7 @@ To simulate a LEO satellite channel model with rfsimulator in UL (DL is simulate So with these modifications to the file `targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.25PRB.usrpx300.conf` an example gNB command for FDD, 5 MHz BW, 15 kHz SCS, trasparent LEO satellite 5G NR NTN is this: ``` cd cmake_targets -sudo ./ran_build/build/nr-softmodem -O ../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.25PRB.usrpx300.conf --sa --rfsim --rfsimulator.prop_delay 20 +sudo ./ran_build/build/nr-softmodem -O ../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.25PRB.usrpx300.conf --rfsim --rfsimulator.prop_delay 20 ``` ### NR UE @@ -288,7 +291,7 @@ At UE side, there are two main parameters to cope with the large NTN propagation So an example NR UE command for FDD, 5MHz BW, 15 kHz SCS, transparent GEO satellite 5G NR NTN is this: ``` cd cmake_targets -sudo ./ran_build/build/nr-uesoftmodem --band 66 -C 2152680000 --CO -400000000 -r 25 --numerology 0 --ssb 48 --sa --rfsim --rfsimulator.prop_delay 238.74 --ntn-koffset 478 --ntn-ta-common 477.48 +sudo ./ran_build/build/nr-uesoftmodem --band 66 -C 2152680000 --CO -400000000 -r 25 --numerology 0 --ssb 48 --rfsim --rfsimulator.prop_delay 238.74 --ntn-koffset 478 --ntn-ta-common 477.48 ``` For LEO satellites a third parameter specifying the NTN propagation delay drift has ben added, ta-CommonDrift. @@ -298,7 +301,7 @@ Also, to perform an autonomous TA update based on the DL drift, the boolean para So an example NR UE command for FDD, 5MHz BW, 15 kHz SCS, transparent LEO satellite 5G NR NTN is this: ``` cd cmake_targets -sudo ./ran_build/build/nr-uesoftmodem --band 66 -C 2152680000 --CO -400000000 -r 25 --numerology 0 --ssb 48 --sa --rfsim --rfsimulator.prop_delay 20 --rfsimulator.options chanmod -O ../targets/PROJECTS/GENERIC-NR-5GC/CONF/channelmod_rfsimu_LEO_satellite.conf --time-sync-I 0.2 --ntn-koffset 40 --ntn-ta-common 37.74 --ntn-ta-commondrift -50 --autonomous-ta +sudo ./ran_build/build/nr-uesoftmodem --band 66 -C 2152680000 --CO -400000000 -r 25 --numerology 0 --ssb 48 --rfsim --rfsimulator.prop_delay 20 --rfsimulator.options chanmod -O ../targets/PROJECTS/GENERIC-NR-5GC/CONF/channelmod_rfsimu_LEO_satellite.conf --time-sync-I 0.2 --ntn-koffset 40 --ntn-ta-common 37.74 --ntn-ta-commondrift -50 --autonomous-ta ``` # Specific OAI modes diff --git a/doc/RUN_NR_multiple_BWPs.md b/doc/RUN_NR_multiple_BWPs.md index c6b497043a..7b79374fd7 100644 --- a/doc/RUN_NR_multiple_BWPs.md +++ b/doc/RUN_NR_multiple_BWPs.md @@ -42,10 +42,10 @@ Each dedicated BWP must have: ## gNB command: ``` - sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --gNBs.[0].min_rxtxtime 6 --rfsim --sa + sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --gNBs.[0].min_rxtxtime 6 --rfsim ``` ## UE command: ``` - sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --sa --uicc0.imsi 208990000000001 --rfsimulator.serveraddr 127.0.0.1 + sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --uicc0.imsi 208990000000001 --rfsimulator.serveraddr 127.0.0.1 ``` diff --git a/doc/TESTBenches.md b/doc/TESTBenches.md index 7e67e78d41..532ef30584 100644 --- a/doc/TESTBenches.md +++ b/doc/TESTBenches.md @@ -244,10 +244,10 @@ steps look like this: `ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.conf` (note that the path is relative to the directory in which the docker-compose file is located). Further, an environment variable `USE_ADDITIONAL_OPTIONS` is declared, - referencing the relevant options `--sa -E --rfsim` (you can ignore logging + referencing the relevant options `-E --rfsim` (you can ignore logging options). You would therefore run the gNB from source like this: ``` - sudo ./cmake_targets/ran_build/build/nr-softmodem -O ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.conf --sa -E --rfsim + sudo ./cmake_targets/ran_build/build/nr-softmodem -O ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.conf -E --rfsim ``` To run this on your local machine, assuming you have a 5GC installed, you might need to change IP information in the config to match your core. diff --git a/doc/TESTING_GNB_W_COTS_UE.md b/doc/TESTING_GNB_W_COTS_UE.md index be53cb371c..f44e140e22 100644 --- a/doc/TESTING_GNB_W_COTS_UE.md +++ b/doc/TESTING_GNB_W_COTS_UE.md @@ -220,7 +220,7 @@ The **-E** option is **NOT supported** when using a a N300 USRP Execute: ``` -~/openairinterface5g/cmake_targets/ran_build/build$ sudo ./nr-softmodem -O **YOUR_GNB_CONF_FILE** -E | tee **YOUR_LOG_FILE** +~/openairinterface5g/cmake_targets/ran_build/build$ sudo ./nr-softmodem -O **YOUR_GNB_CONF_FILE** -E --nsa | tee **YOUR_LOG_FILE** ``` diff --git a/doc/handover-tutorial.md b/doc/handover-tutorial.md index 8595fe05d4..a367de868a 100644 --- a/doc/handover-tutorial.md +++ b/doc/handover-tutorial.md @@ -48,15 +48,15 @@ done, follow below steps to trigger a handover: Start the CU including telnet support: - sudo ./nr-softmodem --sa -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-cu.sa.f1.conf --telnetsrv --telnetsrv.shrmod ci + sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-cu.sa.f1.conf --telnetsrv --telnetsrv.shrmod ci Start DU0: - sudo ./nr-softmodem --sa --rfsim -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-du.sa.band78.106prb.rfsim.pci0.conf --rfsimulator.serveraddr 127.0.0.1 + sudo ./nr-softmodem --rfsim -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-du.sa.band78.106prb.rfsim.pci0.conf --rfsimulator.serveraddr 127.0.0.1 Start the UE, and let it connect completely: - sudo ./nr-uesoftmodem --sa -C 3450720000 -r 106 --numerology 1 --ssb 516 -O --rfsim --rfsimulator.serveraddr server + sudo ./nr-uesoftmodem -C 3450720000 -r 106 --numerology 1 --ssb 516 -O --rfsim --rfsimulator.serveraddr server Note how the RFsimulator roles have been switched, and RFsim server is at the UE side; _this is important_. Replace `` with the UE configuration @@ -65,7 +65,7 @@ matching your core. If you followed the CN and oaiUE tutorials, you can remove Once the UE is connected, start DU1: - sudo ./nr-softmodem --sa --rfsim -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-du.sa.band78.106prb.rfsim.pci1.conf --rfsimulator.serveraddr 127.0.0.1 + sudo ./nr-softmodem --rfsim -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb-du.sa.band78.106prb.rfsim.pci1.conf --rfsimulator.serveraddr 127.0.0.1 Once DU1 is online, you can trigger a handover by issuing this command diff --git a/doc/iqrecordplayer_usage.md b/doc/iqrecordplayer_usage.md index 69c675c996..2806db07f8 100644 --- a/doc/iqrecordplayer_usage.md +++ b/doc/iqrecordplayer_usage.md @@ -33,7 +33,7 @@ than the value of `--subframes-max` parameter. >Recording session example: ```bash -./nr-uesoftmodem -O /home/oaitests/mediatek_sim.conf --sa --numerology 1 -r 106 -C 3649440000 --band 78 -E --ue-fo-compensation --device.recplay.subframes-record 1 --device.recplay.subframes-file /home/iqs/oai-nrUE-17042023.dat --device.recplay.use-mmap 1 --device.recplay.subframes-max 30000 +./nr-uesoftmodem -O /home/oaitests/mediatek_sim.conf --numerology 1 -r 106 -C 3649440000 --band 78 -E --ue-fo-compensation --device.recplay.subframes-record 1 --device.recplay.subframes-file /home/iqs/oai-nrUE-17042023.dat --device.recplay.use-mmap 1 --device.recplay.subframes-max 30000 ............................................ ............................................ ............................................ @@ -54,7 +54,7 @@ options for replay mode are: >Replay mode session example: ```bash -./nr-uesoftmodem -O /home/oaitests/mediatek_sim.conf --sa --numerology 1 -r 106 -C 3649440000 --band 78 -E --ue-fo-compensation --device.recplay.subframes-replay 1 --device.recplay.subframes-file /home/iqs/oai-nrUE-17042023.dat --device.recplay.use-mmap 1 --device.recplay.subframes-loops 1 +./nr-uesoftmodem -O /home/oaitests/mediatek_sim.conf --numerology 1 -r 106 -C 3649440000 --band 78 -E --ue-fo-compensation --device.recplay.subframes-replay 1 --device.recplay.subframes-file /home/iqs/oai-nrUE-17042023.dat --device.recplay.use-mmap 1 --device.recplay.subframes-loops 1 .................................. .................................. [HW] Replay iqs from USRP B200 device, bandwidth 4.000000e+07 diff --git a/docker/README.md b/docker/README.md index 7ec63aacae..36ec65698a 100644 --- a/docker/README.md +++ b/docker/README.md @@ -243,7 +243,7 @@ services: core: -1 # for core dumps environment: USE_B2XX: 'yes' - USE_ADDITIONAL_OPTIONS: --sa --RUs.[0].sdr_addrs serial=30C51D4 --telnetsrv --telnetsrv.shrmod ci --continuous-tx --log_config.global_log_options level,nocolor,time,line_num,function + USE_ADDITIONAL_OPTIONS: --RUs.[0].sdr_addrs serial=30C51D4 --telnetsrv --telnetsrv.shrmod ci --continuous-tx --log_config.global_log_options level,nocolor,time,line_num,function devices: - /dev/bus/usb/:/dev/bus/usb/ volumes: diff --git a/openair1/PHY/CODING/DOC/LDPCImplementation.md b/openair1/PHY/CODING/DOC/LDPCImplementation.md index d280106c76..758f918963 100644 --- a/openair1/PHY/CODING/DOC/LDPCImplementation.md +++ b/openair1/PHY/CODING/DOC/LDPCImplementation.md @@ -46,7 +46,7 @@ Built target ldpc_cl At runtime, to successfully use hardware acceleration via OpenCL, you need to install vendor specific packages which deliver the required drivers and tools to make use of their GPU (Nvidia, Intel...) , fpga (Xilinx, Intel) or CPU (Intel, AMD, ARM...) through OpenCL. -`./nr-softmodem -O libconfig:gnb.band78.sa.fr1.106PRB.usrpb210.conf:dbgl5 --rfsim --rfsimulator.serveraddr server --sa --log_config.gtpu_log_level info --loader.ldpc.shlibversion _cl` +`./nr-softmodem -O libconfig:gnb.band78.sa.fr1.106PRB.usrpb210.conf:dbgl5 --rfsim --rfsimulator.serveraddr server --log_config.gtpu_log_level info --loader.ldpc.shlibversion _cl` ``` ------------------------------------------------ @@ -81,7 +81,7 @@ At runtime, to successfully use hardware acceleration via OpenCL, you need to in ----------------------------------------------------------------- ``` -`./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --sa -O libconfig:/usr/local/oai/conf/nrue_sim.conf:dbgl5 --loader.ldpc.shlibversion _cl --log_config.hw_log_level info` +`./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim -O libconfig:/usr/local/oai/conf/nrue_sim.conf:dbgl5 --loader.ldpc.shlibversion _cl --log_config.hw_log_level info` ``` ............................................................ diff --git a/openair1/SIMULATION/TOOLS/DOC/channel_simulation.md b/openair1/SIMULATION/TOOLS/DOC/channel_simulation.md index 6d1546b484..347f575bfb 100644 --- a/openair1/SIMULATION/TOOLS/DOC/channel_simulation.md +++ b/openair1/SIMULATION/TOOLS/DOC/channel_simulation.md @@ -86,11 +86,11 @@ When the `chanmod` option is enabled, the RF channel simulator with a channel mo Example run of OAI RFSIM on the same machine with activation of the channel model via command line: gNB: ```bash -sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --gNBs.[0].min_rxtxtime 6 --rfsim --sa --rfsimulator.options chanmod --telnetsrv +sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --gNBs.[0].min_rxtxtime 6 --rfsim --rfsimulator.options chanmod --telnetsrv ``` UE: ```bash -sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --sa --rfsimulator.serveraddr 127.0.0.1 --uicc0.imsi 001010000000001 -O ../../../ci-scripts/conf_files/nrue.uicc.conf --rfsimulator.options chanmod +sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --rfsimulator.serveraddr 127.0.0.1 --uicc0.imsi 001010000000001 -O ../../../ci-scripts/conf_files/nrue.uicc.conf --rfsimulator.options chanmod ``` where `@include "channelmod_rfsimu.conf"` has been added at the end of `ci-scripts/conf_files/channelmod_rfsimu.conf` which has been copied to `targets/PROJECTS/GENERIC-LTE-EPC/CONF/`. @@ -131,7 +131,7 @@ Example usage, set the offset for the selected model of the selected `modellist` e.g. with the softmodem: ```bash -sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --gNBs.[0].min_rxtxtime 6 --rfsim --sa --rfsimulator.options chanmod --telnetsrv --channelmod.modellist modellist_rfsimu_2 --channelmod.modellist_rfsimu_2.[1].offset 120 +sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --gNBs.[0].min_rxtxtime 6 --rfsim --rfsimulator.options chanmod --telnetsrv --channelmod.modellist modellist_rfsimu_2 --channelmod.modellist_rfsimu_2.[1].offset 120 ``` ## Real time control and monitoring with telnet server diff --git a/openair2/E2AP/README.md b/openair2/E2AP/README.md index 924977af36..abcfaa1ac0 100644 --- a/openair2/E2AP/README.md +++ b/openair2/E2AP/README.md @@ -179,26 +179,26 @@ e2_agent = { * start the gNB-mono ```bash cd oai/cmake_targets/ran_build/build - sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --rfsim --sa -E + sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --rfsim -E ``` * if CU/DU split is used, start the gNB as follows ```bash - sudo ./nr-softmodem -O --rfsim --sa -E - sudo ./nr-softmodem -O --sa + sudo ./nr-softmodem -O --rfsim -E + sudo ./nr-softmodem -O ``` * if CU-CP/CU-UP/DU split is used, start the gNB as follows ```bash - sudo ./nr-softmodem -O --rfsim --sa -E - sudo ./nr-softmodem -O --sa - sudo ./nr-cuup -O --sa + sudo ./nr-softmodem -O --rfsim -E + sudo ./nr-softmodem -O + sudo ./nr-cuup -O ``` * start the nrUE ```bash cd oai/cmake_targets/ran_build/build - sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --sa --uicc0.imsi 001010000000001 --rfsimulator.serveraddr 127.0.0.1 + sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --uicc0.imsi 001010000000001 --rfsimulator.serveraddr 127.0.0.1 ``` * start the nearRT-RIC diff --git a/radio/rfsimulator/README.md b/radio/rfsimulator/README.md index c86724fa0d..39e34ce651 100644 --- a/radio/rfsimulator/README.md +++ b/radio/rfsimulator/README.md @@ -133,7 +133,7 @@ Notes: 1. This starts the gNB and UE in the `phy-test` UP-only mode where the gNB is started as if a UE had already connected. See [`RUNMODEM.md`](../../doc/RUNMODEM.md) for more details. 2. `` should be the IP interface address of the remote host running the gNB executable, if the gNB and nrUE run on separate hosts, or be omitted if they are on the same host. 3. To enable the noS1 mode, `--noS1` option should be added to the command line, see again [`RUNMODEM.md`](../../doc/RUNMODEM.md). -4. To operate the gNB/UE with a 5GC, start them using the `--sa` option. More information can be found [here](../../../doc/NR_SA_Tutorial_OAI_CN5G.md). +4. Information on operating the gNB/UE with a 5GC can be found here. [here](../../../doc/NR_SA_Tutorial_OAI_CN5G.md). ## Store and replay From 1b02b6327b35d81ac81de15a5e42334a478a87ac Mon Sep 17 00:00:00 2001 From: Reem Bahsoun Date: Thu, 24 Oct 2024 10:41:52 +0200 Subject: [PATCH 65/75] Remove non existing volumes in /5g_f1_rfsimulator/docker-compose.yaml --- ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml index 31d2c8bd75..c925af1adb 100644 --- a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml @@ -121,7 +121,6 @@ services: ipv4_address: 192.168.71.171 volumes: - ../../conf_files/gnb-du.sa.band78.106prb.rfsim.conf:/opt/oai-gnb/etc/gnb.conf - - ../../conf_files/rfsim_channel_ci.conf:/opt/oai-gnb/etc/rfsim_channel_ci.conf healthcheck: test: /bin/bash -c "pgrep nr-softmodem" interval: 10s @@ -153,7 +152,6 @@ services: - /dev/net/tun:/dev/net/tun volumes: - ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf - - ../../conf_files/rfsim_channel_ci.conf:/opt/oai-nr-ue/etc/rfsim_channel_ci.conf healthcheck: test: /bin/bash -c "pgrep nr-uesoftmodem" interval: 10s From a2056a3055f884819d7a1384facb6c4c61d05877 Mon Sep 17 00:00:00 2001 From: Reem Bahsoun Date: Fri, 25 Oct 2024 10:11:08 +0200 Subject: [PATCH 66/75] Add `nsa` flag in docker-compose and xml files --- ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml | 2 +- ci-scripts/xml_files/fr1_nsa_2x2_quectel_attach_detach.xml | 2 +- ci-scripts/yaml_files/nsa_b200_gnb/docker-compose.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml index 4cf8973581..adef26b7c6 100644 --- a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml +++ b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml @@ -114,7 +114,7 @@ Initialize_eNB Initialize gNB - -O ci-scripts/conf_files/gnb.nsa.band78.106prb.usrpn310.2x2.conf -q --usrp-tx-thread-config 1 --T_stdout 2 --log_config.global_log_options level,nocolor,time,line_num,function + -O ci-scripts/conf_files/gnb.nsa.band78.106prb.usrpn310.2x2.conf --nsa -q --usrp-tx-thread-config 1 --T_stdout 2 --log_config.global_log_options level,nocolor,time,line_num,function 1 1 nr diff --git a/ci-scripts/xml_files/fr1_nsa_2x2_quectel_attach_detach.xml b/ci-scripts/xml_files/fr1_nsa_2x2_quectel_attach_detach.xml index 2aadb391bc..f59f883319 100644 --- a/ci-scripts/xml_files/fr1_nsa_2x2_quectel_attach_detach.xml +++ b/ci-scripts/xml_files/fr1_nsa_2x2_quectel_attach_detach.xml @@ -118,7 +118,7 @@ Initialize_eNB Initialize gNB - -O ci-scripts/conf_files/gnb.nsa.band78.106prb.usrpn310.2x2.conf -q --usrp-tx-thread-config 1 --log_config.global_log_options level,nocolor,time,line_num,function + -O ci-scripts/conf_files/gnb.nsa.band78.106prb.usrpn310.2x2.conf --nsa -q --usrp-tx-thread-config 1 --log_config.global_log_options level,nocolor,time,line_num,function 1 1 nr diff --git a/ci-scripts/yaml_files/nsa_b200_gnb/docker-compose.yml b/ci-scripts/yaml_files/nsa_b200_gnb/docker-compose.yml index 28bf0bc1f3..3bd90a3fff 100644 --- a/ci-scripts/yaml_files/nsa_b200_gnb/docker-compose.yml +++ b/ci-scripts/yaml_files/nsa_b200_gnb/docker-compose.yml @@ -11,7 +11,7 @@ services: core: -1 # for core dumps environment: USE_B2XX: 'yes' - USE_ADDITIONAL_OPTIONS: -E -q --RUs.[0].sdr_addrs serial=30C51D4 --continuous-tx --log_config.global_log_options level,nocolor,time,line_num,function + USE_ADDITIONAL_OPTIONS: --nsa -E -q --RUs.[0].sdr_addrs serial=30C51D4 --continuous-tx --log_config.global_log_options level,nocolor,time,line_num,function devices: - /dev/bus/usb/:/dev/bus/usb/ volumes: From 044375971663bc4e5752aa56574ae7530796329a Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 5 Nov 2024 16:13:59 +0100 Subject: [PATCH 67/75] Remove Num_Threads_PUSCH options: it's not used --- ci-scripts/conf_files/gnb-cu.sa.band78.106prb.conf | 1 - ci-scripts/conf_files/gnb-cu.sa.f1.conf | 1 - ci-scripts/conf_files/gnb-cucp.sa.f1.conf | 1 - ci-scripts/conf_files/gnb-cucp.sa.f1.quectel.conf | 1 - .../conf_files/untested/gNB_SA_n78_133PRB.2x2_usrpn310.conf | 1 - targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf | 1 - 6 files changed, 6 deletions(-) diff --git a/ci-scripts/conf_files/gnb-cu.sa.band78.106prb.conf b/ci-scripts/conf_files/gnb-cu.sa.band78.106prb.conf index e828389ca8..311c8551fd 100644 --- a/ci-scripts/conf_files/gnb-cu.sa.band78.106prb.conf +++ b/ci-scripts/conf_files/gnb-cu.sa.band78.106prb.conf @@ -1,7 +1,6 @@ Active_gNBs = ( "cu-rfsim"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; -Num_Threads_PUSCH = 8; gNBs = ( diff --git a/ci-scripts/conf_files/gnb-cu.sa.f1.conf b/ci-scripts/conf_files/gnb-cu.sa.f1.conf index 2126aac17f..84e5dbadb0 100644 --- a/ci-scripts/conf_files/gnb-cu.sa.f1.conf +++ b/ci-scripts/conf_files/gnb-cu.sa.f1.conf @@ -1,7 +1,6 @@ Active_gNBs = ( "gNB-Eurecom-CU"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; -Num_Threads_PUSCH = 8; gNBs = ( diff --git a/ci-scripts/conf_files/gnb-cucp.sa.f1.conf b/ci-scripts/conf_files/gnb-cucp.sa.f1.conf index 586c5d5134..28bb7cfc33 100644 --- a/ci-scripts/conf_files/gnb-cucp.sa.f1.conf +++ b/ci-scripts/conf_files/gnb-cucp.sa.f1.conf @@ -1,7 +1,6 @@ Active_gNBs = ( "gNB-OAI"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; -Num_Threads_PUSCH = 8; gNBs = ( diff --git a/ci-scripts/conf_files/gnb-cucp.sa.f1.quectel.conf b/ci-scripts/conf_files/gnb-cucp.sa.f1.quectel.conf index a0744de01f..99a530ca39 100644 --- a/ci-scripts/conf_files/gnb-cucp.sa.f1.quectel.conf +++ b/ci-scripts/conf_files/gnb-cucp.sa.f1.quectel.conf @@ -1,7 +1,6 @@ Active_gNBs = ( "gNB-OAI"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; -Num_Threads_PUSCH = 8; gNBs = ( diff --git a/ci-scripts/conf_files/untested/gNB_SA_n78_133PRB.2x2_usrpn310.conf b/ci-scripts/conf_files/untested/gNB_SA_n78_133PRB.2x2_usrpn310.conf index 6fe39879de..4e8c55851e 100644 --- a/ci-scripts/conf_files/untested/gNB_SA_n78_133PRB.2x2_usrpn310.conf +++ b/ci-scripts/conf_files/untested/gNB_SA_n78_133PRB.2x2_usrpn310.conf @@ -1,7 +1,6 @@ Active_gNBs = ( "gNB-OAI"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; -Num_Threads_PUSCH = 8; gNBs = ( diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf index 6730f22b41..1666ea4a70 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf @@ -1,7 +1,6 @@ Active_gNBs = ( "gNB-Eurecom-CU"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; -Num_Threads_PUSCH = 8; gNBs = ( From 171530c067eb9ccdd271d8221f6083e23933fb6f Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 5 Nov 2024 16:44:37 +0100 Subject: [PATCH 68/75] cls_oaicitest.py: use new cls_cmd.getConnection() instead of old SSHconnection class It is clearer in CI logs to use absolute paths, and that is also a "preference" of the new SSH class (cls_cmd.py) in the sense that some functions don't handle "cd" gracefully (because of underlying Python library paramiko). For zip, though, we should change to have nice relative paths in the archives, so use cd && zip ... to achieve that, instead of changing to a directory. This way, the path on which we operate is still visible in the logs in each line. --- ci-scripts/cls_oaicitest.py | 51 ++++++++++++++----------------------- 1 file changed, 19 insertions(+), 32 deletions(-) diff --git a/ci-scripts/cls_oaicitest.py b/ci-scripts/cls_oaicitest.py index f286aa9558..8c4f4b906e 100644 --- a/ci-scripts/cls_oaicitest.py +++ b/ci-scripts/cls_oaicitest.py @@ -43,7 +43,6 @@ import json #import our libs import helpreadme as HELP import constants as CONST -import sshconnection import cls_module import cls_cmd @@ -895,55 +894,43 @@ class OaiCiTest(): SourceCodePath = self.UESourceCodePath else: sys.exit('Insufficient Parameter') - SSH = sshconnection.SSHConnection() - SSH.open(IPAddress, UserName, Password) - SSH.command(f'cd {SourceCodePath}', '\$', 5) - SSH.command('cd cmake_targets', '\$', 5) - SSH.command('rm -f build.log.zip', '\$', 5) - SSH.command('zip -r build.log.zip build_log_*/*', '\$', 60) - SSH.close() + with cls_cmd.getConnection(IPAddress) as cmd: + d = f'{SourceCodePath}/cmake_targets' + cmd.run(f'rm -f {d}/build.log.zip') + cmd.run(f'cd {d} && zip -r build.log.zip build_log_*/*') def LogCollectPing(self,EPC): # Some pipelines are using "none" IP / Credentials # In that case, just forget about it if EPC.IPAddress == 'none': sys.exit(0) - SSH = sshconnection.SSHConnection() - SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password) - SSH.command(f'cd {EPC.SourceCodePath}', '\$', 5) - SSH.command('cd scripts', '\$', 5) - SSH.command('rm -f ping.log.zip', '\$', 5) - SSH.command('zip ping.log.zip ping*.log', '\$', 60) - SSH.command('rm ping*.log', '\$', 5) - SSH.close() + with cls_cmd.getConnection(EPC.IPAddress) as cmd: + d = f"{EPC.SourceCodePath}/scripts" + cmd.run(f'rm -f {d}/ping.log.zip') + cmd.run(f'cd {d} && zip ping.log.zip ping*.log') + cmd.run(f'rm {d}/ping*.log') def LogCollectIperf(self,EPC): # Some pipelines are using "none" IP / Credentials # In that case, just forget about it if EPC.IPAddress == 'none': sys.exit(0) - SSH = sshconnection.SSHConnection() - SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password) - SSH.command(f'cd {EPC.SourceCodePath}', '\$', 5) - SSH.command('cd scripts', '\$', 5) - SSH.command('rm -f iperf.log.zip', '\$', 5) - SSH.command('zip iperf.log.zip iperf*.log', '\$', 60) - SSH.command('rm iperf*.log', '\$', 5) - SSH.close() + with cls_cmd.getConnection(EPC.IPAddress) as cmd: + d = f"{EPC.SourceCodePath}/scripts" + cmd.run(f'rm -f {d}/iperf.log.zip') + cmd.run(f'cd {d} && zip iperf.log.zip iperf*.log') + cmd.run(f'rm {d}/iperf*.log') def LogCollectOAIUE(self): # Some pipelines are using "none" IP / Credentials # In that case, just forget about it if self.UEIPAddress == 'none': sys.exit(0) - SSH = sshconnection.SSHConnection() - SSH.open(self.UEIPAddress, self.UEUserName, self.UEPassword) - SSH.command(f'cd {self.UESourceCodePath}', '\$', 5) - SSH.command(f'cd cmake_targets', '\$', 5) - SSH.command(f'echo {self.UEPassword} | sudo -S rm -f ue.log.zip', '\$', 5) - SSH.command(f'echo {self.UEPassword} | sudo -S zip ue.log.zip ue*.log core* ue_*record.raw ue_*.pcap ue_*txt', '\$', 60) - SSH.command(f'echo {self.UEPassword} | sudo -S rm ue*.log core* ue_*record.raw ue_*.pcap ue_*txt', '\$', 5) - SSH.close() + with cls_cmd.getConnection(self.UEIPAddress) as cmd: + d = f'{self.UESourceCodePath}/cmake_targets' + cmd.run(f'echo {self.UEPassword} | sudo -S rm -f {d}/ue.log.zip') + cmd.run(f'cd {d} && echo {self.UEPassword} | sudo -S zip ue.log.zip ue*.log core* ue_*record.raw ue_*.pcap ue_*txt') + cmd.run(f'echo {self.UEPassword} | sudo -S rm {d}/ue*.log {d}/core* {d}/ue_*record.raw {d}/ue_*.pcap {d}/ue_*txt') def ShowTestID(self): logging.info(f'\u001B[1m----------------------------------------\u001B[0m') From e7225e12cb12e008f3f6bae25353b9add25334da Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 5 Nov 2024 19:13:26 +0100 Subject: [PATCH 69/75] Remove CheckAndAddRoute(), replace with scripts on machines Remove CheckAndAddRoute(), as it is complicated to read, uses a multitude of hostname/IP/password combinations. Replace with scripts on the machines, which, as of this commit, are: - porcepix: ~/after-reboot.sh - ofqot: ~/after-reboot.sh - nepes: ~/after-reboot.sh - obelix: ~/how-to-resetup-obelix-out-of-reboot.sh --- ci-scripts/cls_containerize.py | 118 --------------------------------- ci-scripts/main.py | 20 ------ 2 files changed, 138 deletions(-) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index fa4afb865c..ee05f91a27 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -1071,121 +1071,3 @@ class Containerize(): else: logging.error('\u001B[1m Undeploying OAI Object Failed\u001B[0m') return success - - def CheckAndAddRoute(self, svrName, ipAddr, userName, password): - logging.debug('Checking IP routing on ' + svrName) - mySSH = SSH.SSHConnection() - if svrName == 'porcepix': - mySSH.open(ipAddr, userName, password) - # Check if route to asterix gnb exists - mySSH.command('ip route | grep --colour=never "192.168.68.64/26"', '\$', 10) - result = re.search('172.21.16.127', mySSH.getBefore()) - if result is None: - mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.64/26 via 172.21.16.127 dev eno1', '\$', 10) - # Check if route to obelix enb exists - mySSH.command('ip route | grep --colour=never "192.168.68.128/26"', '\$', 10) - result = re.search('172.21.16.128', mySSH.getBefore()) - if result is None: - mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.128/26 via 172.21.16.128 dev eno1', '\$', 10) - # Check if forwarding is enabled - mySSH.command('sysctl net.ipv4.conf.all.forwarding', '\$', 10) - result = re.search('net.ipv4.conf.all.forwarding = 1', mySSH.getBefore()) - if result is None: - mySSH.command('echo ' + password + ' | sudo -S sysctl net.ipv4.conf.all.forwarding=1', '\$', 10) - # Check if iptables forwarding is accepted - mySSH.command('echo ' + password + ' | sudo -S iptables -L FORWARD', '\$', 10) - result = re.search('Chain FORWARD .*policy ACCEPT', mySSH.getBefore()) - if result is None: - mySSH.command('echo ' + password + ' | sudo -S iptables -P FORWARD ACCEPT', '\$', 10) - mySSH.close() - if svrName == 'asterix': - mySSH.open(ipAddr, userName, password) - # Check if route to porcepix epc exists - mySSH.command('ip route | grep --colour=never "192.168.61.192/26"', '\$', 10) - result = re.search('172.21.16.136', mySSH.getBefore()) - if result is None: - mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.61.192/26 via 172.21.16.136 dev em1', '\$', 10) - # Check if route to porcepix cn5g exists - mySSH.command('ip route | grep --colour=never "192.168.70.128/26"', '\$', 10) - result = re.search('172.21.16.136', mySSH.getBefore()) - if result is None: - mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.70.128/26 via 172.21.16.136 dev em1', '\$', 10) - # Check if X2 route to obelix enb exists - mySSH.command('ip route | grep --colour=never "192.168.68.128/26"', '\$', 10) - result = re.search('172.21.16.128', mySSH.getBefore()) - if result is None: - mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.128/26 via 172.21.16.128 dev em1', '\$', 10) - # Check if forwarding is enabled - mySSH.command('sysctl net.ipv4.conf.all.forwarding', '\$', 10) - result = re.search('net.ipv4.conf.all.forwarding = 1', mySSH.getBefore()) - if result is None: - mySSH.command('echo ' + password + ' | sudo -S sysctl net.ipv4.conf.all.forwarding=1', '\$', 10) - # Check if iptables forwarding is accepted - mySSH.command('echo ' + password + ' | sudo -S iptables -L FORWARD', '\$', 10) - result = re.search('Chain FORWARD .*policy ACCEPT', mySSH.getBefore()) - if result is None: - mySSH.command('echo ' + password + ' | sudo -S iptables -P FORWARD ACCEPT', '\$', 10) - mySSH.close() - if svrName == 'obelix': - mySSH.open(ipAddr, userName, password) - # Check if route to porcepix epc exists - mySSH.command('ip route | grep --colour=never "192.168.61.192/26"', '\$', 10) - result = re.search('172.21.16.136', mySSH.getBefore()) - if result is None: - mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.61.192/26 via 172.21.16.136 dev eno1', '\$', 10) - # Check if X2 route to asterix gnb exists - mySSH.command('ip route | grep --colour=never "192.168.68.64/26"', '\$', 10) - result = re.search('172.21.16.127', mySSH.getBefore()) - if result is None: - mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.64/26 via 172.21.16.127 dev eno1', '\$', 10) - # Check if X2 route to nepes gnb exists - mySSH.command('ip route | grep --colour=never "192.168.68.192/26"', '\$', 10) - result = re.search('172.21.16.137', mySSH.getBefore()) - if result is None: - mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.192/26 via 172.21.16.137 dev eno1', '\$', 10) - # Check if forwarding is enabled - mySSH.command('sysctl net.ipv4.conf.all.forwarding', '\$', 10) - result = re.search('net.ipv4.conf.all.forwarding = 1', mySSH.getBefore()) - if result is None: - mySSH.command('echo ' + password + ' | sudo -S sysctl net.ipv4.conf.all.forwarding=1', '\$', 10) - # Check if iptables forwarding is accepted - mySSH.command('echo ' + password + ' | sudo -S iptables -L FORWARD', '\$', 10) - result = re.search('Chain FORWARD .*policy ACCEPT', mySSH.getBefore()) - if result is None: - mySSH.command('echo ' + password + ' | sudo -S iptables -P FORWARD ACCEPT', '\$', 10) - mySSH.close() - if svrName == 'nepes': - mySSH.open(ipAddr, userName, password) - # Check if route to ofqot gnb exists - mySSH.command('ip route | grep --colour=never "192.168.68.192/26"', '\$', 10) - result = re.search('172.21.16.109', mySSH.getBefore()) - if result is None: - mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.192/26 via 172.21.16.109 dev enp0s31f6', '\$', 10) - mySSH.command('sysctl net.ipv4.conf.all.forwarding', '\$', 10) - result = re.search('net.ipv4.conf.all.forwarding = 1', mySSH.getBefore()) - if result is None: - mySSH.command('echo ' + password + ' | sudo -S sysctl net.ipv4.conf.all.forwarding=1', '\$', 10) - # Check if iptables forwarding is accepted - mySSH.command('echo ' + password + ' | sudo -S iptables -L FORWARD', '\$', 10) - result = re.search('Chain FORWARD .*policy ACCEPT', mySSH.getBefore()) - if result is None: - mySSH.command('echo ' + password + ' | sudo -S iptables -P FORWARD ACCEPT', '\$', 10) - mySSH.close() - if svrName == 'ofqot': - mySSH.open(ipAddr, userName, password) - # Check if X2 route to nepes enb/epc exists - mySSH.command('ip route | grep --colour=never "192.168.68.128/26"', '\$', 10) - result = re.search('172.21.16.137', mySSH.getBefore()) - if result is None: - mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.128/26 via 172.21.16.137 dev enp2s0', '\$', 10) - # Check if forwarding is enabled - mySSH.command('sysctl net.ipv4.conf.all.forwarding', '\$', 10) - result = re.search('net.ipv4.conf.all.forwarding = 1', mySSH.getBefore()) - if result is None: - mySSH.command('echo ' + password + ' | sudo -S sysctl net.ipv4.conf.all.forwarding=1', '\$', 10) - # Check if iptables forwarding is accepted - mySSH.command('echo ' + password + ' | sudo -S iptables -L FORWARD', '\$', 10) - result = re.search('Chain FORWARD .*policy ACCEPT', mySSH.getBefore()) - if result is None: - mySSH.command('echo ' + password + ' | sudo -S iptables -P FORWARD ACCEPT', '\$', 10) - mySSH.close() diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 2e163f28ba..f92401267a 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -693,26 +693,6 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re HTML.CreateHtmlTabHeader() - # On CI bench w/ containers, we need to validate if IP routes are set - if EPC.IPAddress == '172.21.16.136': - CONTAINERS.CheckAndAddRoute('porcepix', EPC.IPAddress, EPC.UserName, EPC.Password) - if EPC.IPAddress == '172.21.16.137': - CONTAINERS.CheckAndAddRoute('nepes', EPC.IPAddress, EPC.UserName, EPC.Password) - if CONTAINERS.eNBIPAddress == '172.21.16.127': - CONTAINERS.CheckAndAddRoute('asterix', CONTAINERS.eNBIPAddress, CONTAINERS.eNBUserName, CONTAINERS.eNBPassword) - if CONTAINERS.eNB1IPAddress == '172.21.16.127': - CONTAINERS.CheckAndAddRoute('asterix', CONTAINERS.eNB1IPAddress, CONTAINERS.eNB1UserName, CONTAINERS.eNB1Password) - if CONTAINERS.eNBIPAddress == '172.21.16.128': - CONTAINERS.CheckAndAddRoute('obelix', CONTAINERS.eNBIPAddress, CONTAINERS.eNBUserName, CONTAINERS.eNBPassword) - if CONTAINERS.eNB1IPAddress == '172.21.16.128': - CONTAINERS.CheckAndAddRoute('obelix', CONTAINERS.eNB1IPAddress, CONTAINERS.eNB1UserName, CONTAINERS.eNB1Password) - if CONTAINERS.eNBIPAddress == '172.21.16.109' or CONTAINERS.eNBIPAddress == 'ofqot': - CONTAINERS.CheckAndAddRoute('ofqot', CONTAINERS.eNBIPAddress, CONTAINERS.eNBUserName, CONTAINERS.eNBPassword) - if CONTAINERS.eNBIPAddress == '172.21.16.137': - CONTAINERS.CheckAndAddRoute('nepes', CONTAINERS.eNBIPAddress, CONTAINERS.eNBUserName, CONTAINERS.eNBPassword) - if CONTAINERS.eNB1IPAddress == '172.21.16.137': - CONTAINERS.CheckAndAddRoute('nepes', CONTAINERS.eNB1IPAddress, CONTAINERS.eNB1UserName, CONTAINERS.eNB1Password) - task_set_succeeded = True HTML.startTime=int(round(time.time() * 1000)) From a103be619a63878876055fd87151d58053afe7ed Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 5 Nov 2024 19:29:24 +0100 Subject: [PATCH 70/75] Remove use of old sshConnection class, use cls_cmd instead --- ci-scripts/cls_containerize.py | 99 ++++++++++++++++------------------ 1 file changed, 47 insertions(+), 52 deletions(-) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index ee05f91a27..e3fdae9c0f 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -43,7 +43,6 @@ from zipfile import ZipFile # OAI Testing modules #----------------------------------------------------------- import cls_cmd -import sshconnection as SSH import helpreadme as HELP import constants as CONST import cls_oaicitest @@ -600,24 +599,22 @@ class Containerize(): HELP.GenericHelp(CONST.Version) sys.exit('Insufficient Parameter (need proxyCommit for proxy build)') logging.debug('Building on server: ' + lIpAddr) - mySSH = SSH.SSHConnection() - mySSH.open(lIpAddr, lUserName, lPassWord) + ssh = cls_cmd.getConnection(lIpAddr) # Check that we are on Ubuntu - mySSH.command('hostnamectl', '\$', 5) - result = re.search('Ubuntu', mySSH.getBefore()) + ret = ssh.run('hostnamectl') + result = re.search('Ubuntu', ret.stdout) self.host = result.group(0) if self.host != 'Ubuntu': - logging.error('\u001B[1m Can build proxy only on Ubuntu server\u001B[0m') - mySSH.close() - sys.exit(1) + ssh.close() + raise Exception('Can build proxy only on Ubuntu server') self.cli = 'docker' self.cliBuildOptions = '' # Workaround for some servers, we need to erase completely the workspace if self.forcedWorkspaceCleanup: - mySSH.command('echo ' + lPassWord + ' | sudo -S rm -Rf ' + lSourcePath, '\$', 15) + ssh.run(f'echo {lPassWord} | sudo -S rm -Rf {lSourcePath}') oldRanCommidID = self.ranCommitID oldRanRepository = self.ranRepository @@ -627,7 +624,7 @@ class Containerize(): self.ranRepository = 'https://github.com/EpiSci/oai-lte-5g-multi-ue-proxy.git' self.ranAllowMerge = False self.ranTargetBranch = 'master' - mySSH.command('cd ' +lSourcePath, '\$', 3) + ssh.cd(lSourcePath) # to prevent accidentally overwriting data that might be used later self.ranCommitID = oldRanCommidID self.ranRepository = oldRanRepository @@ -635,22 +632,21 @@ class Containerize(): self.ranTargetBranch = oldRanTargetBranch # Let's remove any previous run artifacts if still there - mySSH.command(self.cli + ' image prune --force', '\$', 30) + ssh.run(f'{self.cli} image prune --force') # Remove any previous proxy image - mySSH.command(self.cli + ' image rm oai-lte-multi-ue-proxy:latest || true', '\$', 30) + ssh.run(f'{self.cli} image rm oai-lte-multi-ue-proxy:latest') tag = self.proxyCommit logging.debug('building L2sim proxy image for tag ' + tag) # check if the corresponding proxy image with tag exists. If not, build it - mySSH.command(self.cli + ' image inspect --format=\'Size = {{.Size}} bytes\' proxy:' + tag, '\$', 5) - buildProxy = mySSH.getBefore().count('o such image') != 0 - if buildProxy: - mySSH.command(self.cli + ' build ' + self.cliBuildOptions + ' --target oai-lte-multi-ue-proxy --tag proxy:' + tag + ' --file docker/Dockerfile.ubuntu18.04 . > cmake_targets/log/proxy-build.log 2>&1', '\$', 180) - mySSH.command(self.cli + ' image inspect --format=\'Size = {{.Size}} bytes\' proxy:' + tag, '\$', 5) - mySSH.command(self.cli + ' image prune --force || true','\$', 15) - if mySSH.getBefore().count('o such image') != 0: + ret = ssh.run(f'{self.cli} image inspect --format=\'Size = {{{{.Size}}}} bytes\' proxy:{tag}') + if ret.returncode != 0: + ssh.run(f'{self.cli} build {self.cliBuildOptions} --target oai-lte-multi-ue-proxy --tag proxy:{tag} --file docker/Dockerfile.ubuntu18.04 . > cmake_targets/log/proxy-build.log 2>&1') + ssh.run(f'{self.cli} image prune --force') + ret = ssh.run(f'{self.cli} image inspect --format=\'Size = {{{{.Size}}}} bytes\' proxy:{tag}') + if ret.returncode != 0: logging.error('\u001B[1m Build of L2sim proxy failed\u001B[0m') - mySSH.close() + ssh.close() HTML.CreateHtmlTestRow('commit ' + tag, 'KO', CONST.ALL_PROCESSES_OK) HTML.CreateHtmlTabFooter(False) return False @@ -658,33 +654,34 @@ class Containerize(): logging.debug('L2sim proxy image for tag ' + tag + ' already exists, skipping build') # retag the build images to that we pick it up later - mySSH.command('docker image tag proxy:' + tag + ' oai-lte-multi-ue-proxy:latest', '\$', 5) + ssh.run(f'docker image tag proxy:{tag} oai-lte-multi-ue-proxy:latest') # no merge: is a push to develop, tag the image so we can push it to the registry if not self.ranAllowMerge: - mySSH.command('docker image tag proxy:' + tag + ' proxy:develop', '\$', 5) + ssh.run('docker image tag proxy:{tag} proxy:develop') # we assume that the host on which this is built will also run the proxy. The proxy # currently requires the following command, and the docker-compose up mechanism of # the CI does not allow to run arbitrary commands. Note that the following actually # belongs to the deployment, not the build of the proxy... logging.warning('the following command belongs to deployment, but no mechanism exists to exec it there!') - mySSH.command('sudo ifconfig lo: 127.0.0.2 netmask 255.0.0.0 up', '\$', 5) + ssh.run('sudo ifconfig lo: 127.0.0.2 netmask 255.0.0.0 up') # Analyzing the logs if buildProxy: self.testCase_id = HTML.testCase_id - mySSH.command('cd ' + lSourcePath + '/cmake_targets', '\$', 5) - mySSH.command('mkdir -p proxy_build_log_' + self.testCase_id, '\$', 5) - mySSH.command('mv log/* ' + 'proxy_build_log_' + self.testCase_id, '\$', 5) + ssh.cd(f'{lSourcePath}/cmake_targets') + ssh.run(f'mkdir -p proxy_build_log_{self.testCase_id}') + ssh.run(f'mv log/* proxy_build_log_{self.testCase_id}') if (os.path.isfile('./proxy_build_log_' + self.testCase_id + '.zip')): os.remove('./proxy_build_log_' + self.testCase_id + '.zip') if (os.path.isdir('./proxy_build_log_' + self.testCase_id)): shutil.rmtree('./proxy_build_log_' + self.testCase_id) - mySSH.command('zip -r -qq proxy_build_log_' + self.testCase_id + '.zip proxy_build_log_' + self.testCase_id, '\$', 5) - mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/build_log_' + self.testCase_id + '.zip', '.') + ssh.run(f'zip -r -qq proxy_build_log_{self.testCase_id}.zip proxy_build_log_{self.testCase_id}') + filename = f'build_log_{self.testCase_id}.zip' + ssh.copyin(f'{lSourcePath}/cmake_targets/{filename}', filename) # don't delete such that we might recover the zips - #mySSH.command('rm -f build_log_' + self.testCase_id + '.zip','\$', 5) + #ssh.run(f'rm -f build_log_{self.testCase_id}.zip') # we do not analyze the logs (we assume the proxy builds fine at this stage), # but need to have the following information to correctly display the HTML @@ -696,11 +693,11 @@ class Containerize(): files['Target Image Creation'] = errorandwarnings collectInfo = {} collectInfo['proxy'] = files - mySSH.command('docker image inspect --format=\'Size = {{.Size}} bytes\' proxy:' + tag, '\$', 5) - result = re.search('Size *= *(?P[0-9\-]+) *bytes', mySSH.getBefore()) + ret = ssh.run(f'docker image inspect --format=\'Size = {{{{.Size}}}} bytes\' proxy:{tag}') + result = re.search('Size *= *(?P[0-9\-]+) *bytes', ret.stdout) # Cleaning any created tmp volume - mySSH.command(self.cli + ' volume prune --force || true','\$', 15) - mySSH.close() + ssh.run(f'{self.cli} volume prune --force') + ssh.close() allImagesSize = {} if result is not None: @@ -822,14 +819,13 @@ class Containerize(): HELP.GenericHelp(CONST.Version) sys.exit('Insufficient Parameter') logging.debug('Pushing images from server: ' + lIpAddr) - mySSH = SSH.SSHConnection() - mySSH.open(lIpAddr, lUserName, lPassWord) + ssh = cls_cmd.getConnection(lIpAddr) imagePrefix = 'porcepix.sboai.cs.eurecom.fr' - mySSH.command(f'docker login -u oaicicd -p oaicicd {imagePrefix}', '\$', 5) - if re.search('Login Succeeded', mySSH.getBefore()) is None: + ret = ssh.run(f'docker login -u oaicicd -p oaicicd {imagePrefix}') + if ret.returncode != 0: msg = 'Could not log into local registry' logging.error(msg) - mySSH.close() + ssh.close() HTML.CreateHtmlTestRow(msg, 'KO', CONST.ALL_PROCESSES_OK) return False @@ -839,33 +835,32 @@ class Containerize(): for image in IMAGES: tagToUse = CreateTag(self.ranCommitID, self.ranBranch, self.ranAllowMerge) imageTag = f"{image}:{tagToUse}" - mySSH.command(f'docker image tag {image}:{orgTag} {imagePrefix}/{imageTag}', '\$', 5) - if re.search('Error response from daemon: No such image:', mySSH.getBefore()) is not None: + ret = ssh.run(f'docker image tag {image}:{orgTag} {imagePrefix}/{imageTag}') + if ret.returncode != 0: continue - mySSH.command(f'docker push {imagePrefix}/{imageTag}', '\$', 120) - if re.search(': digest:', mySSH.getBefore()) is None: - logging.debug(mySSH.getBefore()) + ret = ssh.run(f'docker push {imagePrefix}/{imageTag}') + if ret.returncode != 0: msg = f'Could not push {image} to local registry : {imageTag}' logging.error(msg) - mySSH.close() + ssh.close() HTML.CreateHtmlTestRow(msg, 'KO', CONST.ALL_PROCESSES_OK) return False # Creating a develop tag on the local private registry if not self.ranAllowMerge: - mySSH.command(f'docker image tag {image}:{orgTag} {imagePrefix}/{image}:develop', '\$', 5) - mySSH.command(f'docker push {imagePrefix}/{image}:develop', '\$', 120) - mySSH.command(f'docker rmi {imagePrefix}/{image}:develop', '\$', 120) - mySSH.command(f'docker rmi {imagePrefix}/{imageTag} {image}:{orgTag}', '\$', 30) + ssh.run(f'docker image tag {image}:{orgTag} {imagePrefix}/{image}:develop') + ssh.run(f'docker push {imagePrefix}/{image}:develop') + ssh.run(f'docker rmi {imagePrefix}/{image}:develop') + ssh.run(f'docker rmi {imagePrefix}/{imageTag} {image}:{orgTag}') - mySSH.command(f'docker logout {imagePrefix}', '\$', 5) - if re.search('Removing login credentials', mySSH.getBefore()) is None: + ret = ssh.run(f'docker logout {imagePrefix}') + if ret.returncode != 0: msg = 'Could not log off from local registry' logging.error(msg) - mySSH.close() + ssh.close() HTML.CreateHtmlTestRow(msg, 'KO', CONST.ALL_PROCESSES_OK) return False - mySSH.close() + ssh.close() HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) return True From cf576fc2559cf031ab37814b965d42722ee92b3d Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 6 Nov 2024 08:24:13 +0100 Subject: [PATCH 71/75] Remove Create_Workspace() in xml: follow up step removes it The first thing Build_Proxy does is to remove the repository. Further, Build_Proxy does not use the OAI RAN repo, but the proxy repo. The Create_Workspace() is therefore completely useless. --- ci-scripts/xml_files/container_l2sim_proxy.xml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/ci-scripts/xml_files/container_l2sim_proxy.xml b/ci-scripts/xml_files/container_l2sim_proxy.xml index ead040de82..197baf429b 100644 --- a/ci-scripts/xml_files/container_l2sim_proxy.xml +++ b/ci-scripts/xml_files/container_l2sim_proxy.xml @@ -25,17 +25,10 @@ Build L2sim proxy image wrench - 100001 000001 - - Create_Workspace - Create new Workspace - 1 - 1 - Build_Proxy Build L2sim Proxy Image From 6a36db456960b3d9e818a62793c176db525641a8 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 6 Nov 2024 08:29:33 +0100 Subject: [PATCH 72/75] Repair and refactor proxy build function Recent refactoring replaced the CreateWorkspace function call with a dedicated XML step (for clarity, and because it avoids needless recreation of workspaces). In the proxy function, the same CreateWorkspace xml step has been added, cloning the OAI RAN repo, when we actually need the repository for the proxy. Hence, fix this by calling the CreateWorkspace() function manually, but only when necessary, to build the proxy. (It would only be a problem if the pipeline would rebuild the proxy, which did not happen because not much work is happening on the proxy repo). Further, refactoring and simplication of the proxy build function were done: - never tag proxy with develop, that makes no sense - overwrite CreateWorkspace() info after having created and used the workspace (the "if" to build the proxy) - simplify copying of logs - add simple unit test - remove check for ubuntu; the dependcy is "docker". Simplify the code to not obscure with a class variable. --- ci-scripts/cls_containerize.py | 77 +++++++++++++--------------------- ci-scripts/tests/README.md | 1 + ci-scripts/tests/build.py | 40 ++++++++++++++++++ 3 files changed, 70 insertions(+), 48 deletions(-) create mode 100644 ci-scripts/tests/build.py diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index e3fdae9c0f..bac87de124 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -601,21 +601,7 @@ class Containerize(): logging.debug('Building on server: ' + lIpAddr) ssh = cls_cmd.getConnection(lIpAddr) - # Check that we are on Ubuntu - ret = ssh.run('hostnamectl') - result = re.search('Ubuntu', ret.stdout) - self.host = result.group(0) - if self.host != 'Ubuntu': - ssh.close() - raise Exception('Can build proxy only on Ubuntu server') - - self.cli = 'docker' - self.cliBuildOptions = '' - - # Workaround for some servers, we need to erase completely the workspace - if self.forcedWorkspaceCleanup: - ssh.run(f'echo {lPassWord} | sudo -S rm -Rf {lSourcePath}') - + self.testCase_id = HTML.testCase_id oldRanCommidID = self.ranCommitID oldRanRepository = self.ranRepository oldRanAllowMerge = self.ranAllowMerge @@ -624,26 +610,35 @@ class Containerize(): self.ranRepository = 'https://github.com/EpiSci/oai-lte-5g-multi-ue-proxy.git' self.ranAllowMerge = False self.ranTargetBranch = 'master' - ssh.cd(lSourcePath) - # to prevent accidentally overwriting data that might be used later - self.ranCommitID = oldRanCommidID - self.ranRepository = oldRanRepository - self.ranAllowMerge = oldRanAllowMerge - self.ranTargetBranch = oldRanTargetBranch # Let's remove any previous run artifacts if still there - ssh.run(f'{self.cli} image prune --force') + ssh.run('docker image prune --force') # Remove any previous proxy image - ssh.run(f'{self.cli} image rm oai-lte-multi-ue-proxy:latest') + ssh.run('docker image rm oai-lte-multi-ue-proxy:latest') tag = self.proxyCommit logging.debug('building L2sim proxy image for tag ' + tag) # check if the corresponding proxy image with tag exists. If not, build it - ret = ssh.run(f'{self.cli} image inspect --format=\'Size = {{{{.Size}}}} bytes\' proxy:{tag}') - if ret.returncode != 0: - ssh.run(f'{self.cli} build {self.cliBuildOptions} --target oai-lte-multi-ue-proxy --tag proxy:{tag} --file docker/Dockerfile.ubuntu18.04 . > cmake_targets/log/proxy-build.log 2>&1') - ssh.run(f'{self.cli} image prune --force') - ret = ssh.run(f'{self.cli} image inspect --format=\'Size = {{{{.Size}}}} bytes\' proxy:{tag}') + ret = ssh.run(f'docker image inspect --format=\'Size = {{{{.Size}}}} bytes\' proxy:{tag}') + buildProxy = ret.returncode != 0 # if no image, build new proxy + if buildProxy: + ssh.run(f'rm -Rf {lSourcePath}') + success = CreateWorkspace(lIpAddr, lSourcePath, self.ranRepository, self.ranCommitID, self.ranTargetBranch, self.ranAllowMerge) + if not success: + raise Exception("could not clone proxy repository") + + filename = f'build_log_{self.testCase_id}' + fullpath = f'{lSourcePath}/{filename}' + + ssh.run(f'docker build --target oai-lte-multi-ue-proxy --tag proxy:{tag} --file {lSourcePath}/docker/Dockerfile.ubuntu18.04 {lSourcePath} > {fullpath} 2>&1') + ssh.run(f'zip -r -qq {fullpath}.zip {fullpath}') + local_file = f"{os.getcwd()}/../cmake_targets/log/{filename}.zip" + ssh.copyin(f'{fullpath}.zip', local_file) + # don't delete such that we might recover the zips + #ssh.run(f'rm -f {fullpath}.zip') + + ssh.run('docker image prune --force') + ret = ssh.run(f'docker image inspect --format=\'Size = {{{{.Size}}}} bytes\' proxy:{tag}') if ret.returncode != 0: logging.error('\u001B[1m Build of L2sim proxy failed\u001B[0m') ssh.close() @@ -656,10 +651,6 @@ class Containerize(): # retag the build images to that we pick it up later ssh.run(f'docker image tag proxy:{tag} oai-lte-multi-ue-proxy:latest') - # no merge: is a push to develop, tag the image so we can push it to the registry - if not self.ranAllowMerge: - ssh.run('docker image tag proxy:{tag} proxy:develop') - # we assume that the host on which this is built will also run the proxy. The proxy # currently requires the following command, and the docker-compose up mechanism of # the CI does not allow to run arbitrary commands. Note that the following actually @@ -667,21 +658,11 @@ class Containerize(): logging.warning('the following command belongs to deployment, but no mechanism exists to exec it there!') ssh.run('sudo ifconfig lo: 127.0.0.2 netmask 255.0.0.0 up') - # Analyzing the logs - if buildProxy: - self.testCase_id = HTML.testCase_id - ssh.cd(f'{lSourcePath}/cmake_targets') - ssh.run(f'mkdir -p proxy_build_log_{self.testCase_id}') - ssh.run(f'mv log/* proxy_build_log_{self.testCase_id}') - if (os.path.isfile('./proxy_build_log_' + self.testCase_id + '.zip')): - os.remove('./proxy_build_log_' + self.testCase_id + '.zip') - if (os.path.isdir('./proxy_build_log_' + self.testCase_id)): - shutil.rmtree('./proxy_build_log_' + self.testCase_id) - ssh.run(f'zip -r -qq proxy_build_log_{self.testCase_id}.zip proxy_build_log_{self.testCase_id}') - filename = f'build_log_{self.testCase_id}.zip' - ssh.copyin(f'{lSourcePath}/cmake_targets/{filename}', filename) - # don't delete such that we might recover the zips - #ssh.run(f'rm -f build_log_{self.testCase_id}.zip') + # to prevent accidentally overwriting data that might be used later + self.ranCommitID = oldRanCommidID + self.ranRepository = oldRanRepository + self.ranAllowMerge = oldRanAllowMerge + self.ranTargetBranch = oldRanTargetBranch # we do not analyze the logs (we assume the proxy builds fine at this stage), # but need to have the following information to correctly display the HTML @@ -696,7 +677,7 @@ class Containerize(): ret = ssh.run(f'docker image inspect --format=\'Size = {{{{.Size}}}} bytes\' proxy:{tag}') result = re.search('Size *= *(?P[0-9\-]+) *bytes', ret.stdout) # Cleaning any created tmp volume - ssh.run(f'{self.cli} volume prune --force') + ssh.run('docker volume prune --force') ssh.close() allImagesSize = {} diff --git a/ci-scripts/tests/README.md b/ci-scripts/tests/README.md index dc8f9ea80a..9a19bacb67 100644 --- a/ci-scripts/tests/README.md +++ b/ci-scripts/tests/README.md @@ -6,6 +6,7 @@ scripts. There are some unit tests. From the parent directory, i.e., `ci-scripts/`, start with + python tests/build.py -v python tests/cmd.py -v python tests/deployment.py -v python tests/iperf-analysis.py -v diff --git a/ci-scripts/tests/build.py b/ci-scripts/tests/build.py new file mode 100644 index 0000000000..669e6711b4 --- /dev/null +++ b/ci-scripts/tests/build.py @@ -0,0 +1,40 @@ +import sys +import logging +logging.basicConfig( + level=logging.DEBUG, + stream=sys.stdout, + format="[%(asctime)s] %(levelname)8s: %(message)s" +) +import unittest +import tempfile + +sys.path.append('./') # to find OAI imports below +import cls_oai_html +import cls_containerize +import cls_cmd + +class TestBuild(unittest.TestCase): + def setUp(self): + self.html = cls_oai_html.HTMLManagement() + self.html.testCase_id = "000000" + self.cont = cls_containerize.Containerize() + self.cont.eNB_serverId[0] = '0' + self.cont.eNBIPAddress = 'localhost' + self.cont.eNBUserName = None + self.cont.eNBPassword = None + self._d = tempfile.mkdtemp() + logging.warning(f"temporary directory: {self._d}") + self.cont.eNBSourceCodePath = self._d + + def tearDown(self): + logging.warning(f"removing directory contents") + with cls_cmd.getConnection(None) as cmd: + cmd.run(f"rm -rf {self._d}") + + def test_build_proxy(self): + self.cont.proxyCommit = "b64d9bce986b38ca59e8582864ade3fcdd05c0dc" + success = self.cont.BuildProxy(self.html) + self.assertTrue(success) + +if __name__ == '__main__': + unittest.main() From 9f5d82212a1a6e1720969371e1943c8bd9b3f173 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 7 Nov 2024 15:02:53 +0100 Subject: [PATCH 73/75] Remove Username/Password from cls_containerize and use GetCredentials() In the last commits, SSHconnection class has been removed from cls_containerize.py. We therefore don't need the username and password, as cls_cmd uses certificates only. Remove the usage of the username and the password, and harmonize the use of GetCredentials(). --- ci-scripts/cls_containerize.py | 191 +++++---------------------------- 1 file changed, 29 insertions(+), 162 deletions(-) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index bac87de124..28f1abbfac 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -143,17 +143,6 @@ def AnalyzeBuildLogs(buildRoot, images, globalStatus): collectInfo[image] = files return collectInfo -def GetCredentials(instance): - server_id = instance.eNB_serverId[instance.eNB_instance] - if server_id == '0': - return (instance.eNBIPAddress, instance.eNBUserName, instance.eNBPassword, instance.eNBSourceCodePath) - elif server_id == '1': - return (instance.eNB1IPAddress, instance.eNB1UserName, instance.eNB1Password, instance.eNB1SourceCodePath) - elif server_id == '2': - return (instance.eNB2IPAddress, instance.eNB2UserName, instance.eNB2Password, instance.eNB2SourceCodePath) - else: - raise Exception ("Only supports maximum of 3 servers") - def GetContainerName(ssh, svcName, file): ret = ssh.run(f"docker compose -f {file} config --format json {svcName} | jq -r '.services.\"{svcName}\".container_name'", silent=True) return ret.stdout @@ -355,28 +344,23 @@ class Containerize(): # Container management functions #----------------------------------------------------------- + def GetCredentials(self, server_id): + if server_id == '0': + ip, path = self.eNBIPAddress, self.eNBSourceCodePath + elif server_id == '1': + ip, path = self.eNB1IPAddress, self.eNB1SourceCodePath + elif server_id == '2': + ip, path = self.eNB2IPAddress, self.eNB2SourceCodePath + else: + raise ValueError(f"unknown server ID '{server_id}'") + if ip == '' or path == '': + HELP.GenericHelp(CONST.Version) + raise ValueError(f'Insufficient Parameter: IP/node {ip}, path {path}') + return (ip, path) + def BuildImage(self, HTML): - if self.ranRepository == '' or self.ranBranch == '' or self.ranCommitID == '': - HELP.GenericHelp(CONST.Version) - sys.exit('Insufficient Parameter') - if self.eNB_serverId[self.eNB_instance] == '0': - lIpAddr = self.eNBIPAddress - lUserName = self.eNBUserName - lPassWord = self.eNBPassword - lSourcePath = self.eNBSourceCodePath - elif self.eNB_serverId[self.eNB_instance] == '1': - lIpAddr = self.eNB1IPAddress - lUserName = self.eNB1UserName - lPassWord = self.eNB1Password - lSourcePath = self.eNB1SourceCodePath - elif self.eNB_serverId[self.eNB_instance] == '2': - lIpAddr = self.eNB2IPAddress - lUserName = self.eNB2UserName - lPassWord = self.eNB2Password - lSourcePath = self.eNB2SourceCodePath - if lIpAddr == '' or lUserName == '' or lPassWord == '' or lSourcePath == '': - HELP.GenericHelp(CONST.Version) - sys.exit('Insufficient Parameter') + svr = self.eNB_serverId[self.eNB_instance] + lIpAddr, lSourcePath = self.GetCredentials(svr) logging.debug('Building on server: ' + lIpAddr) cmd = cls_cmd.RemoteCmd(lIpAddr) @@ -574,30 +558,8 @@ class Containerize(): return False def BuildProxy(self, HTML): - if self.ranRepository == '' or self.ranBranch == '' or self.ranCommitID == '': - HELP.GenericHelp(CONST.Version) - sys.exit('Insufficient Parameter') - if self.eNB_serverId[self.eNB_instance] == '0': - lIpAddr = self.eNBIPAddress - lUserName = self.eNBUserName - lPassWord = self.eNBPassword - lSourcePath = self.eNBSourceCodePath - elif self.eNB_serverId[self.eNB_instance] == '1': - lIpAddr = self.eNB1IPAddress - lUserName = self.eNB1UserName - lPassWord = self.eNB1Password - lSourcePath = self.eNB1SourceCodePath - elif self.eNB_serverId[self.eNB_instance] == '2': - lIpAddr = self.eNB2IPAddress - lUserName = self.eNB2UserName - lPassWord = self.eNB2Password - lSourcePath = self.eNB2SourceCodePath - if lIpAddr == '' or lUserName == '' or lPassWord == '' or lSourcePath == '': - HELP.GenericHelp(CONST.Version) - sys.exit('Insufficient Parameter') - if self.proxyCommit is None: - HELP.GenericHelp(CONST.Version) - sys.exit('Insufficient Parameter (need proxyCommit for proxy build)') + svr = self.eNB_serverId[self.eNB_instance] + lIpAddr, lSourcePath = self.GetCredentials(svr) logging.debug('Building on server: ' + lIpAddr) ssh = cls_cmd.getConnection(lIpAddr) @@ -698,27 +660,8 @@ class Containerize(): return False def BuildRunTests(self, HTML): - if self.ranRepository == '' or self.ranBranch == '' or self.ranCommitID == '': - HELP.GenericHelp(CONST.Version) - sys.exit('Insufficient Parameter') - if self.eNB_serverId[self.eNB_instance] == '0': - lIpAddr = self.eNBIPAddress - lUserName = self.eNBUserName - lPassWord = self.eNBPassword - lSourcePath = self.eNBSourceCodePath - elif self.eNB_serverId[self.eNB_instance] == '1': - lIpAddr = self.eNB1IPAddress - lUserName = self.eNB1UserName - lPassWord = self.eNB1Password - lSourcePath = self.eNB1SourceCodePath - elif self.eNB_serverId[self.eNB_instance] == '2': - lIpAddr = self.eNB2IPAddress - lUserName = self.eNB2UserName - lPassWord = self.eNB2Password - lSourcePath = self.eNB2SourceCodePath - if lIpAddr == '' or lUserName == '' or lPassWord == '' or lSourcePath == '': - HELP.GenericHelp(CONST.Version) - sys.exit('Insufficient Parameter') + svr = self.eNB_serverId[self.eNB_instance] + lIpAddr, lSourcePath = self.GetCredentials(svr) logging.debug('Building on server: ' + lIpAddr) cmd = cls_cmd.RemoteCmd(lIpAddr) cmd.cd(lSourcePath) @@ -781,24 +724,7 @@ class Containerize(): return False def Push_Image_to_Local_Registry(self, HTML): - if self.registrySvrId == '0': - lIpAddr = self.eNBIPAddress - lUserName = self.eNBUserName - lPassWord = self.eNBPassword - lSourcePath = self.eNBSourceCodePath - elif self.registrySvrId == '1': - lIpAddr = self.eNB1IPAddress - lUserName = self.eNB1UserName - lPassWord = self.eNB1Password - lSourcePath = self.eNB1SourceCodePath - elif self.registrySvrId == '2': - lIpAddr = self.eNB2IPAddress - lUserName = self.eNB2UserName - lPassWord = self.eNB2Password - lSourcePath = self.eNB2SourceCodePath - if lIpAddr == '' or lUserName == '' or lPassWord == '' or lSourcePath == '': - HELP.GenericHelp(CONST.Version) - sys.exit('Insufficient Parameter') + lIpAddr, lSourcePath = self.GetCredentials(self.registrySvrId) logging.debug('Pushing images from server: ' + lIpAddr) ssh = cls_cmd.getConnection(lIpAddr) imagePrefix = 'porcepix.sboai.cs.eurecom.fr' @@ -846,26 +772,7 @@ class Containerize(): return True def Pull_Image_from_Local_Registry(self, HTML): - # This method can be called either onto a remote server (different from python executor) - # or directly on the python executor (ie lIpAddr == 'none') - if self.testSvrId == '0': - lIpAddr = self.eNBIPAddress - lUserName = self.eNBUserName - lPassWord = self.eNBPassword - lSourcePath = self.eNBSourceCodePath - elif self.testSvrId == '1': - lIpAddr = self.eNB1IPAddress - lUserName = self.eNB1UserName - lPassWord = self.eNB1Password - lSourcePath = self.eNB1SourceCodePath - elif self.testSvrId == '2': - lIpAddr = self.eNB2IPAddress - lUserName = self.eNB2UserName - lPassWord = self.eNB2Password - lSourcePath = self.eNB2SourceCodePath - if lIpAddr == '' or lUserName == '' or lPassWord == '' or lSourcePath == '': - HELP.GenericHelp(CONST.Version) - sys.exit('Insufficient Parameter') + lIpAddr, lSourcePath = self.GetCredentials(self.testSvrId) logging.debug('\u001B[1m Pulling image(s) on server: ' + lIpAddr + '\u001B[0m') myCmd = cls_cmd.getConnection(lIpAddr) imagePrefix = 'porcepix.sboai.cs.eurecom.fr' @@ -905,26 +812,7 @@ class Containerize(): return True def Clean_Test_Server_Images(self, HTML): - # This method can be called either onto a remote server (different from python executor) - # or directly on the python executor (ie lIpAddr == 'none') - if self.testSvrId == '0': - lIpAddr = self.eNBIPAddress - lUserName = self.eNBUserName - lPassWord = self.eNBPassword - lSourcePath = self.eNBSourceCodePath - elif self.testSvrId == '1': - lIpAddr = self.eNB1IPAddress - lUserName = self.eNB1UserName - lPassWord = self.eNB1Password - lSourcePath = self.eNB1SourceCodePath - elif self.testSvrId == '2': - lIpAddr = self.eNB2IPAddress - lUserName = self.eNB2UserName - lPassWord = self.eNB2Password - lSourcePath = self.eNB2SourceCodePath - if lIpAddr == '' or lUserName == '' or lPassWord == '' or lSourcePath == '': - HELP.GenericHelp(CONST.Version) - sys.exit('Insufficient Parameter') + lIpAddr, lSourcePath = self.GetCredentials(self.testSvrId) if lIpAddr != 'none': logging.debug('Removing test images from server: ' + lIpAddr) myCmd = cls_cmd.RemoteCmd(lIpAddr) @@ -943,25 +831,8 @@ class Containerize(): return True def Create_Workspace(self,HTML): - if self.eNB_serverId[self.eNB_instance] == '0': - lIpAddr = self.eNBIPAddress - lUserName = self.eNBUserName - lPassWord = self.eNBPassword - lSourcePath = self.eNBSourceCodePath - elif self.eNB_serverId[self.eNB_instance] == '1': - lIpAddr = self.eNB1IPAddress - lUserName = self.eNB1UserName - lPassWord = self.eNB1Password - lSourcePath = self.eNB1SourceCodePath - elif self.eNB_serverId[self.eNB_instance] == '2': - lIpAddr = self.eNB2IPAddress - lUserName = self.eNB2UserName - lPassWord = self.eNB2Password - lSourcePath = self.eNB2SourceCodePath - if lIpAddr == '' or lUserName == '' or lPassWord == '' or lSourcePath == '': - HELP.GenericHelp(CONST.Version) - sys.exit('Insufficient Parameter') - + svr = self.eNB_serverId[self.eNB_instance] + lIpAddr, lSourcePath = self.GetCredentials(svr) success = CreateWorkspace(lIpAddr, lSourcePath, self.ranRepository, self.ranCommitID, self.ranTargetBranch, self.ranAllowMerge) if success: HTML.CreateHtmlTestRowQueue('N/A', 'OK', [f"created workspace {lSourcePath}"]) @@ -970,10 +841,8 @@ class Containerize(): return success def DeployObject(self, HTML): - lIpAddr, lUserName, lPassWord, lSourcePath = GetCredentials(self) - if lIpAddr == '' or lUserName == '' or lPassWord == '' or lSourcePath == '': - HELP.GenericHelp(CONST.Version) - sys.exit('Insufficient Parameter') + svr = self.eNB_serverId[self.eNB_instance] + lIpAddr, lSourcePath = self.GetCredentials(svr) logging.debug('\u001B[1m Deploying OAI Object on server: ' + lIpAddr + '\u001B[0m') yaml = self.yamlPath[self.eNB_instance].strip('/') wd = f'{lSourcePath}/{yaml}' @@ -1016,10 +885,8 @@ class Containerize(): return fstatus def UndeployObject(self, HTML, RAN): - lIpAddr, lUserName, lPassWord, lSourcePath = GetCredentials(self) - if lIpAddr == '' or lUserName == '' or lPassWord == '' or lSourcePath == '': - HELP.GenericHelp(CONST.Version) - sys.exit('Insufficient Parameter') + svr = self.eNB_serverId[self.eNB_instance] + lIpAddr, lSourcePath = self.GetCredentials(svr) logging.debug(f'\u001B[1m Undeploying OAI Object from server: {lIpAddr}\u001B[0m') yaml = self.yamlPath[self.eNB_instance].strip('/') wd = f'{lSourcePath}/{yaml}' From 0784d1907fee70c79311df888d78d3498203a5e5 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Sat, 9 Nov 2024 12:46:09 +0100 Subject: [PATCH 74/75] ci-scripts/tests/README.md: how to run all tests --- ci-scripts/tests/README.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ci-scripts/tests/README.md b/ci-scripts/tests/README.md index 9a19bacb67..364cf031d3 100644 --- a/ci-scripts/tests/README.md +++ b/ci-scripts/tests/README.md @@ -3,8 +3,12 @@ scripts. # Unit test -There are some unit tests. From the parent directory, i.e., `ci-scripts/`, -start with +This repository contains unit tests. To run them, switch to the parent +directory, i.e., `ci-scripts/`, and run + + python3 -m unittest tests/*.py + +To run individual unit tests, start them like so: python tests/build.py -v python tests/cmd.py -v @@ -12,8 +16,8 @@ start with python tests/iperf-analysis.py -v python tests/ping-iperf.py -v -It will indicate if all tests passed. `tests/deployment.py` requires these -images to be present: +The logs will indicate if all tests passed. `tests/deployment.py` requires +these images to be present: - `oai-ci/oai-nr-ue:develop-12345678` - `oai-ci/oai-gnb:develop-12345678` From 9e81040a8d12eaa35a98f78077acb165f34ef3b1 Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Fri, 8 Nov 2024 22:09:14 +0100 Subject: [PATCH 75/75] CI: use multiple cores for nr_ulsim/nr_dlsim tests with T2 Increase number of cores used for T2 nr_ulsim/nr_dlsim processing to ensure a fair comparison of total gNB PHY RX/TX processing time. --- .../xml_files/t2_offload_dec_nr_ulsim.xml | 18 ++++++------- .../xml_files/t2_offload_enc_nr_dlsim.xml | 26 +++++++++---------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/ci-scripts/xml_files/t2_offload_dec_nr_ulsim.xml b/ci-scripts/xml_files/t2_offload_dec_nr_ulsim.xml index 8fe7fcf126..7cbbbcaf14 100644 --- a/ci-scripts/xml_files/t2_offload_dec_nr_ulsim.xml +++ b/ci-scripts/xml_files/t2_offload_dec_nr_ulsim.xml @@ -45,7 +45,7 @@ true nr_ulsim 100 - -n100 -s30 -S30.2 -m5 -r106 -R106 -o -P --ldpc_offload.dpdk_dev d8:00.0 + -n100 -s30 -S30.2 -m5 -r106 -R106 -C10 -o -P --ldpc_offload.dpdk_dev d8:00.0 @@ -63,7 +63,7 @@ true nr_ulsim 150 - -n100 -s30 -S30.2 -m15 -r106 -R106 -o -P --ldpc_offload.dpdk_dev d8:00.0 + -n100 -s30 -S30.2 -m15 -r106 -R106 -C10 -o -P --ldpc_offload.dpdk_dev d8:00.0 @@ -81,7 +81,7 @@ true nr_ulsim 250 - -n100 -s30 -S30.2 -m25 -r106 -R106 -o -P --ldpc_offload.dpdk_dev d8:00.0 + -n100 -s30 -S30.2 -m25 -r106 -R106 -C10 -o -P --ldpc_offload.dpdk_dev d8:00.0 @@ -99,7 +99,7 @@ true nr_ulsim 150 - -n100 -s30 -S30.2 -m5 -r273 -R273 -o -P --ldpc_offload.dpdk_dev d8:00.0 + -n100 -s30 -S30.2 -m5 -r273 -R273 -C10 -o -P --ldpc_offload.dpdk_dev d8:00.0 @@ -117,7 +117,7 @@ true nr_ulsim 350 - -n100 -s30 -S30.2 -m15 -r273 -R273 -o -P --ldpc_offload.dpdk_dev d8:00.0 + -n100 -s30 -S30.2 -m15 -r273 -R273 -C10 -o -P --ldpc_offload.dpdk_dev d8:00.0 @@ -135,7 +135,7 @@ true nr_ulsim 550 - -n100 -s30 -S30.2 -m25 -r273 -R273 -o -P --ldpc_offload.dpdk_dev d8:00.0 + -n100 -s30 -S30.2 -m25 -r273 -R273 -C10 -o -P --ldpc_offload.dpdk_dev d8:00.0 @@ -153,7 +153,7 @@ true nr_ulsim 250 - -n100 -s30 -S30.2 -m5 -r273 -R273 -o -W2 -z2 -y2 -P --ldpc_offload.dpdk_dev d8:00.0 + -n100 -s30 -S30.2 -m5 -r273 -R273 -C10 -o -W2 -z2 -y2 -P --ldpc_offload.dpdk_dev d8:00.0 @@ -171,7 +171,7 @@ true nr_ulsim 650 - -n100 -s30 -S30.2 -m15 -r273 -R273 -o -W2 -z2 -y2 -P --ldpc_offload.dpdk_dev d8:00.0 + -n100 -s30 -S30.2 -m15 -r273 -R273 -C10 -o -W2 -z2 -y2 -P --ldpc_offload.dpdk_dev d8:00.0 @@ -189,7 +189,7 @@ true nr_ulsim 1100 - -n100 -s30 -S30.2 -m25 -r273 -R273 -o -W2 -z2 -y2 -P --ldpc_offload.dpdk_dev d8:00.0 + -n100 -s30 -S30.2 -m25 -r273 -R273 -C10 -o -W2 -z2 -y2 -P --ldpc_offload.dpdk_dev d8:00.0 diff --git a/ci-scripts/xml_files/t2_offload_enc_nr_dlsim.xml b/ci-scripts/xml_files/t2_offload_enc_nr_dlsim.xml index df6c613393..c4dba5db6c 100644 --- a/ci-scripts/xml_files/t2_offload_enc_nr_dlsim.xml +++ b/ci-scripts/xml_files/t2_offload_enc_nr_dlsim.xml @@ -46,7 +46,7 @@ true nr_dlsim 100 - -n100 -s30 -S30.2 -e5 -b106 -R106 -c -P --ldpc_offload.dpdk_dev d8:00.0 + -n100 -s30 -S30.2 -e5 -b106 -R106 -c -X4,5,6,7,8,9 -P --ldpc_offload.dpdk_dev d8:00.0 @@ -64,7 +64,7 @@ true nr_dlsim 100 - -n100 -s30 -S30.2 -e15 -b106 -R106 -c -P --ldpc_offload.dpdk_dev d8:00.0 + -n100 -s30 -S30.2 -e15 -b106 -R106 -c -X4,5,6,7,8,9 -P --ldpc_offload.dpdk_dev d8:00.0 @@ -82,7 +82,7 @@ true nr_dlsim 200 - -n100 -s30 -S30.2 -e25 -b106 -R106 -c -P --ldpc_offload.dpdk_dev d8:00.0 + -n100 -s30 -S30.2 -e25 -b106 -R106 -c -X4,5,6,7,8,9 -P --ldpc_offload.dpdk_dev d8:00.0 @@ -100,7 +100,7 @@ true nr_dlsim 150 - -n100 -s30 -S30.2 -e5 -b273 -R273 -c -P --ldpc_offload.dpdk_dev d8:00.0 + -n100 -s30 -S30.2 -e5 -b273 -R273 -c -X4,5,6,7,8,9 -P --ldpc_offload.dpdk_dev d8:00.0 @@ -118,7 +118,7 @@ true nr_dlsim 250 - -n100 -s30 -S30.2 -e15 -b273 -R273 -c -P --ldpc_offload.dpdk_dev d8:00.0 + -n100 -s30 -S30.2 -e15 -b273 -R273 -c -X4,5,6,7,8,9 -P --ldpc_offload.dpdk_dev d8:00.0 @@ -136,7 +136,7 @@ true nr_dlsim 400 - -n100 -s30 -S30.2 -e25 -b273 -R273 -c -P --ldpc_offload.dpdk_dev d8:00.0 + -n100 -s30 -S30.2 -e25 -b273 -R273 -c -X4,5,6,7,8,9 -P --ldpc_offload.dpdk_dev d8:00.0 @@ -154,7 +154,7 @@ true nr_dlsim 200 - -n100 -s30 -S30.2 -e5 -b273 -R273 -c -x2 -z2 -y2 -P --ldpc_offload.dpdk_dev d8:00.0 + -n100 -s30 -S30.2 -e5 -b273 -R273 -c -X4,5,6,7,8,9 -x2 -z2 -y2 -P --ldpc_offload.dpdk_dev d8:00.0 @@ -172,7 +172,7 @@ true nr_dlsim 500 - -n100 -s30 -S30.2 -e15 -b273 -R273 -c -x2 -z2 -y2 -P --ldpc_offload.dpdk_dev d8:00.0 + -n100 -s30 -S30.2 -e15 -b273 -R273 -c -X4,5,6,7,8,9 -x2 -z2 -y2 -P --ldpc_offload.dpdk_dev d8:00.0 @@ -190,7 +190,7 @@ true nr_dlsim 500 - -n100 -s30 -S30.2 -e25 -b273 -R273 -c -x2 -z2 -y2 -P --ldpc_offload.dpdk_dev d8:00.0 + -n100 -s30 -S30.2 -e25 -b273 -R273 -c -X4,5,6,7,8,9 -x2 -z2 -y2 -P --ldpc_offload.dpdk_dev d8:00.0 @@ -207,8 +207,8 @@ Run nr_dlsim with T2 LDPC offload: SNR = 30, MCS = 5, 273 PRBs, 2 layers, 4 antennas true nr_dlsim - 150 - -n100 -s30 -S30.2 -e5 -b273 -R273 -c -x2 -z4 -y4 -P --ldpc_offload.dpdk_dev d8:00.0 + 200 + -n100 -s30 -S30.2 -e5 -b273 -R273 -c -X4,5,6,7,8,9 -x2 -z4 -y4 -P --ldpc_offload.dpdk_dev d8:00.0 @@ -226,7 +226,7 @@ true nr_dlsim 300 - -n100 -s30 -S30.2 -e15 -b273 -R273 -c -x2 -z4 -y4 -P --ldpc_offload.dpdk_dev d8:00.0 + -n100 -s30 -S30.2 -e15 -b273 -R273 -c -X4,5,6,7,8,9 -x2 -z4 -y4 -P --ldpc_offload.dpdk_dev d8:00.0 @@ -244,6 +244,6 @@ true nr_dlsim 450 - -n100 -s30 -S30.2 -e25 -b273 -R273 -c -x2 -z4 -y4 -P --ldpc_offload.dpdk_dev d8:00.0 + -n100 -s30 -S30.2 -e25 -b273 -R273 -c -X4,5,6,7,8,9 -x2 -z4 -y4 -P --ldpc_offload.dpdk_dev d8:00.0