From 286893a1ed6d87ff777ebe00ad868fde4c1480d7 Mon Sep 17 00:00:00 2001 From: Eurecom Date: Mon, 27 Sep 2021 07:21:00 +0200 Subject: [PATCH 001/114] commit before merge --- openair1/PHY/NR_TRANSPORT/nr_dci.c | 4 ++-- targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index 194c7c0c56..77ad962d56 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -97,8 +97,8 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, cset_start_symb = pdcch_pdu_rel15->StartSymbolIndex; cset_nsymb = pdcch_pdu_rel15->DurationSymbols; dci_idx = 0; - LOG_D(PHY, "Coreset rb_offset %d, nb_rb %d BWP Start %d\n",rb_offset,n_rb,pdcch_pdu_rel15->BWPStart); - LOG_D(PHY, "Coreset starting subcarrier %d on symbol %d (%d symbols)\n", cset_start_sc, cset_start_symb, cset_nsymb); + LOG_I(PHY, "Coreset rb_offset %d, nb_rb %d BWP Start %d\n",rb_offset,n_rb,pdcch_pdu_rel15->BWPStart); + LOG_I(PHY, "Coreset starting subcarrier %d on symbol %d (%d symbols)\n", cset_start_sc, cset_start_symb, cset_nsymb); // DMRS length is per OFDM symbol uint32_t dmrs_length = n_rb*6; //2(QPSK)*3(per RB)*6(REG per CCE) uint32_t encoded_length = dci_pdu->AggregationLevel*108; //2(QPSK)*9(per RB)*6(REG per CCE) diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index e7a3c61c51..67ca6b9169 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -942,7 +942,7 @@ extern "C" { LOG_I(HW, "openair0_cfg[0].sdr_addrs == '%s'\n", openair0_cfg[0].sdr_addrs); LOG_I(HW, "openair0_cfg[0].clock_source == '%d' (internal = %d, external = %d)\n", openair0_cfg[0].clock_source,internal,external); usrp_state_t *s ; - int choffset = 1; + int choffset = 0; if ( device->priv == NULL) { s=(usrp_state_t *)calloc(sizeof(usrp_state_t),1); From d9235268b46e5c7ecedf783c2167b56669b404da Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Wed, 29 Sep 2021 21:32:22 +0200 Subject: [PATCH 002/114] MAC statistics in separate thread --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 89 ++-------------------- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 1 + openair2/LAYER2/NR_MAC_gNB/main.c | 81 ++++++++++++++++++++ openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 1 + 4 files changed, 89 insertions(+), 83 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index e3ee1d9888..f9f8524f7f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -62,87 +62,6 @@ uint16_t nr_pdcch_order_table[6] = { 31, 31, 511, 2047, 2047, 8191 }; uint8_t vnf_first_sched_entry = 1; -void clear_mac_stats(gNB_MAC_INST *gNB) { - memset((void*)gNB->UE_info.mac_stats,0,MAX_MOBILES_PER_GNB*sizeof(NR_mac_stats_t)); -} -#define MACSTATSSTRLEN 16384 -void dump_mac_stats(gNB_MAC_INST *gNB) -{ - NR_UE_info_t *UE_info = &gNB->UE_info; - int num = 1; - FILE *fd=fopen("nrMAC_stats.log","w"); - AssertFatal(fd!=NULL,"Cannot open nrMAC_stats.log, error %s\n",strerror(errno)); - char output[MACSTATSSTRLEN]; - memset(output,0,MACSTATSSTRLEN); - int stroff=0; - for (int UE_id = UE_info->list.head; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) { - - stroff+=sprintf(output+stroff,"UE ID %d RNTI %04x (%d/%d) PH %d dB PCMAX %d dBm\n", - UE_id, - UE_info->rnti[UE_id], - num++, - UE_info->num_UEs, - UE_info->UE_sched_ctrl[UE_id].ph, - UE_info->UE_sched_ctrl[UE_id].pcmax); - - LOG_I(NR_MAC, "UE ID %d RNTI %04x (%d/%d) PH %d dB PCMAX %d dBm\n", - UE_id, - UE_info->rnti[UE_id], - num++, - UE_info->num_UEs, - UE_info->UE_sched_ctrl[UE_id].ph, - UE_info->UE_sched_ctrl[UE_id].pcmax); - - NR_mac_stats_t *stats = &UE_info->mac_stats[UE_id]; - const int avg_rsrp = stats->num_rsrp_meas > 0 ? stats->cumul_rsrp / stats->num_rsrp_meas : 0; - stroff+=sprintf(output+stroff,"UE %d: dlsch_rounds %d/%d/%d/%d, dlsch_errors %d, pucch0_DTX %d average RSRP %d (%d meas)\n", - UE_id, - stats->dlsch_rounds[0], stats->dlsch_rounds[1], - stats->dlsch_rounds[2], stats->dlsch_rounds[3], stats->dlsch_errors, - stats->pucch0_DTX, - avg_rsrp, stats->num_rsrp_meas); - LOG_I(NR_MAC, "UE %d: dlsch_rounds %d/%d/%d/%d, dlsch_errors %d\n", - UE_id, - stats->dlsch_rounds[0], stats->dlsch_rounds[1], - stats->dlsch_rounds[2], stats->dlsch_rounds[3], stats->dlsch_errors); - stats->num_rsrp_meas = 0; - stats->cumul_rsrp = 0 ; - stroff+=sprintf(output+stroff,"UE %d: dlsch_total_bytes %d\n", UE_id, stats->dlsch_total_bytes); - stroff+=sprintf(output+stroff,"UE %d: ulsch_rounds %d/%d/%d/%d, ulsch_DTX %d, ulsch_errors %d\n", - UE_id, - stats->ulsch_rounds[0], stats->ulsch_rounds[1], - stats->ulsch_rounds[2], stats->ulsch_rounds[3], - stats->ulsch_DTX, - stats->ulsch_errors); - stroff+=sprintf(output+stroff, - "UE %d: ulsch_total_bytes_scheduled %d, ulsch_total_bytes_received %d\n", - UE_id, - stats->ulsch_total_bytes_scheduled, stats->ulsch_total_bytes_rx); - LOG_I(NR_MAC, "UE %d: dlsch_total_bytes %d\n", UE_id, stats->dlsch_total_bytes); - LOG_I(NR_MAC, "UE %d: ulsch_rounds %d/%d/%d/%d, ulsch_errors %d\n", - UE_id, - stats->ulsch_rounds[0], stats->ulsch_rounds[1], - stats->ulsch_rounds[2], stats->ulsch_rounds[3], - stats->ulsch_errors); - LOG_I(NR_MAC, - "UE %d: ulsch_total_bytes (scheduled/received): %d / %d\n", - UE_id, - stats->ulsch_total_bytes_scheduled, stats->ulsch_total_bytes_rx); - for (int lc_id = 0; lc_id < 63; lc_id++) { - if (stats->lc_bytes_tx[lc_id] > 0) { - stroff+=sprintf(output+stroff, "UE %d: LCID %d: %d bytes TX\n", UE_id, lc_id, stats->lc_bytes_tx[lc_id]); - LOG_D(NR_MAC, "UE %d: LCID %d: %d bytes TX\n", UE_id, lc_id, stats->lc_bytes_tx[lc_id]); - } - if (stats->lc_bytes_rx[lc_id] > 0) { - stroff+=sprintf(output+stroff, "UE %d: LCID %d: %d bytes RX\n", UE_id, lc_id, stats->lc_bytes_rx[lc_id]); - LOG_D(NR_MAC, "UE %d: LCID %d: %d bytes RX\n", UE_id, lc_id, stats->lc_bytes_rx[lc_id]); - } - } - } - print_meas(&gNB->eNB_scheduler, "DL & UL scheduling timing stats", NULL, NULL); - if (stroff>0) fprintf(fd,"%s",output); - fclose(fd); -} void clear_nr_nfapi_information(gNB_MAC_INST * gNB, int CC_idP, @@ -362,6 +281,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, NOT_A_RNTI, frame, slot,module_idP); const int bwp_id = 1; + char stats_output[16384]; gNB_MAC_INST *gNB = RC.nrmac[module_idP]; NR_COMMON_channels_t *cc = gNB->common_channels; @@ -429,8 +349,11 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, } - if ((slot == 0) && (frame & 127) == 0) dump_mac_stats(RC.nrmac[module_idP]); - + if ((slot == 0) && (frame & 127) == 0) { + stats_output[0]='\0'; + dump_mac_stats(RC.nrmac[module_idP],stats_output,16384); + LOG_I(NR_MAC,"Frame.Slot %d.%d\n%s\n",frame,slot,stats_output); + } // This schedules MIB schedule_nr_mib(module_idP, frame, slot); diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 321476d513..51bbcf1c8a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -442,4 +442,5 @@ bool nr_find_nb_rb(uint16_t Qm, void nr_sr_reporting(int Mod_idP, frame_t frameP, sub_frame_t slotP); +void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen); #endif /*__LAYER2_NR_MAC_PROTO_H__*/ diff --git a/openair2/LAYER2/NR_MAC_gNB/main.c b/openair2/LAYER2/NR_MAC_gNB/main.c index 117c18ae8d..0497eea7e1 100644 --- a/openair2/LAYER2/NR_MAC_gNB/main.c +++ b/openair2/LAYER2/NR_MAC_gNB/main.c @@ -45,6 +45,85 @@ extern RAN_CONTEXT_t RC; +#define MACSTATSSTRLEN 16384 + +void nrmac_stats_thread(void *arg) { + + gNB_MAC_INST *gNB = (gNB_MAC_INST *)arg; + + char output[MACSTATSSTRLEN]; + memset(output,0,MACSTATSSTRLEN); + FILE *fd=fopen("nrMAC_stats.log","w"); + AssertFatal(fd!=NULL,"Cannot open nrMAC_stats.log, error %s\n",strerror(errno)); + + while (oai_exit == 0) { + dump_mac_stats(gNB,output,MACSTATSSTRLEN); + fprintf(fd,"%s\n",output); + fflush(fd); + usleep(200000); + fseek(fd,0,SEEK_SET); + } + fclose(fd); +} + +void clear_mac_stats(gNB_MAC_INST *gNB) { + memset((void*)gNB->UE_info.mac_stats,0,MAX_MOBILES_PER_GNB*sizeof(NR_mac_stats_t)); +} + +void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen) +{ + NR_UE_info_t *UE_info = &gNB->UE_info; + int num = 1; + + int stroff=0; + if (UE_info->num_UEs == 0) return; + + for (int UE_id = UE_info->list.head; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) { + + stroff+=sprintf(output+stroff,"UE ID %d RNTI %04x (%d/%d) PH %d dB PCMAX %d dBm\n", + UE_id, + UE_info->rnti[UE_id], + num++, + UE_info->num_UEs, + UE_info->UE_sched_ctrl[UE_id].ph, + UE_info->UE_sched_ctrl[UE_id].pcmax); + + NR_mac_stats_t *stats = &UE_info->mac_stats[UE_id]; + const int avg_rsrp = stats->num_rsrp_meas > 0 ? stats->cumul_rsrp / stats->num_rsrp_meas : 0; + stroff+=sprintf(output+stroff,"UE %d: dlsch_rounds %d/%d/%d/%d, dlsch_errors %d, pucch0_DTX %d average RSRP %d (%d meas)\n", + UE_id, + stats->dlsch_rounds[0], stats->dlsch_rounds[1], + stats->dlsch_rounds[2], stats->dlsch_rounds[3], stats->dlsch_errors, + stats->pucch0_DTX, + avg_rsrp, stats->num_rsrp_meas); + stats->num_rsrp_meas = 0; + stats->cumul_rsrp = 0 ; + stroff+=sprintf(output+stroff,"UE %d: dlsch_total_bytes %d\n", UE_id, stats->dlsch_total_bytes); + stroff+=sprintf(output+stroff,"UE %d: ulsch_rounds %d/%d/%d/%d, ulsch_DTX %d, ulsch_errors %d\n", + UE_id, + stats->ulsch_rounds[0], stats->ulsch_rounds[1], + stats->ulsch_rounds[2], stats->ulsch_rounds[3], + stats->ulsch_DTX, + stats->ulsch_errors); + stroff+=sprintf(output+stroff, + "UE %d: ulsch_total_bytes_scheduled %d, ulsch_total_bytes_received %d\n", + UE_id, + stats->ulsch_total_bytes_scheduled, stats->ulsch_total_bytes_rx); + for (int lc_id = 0; lc_id < 63; lc_id++) { + if (stats->lc_bytes_tx[lc_id] > 0) { + stroff+=sprintf(output+stroff, "UE %d: LCID %d: %d bytes TX\n", UE_id, lc_id, stats->lc_bytes_tx[lc_id]); + LOG_D(NR_MAC, "UE %d: LCID %d: %d bytes TX\n", UE_id, lc_id, stats->lc_bytes_tx[lc_id]); + } + if (stats->lc_bytes_rx[lc_id] > 0) { + stroff+=sprintf(output+stroff, "UE %d: LCID %d: %d bytes RX\n", UE_id, lc_id, stats->lc_bytes_rx[lc_id]); + LOG_D(NR_MAC, "UE %d: LCID %d: %d bytes RX\n", UE_id, lc_id, stats->lc_bytes_rx[lc_id]); + } + } + } + print_meas(&gNB->eNB_scheduler, "DL & UL scheduling timing stats", NULL, NULL); +} + + void mac_top_init_gNB(void) { module_id_t i; @@ -90,6 +169,7 @@ void mac_top_init_gNB(void) RC.nrmac[i]->pre_processor_dl = nr_init_fr1_dlsch_preprocessor(i, 0); RC.nrmac[i]->pre_processor_ul = nr_init_fr1_ulsch_preprocessor(i, 0); } + pthread_create(&RC.nrmac[i]->stats_thread,NULL,nrmac_stats_thread,(void*)RC.nrmac[i]); }//END for (i = 0; i < RC.nb_nr_macrlc_inst; i++) @@ -103,6 +183,7 @@ void mac_top_init_gNB(void) rrc_init_nr_global_param(); + } else { RC.nrmac = NULL; } diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index c2e2b8d562..1a3b654727 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -665,6 +665,7 @@ typedef struct gNB_MAC_INST_s { NR_TAG_t *tag; /// Pointer to IF module instance for PHY NR_IF_Module_t *if_inst; + pthread_t stats_thread; /// Pusch target SNR int pusch_target_snrx10; /// Pucch target SNR From 33371f226a963e5e391a864f42511f6c191982a8 Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Tue, 5 Oct 2021 11:37:34 +0200 Subject: [PATCH 003/114] initial changes for n41 support with aw2s RRU --- executables/nr-ru.c | 1 - executables/nr-softmodem.c | 4 +++- openair1/PHY/NR_TRANSPORT/nr_dci.c | 4 ++-- openair1/PHY/NR_TRANSPORT/nr_dlsch.c | 2 ++ openair1/PHY/NR_TRANSPORT/nr_prach.c | 21 ++++++++++--------- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 2 +- openair1/SCHED_NR/fapi_nr_l1.c | 3 ++- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 2 +- openair2/LAYER2/NR_MAC_gNB/config.c | 4 ++-- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 2 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 20 ++++++++++-------- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 2 +- 12 files changed, 37 insertions(+), 30 deletions(-) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 57ab8494bf..4bcfc04b98 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1401,7 +1401,6 @@ void *ru_thread( void *param ) { // Do PRACH RU processing int prach_id=find_nr_prach_ru(ru,proc->frame_rx,proc->tti_rx,SEARCH_EXIST); uint8_t prachStartSymbol,N_dur; - if (prach_id>=0) { T(T_GNB_PHY_PRACH_INPUT_SIGNAL, T_INT(proc->frame_rx), T_INT(proc->tti_rx), T_INT(0), T_BUFFER(&ru->common.rxdata[0][fp->get_samples_slot_timestamp(proc->tti_rx-1,fp,0)]/*-ru->N_TA_offset*/, fp->get_samples_per_slot(proc->tti_rx,fp)*4*2)); diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 1b33667b13..a799a54d57 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -335,13 +335,15 @@ int create_gNB_tasks(uint32_t gnb_nb) { for(int i = GNB_INTERFACE_NAME_FOR_NG_AMF_IDX; i <= GNB_IPV4_ADDRESS_FOR_NG_AMF_IDX; i++) { if( NETParams[i].strptr == NULL) { - LOG_E(NGAP, "No configuration in the file.\n"); + LOG_E(NGAP, "No configuration in the file (%d).\n",i); NGAP_CONF_MODE = 0; } else { LOG_D(NGAP, "Configuration in the file: %s.\n",*NETParams[i].strptr); } } + LOG_E(NGAP,"aprefix %s : %s %s %s %s %d %s %d\n",aprefix,NETParams[0].strptr,NETParams[1].strptr,NETParams[2].strptr,NETParams[3].strptr,NETParams[4].iptr,NETParams[5].strptr,NETParams[6].iptr); + if (AMF_MODE_ENABLED) { if (gnb_nb > 0) { /* diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index 194c7c0c56..253635ba65 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -97,8 +97,8 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, cset_start_symb = pdcch_pdu_rel15->StartSymbolIndex; cset_nsymb = pdcch_pdu_rel15->DurationSymbols; dci_idx = 0; - LOG_D(PHY, "Coreset rb_offset %d, nb_rb %d BWP Start %d\n",rb_offset,n_rb,pdcch_pdu_rel15->BWPStart); - LOG_D(PHY, "Coreset starting subcarrier %d on symbol %d (%d symbols)\n", cset_start_sc, cset_start_symb, cset_nsymb); + LOG_D(PHY, "pdcch: Coreset rb_offset %d, nb_rb %d BWP Start %d\n",rb_offset,n_rb,pdcch_pdu_rel15->BWPStart); + LOG_D(PHY, "pdcch: Coreset starting subcarrier %d on symbol %d (%d symbols)\n", cset_start_sc, cset_start_symb, cset_nsymb); // DMRS length is per OFDM symbol uint32_t dmrs_length = n_rb*6; //2(QPSK)*3(per RB)*6(REG per CCE) uint32_t encoded_length = dci_pdu->AggregationLevel*108; //2(QPSK)*9(per RB)*6(REG per CCE) diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index 5e00a37266..627149ac1f 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -146,6 +146,8 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, uint8_t dmrs_Type = rel15->dmrsConfigType; int nb_re_dmrs; uint16_t n_dmrs; + LOG_D(PHY,"pdsch: BWPStart %d, BWPSize %d, rbStart %d, rbsize %d\n", + rel15->BWPStart,rel15->BWPSize,rel15->rbStart,rel15->rbSize); if (rel15->dmrsConfigType==NFAPI_NR_DMRS_TYPE1) { nb_re_dmrs = 6*rel15->numDmrsCdmGrpsNoData; } diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach.c b/openair1/PHY/NR_TRANSPORT/nr_prach.c index 4e2fbd4e71..b12a58526d 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_TRANSPORT/nr_prach.c @@ -68,7 +68,7 @@ int16_t find_nr_prach(PHY_VARS_gNB *gNB,int frame, int slot, find_type_t type) { } else if ((type == SEARCH_EXIST) && (gNB->prach_vars.list[i].frame == frame) && - (gNB->prach_vars.list[i].slot == slot)) { + (gNB->prach_vars.list[i].slot == slot)) { return i; } } @@ -107,15 +107,15 @@ int16_t find_nr_prach_ru(RU_t *ru,int frame,int slot, find_type_t type) { for (uint16_t i=0; i %d.%d\n", frame,slot,i, ru->prach_list[i].frame,ru->prach_list[i].slot); - if((type == SEARCH_EXIST_OR_FREE) && - (ru->prach_list[i].frame == -1) && - (ru->prach_list[i].slot == -1)) { - pthread_mutex_unlock(&ru->prach_list_mutex); - return i; - } + if((type == SEARCH_EXIST_OR_FREE) && + (ru->prach_list[i].frame == -1) && + (ru->prach_list[i].slot == -1)) { + pthread_mutex_unlock(&ru->prach_list_mutex); + return i; + } else if ((type == SEARCH_EXIST) && - (ru->prach_list[i].frame == frame) && - (ru->prach_list[i].slot == slot)) { + (ru->prach_list[i].frame == frame) && + (ru->prach_list[i].slot == slot)) { pthread_mutex_unlock(&ru->prach_list_mutex); return i; } @@ -185,7 +185,8 @@ void rx_nr_prach_ru(RU_t *ru, rxsigF = ru->prach_rxsigF[prachOccasion]; - AssertFatal(ru->if_south == LOCAL_RF,"we shouldn't call this if if_south != LOCAL_RF\n"); + AssertFatal(ru->if_south == LOCAL_RF || ru->if_south == REMOTE_IF5, + "we shouldn't call this if if_south != LOCAL_RF or REMOTE_IF5\n"); for (int aa=0; aanb_rx; aa++){ if (prach_sequence_length == 0) slot2=(slot/fp->slots_per_subframe)*fp->slots_per_subframe; diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index 8063fe136f..1fa03842cc 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -426,7 +426,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_pdu->harq->harq_confidence_level = no_conf ? 1 : 0; uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1); uci_pdu->harq->harq_list[0].harq_value = index&0x01; - if (no_conf) LOG_I(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ value %d with confidence level (0 is good, 1 is bad) %d xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d, energy %f, sync_pos %d\n", + if (1/*no_conf*/) LOG_I(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ value %d with confidence level (0 is good, 1 is bad) %d xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d, energy %f, sync_pos %d\n", frame,slot,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10,10*log10((double)sigenergy),gNB->ulsch_stats[0].sync_pos); if (pucch_pdu->sr_flag == 1) { uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); diff --git a/openair1/SCHED_NR/fapi_nr_l1.c b/openair1/SCHED_NR/fapi_nr_l1.c index b2a802ab08..c9b8defca2 100644 --- a/openair1/SCHED_NR/fapi_nr_l1.c +++ b/openair1/SCHED_NR/fapi_nr_l1.c @@ -253,7 +253,8 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_TTI_PRACH_PDU_TYPE for %d.%d\n", frame, slot, UL_tti_req->SFN, UL_tti_req->Slot); nfapi_nr_prach_pdu_t *prach_pdu = &UL_tti_req->pdus_list[i].prach_pdu; nr_fill_prach(gNB, UL_tti_req->SFN, UL_tti_req->Slot, prach_pdu); - if (gNB->RU_list[0]->if_south == LOCAL_RF) nr_fill_prach_ru(gNB->RU_list[0], UL_tti_req->SFN, UL_tti_req->Slot, prach_pdu); + if (gNB->RU_list[0]->if_south == LOCAL_RF || + gNB->RU_list[0]->if_south == REMOTE_IF5) nr_fill_prach_ru(gNB->RU_list[0], UL_tti_req->SFN, UL_tti_req->Slot, prach_pdu); break; } } diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index bc22a3602e..f700b092aa 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -453,7 +453,7 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, int SNRtimes10 = dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot) - dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot); - LOG_D(PHY, "Estimated SNR for PUSCH is = %f dB (ulsch_power %f, noise %f)\n", SNRtimes10/10.0,dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot)/10.0,dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot)/10.0); + LOG_I(PHY, "%d.%d: Estimated SNR for PUSCH is = %f dB (ulsch_power %f, noise %f) delay %d\n", frame, slot_rx, SNRtimes10/10.0,dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot)/10.0,dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot)/10.0,sync_pos); if (SNRtimes10 < -640) cqi=0; else if (SNRtimes10 > 635) cqi=255; diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 41591b1169..4ac09bab6a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -318,14 +318,14 @@ void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts scs_scaling = scs_scaling>>2; uint32_t absolute_diff = (*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA); uint16_t sco = absolute_diff%(12*scs_scaling); - AssertFatal(sco==(scs_scaling * ssb_SubcarrierOffset),"absoluteFrequencySSB has a subcarrier offset of %d while it should be %d\n",sco/scs_scaling,ssb_SubcarrierOffset); + AssertFatal(sco==(scs_scaling * (ssb_SubcarrierOffset>>(cfg->ssb_config.scs_common.value))),"absoluteFrequencySSB has a subcarrier offset of %d while it should be %d\n",sco/scs_scaling,ssb_SubcarrierOffset); cfg->ssb_table.ssb_offset_point_a.value = absolute_diff/(12*scs_scaling) - 10; //absoluteFrequencySSB is the central frequency of SSB which is made by 20RBs in total cfg->ssb_table.ssb_offset_point_a.tl.tag = NFAPI_NR_CONFIG_SSB_OFFSET_POINT_A_TAG; cfg->num_tlv++; cfg->ssb_table.ssb_period.value = *scc->ssb_periodicityServingCell; cfg->ssb_table.ssb_period.tl.tag = NFAPI_NR_CONFIG_SSB_PERIOD_TAG; cfg->num_tlv++; - cfg->ssb_table.ssb_subcarrier_offset.value = ssb_SubcarrierOffset; + cfg->ssb_table.ssb_subcarrier_offset.value = ssb_SubcarrierOffset>>(cfg->ssb_config.scs_common.value); cfg->ssb_table.ssb_subcarrier_offset.tl.tag = NFAPI_NR_CONFIG_SSB_SUBCARRIER_OFFSET_TAG; cfg->num_tlv++; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 27037446d2..8367abfd3e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -861,7 +861,7 @@ void nr_get_Msg3alloc(module_id_t module_id, // msg3 is scheduled in mixed slot in the following TDD period - uint16_t msg3_nb_rb = 8 + sizeof(NR_MAC_SUBHEADER_SHORT) + sizeof(NR_MAC_SUBHEADER_SHORT); // sdu has 6 or 8 bytes + uint16_t msg3_nb_rb = 8; // sdu has 6 or 8 bytes int mu = ubwp ? ubwp->bwp_Common->genericParameters.subcarrierSpacing : diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 2f23800af9..cbdc00aa61 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -400,14 +400,14 @@ uint32_t schedule_control_sib1(module_id_t module_id, gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize = rbSize; gNB_mac->sched_ctrlCommon->sched_pdsch.rbStart = 0; - LOG_D(MAC,"mcs = %i\n", gNB_mac->sched_ctrlCommon->sched_pdsch.mcs); - LOG_D(MAC,"startSymbolIndex = %i\n", startSymbolIndex); - LOG_D(MAC,"nrOfSymbols = %i\n", nrOfSymbols); - LOG_D(MAC, "rbSize = %i\n", gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize); - LOG_D(MAC,"TBS = %i\n", TBS); - LOG_D(MAC,"dmrs_length %d\n",dmrs_length); - LOG_D(MAC,"N_PRB_DMRS = %d\n",N_PRB_DMRS); - LOG_D(MAC,"mappingtype = %d\n", mappingtype); + LOG_D(NR_MAC,"mcs = %i\n", gNB_mac->sched_ctrlCommon->sched_pdsch.mcs); + LOG_D(NR_MAC,"startSymbolIndex = %i\n", startSymbolIndex); + LOG_D(NR_MAC,"nrOfSymbols = %i\n", nrOfSymbols); + LOG_D(NR_MAC, "rbSize = %i\n", gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize); + LOG_D(NR_MAC,"TBS = %i\n", TBS); + LOG_D(NR_MAC,"dmrs_length %d\n",dmrs_length); + LOG_D(NR_MAC,"N_PRB_DMRS = %d\n",N_PRB_DMRS); + LOG_D(NR_MAC,"mappingtype = %d\n", mappingtype); // Mark the corresponding RBs as used for (int rb = 0; rb < gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize; rb++) { @@ -486,7 +486,9 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex; pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols; pdsch_pdu_rel15->dlDmrsSymbPos = dlDmrsSymbPos; - LOG_D(MAC,"dlDmrsSymbPos = 0x%x\n", pdsch_pdu_rel15->dlDmrsSymbPos); + LOG_D(NR_MAC,"sib1:bwpStart %d, bwpSize %d\n",pdsch_pdu_rel15->BWPStart,pdsch_pdu_rel15->BWPSize); + LOG_D(NR_MAC,"sib1:rbStart %d, rbSize %d\n",pdsch_pdu_rel15->rbStart,pdsch_pdu_rel15->rbSize); + LOG_D(NR_MAC,"sib1:dlDmrsSymbPos = 0x%x\n", pdsch_pdu_rel15->dlDmrsSymbPos); /* Fill PDCCH DL DCI PDU */ nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci]; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index ec57befd71..49b1a8ff54 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -1044,7 +1044,7 @@ void pf_ul(module_id_t module_id, gNB_MAC_INST *nrmac = RC.nrmac[module_id]; NR_ServingCellConfigCommon_t *scc = nrmac->common_channels[CC_id].ServingCellConfigCommon; NR_UE_info_t *UE_info = &nrmac->UE_info; - const int min_rb = 40; + const int min_rb = 5; float coeff_ue[MAX_MOBILES_PER_GNB]; // UEs that could be scheduled int ue_array[MAX_MOBILES_PER_GNB]; From 3549168347562664433c2d8aa2ce8bdad50d5a43 Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Wed, 6 Oct 2021 22:43:06 +0200 Subject: [PATCH 004/114] removal of mean signal level --- executables/nr-ru.c | 6 ++- targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp | 52 +++++++++++++++----- 2 files changed, 45 insertions(+), 13 deletions(-) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 57ab8494bf..1d0c3eea29 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1367,7 +1367,10 @@ void *ru_thread( void *param ) { initial_wait=0; opp_enabled = opp_enabled0; } - if (initial_wait == 0 && ru->rx_fhaul.trials > 1000) reset_meas(&ru->rx_fhaul); + if (initial_wait == 0 && ru->rx_fhaul.trials > 1000) reset_meas(&ru->rx_fhaul); + + + proc->timestamp_tx = proc->timestamp_rx + (sf_ahead*fp->samples_per_subframe); proc->frame_tx = (proc->tti_rx > (fp->slots_per_frame-1-(fp->slots_per_subframe*sf_ahead))) ? (proc->frame_rx+1)&1023 : proc->frame_rx; proc->tti_tx = (proc->tti_rx + (fp->slots_per_subframe*sf_ahead))%fp->slots_per_frame; @@ -1387,6 +1390,7 @@ void *ru_thread( void *param ) { if (ru->feprx) { ru->feprx(ru,proc->tti_rx); //LOG_M("rxdata.m","rxs",ru->common.rxdata[0],1228800,1,1); + if (initial_wait == 0 && proc->frame_rx == 127 ) {LOG_M("rxdata.m","rxs",ru->common.rxdata[0],fp->samples_per_frame,1,1); LOG_M("rxdataF.m","rxsF",RC.gNB[0]->common_vars.rxdataF[0],fp->symbols_per_slot*fp->ofdm_symbol_size,1,1); exit(-1);} LOG_D(PHY,"RU proc: frame_rx = %d, tti_rx = %d\n", proc->frame_rx, proc->tti_rx); /* LOG_D(PHY,"Copying rxdataF from RU to gNB\n"); diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index b1608b09ea..6cd7c4029f 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -676,25 +676,53 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp // bring RX data into 12 LSBs for softmodem RX for (int i=0; itype==USRP_X300_DEV) { openair0_cfg[0].rx_gain_calib_table = calib_table_x310; std::cerr << "-- Using calibration table: calib_table_x310" << std::endl; - s->usrp->set_rx_dc_offset(true); + // s->usrp->set_rx_dc_offset(true); } if (device->type==USRP_N300_DEV) { From a0eddabbbd9efca935cf5e0e9316a38aa76fcf23 Mon Sep 17 00:00:00 2001 From: Eurecom Date: Wed, 6 Oct 2021 22:44:22 +0200 Subject: [PATCH 005/114] log reduction --- openair1/PHY/NR_TRANSPORT/nr_dci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index 77ad962d56..194c7c0c56 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -97,8 +97,8 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, cset_start_symb = pdcch_pdu_rel15->StartSymbolIndex; cset_nsymb = pdcch_pdu_rel15->DurationSymbols; dci_idx = 0; - LOG_I(PHY, "Coreset rb_offset %d, nb_rb %d BWP Start %d\n",rb_offset,n_rb,pdcch_pdu_rel15->BWPStart); - LOG_I(PHY, "Coreset starting subcarrier %d on symbol %d (%d symbols)\n", cset_start_sc, cset_start_symb, cset_nsymb); + LOG_D(PHY, "Coreset rb_offset %d, nb_rb %d BWP Start %d\n",rb_offset,n_rb,pdcch_pdu_rel15->BWPStart); + LOG_D(PHY, "Coreset starting subcarrier %d on symbol %d (%d symbols)\n", cset_start_sc, cset_start_symb, cset_nsymb); // DMRS length is per OFDM symbol uint32_t dmrs_length = n_rb*6; //2(QPSK)*3(per RB)*6(REG per CCE) uint32_t encoded_length = dci_pdu->AggregationLevel*108; //2(QPSK)*9(per RB)*6(REG per CCE) From 7d7dd29514c4d5d9c2f5d497ca0b8eedf4641009 Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Fri, 8 Oct 2021 15:44:57 +0200 Subject: [PATCH 006/114] blacklisting of PRBs in configuration file --- executables/nr-ru.c | 1 - .../PHY/NR_ESTIMATION/nr_measurements_gNB.c | 6 +- openair1/PHY/defs_gNB.h | 2 + openair1/SCHED_NR/phy_procedures_nr_gNB.c | 11 +++- openair2/GNB_APP/gnb_config.c | 55 ++++++++++++++++++- openair2/GNB_APP/gnb_paramdef.h | 6 +- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 2 + targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp | 33 +---------- 8 files changed, 78 insertions(+), 38 deletions(-) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 1d0c3eea29..195285b187 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1390,7 +1390,6 @@ void *ru_thread( void *param ) { if (ru->feprx) { ru->feprx(ru,proc->tti_rx); //LOG_M("rxdata.m","rxs",ru->common.rxdata[0],1228800,1,1); - if (initial_wait == 0 && proc->frame_rx == 127 ) {LOG_M("rxdata.m","rxs",ru->common.rxdata[0],fp->samples_per_frame,1,1); LOG_M("rxdataF.m","rxsF",RC.gNB[0]->common_vars.rxdataF[0],fp->symbols_per_slot*fp->ofdm_symbol_size,1,1); exit(-1);} LOG_D(PHY,"RU proc: frame_rx = %d, tti_rx = %d\n", proc->frame_rx, proc->tti_rx); /* LOG_D(PHY,"Copying rxdataF from RU to gNB\n"); diff --git a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c index 020117adba..157c9533d0 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c +++ b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c @@ -73,8 +73,9 @@ void dump_nr_I0_stats(FILE *fd,PHY_VARS_gNB *gNB) { int min_I0=1000,max_I0=0; int amin=0,amax=0; + fprintf(fd,"Blacklisted PRBs %d/%d\n",gNB->num_ulprbbl,gNB->frame_parms.N_RB_UL); for (int i=0; iframe_parms.N_RB_UL; i++) { - if (i==(gNB->frame_parms.N_RB_UL>>1) - 1) i+=2; + if (gNB->ulprbbl[i] > 0) continue; if (gNB->measurements.n0_subband_power_tot_dB[i]measurements.n0_subband_power_tot_dB[i]; amin=i;} @@ -82,7 +83,8 @@ void dump_nr_I0_stats(FILE *fd,PHY_VARS_gNB *gNB) { } for (int i=0; iframe_parms.N_RB_UL; i++) { - fprintf(fd,"%2d.",gNB->measurements.n0_subband_power_tot_dB[i]-gNB->measurements.n0_subband_power_avg_dB); + if (gNB->ulprbbl[i] ==0) fprintf(fd,"%2d.",gNB->measurements.n0_subband_power_tot_dB[i]-gNB->measurements.n0_subband_power_avg_dB); + else fprintf(fd,"X ."); if (i%25 == 24) fprintf(fd,"\n"); } fprintf(fd,"\n"); diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 9a1ba7e780..55a60f7a1b 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -855,6 +855,8 @@ typedef struct PHY_VARS_gNB_s { int pusch_thres; int prach_thres; uint64_t bad_pucch; + int num_ulprbbl; + int ulprbbl[275]; /* time_stats_t phy_proc; */ diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index bc22a3602e..f4a98cef64 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -539,11 +539,18 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { int rb2, rb, nb_rb; + int prbpos=0; if (1/*(gNB->gNB_config.tdd_table.max_tdd_periodicity_list[slot_rx].max_num_of_symbol_per_slot_list[symbol].slot_config.value==1*/){ nb_rb = 0; for (int symbol=0;symbol<14;symbol++) - for (int m=0;m<9;m++) gNB->rb_mask_ul[symbol][m] = 0; - + for (int m=0;m<9;m++) { + gNB->rb_mask_ul[symbol][m] = 0; + for (int i=0;i<32;i++) { + prbpos = (m*32)+i; + if (prbpos>gNB->frame_parms.N_RB_UL) break; + gNB->rb_mask_ul[symbol][m] |= (gNB->ulprbbl[prbpos]>0 ? 1 : 0)<pucch[i]; if (pucch) { diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 209cdd255d..8d15fc3445 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -549,6 +549,31 @@ void RCconfig_nr_flexran() void RCconfig_NR_L1(void) { int j; + paramdef_t GNBSParams[] = GNBSPARAMS_DESC; + ////////// Identification parameters + paramdef_t GNBParams[] = GNBPARAMS_DESC; + + paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST,NULL,0}; + + config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),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( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL); + char *ulprbbl = *GNBParamList.paramarray[0][GNB_ULPRBBLACKLIST_IDX].strptr; + if (ulprbbl) LOG_I(NR_PHY,"PRB blacklist %s\n",ulprbbl); + char *pt = strtok(ulprbbl,","); + int prbbl[275]; + int num_prbbl=0; + memset(prbbl,0,275*sizeof(int)); + + while (pt) { + prbbl[atoi(pt)] = 1; + LOG_I(NR_PHY,"Blacklisting prb %d\n",atoi(pt)); + pt = strtok(NULL,","); + num_prbbl++; + } + paramdef_t L1_Params[] = L1PARAMS_DESC; paramlist_def_t L1_ParamList = {CONFIG_STRING_L1_LIST,NULL,0}; @@ -577,6 +602,9 @@ void RCconfig_NR_L1(void) { 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]->num_ulprbbl = num_prbbl; + LOG_I(NR_PHY,"Copying %d blacklisted PRB to L1 context\n",num_prbbl); + memcpy(RC.gNB[j]->ulprbbl,prbbl,275*sizeof(int)); 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) { @@ -633,9 +661,32 @@ void RCconfig_NR_L1(void) { void RCconfig_nr_macrlc() { int j; + + paramdef_t GNBSParams[] = GNBSPARAMS_DESC; + ////////// Identification parameters + paramdef_t GNBParams[] = GNBPARAMS_DESC; + + paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST,NULL,0}; + + config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),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( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL); + char *ulprbbl = *GNBParamList.paramarray[0][GNB_ULPRBBLACKLIST_IDX].strptr; + char *pt = strtok(ulprbbl,","); + int prbbl[275]; + int num_prbbl=0; + int prb; + memset(prbbl,0,275*sizeof(int)); + while (pt) { + prb=atoi(pt); + prbbl[prb] = 1; + pt = strtok(NULL,","); + num_prbbl++; + } paramdef_t MacRLC_Params[] = MACRLCPARAMS_DESC; paramlist_def_t MacRLC_ParamList = {CONFIG_STRING_MACRLC_LIST,NULL,0}; - config_getlist( &MacRLC_ParamList,MacRLC_Params,sizeof(MacRLC_Params)/sizeof(paramdef_t), NULL); if ( MacRLC_ParamList.numelt > 0) { @@ -702,6 +753,8 @@ void RCconfig_nr_macrlc() { AssertFatal(1==0,"MACRLC %d: %s unknown southbound midhaul\n",j,*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr)); } RC.nrmac[j]->ulsch_max_slots_inactivity = *(MacRLC_ParamList.paramarray[j][MACRLC_ULSCH_MAX_SLOTS_INACTIVITY].uptr); + RC.nrmac[j]->num_ulprbbl = num_prbbl; + memcpy(RC.nrmac[j]->ulprbbl,prbbl,num_prbbl*sizeof(prbbl[0])); }// for (j=0;j 0 LOG_E(PHY,"No %s configuration found\n", CONFIG_STRING_MACRLC_LIST); diff --git a/openair2/GNB_APP/gnb_paramdef.h b/openair2/GNB_APP/gnb_paramdef.h index 380c6890a5..4618c009b4 100644 --- a/openair2/GNB_APP/gnb_paramdef.h +++ b/openair2/GNB_APP/gnb_paramdef.h @@ -120,7 +120,7 @@ typedef enum { #define GNB_CONFIG_STRING_DOCSIRS "do_CSIRS" #define GNB_CONFIG_STRING_NRCELLID "nr_cellid" #define GNB_CONFIG_STRING_MINRXTXTIMEPDSCH "min_rxtxtime_pdsch" - +#define GNB_CONFIG_STRING_ULPRBBLACKLIST "ul_prbblacklist" /*-----------------------------------------------------------------------------------------------------------------------------------------*/ /* cell configuration parameters */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ @@ -146,7 +146,8 @@ typedef enum { {GNB_CONFIG_STRING_SIB1TDA, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ {GNB_CONFIG_STRING_DOCSIRS, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ {GNB_CONFIG_STRING_NRCELLID, NULL, 0, u64ptr:NULL, defint64val:1, TYPE_UINT64, 0}, \ -{GNB_CONFIG_STRING_MINRXTXTIMEPDSCH, NULL, 0, iptr:NULL, defintval:2, TYPE_INT, 0} \ +{GNB_CONFIG_STRING_MINRXTXTIMEPDSCH, NULL, 0, iptr:NULL, defintval:2, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_ULPRBBLACKLIST, NULL, 0, strptr:NULL, defstrval:"", TYPE_STRING, 0} \ } #define GNB_GNB_ID_IDX 0 @@ -170,6 +171,7 @@ typedef enum { #define GNB_DO_CSIRS_IDX 18 #define GNB_NRCELLID_IDX 19 #define GNB_MINRXTXTIMEPDSCH_IDX 20 +#define GNB_ULPRBBLACKLIST_IDX 21 #define TRACKING_AREA_CODE_OKRANGE {0x0001,0xFFFD} #define GNBPARAMS_CHECK { \ diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 1a3b654727..4adbb70daf 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -683,6 +683,8 @@ typedef struct gNB_MAC_INST_s { /// current PDU index (BCH,DLSCH) uint16_t pdu_index[NFAPI_CC_MAX]; + int num_ulprbbl; + int ulprbbl[275]; /// NFAPI Config Request Structure nfapi_nr_config_request_scf_t config[NFAPI_CC_MAX]; /// NFAPI DL Config Request Structure diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index 6cd7c4029f..7bccf66c5c 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -679,44 +679,17 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp #if defined(__x86_64__) || defined(__i386__) #ifdef __AVX2__ - __m256i mean=_mm256_setzero_si256(); - int16_t mean16[2]; - for (int j=0; j Date: Fri, 8 Oct 2021 21:21:28 +0200 Subject: [PATCH 007/114] MAC support for prb blacklisting --- openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c index 157c9533d0..73b8660e83 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c +++ b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c @@ -84,7 +84,7 @@ void dump_nr_I0_stats(FILE *fd,PHY_VARS_gNB *gNB) { for (int i=0; iframe_parms.N_RB_UL; i++) { if (gNB->ulprbbl[i] ==0) fprintf(fd,"%2d.",gNB->measurements.n0_subband_power_tot_dB[i]-gNB->measurements.n0_subband_power_avg_dB); - else fprintf(fd,"X ."); + else fprintf(fd," X."); if (i%25 == 24) fprintf(fd,"\n"); } fprintf(fd,"\n"); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index ec57befd71..03c0bbe777 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -1322,6 +1322,7 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t int st = 0, e = 0, len = 0; for (int i = 0; i < bwpSize; i++) { + if (RC.nrmac[module_id]->ulprbbl[i] == 1) vrb_map_UL[i]=1; while ((vrb_map_UL[i] & symb) != 0 && i < bwpSize) i++; st = i; From 85d54ac9df34516244b5d7cb8d7f9886dbf09554 Mon Sep 17 00:00:00 2001 From: Eurecom Date: Thu, 14 Oct 2021 15:46:50 +0200 Subject: [PATCH 008/114] logging --- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 2 +- openair2/GNB_APP/gnb_config.c | 2 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 59 ++++++++++--------- 3 files changed, 33 insertions(+), 30 deletions(-) diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index d1fe5ea049..7f5736a33a 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -275,7 +275,7 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) { nr_fill_indication(gNB,ulsch_harq->frame, ulsch_harq->slot, rdata->ulsch_id, rdata->harq_pid, 0,0); //dumpsig=1; } else { - LOG_D(PHY,"[gNB %d] ULSCH: Setting NAK for SFN/SF %d/%d (pid %d, ndi %d, status %d, round %d, RV %d, TBS %d) r %d\n", + LOG_I(PHY,"[gNB %d] ULSCH: Setting NAK for SFN/SF %d/%d (pid %d, ndi %d, status %d, round %d, RV %d, TBS %d) r %d\n", gNB->Mod_id, ulsch_harq->frame, ulsch_harq->slot, rdata->harq_pid,pusch_pdu->pusch_data.new_data_indicator,ulsch_harq->status, ulsch_harq->round, ulsch_harq->ulsch_pdu.pusch_data.rv_index,ulsch_harq->TBS,r); ulsch_harq->round++; diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 8d15fc3445..421f7e17dd 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -754,7 +754,7 @@ void RCconfig_nr_macrlc() { } RC.nrmac[j]->ulsch_max_slots_inactivity = *(MacRLC_ParamList.paramarray[j][MACRLC_ULSCH_MAX_SLOTS_INACTIVITY].uptr); RC.nrmac[j]->num_ulprbbl = num_prbbl; - memcpy(RC.nrmac[j]->ulprbbl,prbbl,num_prbbl*sizeof(prbbl[0])); + memcpy(RC.nrmac[j]->ulprbbl,prbbl,275*sizeof(prbbl[0])); }// for (j=0;j 0 LOG_E(PHY,"No %s configuration found\n", CONFIG_STRING_MACRLC_LIST); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 23b3bf1ddf..ddd7e0334a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -1245,6 +1245,7 @@ void pf_ul(module_id_t module_id, const int B = cmax(sched_ctrl->estimated_ul_buffer - sched_ctrl->sched_ul_bytes, 0); uint16_t rbSize = 0; uint32_t TBS = 0; + nr_find_nb_rb(sched_pusch->Qm, sched_pusch->R, ps->nrOfSymbols, @@ -1255,8 +1256,8 @@ void pf_ul(module_id_t module_id, &rbSize); sched_pusch->rbSize = rbSize; sched_pusch->tb_size = TBS; - LOG_D(NR_MAC,"rbSize %d, TBS %d, est buf %d, sched_ul %d, B %d, CCE %d, num_dmrs_symb %d, N_PRB_DMRS %d\n", - rbSize, sched_pusch->tb_size, sched_ctrl->estimated_ul_buffer, sched_ctrl->sched_ul_bytes, B,sched_ctrl->cce_index,ps->num_dmrs_symb,ps->N_PRB_DMRS); + LOG_I(NR_MAC,"rbSize %d (max_rbSize %d), TBS %d, est buf %d, sched_ul %d, B %d, CCE %d, num_dmrs_symb %d, N_PRB_DMRS %d\n", + rbSize, max_rbSize,sched_pusch->tb_size, sched_ctrl->estimated_ul_buffer, sched_ctrl->sched_ul_bytes, B,sched_ctrl->cce_index,ps->num_dmrs_symb,ps->N_PRB_DMRS); /* Mark the corresponding RBs as used */ n_rb_sched -= sched_pusch->rbSize; @@ -1329,8 +1330,10 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t const uint16_t symb = ((1 << nrOfSymbols) - 1) << startSymbolIndex; int st = 0, e = 0, len = 0; + + for (int i = 0; i < bwpSize; i++) + if (RC.nrmac[module_id]->ulprbbl[i] == 1) vrb_map_UL[i]=symb; for (int i = 0; i < bwpSize; i++) { - if (RC.nrmac[module_id]->ulprbbl[i] == 1) vrb_map_UL[i]=1; while ((vrb_map_UL[i] & symb) != 0 && i < bwpSize) i++; st = i; @@ -1348,7 +1351,7 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t /* Calculate mask: if any RB in vrb_map_UL is blocked (1), the current RB will be 0 */ for (int i = 0; i < bwpSize; i++) rballoc_mask[i] = i >= st && i <= e; - + LOG_D(NR_MAC,"%d.%d : UL start %d, end %d\n",frame,slot,st,e); /* proportional fair scheduling algorithm */ pf_ul(module_id, frame, @@ -1490,30 +1493,30 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot) UE_info->mac_stats[UE_id].ulsch_current_bytes = sched_pusch->tb_size; sched_ctrl->last_ul_frame = sched_pusch->frame; sched_ctrl->last_ul_slot = sched_pusch->slot; - - LOG_D(NR_MAC, - "ULSCH/PUSCH: %4d.%2d RNTI %04x UL sched %4d.%2d DCI L %d start %2d RBS %3d startSymbol %2d nb_symbol %2d dmrs_pos %x MCS %2d TBS %4d HARQ PID %2d round %d RV %d NDI %d est %6d sched %6d est BSR %6d TPC %d\n", - frame, - slot, - rnti, - sched_pusch->frame, - sched_pusch->slot, - sched_ctrl->aggregation_level, - sched_pusch->rbStart, - sched_pusch->rbSize, - ps->startSymbolIndex, - ps->nrOfSymbols, - ps->ul_dmrs_symb_pos, - sched_pusch->mcs, - sched_pusch->tb_size, - harq_id, - cur_harq->round, - nr_rv_round_map[cur_harq->round], - cur_harq->ndi, - sched_ctrl->estimated_ul_buffer, - sched_ctrl->sched_ul_bytes, - sched_ctrl->estimated_ul_buffer - sched_ctrl->sched_ul_bytes, - sched_ctrl->tpc0); + if (sched_pusch->rbSize > 5) + LOG_D(NR_MAC, + "ULSCH/PUSCH: %4d.%2d RNTI %04x UL sched %4d.%2d DCI L %d start %2d RBS %3d startSymbol %2d nb_symbol %2d dmrs_pos %x MCS %2d TBS %4d HARQ PID %2d round %d RV %d NDI %d est %6d sched %6d est BSR %6d TPC %d\n", + frame, + slot, + rnti, + sched_pusch->frame, + sched_pusch->slot, + sched_ctrl->aggregation_level, + sched_pusch->rbStart, + sched_pusch->rbSize, + ps->startSymbolIndex, + ps->nrOfSymbols, + ps->ul_dmrs_symb_pos, + sched_pusch->mcs, + sched_pusch->tb_size, + harq_id, + cur_harq->round, + nr_rv_round_map[cur_harq->round], + cur_harq->ndi, + sched_ctrl->estimated_ul_buffer, + sched_ctrl->sched_ul_bytes, + sched_ctrl->estimated_ul_buffer - sched_ctrl->sched_ul_bytes, + sched_ctrl->tpc0); /* PUSCH in a later slot, but corresponding DCI now! */ From e1eebbad19112008bbbe797b539b920b4c2153c1 Mon Sep 17 00:00:00 2001 From: Eurecom Date: Sat, 16 Oct 2021 11:11:05 +0200 Subject: [PATCH 009/114] CSI RSRP reporting ok. --- openair2/LAYER2/NR_MAC_gNB/config.c | 7 +++++ .../NR_MAC_gNB/gNB_scheduler_primitives.c | 7 ++++- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 29 ++++++++++++++----- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index a2c130078e..15dd5c1561 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -626,6 +626,13 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, UE_info->UE_sched_ctrl[UE_id].search_space = get_searchspace(scc, bwpd, target_ss); UE_info->UE_sched_ctrl[UE_id].coreset = get_coreset(Mod_idP, scc, bwpd, UE_info->UE_sched_ctrl[UE_id].search_space, target_ss); UE_info->UE_sched_ctrl[UE_id].maxL = 2; + if (CellGroup->spCellConfig && + CellGroup->spCellConfig->spCellConfigDedicated && + CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig && + CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup + ) + compute_csi_bitlen (CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup, UE_info, UE_id, Mod_idP); + } } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index c1b1ef9762..3fb98620de 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1935,7 +1935,12 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG add_nr_list(&UE_info->list, UE_id); memset(&UE_info->mac_stats[UE_id], 0, sizeof(NR_mac_stats_t)); set_Y(UE_info->Y[UE_id], rntiP); - if (CellGroup && CellGroup->spCellConfig && CellGroup->spCellConfig && CellGroup->spCellConfig->spCellConfigDedicated) + if (CellGroup && + CellGroup->spCellConfig && + CellGroup->spCellConfig->spCellConfigDedicated && + CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig && + CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup + ) compute_csi_bitlen (CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup, UE_info, UE_id, mod_idP); NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; memset(sched_ctrl, 0, sizeof(*sched_ctrl)); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 820aa8ae6a..65972017da 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -362,6 +362,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in struct NR_CSI_ResourceConfig *csi_resourceconfig; // for each CSI measurement report configuration (list of CSI-ReportConfig) + LOG_I(NR_MAC,"Searching %d csi_reports\n",csi_MeasConfig->csi_ReportConfigToAddModList->list.count); for (csi_report_id=0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){ struct NR_CSI_ReportConfig *csi_reportconfig = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]; // MAC structure for CSI measurement reports (per UE and per report) @@ -416,7 +417,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in } else AssertFatal(1==0,"Only periodic resource configuration currently supported\n"); } - + LOG_I(NR_MAC,"nb_resources %d\n",nb_resources); // computation of bit length depending on the report type switch(reportQuantity_type){ case (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP): @@ -504,7 +505,7 @@ void nr_csi_meas_reporting(int Mod_idP, // preparation is done in first slot of tdd period if (frame % (period / n_slots_frame) != offset / n_slots_frame) continue; - LOG_D(NR_MAC, "CSI reporting in frame %d slot %d\n", frame, sched_slot); + LOG_I(NR_MAC, "CSI reporting in frame %d slot %d\n", frame, sched_slot); const NR_PUCCH_CSI_Resource_t *pucchcsires = csirep->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list.array[0]; const NR_PUCCH_ResourceSet_t *pucchresset = pucch_Config->resourceSetToAddModList->list.array[1]; // set with formats >1 @@ -530,7 +531,7 @@ void nr_csi_meas_reporting(int Mod_idP, curr_pucch->resource_indicator = res_index; curr_pucch->csi_bits += nr_get_csi_bitlen(Mod_idP,UE_id,csi_report_id); - + LOG_I(NR_MAC,"Programmed CSI pucch for %d.%d, resource %d, csi_bits %d\n",frame,sched_slot,res_index,curr_pucch->csi_bits); // going through the list of PUCCH resources to find the one indexed by resource_id uint16_t *vrb_map_UL = &RC.nrmac[Mod_idP]->common_channels[0].vrb_map_UL[sched_slot * MAX_BWP_SIZE]; const int m = pucch_Config->resourceToAddModList->list.count; @@ -695,18 +696,27 @@ void tci_handling(module_id_t Mod_idP, int UE_id, frame_t frame, slot_t slot) { int ssb_index[MAX_NUM_SSB] = {0}; int ssb_rsrp[MAX_NUM_SSB] = {0}; uint8_t idx = 0; - int bwp_id = 1; NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; + NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + int bwp_id = sched_ctrl->active_bwp ? 1 : 0; NR_CellGroupConfig_t *CellGroup = UE_info->CellGroup[UE_id]; - NR_BWP_Downlink_t *bwp = CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; + NR_BWP_Downlink_t *bwp = bwp_id>0 ? + sched_ctrl->active_bwp: + NULL; + + //bwp indicator - int n_dl_bwp = CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count; + int n_dl_bwp=0; + if (CellGroup->spCellConfig->spCellConfigDedicated && + CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList) + n_dl_bwp = CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count; + uint8_t nr_ssbri_cri = 0; uint8_t nb_of_csi_ssb_report = UE_info->csi_report_template[UE_id][cqi_idx].nb_of_csi_ssb_report; int better_rsrp_reported = -140-(-0); /*minimum_measured_RSRP_value - minimum_differntail_RSRP_value*///considering the minimum RSRP value as better RSRP initially uint8_t diff_rsrp_idx = 0; uint8_t i, j; - NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + NR_mac_stats_t *stats = &UE_info->mac_stats[UE_id]; if (n_dl_bwp < 4) @@ -831,7 +841,10 @@ void tci_handling(module_id_t Mod_idP, int UE_id, frame_t frame, slot_t slot) { } } - sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tci_present_inDCI = bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.array[bwp_id-1]->tci_PresentInDCI; + sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tci_present_inDCI = bwp ? + bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.array[bwp_id-1]->tci_PresentInDCI : + CellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.array[0]->tci_PresentInDCI; + //filling pdsch tci state activation deactivation mac ce structure fields if(sched_ctrl->UE_mac_ce_ctrl.pdcch_state_ind.tci_present_inDCI) { From 4496b05423f5cff4080895adec85a1346da75cf8 Mon Sep 17 00:00:00 2001 From: Eurecom Date: Sun, 17 Oct 2021 18:03:55 +0200 Subject: [PATCH 010/114] testing CSI reporting and MIMO DL --- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 2 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 2 +- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 10 +++++----- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 20 +++++++++---------- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 2 +- openair2/LAYER2/NR_MAC_gNB/main.c | 6 ++++++ openair2/RRC/NR/MESSAGES/asn1_msg.c | 1 - openair2/RRC/NR/rrc_gNB_reconfig.c | 3 ++- 8 files changed, 26 insertions(+), 20 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index 594557afb1..53116671b9 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -1519,7 +1519,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, #ifdef DEBUG_NR_PUCCH_RX printf("cw_ML %d, metric %d dB\n",cw_ML,corr_dB); #endif - LOG_I(PHY,"slot %d PUCCH2 cw_ML %d, metric %d dB\n",slot,cw_ML,corr_dB); + LOG_D(PHY,"slot %d PUCCH2 cw_ML %d, metric %d dB\n",slot,cw_ML,corr_dB); decodedPayload[0]=(uint64_t)cw_ML; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 9bdedb0357..6d7b3fd81f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -905,7 +905,7 @@ void nr_schedule_ue_spec(module_id_t module_id, harq->is_waiting = true; UE_info->mac_stats[UE_id].dlsch_rounds[harq->round]++; - LOG_I(NR_MAC, + LOG_D(NR_MAC, "%4d.%2d [DLSCH/PDSCH/PUCCH] UE %d RNTI %04x DCI L %d start %3d RBs %3d startSymbol %2d nb_symbol %2d dmrspos %x MCS %2d nrOfLayer %d TBS %4d HARQ PID %2d round %d RV %d NDI %d dl_data_to_ULACK %d (%d.%d) TPC %d\n", frame, slot, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index ea1eae17e2..57500ee56d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -418,7 +418,7 @@ void nr_set_pdsch_semi_static(const NR_ServingCellConfigCommon_t *scc, NR_PDSCH_Config_t *pdsch_Config=NULL; if (bwpd) pdsch_Config = bwpd->pdsch_Config->choice.setup; - LOG_I(NR_MAC,"tda %d, ps->time_domain_allocation %d,layers %d, ps->nrOfLayers %d, pdsch_config %p\n",tda,ps->time_domain_allocation,layers,ps->nrOfLayers,pdsch_Config); + LOG_D(NR_MAC,"tda %d, ps->time_domain_allocation %d,layers %d, ps->nrOfLayers %d, pdsch_config %p\n",tda,ps->time_domain_allocation,layers,ps->nrOfLayers,pdsch_Config); if (ps->time_domain_allocation != tda) { reset_dmrs = true; ps->time_domain_allocation = tda; @@ -440,7 +440,7 @@ void nr_set_pdsch_semi_static(const NR_ServingCellConfigCommon_t *scc, } const long dci_format = sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats; - LOG_I(NR_MAC,"dci_format %d\n",(int)dci_format); + LOG_D(NR_MAC,"dci_format %d\n",(int)dci_format); if (dci_format == NR_SearchSpace__searchSpaceType__ue_Specific__dci_Formats_formats0_0_And_1_0 || pdsch_Config == NULL) { if (ps->nrOfSymbols == 2 && ps->mapping_type == NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeB) @@ -456,7 +456,7 @@ void nr_set_pdsch_semi_static(const NR_ServingCellConfigCommon_t *scc, ps->nrOfLayers = 1; } else { - LOG_I(NR_MAC,"checking layers\n"); + LOG_D(NR_MAC,"checking layers\n"); if (ps->nrOfLayers != layers) { reset_dmrs = true; ps->nrOfLayers = layers; @@ -468,7 +468,7 @@ void nr_set_pdsch_semi_static(const NR_ServingCellConfigCommon_t *scc, if (reset_dmrs) { ps->dl_dmrs_symb_pos = fill_dmrs_mask(bwpd ? bwpd->pdsch_Config->choice.setup : NULL, scc->dmrs_TypeA_Position, ps->nrOfSymbols, ps->startSymbolIndex, ps->mapping_type, ps->frontloaded_symb); ps->N_DMRS_SLOT = get_num_dmrs(ps->dl_dmrs_symb_pos); - LOG_I(NR_MAC,"bwpd0 %p, bwpd %p : Filling dmrs info, ps->N_PRB_DMRS %d, ps->dl_dmrs_symb_pos %x, ps->N_DMRS_SLOT %d\n",bwpd0,bwpd,ps->N_PRB_DMRS,ps->dl_dmrs_symb_pos,ps->N_DMRS_SLOT); + LOG_D(NR_MAC,"bwpd0 %p, bwpd %p : Filling dmrs info, ps->N_PRB_DMRS %d, ps->dl_dmrs_symb_pos %x, ps->N_DMRS_SLOT %d\n",bwpd0,bwpd,ps->N_PRB_DMRS,ps->dl_dmrs_symb_pos,ps->N_DMRS_SLOT); } } @@ -2349,7 +2349,7 @@ void nr_csirs_scheduling(int Mod_idP, if((frame*n_slots_frame+slot-offset)%period == 0) { - LOG_I(MAC,"Scheduling CSI-RS in frame %d slot %d\n",frame,slot); + LOG_D(NR_MAC,"Scheduling CSI-RS in frame %d slot %d\n",frame,slot); nfapi_nr_dl_tti_request_pdu_t *dl_tti_csirs_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; memset((void*)dl_tti_csirs_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index da18f324ef..4b23ab4656 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -60,7 +60,7 @@ void nr_fill_nfapi_pucch(module_id_t mod_id, memset(pucch_pdu, 0, sizeof(nfapi_nr_pucch_pdu_t)); future_ul_tti_req->n_pdus += 1; - LOG_I(NR_MAC, + LOG_D(NR_MAC, "%s %4d.%2d Scheduling pucch reception in %4d.%2d: bits SR %d, DAI %d, CSI %d on res %d\n", pucch->dai_c>0 ? "pucch_acknak" : "", frame, @@ -78,7 +78,7 @@ void nr_fill_nfapi_pucch(module_id_t mod_id, NR_BWP_UplinkDedicated_t *ubwpd; ubwpd = cg ? cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP:NULL; - LOG_I(NR_MAC,"pucch_acknak: %d.%d Calling nr_configure_pucch (ubwpd %p,r_pucch %d) pucch in %d.%d\n",frame,slot,ubwpd,pucch->r_pucch,pucch->frame,pucch->ul_slot); + LOG_D(NR_MAC,"pucch_acknak: %d.%d Calling nr_configure_pucch (ubwpd %p,r_pucch %d) pucch in %d.%d\n",frame,slot,ubwpd,pucch->r_pucch,pucch->frame,pucch->ul_slot); nr_configure_pucch(pucch_pdu, scc, UE_info->CellGroup[UE_id], @@ -556,7 +556,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in struct NR_CSI_ResourceConfig *csi_resourceconfig; // for each CSI measurement report configuration (list of CSI-ReportConfig) - LOG_I(NR_MAC,"Searching %d csi_reports\n",csi_MeasConfig->csi_ReportConfigToAddModList->list.count); + LOG_D(NR_MAC,"Searching %d csi_reports\n",csi_MeasConfig->csi_ReportConfigToAddModList->list.count); for (csi_report_id=0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){ struct NR_CSI_ReportConfig *csi_reportconfig = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]; // MAC structure for CSI measurement reports (per UE and per report) @@ -611,7 +611,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in } else AssertFatal(1==0,"Only periodic resource configuration currently supported\n"); } - LOG_I(NR_MAC,"nb_resources %d\n",nb_resources); + LOG_D(NR_MAC,"nb_resources %d\n",nb_resources); // computation of bit length depending on the report type switch(reportQuantity_type){ case (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP): @@ -724,7 +724,7 @@ void nr_csi_meas_reporting(int Mod_idP, // preparation is done in first slot of tdd period if (frame % (period / n_slots_frame) != offset / n_slots_frame) continue; - LOG_I(NR_MAC, "CSI reporting in frame %d slot %d\n", frame, sched_slot); + LOG_D(NR_MAC, "CSI reporting in frame %d slot %d\n", frame, sched_slot); const NR_PUCCH_CSI_Resource_t *pucchcsires = csirep->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list.array[0]; const NR_PUCCH_ResourceSet_t *pucchresset = pucch_Config->resourceSetToAddModList->list.array[1]; // set with formats >1 @@ -750,7 +750,7 @@ void nr_csi_meas_reporting(int Mod_idP, curr_pucch->resource_indicator = res_index; curr_pucch->csi_bits += nr_get_csi_bitlen(Mod_idP,UE_id,csi_report_id); - LOG_I(NR_MAC,"Programmed CSI pucch for %d.%d, resource %d, csi_bits %d\n",frame,sched_slot,res_index,curr_pucch->csi_bits); + LOG_D(NR_MAC,"Programmed CSI pucch for %d.%d, resource %d, csi_bits %d\n",frame,sched_slot,res_index,curr_pucch->csi_bits); // going through the list of PUCCH resources to find the one indexed by resource_id uint16_t *vrb_map_UL = &RC.nrmac[Mod_idP]->common_channels[0].vrb_map_UL[sched_slot * MAX_BWP_SIZE]; const int m = pucch_Config->resourceToAddModList->list.count; @@ -1188,7 +1188,7 @@ int evaluate_ri_report(uint8_t *payload, if ((ri_restriction>>i)&0x01) { if(count == ri_index) { sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.ri = i; - LOG_I(MAC,"CSI Reported Rank %d\n", i+1); + LOG_D(MAC,"CSI Reported Rank %d\n", i+1); return i; } count++; @@ -1218,7 +1218,7 @@ void evaluate_cqi_report(uint8_t *payload, else AssertFatal(1==0,"CQI Table not present in RRC configuration\n"); sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.wb_cqi_1tb = temp_cqi; - LOG_I(MAC,"Wide-band CQI for the first TB %d\n", temp_cqi); + LOG_D(MAC,"Wide-band CQI for the first TB %d\n", temp_cqi); if (cqi_bitlen > 4) { temp_cqi = pickandreverse_bits(payload, 4, cumul_bits); sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.wb_cqi_2tb = temp_cqi; @@ -1243,7 +1243,7 @@ uint8_t evaluate_pmi_report(uint8_t *payload, sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.pmi_x1 = temp_pmi&((1<CSI_report.cri_ri_li_pmi_cqi_report.pmi_x2 = (temp_pmi>>x1_bitlen)&((1<CSI_report.cri_ri_li_pmi_cqi_report.pmi_x1, sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.pmi_x2); @@ -1262,7 +1262,7 @@ int evaluate_li_report(uint8_t *payload, if (li_bitlen>0) { int temp_li = pickandreverse_bits(payload, li_bitlen, cumul_bits); - LOG_I(MAC,"LI %d\n",temp_li); + LOG_D(MAC,"LI %d\n",temp_li); sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.li = temp_li; } return li_bitlen; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 89410b6c2b..0c9c5bd76e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -1261,7 +1261,7 @@ void pf_ul(module_id_t module_id, &rbSize); sched_pusch->rbSize = rbSize; sched_pusch->tb_size = TBS; - LOG_I(NR_MAC,"rbSize %d (max_rbSize %d), TBS %d, est buf %d, sched_ul %d, B %d, CCE %d, num_dmrs_symb %d, N_PRB_DMRS %d\n", + LOG_D(NR_MAC,"rbSize %d (max_rbSize %d), TBS %d, est buf %d, sched_ul %d, B %d, CCE %d, num_dmrs_symb %d, N_PRB_DMRS %d\n", rbSize, max_rbSize,sched_pusch->tb_size, sched_ctrl->estimated_ul_buffer, sched_ctrl->sched_ul_bytes, B,sched_ctrl->cce_index,ps->num_dmrs_symb,ps->N_PRB_DMRS); /* Mark the corresponding RBs as used */ diff --git a/openair2/LAYER2/NR_MAC_gNB/main.c b/openair2/LAYER2/NR_MAC_gNB/main.c index 0497eea7e1..7c7c992afc 100644 --- a/openair2/LAYER2/NR_MAC_gNB/main.c +++ b/openair2/LAYER2/NR_MAC_gNB/main.c @@ -96,6 +96,12 @@ void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen) stats->dlsch_rounds[2], stats->dlsch_rounds[3], stats->dlsch_errors, stats->pucch0_DTX, avg_rsrp, stats->num_rsrp_meas); + stroff+=sprintf(output+stroff,"UE %d: CQI %d, RI %d, PMI (%d,%d)\n", + UE_id, + UE_info->UE_sched_ctrl[UE_id].CSI_report.cri_ri_li_pmi_cqi_report.wb_cqi_1tb, + UE_info->UE_sched_ctrl[UE_id].CSI_report.cri_ri_li_pmi_cqi_report.ri+1, + UE_info->UE_sched_ctrl[UE_id].CSI_report.cri_ri_li_pmi_cqi_report.pmi_x1, + UE_info->UE_sched_ctrl[UE_id].CSI_report.cri_ri_li_pmi_cqi_report.pmi_x2); stats->num_rsrp_meas = 0; stats->cumul_rsrp = 0 ; stroff+=sprintf(output+stroff,"UE %d: dlsch_total_bytes %d\n", UE_id, stats->dlsch_total_bytes); diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 121696744b..438ba0626a 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1406,7 +1406,6 @@ void fill_initial_SpCellConfig(rnti_t rnti, } csi_MeasConfig->csi_IM_ResourceToReleaseList = NULL; - csi_MeasConfig->csi_IM_ResourceSetToAddModList = NULL; csi_MeasConfig->csi_IM_ResourceSetToReleaseList = NULL; csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList = calloc(1,sizeof(*csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList)); diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index a54ce7856a..1697580640 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -1342,7 +1342,8 @@ void config_csirs(NR_ServingCellConfigCommon_t *servingcellconfigcommon, nzpcsi0->periodicityAndOffset = calloc(1,sizeof(*nzpcsi0->periodicityAndOffset)); nzpcsi0->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots320; nzpcsi0->periodicityAndOffset->choice.slots320 = 0; - nzpcsi0->qcl_InfoPeriodicCSI_RS = NULL; + nzpcsi0->qcl_InfoPeriodicCSI_RS = calloc(1,sizeof(*nzpcsi0->qcl_InfoPeriodicCSI_RS)); + *nzpcsi0->qcl_InfoPeriodicCSI_RS=0; ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList->list,nzpcsi0); } else From 6d6dd8f1775a097fafe045f6c76d33c6a805273b Mon Sep 17 00:00:00 2001 From: Eurecom Date: Sun, 31 Oct 2021 21:00:50 +0100 Subject: [PATCH 011/114] small modification in UE RX for handling DMRS configuration --- openair1/SIMULATION/NR_PHY/dlsim.c | 2 +- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 9029c23664..b3f087ac75 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -267,7 +267,7 @@ void nr_dlsim_preprocessor(module_id_t module_id, NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static; - ps->nrOfLayers = g_nrOfLayers; + ps->nrOfLayers = 0; int dci_format = sched_ctrl->search_space && sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats ? NR_DL_DCI_FORMAT_1_1 : NR_DL_DCI_FORMAT_1_0; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 30ae6b2c97..a82b4f1306 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -1015,7 +1015,8 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr mac->scc? mac->scc->dmrs_TypeA_Position:mac->mib->dmrs_TypeA_Position, dlsch_config_pdu_1_1->number_symbols, dlsch_config_pdu_1_1->start_symbol, - mappingtype); + mappingtype, + dlsch_config_pdu_1_1->n_front_load_symb); dlsch_config_pdu_1_1->dmrsConfigType = pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? NFAPI_NR_DMRS_TYPE1 : NFAPI_NR_DMRS_TYPE2; @@ -1095,6 +1096,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr (table_7_3_2_3_3_1[dci->antenna_ports.val][2]<<1) + (table_7_3_2_3_3_1[dci->antenna_ports.val][2]<<2) + (table_7_3_2_3_3_1[dci->antenna_ports.val][4]<<3)); + dlsch_config_pdu_1_1->n_front_load_symb = 1; } if ((dmrs_type == NULL) && (max_length != NULL)){ // Table 7.3.1.2.2-2: Antenna port(s) (1000 + DMRS port), dmrs-Type=1, maxLength=2 @@ -1181,7 +1183,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr } /* dmrs symbol positions*/ - dlsch_config_pdu_1_1->dlDmrsSymbPos = fill_dmrs_mask(pdsch_config, + dlsch_config_pdu_1_1->dlDmrsSymbPos = fill_dmrs_mask(pdsch_Config, mac->scc->dmrs_TypeA_Position, dlsch_config_pdu_1_1->number_symbols, dlsch_config_pdu_1_1->start_symbol, From a0f654573310255759389b02bb0c69c006761b3f Mon Sep 17 00:00:00 2001 From: Eurecom Date: Sun, 31 Oct 2021 21:14:53 +0100 Subject: [PATCH 012/114] added 133/162 PRBs to nr_dlsim --- openair1/SIMULATION/NR_PHY/dlsim.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index b3f087ac75..cc863e19c6 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -826,6 +826,14 @@ int main(int argc, char **argv) fs = 61.44e6; bw = 40e6; } + else if (mu == 1 && N_RB_DL == 133) { + fs = 61.44e6; + bw = 50e6; + } + else if (mu == 1 && N_RB_DL == 162) { + fs = 61.44e6; + bw = 60e6; + } else if (mu == 3 && N_RB_DL == 66) { fs = 122.88e6; bw = 100e6; From 9b0d2384ea407a683ffb0e8aa02ff6903a991135 Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Thu, 9 Dec 2021 12:34:08 +0100 Subject: [PATCH 013/114] minor changes after merge --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 1 - openair2/RRC/NR/MESSAGES/asn1_msg.c | 1 - 2 files changed, 2 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 125b77df41..3dcecb0286 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -941,7 +941,6 @@ void tci_handling(module_id_t Mod_idP, int UE_id, frame_t frame, slot_t slot) { int better_rsrp_reported = -140-(-0); /*minimum_measured_RSRP_value - minimum_differntail_RSRP_value*///considering the minimum RSRP value as better RSRP initially uint8_t diff_rsrp_idx = 0; uint8_t i, j; - NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; if (n_dl_bwp < 4) pdsch_bwp_id = bwp_id; diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 4591756c67..743c794546 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1260,7 +1260,6 @@ void fill_initial_SpCellConfig(rnti_t rnti, // frequency domain resources depends on BWP size // options are 24, 48 or 96 coreset->frequencyDomainResources.buf = calloc(1,6); - int curr_bwp = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; if (0) { if (curr_bwp < 48) coreset->frequencyDomainResources.buf[0] = 0xf0; From 34866293c1485a612e9e62c4c777d2234b0b3dc5 Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Sat, 11 Dec 2021 17:32:09 +0100 Subject: [PATCH 014/114] minor changes --- openair1/PHY/CODING/crc_byte.c | 4 ++-- openair2/LAYER2/NR_MAC_gNB/config.c | 4 +--- targets/ARCH/AW2SORI/oaiori.c | 5 ++++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/openair1/PHY/CODING/crc_byte.c b/openair1/PHY/CODING/crc_byte.c index c3b141db8e..a0ad837e87 100644 --- a/openair1/PHY/CODING/crc_byte.c +++ b/openair1/PHY/CODING/crc_byte.c @@ -153,7 +153,7 @@ unsigned int crc24a (unsigned char * inptr, { int octetlen = bitlen / 8; /* Change in octets */ - if ( bitlen % 8 || !__builtin_cpu_supports ("pclmul") ) { + if ( bitlen % 8 /*|| !__builtin_cpu_supports ("pclmul")*/ ) { unsigned int crc = 0; int resbit = (bitlen % 8); @@ -187,7 +187,7 @@ unsigned int crc24b (unsigned char * inptr, { int octetlen = bitlen / 8; /* Change in octets */ - if ( bitlen % 8 || !__builtin_cpu_supports ("pclmul") ) { + if ( bitlen % 8 /*|| !__builtin_cpu_supports ("pclmul") */) { unsigned int crc = 0; int resbit = (bitlen % 8); diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 1cb3fdb708..4687f6aeea 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -325,8 +325,6 @@ void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts } else { ssb_SubcarrierOffset_limit = 12; } - if (ssb_SubcarrierOffsetssb_table.ssb_offset_point_a.value = absolute_diff/(12*scs_scaling) - 10; //absoluteFrequencySSB is the central frequency of SSB which is made by 20RBs in total cfg->ssb_table.ssb_offset_point_a.tl.tag = NFAPI_NR_CONFIG_SSB_OFFSET_POINT_A_TAG; @@ -334,7 +332,7 @@ void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts cfg->ssb_table.ssb_period.value = *scc->ssb_periodicityServingCell; cfg->ssb_table.ssb_period.tl.tag = NFAPI_NR_CONFIG_SSB_PERIOD_TAG; cfg->num_tlv++; - cfg->ssb_table.ssb_subcarrier_offset.value = ssb_SubcarrierOffset; + cfg->ssb_table.ssb_subcarrier_offset.value = ssb_SubcarrierOffset>>(cfg->ssb_config.scs_common.value); cfg->ssb_table.ssb_subcarrier_offset.tl.tag = NFAPI_NR_CONFIG_SSB_SUBCARRIER_OFFSET_TAG; cfg->num_tlv++; diff --git a/targets/ARCH/AW2SORI/oaiori.c b/targets/ARCH/AW2SORI/oaiori.c index f79e2fad20..ec69e27135 100644 --- a/targets/ARCH/AW2SORI/oaiori.c +++ b/targets/ARCH/AW2SORI/oaiori.c @@ -317,7 +317,10 @@ int aw2s_startstreaming(openair0_device *device) { (openair0_cfg->rx_num_channels > 1 && rx1->fst != ORI_FST_Operational) || tx0->fst != ORI_FST_Operational || (openair0_cfg->tx_num_channels > 1 && tx1->fst != ORI_FST_Operational)) - {} + { + printf("rx0->fst %d,rx1->fst %d,tx0->fst %d, tx1->fst %d\n", + rx0->fst,rx1 ? rx1->fst : -1, tx0->fst, tx1 ? tx1->fst: -1); + } // test RX interface uint64_t TS; From 171408bc4d3b02a8b42b5755434fd1ff7daaf42d Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Mon, 13 Dec 2021 21:25:38 +0100 Subject: [PATCH 015/114] pucch DTX threshold modification --- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index 4921a79fa5..ea926d0bbb 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -400,7 +400,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_stats->pucch0_thres = gNB->pucch0_thres; /* + (10*max_n0);*/ bool no_conf=false; if (nr_sequences>1) { - if (xrtmag_dBtimes10 < (50+xrtmag_next_dBtimes10) || SNRtimes10 < uci_stats->pucch0_thres) + if (/*xrtmag_dBtimes10 < (30+xrtmag_next_dBtimes10) ||*/ SNRtimes10 < uci_stats->pucch0_thres) no_conf=true; } gNB->bad_pucch += no_conf; @@ -431,7 +431,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1); uci_pdu->harq->harq_list[0].harq_value = !(index&0x01); - LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ value %d (0 pass, 1 fail) with confidence level %d (0 is good, 1 is bad) xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d, energy %f, sync_pos %d\n", + if (no_conf) LOG_I(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ value %d (0 pass, 1 fail) with confidence level %d (0 is good, 1 is bad) xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d, energy %f, sync_pos %d\n", frame,slot,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10,10*log10((double)sigenergy),gNB->ulsch_stats[0].sync_pos); if (pucch_pdu->sr_flag == 1) { @@ -450,7 +450,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_pdu->harq->harq_list[1].harq_value = !(index&0x01); uci_pdu->harq->harq_list[0].harq_value = !((index>>1)&0x01); - LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ values %d (0 pass, 1 fail) and %d with confidence level %d (0 is good, 1 is bad), xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d,sync_pos %d\n", + if (no_conf) LOG_I(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ values %d (0 pass, 1 fail) and %d with confidence level %d (0 is good, 1 is bad), xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d,sync_pos %d\n", frame,slot,uci_pdu->harq->harq_list[1].harq_value,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10,gNB->ulsch_stats[0].sync_pos); if (pucch_pdu->sr_flag == 1) { uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); From 99e006f750d08ad2fe25ba492046cc97e265fd9e Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Wed, 15 Dec 2021 13:38:00 +0100 Subject: [PATCH 016/114] testing with UM/No Harq --- openair2/GNB_APP/MACRLC_nr_paramdef.h | 5 +++-- openair2/GNB_APP/gnb_config.c | 2 ++ openair2/GNB_APP/gnb_paramdef.h | 6 ++++-- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 6 +++--- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 2 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 6 +++--- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 1 + openair2/RRC/NR/MESSAGES/asn1_msg.c | 21 +++++++------------ openair2/RRC/NR/MESSAGES/asn1_msg.h | 2 +- openair2/RRC/NR/nr_rrc_defs.h | 1 + openair2/RRC/NR/rrc_gNB.c | 3 ++- 11 files changed, 28 insertions(+), 27 deletions(-) diff --git a/openair2/GNB_APP/MACRLC_nr_paramdef.h b/openair2/GNB_APP/MACRLC_nr_paramdef.h index b17fced7b7..436271fc0b 100644 --- a/openair2/GNB_APP/MACRLC_nr_paramdef.h +++ b/openair2/GNB_APP/MACRLC_nr_paramdef.h @@ -64,7 +64,7 @@ #define CONFIG_STRING_MACRLC_DL_BLER_TARGET_LOWER "dl_bler_target_lower" #define CONFIG_STRING_MACRLC_DL_RD2_BLER_THRESHOLD "dl_rd2_bler_threshold" #define CONFIG_STRING_MACRLC_DL_MAX_MCS "dl_max_mcs" - +#define CONFIG_STRING_MACRLC_HARQ_ROUND_MAX "harq_round_max" /*-------------------------------------------------------------------------------------------------------------------------------------------------------*/ /* MacRLC configuration parameters */ @@ -97,6 +97,7 @@ {CONFIG_STRING_MACRLC_DL_BLER_TARGET_LOWER, "Lower threshold of BLER to increase DL MCS", 0, dblptr:NULL, defdblval:0.05, TYPE_DOUBLE, 0}, \ {CONFIG_STRING_MACRLC_DL_RD2_BLER_THRESHOLD, "Threshold of RD2/RETX2 BLER to decrease DL MCS", 0, dblptr:NULL, defdblval:0.01, TYPE_DOUBLE, 0}, \ {CONFIG_STRING_MACRLC_DL_MAX_MCS, "Maximum DL MCS that should be used", 0, u8ptr:NULL, defintval:28, TYPE_UINT8, 0}, \ +{CONFIG_STRING_MACRLC_HARQ_ROUND_MAX, "Maximum number of HARQ rounds", 0, u8ptr:NULL, defintval:4, TYPE_UINT8, 0} \ } #define MACRLC_CC_IDX 0 #define MACRLC_TRANSPORT_N_PREFERENCE_IDX 1 @@ -124,6 +125,6 @@ #define MACRLC_DL_BLER_TARGET_LOWER_IDX 23 #define MACRLC_DL_RD2_BLER_THRESHOLD_IDX 24 #define MACRLC_DL_MAX_MCS_IDX 25 - +#define MACRLC_HARQ_ROUND_MAX_IDX 26 /*---------------------------------------------------------------------------------------------------------------------------------------------------------*/ #endif diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index dffced1374..7f85164140 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -759,6 +759,7 @@ void RCconfig_nr_macrlc() { RC.nrmac[j]->dl_bler_target_lower = *(MacRLC_ParamList.paramarray[j][MACRLC_DL_BLER_TARGET_LOWER_IDX].dblptr); RC.nrmac[j]->dl_rd2_bler_threshold = *(MacRLC_ParamList.paramarray[j][MACRLC_DL_RD2_BLER_THRESHOLD_IDX].dblptr); RC.nrmac[j]->dl_max_mcs = *(MacRLC_ParamList.paramarray[j][MACRLC_DL_MAX_MCS_IDX].u8ptr); + RC.nrmac[j]->harq_round_max = *(MacRLC_ParamList.paramarray[j][MACRLC_HARQ_ROUND_MAX_IDX].u8ptr); RC.nrmac[j]->num_ulprbbl = num_prbbl; LOG_I(NR_MAC,"Blacklisted PRBS %d\n",num_prbbl); memcpy(RC.nrmac[j]->ulprbbl,prbbl,275*sizeof(prbbl[0])); @@ -1041,6 +1042,7 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { rrc->nr_cellid = (uint64_t)*(GNBParamList.paramarray[i][GNB_NRCELLID_IDX].u64ptr); + rrc->um_on_default_drb = *(GNBParamList.paramarray[i][GNB_UMONDEFAULTDRB_IDX].uptr); if (strcmp(*(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr), "local_mac") == 0) { } else if (strcmp(*(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr), "cudu") == 0) { diff --git a/openair2/GNB_APP/gnb_paramdef.h b/openair2/GNB_APP/gnb_paramdef.h index bf1d12825e..94e9735a31 100644 --- a/openair2/GNB_APP/gnb_paramdef.h +++ b/openair2/GNB_APP/gnb_paramdef.h @@ -121,7 +121,7 @@ typedef enum { #define GNB_CONFIG_STRING_NRCELLID "nr_cellid" #define GNB_CONFIG_STRING_MINRXTXTIMEPDSCH "min_rxtxtime_pdsch" #define GNB_CONFIG_STRING_ULPRBBLACKLIST "ul_prbblacklist" - +#define GNB_CONFIG_STRING_UMONDEFAULTDRB "um_on_default_drb" /*-----------------------------------------------------------------------------------------------------------------------------------------*/ /* cell configuration parameters */ @@ -149,7 +149,8 @@ typedef enum { {GNB_CONFIG_STRING_DOCSIRS, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ {GNB_CONFIG_STRING_NRCELLID, NULL, 0, u64ptr:NULL, defint64val:1, TYPE_UINT64, 0}, \ {GNB_CONFIG_STRING_MINRXTXTIMEPDSCH, NULL, 0, iptr:NULL, defintval:2, TYPE_INT, 0}, \ -{GNB_CONFIG_STRING_ULPRBBLACKLIST, NULL, 0, strptr:NULL, defstrval:"", TYPE_STRING, 0} \ +{GNB_CONFIG_STRING_ULPRBBLACKLIST, NULL, 0, strptr:NULL, defstrval:"", TYPE_STRING, 0}, \ +{GNB_CONFIG_STRING_UMONDEFAULTDRB, NULL, 0, uptr:NULL, defuintval:0, TYPE_UINT, 0} \ } #define GNB_GNB_ID_IDX 0 @@ -174,6 +175,7 @@ typedef enum { #define GNB_NRCELLID_IDX 19 #define GNB_MINRXTXTIMEPDSCH_IDX 20 #define GNB_ULPRBBLACKLIST_IDX 21 +#define GNB_UMONDEFAULTDRB_IDX 22 #define TRACKING_AREA_CODE_OKRANGE {0x0001,0xFFFD} #define GNBPARAMS_CHECK { \ diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index d8b168ae75..3f93f79621 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -611,7 +611,7 @@ bool allocate_dl_retransmission(module_id_t module_id, /* Find a free CCE */ bool freeCCE = find_free_CCE(module_id, slot, UE_id); if (!freeCCE) { - LOG_D(MAC, "%4d.%2d could not find CCE for DL DCI retransmission UE %d/RNTI %04x\n", + LOG_I(MAC, "%4d.%2d allocate_dl_transmission: could not find CCE for DL DCI retransmission UE %d/RNTI %04x\n", frame, slot, UE_id, UE_info->rnti[UE_id]); return false; } @@ -746,7 +746,7 @@ void pf_dl(module_id_t module_id, /* Find a free CCE */ bool freeCCE = find_free_CCE(module_id, slot, UE_id); if (!freeCCE) { - LOG_D(NR_MAC, "%4d.%2d could not find CCE for DL DCI UE %d/RNTI %04x\n", frame, slot, UE_id, rnti); + LOG_I(NR_MAC, "%4d.%2d could not find CCE for DL DCI UE %d/RNTI %04x\n", frame, slot, UE_id, rnti); continue; } /* reduce max_num_ue once we are sure UE can be allocated, i.e., has CCE */ @@ -963,7 +963,7 @@ void nr_schedule_ue_spec(module_id_t module_id, harq->is_waiting = true; UE_info->mac_stats[UE_id].dlsch_rounds[harq->round]++; - LOG_D(NR_MAC, + LOG_I(NR_MAC, "%4d.%2d [DLSCH/PDSCH/PUCCH] UE %d RNTI %04x DCI L %d start %3d RBs %3d startSymbol %2d nb_symbol %2d dmrspos %x MCS %2d TBS %4d HARQ PID %2d round %d RV %d NDI %d dl_data_to_ULACK %d (%d.%d) PUCCH allocation %d TPC %d\n", frame, slot, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index ee312f51a0..9b48feab9d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -576,7 +576,7 @@ static void handle_dl_harq(module_id_t mod_id, add_tail_nr_list(&UE_info->UE_sched_ctrl[UE_id].available_dl_harq, harq_pid); harq->round = 0; harq->ndi ^= 1; - } else if (harq->round >= MAX_HARQ_ROUNDS - 1) { + } else if (harq->round >= RC.nrmac[mod_id]->harq_round_max - 1) { add_tail_nr_list(&UE_info->UE_sched_ctrl[UE_id].available_dl_harq, harq_pid); harq->round = 0; harq->ndi ^= 1; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 1d6edfe4f0..b2d2b51a30 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -550,7 +550,7 @@ void handle_nr_ul_harq(const int CC_idP, remove_front_nr_list(&sched_ctrl->feedback_ul_harq); sched_ctrl->ul_harq_processes[harq_pid].is_waiting = false; - if(sched_ctrl->ul_harq_processes[harq_pid].round >= MAX_HARQ_ROUNDS - 1) { + if(sched_ctrl->ul_harq_processes[harq_pid].round >= gNB_mac->harq_round_max - 1) { abort_nr_ul_harq(mod_id, UE_id, harq_pid); } else { sched_ctrl->ul_harq_processes[harq_pid].round++; @@ -571,7 +571,7 @@ void handle_nr_ul_harq(const int CC_idP, harq_pid, crc_pdu->rnti); add_tail_nr_list(&sched_ctrl->available_ul_harq, harq_pid); - } else if (harq->round >= MAX_HARQ_ROUNDS - 1) { + } else if (harq->round >= gNB_mac->harq_round_max - 1) { abort_nr_ul_harq(mod_id, UE_id, harq_pid); LOG_D(NR_MAC, "RNTI %04x: Ulharq id %d crc failed in all rounds\n", @@ -1481,7 +1481,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot) sched_ctrl->last_ul_frame = sched_pusch->frame; sched_ctrl->last_ul_slot = sched_pusch->slot; - LOG_D(NR_MAC, + LOG_I(NR_MAC, "ULSCH/PUSCH: %4d.%2d RNTI %04x UL sched %4d.%2d DCI L %d start %2d RBS %3d startSymbol %2d nb_symbol %2d dmrs_pos %x MCS %2d TBS %4d HARQ PID %2d round %d RV %d NDI %d est %6d sched %6d est BSR %6d TPC %d\n", frame, slot, diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 738f9b4117..5091262a0b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -781,6 +781,7 @@ typedef struct gNB_MAC_INST_s { double dl_bler_target_lower; double dl_rd2_bler_threshold; uint8_t dl_max_mcs; + uint8_t harq_round_max; } gNB_MAC_INST; #endif /*__LAYER2_NR_MAC_GNB_H__ */ diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index ff6923429e..f1cc264b9f 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1258,7 +1258,7 @@ void fill_initial_SpCellConfig(rnti_t rnti, ss2->nrofCandidates=calloc(1,sizeof(*ss2->nrofCandidates)); ss2->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0; ss2->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n2; - ss2->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n1; + ss2->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n0; ss2->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0; ss2->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0; ss2->searchSpaceType=calloc(1,sizeof(*ss2->searchSpaceType)); @@ -1317,7 +1317,7 @@ void fill_initial_SpCellConfig(rnti_t rnti, } -void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGroupConfig_t *ue_context_mastercellGroup) { +void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGroupConfig_t *ue_context_mastercellGroup,int use_rlc_um_for_drb) { cellGroupConfig->cellGroupId = 0; cellGroupConfig->rlc_BearerToReleaseList = NULL; @@ -1377,18 +1377,11 @@ void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGr rlc_BearerConfig_drb->servedRadioBearer->choice.drb_Identity = 1; rlc_BearerConfig_drb->reestablishRLC = NULL; rlc_Config_drb = calloc(1, sizeof(NR_RLC_Config_t)); - rlc_Config_drb->present = NR_RLC_Config_PR_am; - rlc_Config_drb->choice.am = calloc(1, sizeof(*rlc_Config_drb->choice.am)); - rlc_Config_drb->choice.am->dl_AM_RLC.sn_FieldLength = calloc(1, sizeof(NR_SN_FieldLengthAM_t)); - *(rlc_Config_drb->choice.am->dl_AM_RLC.sn_FieldLength) = NR_SN_FieldLengthAM_size18; - rlc_Config_drb->choice.am->dl_AM_RLC.t_Reassembly = NR_T_Reassembly_ms80; - rlc_Config_drb->choice.am->dl_AM_RLC.t_StatusProhibit = NR_T_StatusProhibit_ms10; - rlc_Config_drb->choice.am->ul_AM_RLC.sn_FieldLength = calloc(1, sizeof(NR_SN_FieldLengthAM_t)); - *(rlc_Config_drb->choice.am->ul_AM_RLC.sn_FieldLength) = NR_SN_FieldLengthAM_size18; - rlc_Config_drb->choice.am->ul_AM_RLC.t_PollRetransmit = NR_T_PollRetransmit_ms80; - rlc_Config_drb->choice.am->ul_AM_RLC.pollPDU = NR_PollPDU_p64; - rlc_Config_drb->choice.am->ul_AM_RLC.pollByte = NR_PollByte_kB125; - rlc_Config_drb->choice.am->ul_AM_RLC.maxRetxThreshold = NR_UL_AM_RLC__maxRetxThreshold_t8; + + if (use_rlc_um_for_drb) nr_drb_config(rlc_Config_drb, NR_RLC_Config_PR_um_Bi_Directional); + else nr_drb_config(rlc_Config_drb, NR_RLC_Config_PR_am); + + rlc_BearerConfig_drb->rlc_Config = rlc_Config_drb; logicalChannelConfig_drb = calloc(1, sizeof(NR_LogicalChannelConfig_t)); logicalChannelConfig_drb->ul_SpecificParameters = calloc(1, sizeof(*logicalChannelConfig_drb->ul_SpecificParameters)); diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.h b/openair2/RRC/NR/MESSAGES/asn1_msg.h index 7b38de2bb9..b9a3ea6dac 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.h +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.h @@ -99,7 +99,7 @@ void fill_initial_cellGroupConfig(rnti_t rnti, NR_ServingCellConfigCommon_t *scc, rrc_gNB_carrier_data_t *carrier); -void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGroupConfig_t *ue_context_mastercellGroup); +void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGroupConfig_t *ue_context_mastercellGroup,int use_rlc_um_for_drb); uint8_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP, uint8_t *const buffer, diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index ad31e8cac7..95f3772b71 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -514,6 +514,7 @@ typedef struct gNB_RRC_INST_s { int srb1_max_retx_threshold; int srb1_timer_reordering; int srb1_timer_status_prohibit; + int um_on_default_drb; int srs_enable[MAX_NUM_CCs]; uint16_t sctp_in_streams; uint16_t sctp_out_streams; diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 65ae2660b3..2ff3da787c 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1109,7 +1109,8 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( memset(buffer, 0, RRC_BUF_SIZE); cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t)); - fill_mastercellGroupConfig(cellGroupConfig, ue_context_pP->ue_context.masterCellGroup); + fill_mastercellGroupConfig(cellGroupConfig, ue_context_pP->ue_context.masterCellGroup, + rrc->um_on_default_drb); size = do_RRCReconfiguration(ctxt_pP, buffer, xid, *SRB_configList2, From 50629a83a22ef75b79ef8e290c7f0db358cb270b Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Mon, 20 Dec 2021 21:24:52 +0100 Subject: [PATCH 017/114] first set of changes to AW2S ORI/eCPRI driver for n78 --- targets/ARCH/AW2SORI/oaiori.c | 44 +++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/targets/ARCH/AW2SORI/oaiori.c b/targets/ARCH/AW2SORI/oaiori.c index f79e2fad20..ea39d9c90d 100644 --- a/targets/ARCH/AW2SORI/oaiori.c +++ b/targets/ARCH/AW2SORI/oaiori.c @@ -101,31 +101,37 @@ static const eutra_bandentry_t eutra_bandtable[] = { uint32_t to_earfcn_DL_aw2s(int eutra_bandP, long long int dl_CarrierFreq, uint32_t bw) { uint32_t dl_CarrierFreq_by_100k = dl_CarrierFreq / 100000; - int i; + int i=0; if (eutra_bandP > 68) { printf("eutra_band %d > 68\n", eutra_bandP); exit(-1);} - for (i = 0; i < BANDTABLE_SIZE && eutra_bandtable[i].band != eutra_bandP; i++); - printf("AW2S: band %d, index %d\n",eutra_bandP, i); + + if (eutra_bandP > 0) + for (i = 0; i < BANDTABLE_SIZE && eutra_bandtable[i].band != eutra_bandP; i++); + printf("AW2S: band %d: index %d\n",eutra_bandP, i); if (i >= BANDTABLE_SIZE) { printf(" i = %d , it will trigger out-of-bounds read.\n",i); exit(-1);} - if (dl_CarrierFreq_by_100k < eutra_bandtable[i].dl_min) { - printf("Band %d, bw %u : DL carrier frequency %u .1 MHz < %u\n", - eutra_bandP, bw, dl_CarrierFreq_by_100k, - eutra_bandtable[i].dl_min); exit(-1);} + while(i - (eutra_bandtable[i].dl_max - bw)) { - printf("Band %d, bw %u : DL carrier frequency %u .1MHz > %d\n", - eutra_bandP, bw, dl_CarrierFreq_by_100k, - eutra_bandtable[i].dl_max - bw); exit(-1); } - printf("AW2S: dl_CarrierFreq_by_100k %d, dl_min %d\n",dl_CarrierFreq_by_100k,eutra_bandtable[i].dl_min); + if(dl_CarrierFreq_by_100k > + (eutra_bandtable[i].dl_max - bw)) { + printf("Band %d, bw %u : DL carrier frequency %u .1MHz > %d\n", + eutra_bandtable[i].band, bw, dl_CarrierFreq_by_100k, + eutra_bandtable[i].dl_max - bw); i++;continue; } + printf("AW2S: dl_CarrierFreq_by_100k %d, dl_min %d\n",dl_CarrierFreq_by_100k,eutra_bandtable[i].dl_min); - return (dl_CarrierFreq_by_100k - eutra_bandtable[i].dl_min + - (eutra_bandtable[i].N_OFFs_DL / 10)); + return (dl_CarrierFreq_by_100k - eutra_bandtable[i].dl_min + + (eutra_bandtable[i].N_OFFs_DL / 10)); + + } + printf("No DL band found\n"); + exit(-1); } - uint32_t to_earfcn_UL_aw2s(int eutra_bandP, long long int ul_CarrierFreq, uint32_t bw) { uint32_t ul_CarrierFreq_by_100k = ul_CarrierFreq / 100000; int i; @@ -134,6 +140,7 @@ uint32_t to_earfcn_UL_aw2s(int eutra_bandP, long long int ul_CarrierFreq, uint32 exit(-1); } + for (i = 0; i < BANDTABLE_SIZE && eutra_bandtable[i].band != eutra_bandP; i++); if(i >= BANDTABLE_SIZE) {printf("i = %d , it will trigger out-of-bounds read.\n",i); exit(-1);} @@ -313,12 +320,13 @@ int aw2s_startstreaming(openair0_device *device) { printf("ORI_ObjectStateModify: %s\n", ORI_Result_Print(RE_result)); } + /* while (rx0->fst != ORI_FST_Operational || (openair0_cfg->rx_num_channels > 1 && rx1->fst != ORI_FST_Operational) || tx0->fst != ORI_FST_Operational || (openair0_cfg->tx_num_channels > 1 && tx1->fst != ORI_FST_Operational)) {} - +*/ // test RX interface uint64_t TS; char temp_rx[1024] __attribute__((aligned(32))); @@ -475,7 +483,7 @@ int aw2s_oriinit(openair0_device *device) { txParams.TxEUtraTDD.axcW = 1; txParams.TxEUtraTDD.axcB = 0; txParams.TxEUtraTDD.chanBW = openair0_cfg->tx_bw/100e3; - txParams.TxEUtraTDD.earfcn = to_earfcn_DL_aw2s(38,(long long int)openair0_cfg->tx_freq[0],txParams.TxEUtraTDD.chanBW); + txParams.TxEUtraTDD.earfcn = to_earfcn_DL_aw2s(-1,(long long int)openair0_cfg->tx_freq[0],txParams.TxEUtraTDD.chanBW); txParams.TxEUtraTDD.maxTxPwr = 430-((int)openair0_cfg->tx_gain[0]*10); txParams.TxEUtraTDD.tddULDLConfig = 1; txParams.TxEUtraTDD.tddSpecialSFConfig = 0; From cd5e07b67cf933df873e2ea6775300dcb3494d75 Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Mon, 24 Jan 2022 15:06:02 +0100 Subject: [PATCH 018/114] minor change after merge with develop --- executables/nr-ru.c | 1 + 1 file changed, 1 insertion(+) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 6891a360f3..c7375601a6 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1312,6 +1312,7 @@ void *ru_thread( void *param ) { else LOG_I(PHY,"RU %d rf device ready\n",ru->idx); } else LOG_I(PHY,"RU %d no rf device\n",ru->idx); + LOG_I(PHY,"RU %d RF started\n",ru->idx); // start trx write thread if(usrp_tx_thread == 1) { if (ru->start_write_thread) { From 86560439e73d22ca0e3341fda5c5694968104a84 Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Tue, 1 Feb 2022 21:55:49 +0100 Subject: [PATCH 019/114] nr-softmodem fixed after merge` --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 4 ++-- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 3 +-- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 1 - 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 91187a88f8..a4ef3e425f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -580,14 +580,14 @@ bool allocate_dl_retransmission(module_id_t module_id, } else { /* the retransmission will use a different time domain allocation, check * that we have enough resources */ + NR_pdsch_semi_static_t temp_ps = *ps; + nr_set_pdsch_semi_static(scc, cg, sched_ctrl->active_bwp, bwpd,tda, ps->nrOfLayers, sched_ctrl, &temp_ps); while (rbStart < bwpSize && !(rballoc_mask[rbStart]&SL_to_bitmap(temp_ps.startSymbolIndex, temp_ps.nrOfSymbols))) rbStart++; while (rbStart + rbSize < bwpSize && (rballoc_mask[rbStart + rbSize]&SL_to_bitmap(temp_ps.startSymbolIndex, temp_ps.nrOfSymbols))) rbSize++; - NR_pdsch_semi_static_t temp_ps = *ps; - nr_set_pdsch_semi_static(scc, cg, sched_ctrl->active_bwp, bwpd,tda, ps->nrOfLayers, sched_ctrl, &temp_ps); uint32_t new_tbs; uint16_t new_rbSize; bool success = nr_find_nb_rb(retInfo->Qm, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 633ff0e54c..40890cf258 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -284,7 +284,7 @@ void nr_preprocessor_phytest(module_id_t module_id, ps->nrOfLayers = target_dl_Nl; if (ps->time_domain_allocation != tda) nr_set_pdsch_semi_static( - scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, NULL, tda, f, ps); + scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, NULL, tda, target_dl_Nl, sched_ctrl,ps); /* find largest unallocated chunk */ const int bwpSize = NRRIV2BW(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); @@ -389,7 +389,6 @@ void nr_preprocessor_phytest(module_id_t module_id, sched_pdsch->pucch_allocation = alloc; sched_pdsch->rbStart = rbStart; sched_pdsch->rbSize = rbSize; - const int tda = sched_ctrl->active_bwp ? RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp->bwp_Id][slot] : 1; if (ps->time_domain_allocation != tda || ps->nrOfLayers != target_dl_Nl) nr_set_pdsch_semi_static(scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, NULL, tda, target_dl_Nl, sched_ctrl, ps); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 21e8419884..24a01fe8ea 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2137,7 +2137,6 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG UE_info->CellGroup[UE_id] = CellGroup; add_nr_list(&UE_info->list, UE_id); memset(&UE_info->mac_stats[UE_id], 0, sizeof(NR_mac_stats_t)); - set_Y(UE_info->Y[UE_id], rntiP); if (CellGroup && CellGroup->spCellConfig && CellGroup->spCellConfig->spCellConfigDedicated && From 2b96909960979eff578ba3756a63d612126073e2 Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Fri, 11 Feb 2022 08:11:45 +0100 Subject: [PATCH 020/114] update to ori.h (with NR extensions) --- targets/ARCH/AW2SORI/ori.h | 113 ++++++++++++++++++++++++++++++++++--- 1 file changed, 104 insertions(+), 9 deletions(-) diff --git a/targets/ARCH/AW2SORI/ori.h b/targets/ARCH/AW2SORI/ori.h index d4a4f2cbbf..3650d15ec6 100644 --- a/targets/ARCH/AW2SORI/ori.h +++ b/targets/ARCH/AW2SORI/ori.h @@ -2,8 +2,8 @@ * @file ori.h * @brief Open Radio Interface (ORI) C library header file. * @author AW2S (http://www.aw2s.com) -* @version 1.6 -* @date July 29, 2019 +* @version 1.8 +* @date January 18, 2022 * * This file is the AW2S REC ORI C library header, and contains all necessary * functions prototypes, enumerations, data structures and type definitions @@ -14,7 +14,7 @@ #define ORI_H_ #define ORILIB_VERSION_MAJOR 1 -#define ORILIB_VERSION_MINOR 6 +#define ORILIB_VERSION_MINOR 8 #include @@ -144,10 +144,14 @@ typedef enum ORI_ObjectType_TxEUtraFDD, /**< */ ORI_ObjectType_TxEUtraTDD, /**< */ ORI_ObjectType_TxGSM, /**< */ + ORI_ObjectType_TxNRFDD, /**< */ + ORI_ObjectType_TxNRTDD, /**< */ ORI_ObjectType_RxUtra, /**< */ ORI_ObjectType_RxEUtraFDD, /**< */ ORI_ObjectType_RxEUtraTDD, /**< */ ORI_ObjectType_RxGSM, /**< */ + ORI_ObjectType_RxNRFDD, /**< */ + ORI_ObjectType_RxNRTDD, /**< */ ORI_ObjectType_ORILink, /**< */ ORI_ObjectType_ExternalEventPort, /**< */ ORI_ObjectType_AISGPort, /**< */ @@ -223,6 +227,7 @@ typedef enum ORI_ObjectParam_SigPath_AWS_enableCompBitChange, /**< */ ORI_ObjectParam_SigPath_AWS_measuredPwr, /**< */ ORI_ObjectParam_SigPath_AWS_axcIncr, /**< */ + ORI_ObjectParam_SigPath_AWS_arfcn, /**< */ ORI_ObjectParam_TxSigPath_t2a, /**< */ ORI_ObjectParam_TxSigPath_maxTxPwr, /**< */ ORI_ObjectParam_TxSigPath_dlCalRE, /**< */ @@ -252,12 +257,12 @@ typedef enum ORI_ObjectParam_ORILink_AWS_localMAC, /**< */ ORI_ObjectParam_ORILink_AWS_remoteMAC, /**< */ ORI_ObjectParam_ORILink_AWS_t14, /**< */ + ORI_ObjectParam_ORILink_AWS_sfpTxPow, /**< */ + ORI_ObjectParam_ORILink_AWS_sfpRxPow, /**< */ ORI_ObjectParam_ORILink_AWS_remoteIP, /**< */ ORI_ObjectParam_ORILink_AWS_localIP, /**< */ ORI_ObjectParam_ORILink_AWS_remoteUdpPort, /**< */ ORI_ObjectParam_ORILink_AWS_localUdpPort, /**< */ - ORI_ObjectParam_ORILink_AWS_sfpTxPow, /**< */ - ORI_ObjectParam_ORILink_AWS_sfpRxPow, /**< */ ORI_ObjectParam_AISGPort_busPowerEnable, /**< */ ORI_ObjectParam_AISGALD_deviceType, /**< */ ORI_ObjectParam_AISGALD_UID, /**< */ @@ -1146,6 +1151,50 @@ typedef struct ORI_Boolean_e AWS_enPeakCancel; /**< RW-Locked. AW2S Vendor specific: Peak-Cancellation CFR enablement. */ } ORI_ObjectParams_TxSigPathGSM_s; +/** + * @struct ORI_ObjectParams_TxSigPathNRFDD_s + * @brief Structure containing the parameters of a TxSigPath NRFDD object. + */ +typedef struct +{ + uint16_t chanBW; /**< RW-Locked. Channel bandwith in MHz/10. */ + uint16_t dlCalREMax; /**< RO. Max possible buffer in RE for DL timing calibration in Tc/16.*/ + uint32_t t2a; /**< RO. RE time delay. */ + uint16_t dlCalRE; /**< RW-Locked. Time delay to enable DL timing calibration in Tc/16. */ + int16_t maxTxPwr; /**< RW. Max tx power for this path, unit is dBm/10 (e.g. 400 for 40 dBm). */ + uint8_t axcW; /**< RW-Locked. AxC W parameter. */ + uint8_t axcB; /**< RW-Locked. AxC B parameter. */ + ORI_Object_s * oriLink; /**< RW-Locked. ORI Link on which the AxC is mapped. */ + ORI_Object_s * antPort; /**< RW-Locked. Reference Antenna port for this signal. */ + ORI_Boolean_e AWS_enableCompRateChange; /**< RW-Locked. AW2S Vendor specific: Enable IQ data compression sample rate change. */ + int16_t AWS_measuredPwr; /**< RO. AW2S Vendor specific: Measured Tx power for this path, unit is dBm/10 (e.g. 400 for 40 dBm). */ + uint16_t AWS_axcIncr; /**< RW-Locked. AW2S Vendor specific: AxC increment for each sample, 0 means auto (= packed, no interleaving). */ + ORI_Boolean_e AWS_enPeakCancel; /**< RW-Locked. AW2S Vendor specific: Peak-Cancellation CFR enablement. */ + uint32_t AWS_arfcn; /**< RW-Locked. ARFCN of the NR carrier. */ +} ORI_ObjectParams_TxSigPathNRFDD_s; + +/** + * @struct ORI_ObjectParams_TxSigPathNRTDD_s + * @brief Structure containing the parameters of a TxSigPath NRTDD object. + */ +typedef struct +{ + uint16_t chanBW; /**< RW-Locked. Channel bandwith in MHz/10. */ + uint16_t dlCalREMax; /**< RO. Max possible buffer in RE for DL timing calibration in Tc/16.*/ + uint32_t t2a; /**< RO. RE time delay. */ + uint16_t dlCalRE; /**< RW-Locked. Time delay to enable DL timing calibration in Tc/16. */ + int16_t maxTxPwr; /**< RW. Max tx power for this path, unit is dBm/10 (e.g. 400 for 40 dBm). */ + uint8_t axcW; /**< RW-Locked. AxC W parameter. */ + uint8_t axcB; /**< RW-Locked. AxC B parameter. */ + ORI_Object_s * oriLink; /**< RW-Locked. ORI Link on which the AxC is mapped. */ + ORI_Object_s * antPort; /**< RW-Locked. Reference Antenna port for this signal. */ + ORI_Boolean_e AWS_enableCompRateChange; /**< RW-Locked. AW2S Vendor specific: Enable IQ data compression sample rate change. */ + int16_t AWS_measuredPwr; /**< RO. AW2S Vendor specific: Measured Tx power for this path, unit is dBm/10 (e.g. 400 for 40 dBm). */ + uint16_t AWS_axcIncr; /**< RW-Locked. AW2S Vendor specific: AxC increment for each sample, 0 means auto (= packed, no interleaving). */ + ORI_Boolean_e AWS_enPeakCancel; /**< RW-Locked. AW2S Vendor specific: Peak-Cancellation CFR enablement. */ + uint32_t AWS_arfcn; /**< RW-Locked. ARFCN of the NR carrier. */ +} ORI_ObjectParams_TxSigPathNRTDD_s; + /** * @struct ORI_ObjectParams_RxSigPathUtra_s * @brief Structure containing the parameters of a RxSigPath UTRAFDD object. @@ -1239,6 +1288,48 @@ typedef struct uint16_t AWS_axcIncr; /**< RW-Locked. AW2S Vendor specific: AxC increment for each sample, 0 means auto (= packed, no interleaving). */ } ORI_ObjectParams_RxSigPathGSM_s; +/** + * @struct ORI_ObjectParams_RxSigPathNRFDD_s + * @brief Structure containing the parameters of a RxSigPath NRFDD object. + * + */ +typedef struct +{ + uint16_t chanBW; /**< RW-Locked. Channel bandwith in MHz/10. */ + uint16_t ulCalREMax; /**< RO. Max possible buffer in RE for UL timing calibration in Tc/2.*/ + uint32_t ta3; /**< RO. RE time delay. */ + uint16_t ulCalRE; /**< RW-Locked. Time delay to enable UL timing calibration in Tc/2. */ + uint8_t axcW; /**< RW-Locked. AxC W parameter. */ + uint8_t axcB; /**< RW-Locked. AxC B parameter. */ + ORI_Object_s * oriLink; /**< RW-Locked. ORI Link on which the AxC is mapped. */ + ORI_Object_s * antPort; /**< RW-Locked. Reference Antenna port for this signal. */ + ORI_Boolean_e AWS_enableCompRateChange; /**< RW-Locked. AW2S Vendor specific: Enable IQ data compression sample rate change. */ + int16_t AWS_measuredPwr; /**< RO. AW2S Vendor specific: Measured Rx power for this path, unit is dBm/10 (e.g. -650 for -65 dBm). */ + uint16_t AWS_axcIncr; /**< RW-Locked. AW2S Vendor specific: AxC increment for each sample, 0 means auto (= packed, no interleaving). */ + uint32_t AWS_arfcn; /**< RW-Locked. ARFCN of the NR carrier. */ +} ORI_ObjectParams_RxSigPathNRFDD_s; + +/** + * @struct ORI_ObjectParams_RxSigPathNRTDD_s + * @brief Structure containing the parameters of a RxSigPath NRTDD object. + * + */ +typedef struct +{ + uint16_t chanBW; /**< RW-Locked. Channel bandwith in MHz/10. */ + uint16_t ulCalREMax; /**< RO. Max possible buffer in RE for UL timing calibration in Tc/2.*/ + uint32_t ta3; /**< RO. RE time delay. */ + uint16_t ulCalRE; /**< RW-Locked. Time delay to enable UL timing calibration in Tc/2. */ + uint8_t axcW; /**< RW-Locked. AxC W parameter. */ + uint8_t axcB; /**< RW-Locked. AxC B parameter. */ + ORI_Object_s * oriLink; /**< RW-Locked. ORI Link on which the AxC is mapped. */ + ORI_Object_s * antPort; /**< RW-Locked. Reference Antenna port for this signal. */ + ORI_Boolean_e AWS_enableCompRateChange; /**< RW-Locked. AW2S Vendor specific: Enable IQ data compression sample rate change. */ + int16_t AWS_measuredPwr; /**< RO. AW2S Vendor specific: Measured Rx power for this path, unit is dBm/10 (e.g. -650 for -65 dBm). */ + uint16_t AWS_axcIncr; /**< RW-Locked. AW2S Vendor specific: AxC increment for each sample, 0 means auto (= packed, no interleaving). */ + uint32_t AWS_arfcn; /**< RW-Locked. ARFCN of the NR carrier. */ +} ORI_ObjectParams_RxSigPathNRTDD_s; + /** * @struct ORI_ObjectParams_ORILink_s * @brief Structure containing the parameters of an ORI Link object. @@ -1258,12 +1349,12 @@ typedef struct uint8_t AWS_localMAC[6]; /**< R0. AW2S Vendor specific: Local MAC address of the ORI link. */ uint8_t AWS_remoteMAC[6]; /**< RW. AW2S Vendor specific: Remote MAC address of the ORI link. */ uint32_t AWS_t14; /**< RO. AW2S Vendor specific: CPRI time delay component. */ - uint8_t AWS_remoteIP[4]; /**< RW. AW2S Vendor specific: REC IP for ECPRI Ethernet frame */ - uint8_t AWS_localIP[4]; /**< R0. AW2S Vendor specific: RE IP for ECPRI Ethernet frame */ - uint16_t AWS_remoteUdpPort; /**< RW. AW2S Vendor specific: REC Udp Port for ECPRI Ethernet frame */ - uint16_t AWS_localUdpPort; /**< R0. AW2S Vendor specific: RE Udp Port for ECPRI Ethernet frame */ uint32_t AWS_sfpTxPow; /**< RO. AW2S Vendor specific: SFP Tx power. */ uint32_t AWS_sfpRxPow; /**< RO. AW2S Vendor specific: SFP Rx power. */ + uint8_t AWS_remoteIP[4]; /**< RW. AW2S Vendor specific: IP of REC for ECPRI Ethernet frame */ + uint8_t AWS_localIP[4]; /**< RW. AW2S Vendor specific: IP of RE for ECPRI Ethernet frame */ + uint16_t AWS_remoteUdpPort; /**< RW. AW2S Vendor specific: UDP port of REC for ECPRI Ethernet frame */ + uint16_t AWS_localUdpPort; /**< RO. AW2S Vendor specific: UDP port of RE for ECPRI Ethernet frame */ } ORI_ObjectParams_ORILink_s; /** @@ -1393,10 +1484,14 @@ typedef union ORI_ObjectParams_TxSigPathEUtraFDD_s TxEUtraFDD; /**< Parameters for ::ORI_ObjectType_TxEUtraFDD. */ ORI_ObjectParams_TxSigPathEUtraTDD_s TxEUtraTDD; /**< Parameters for ::ORI_ObjectType_TxEUtraTDD. */ ORI_ObjectParams_TxSigPathGSM_s TxGSM; /**< Parameters for ::ORI_ObjectType_TxGSM. */ + ORI_ObjectParams_TxSigPathNRFDD_s TxNRFDD; /**< Parameters for ::ORI_ObjectType_TxNRFDD. */ + ORI_ObjectParams_TxSigPathNRTDD_s TxNRTDD; /**< Parameters for ::ORI_ObjectType_TxNRTDD. */ ORI_ObjectParams_RxSigPathUtra_s RxUtra; /**< Parameters for ::ORI_ObjectType_RxUtra. */ ORI_ObjectParams_RxSigPathEUtraFDD_s RxEUtraFDD; /**< Parameters for ::ORI_ObjectType_RxEUtraFDD. */ ORI_ObjectParams_RxSigPathEUtraTDD_s RxEUtraTDD; /**< Parameters for ::ORI_ObjectType_RxEUtraTDD. */ ORI_ObjectParams_RxSigPathGSM_s RxGSM; /**< Parameters for ::ORI_ObjectType_RxGSM. */ + ORI_ObjectParams_RxSigPathNRFDD_s RxNRFDD; /**< Parameters for ::ORI_ObjectType_RxNRFDD. */ + ORI_ObjectParams_RxSigPathNRTDD_s RxNRTDD; /**< Parameters for ::ORI_ObjectType_RxNRTDD. */ ORI_ObjectParams_ORILink_s ORILink; /**< Parameters for ::ORI_ObjectType_ORILink. */ ORI_ObjectParams_ExternalEventPort_s ExternalEventPort; /**< Parameters for ::ORI_ObjectType_ExternalEventPort. */ ORI_ObjectParams_AISGPort_s AISGPort; /**< Parameters for ::ORI_ObjectType_AISGPort. */ From 74fd3f029adf496422d6cefe5c590ad2209176d1 Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Sun, 13 Feb 2022 09:44:15 +0100 Subject: [PATCH 021/114] changes for AW2S NR support in ORI library --- executables/nr-ru.c | 11 +- openair2/ENB_APP/enb_paramdef.h | 6 + openair2/GNB_APP/gnb_config.c | 12 +- targets/ARCH/AW2SORI/oaiori.c | 351 +++++++++++++++++++++++++------ targets/ARCH/COMMON/common_lib.h | 6 + 5 files changed, 305 insertions(+), 81 deletions(-) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index c3788ef480..e4fc3bc27c 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -2084,9 +2084,7 @@ static void NRRCconfig_RU(void) { RC.ru[j]->max_pdschReferenceSignalPower = *(RUParamList.paramarray[j][RU_MAX_RS_EPRE_IDX].uptr);; RC.ru[j]->max_rxgain = *(RUParamList.paramarray[j][RU_MAX_RXGAIN_IDX].uptr); - RC.ru[j]->num_bands = RUParamList.paramarray[j][RU_BAND_LIST_IDX].numelt; RC.ru[j]->sf_extension = *(RUParamList.paramarray[j][RU_SF_EXTENSION_IDX].uptr); - for (i=0; inum_bands; i++) RC.ru[j]->band[i] = RUParamList.paramarray[j][RU_BAND_LIST_IDX].iptr[i]; } //strcmp(local_rf, "yes") == 0 else { printf("RU %d: Transport %s\n",j,*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr)); @@ -2106,8 +2104,6 @@ static void NRRCconfig_RU(void) { RC.ru[j]->if_south = REMOTE_IF5; RC.ru[j]->function = NGFI_RAU_IF5; RC.ru[j]->eth_params.transp_preference = ETH_UDP_IF5_ECPRI_MODE; - } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp_ecpri_if5") == 0) { - RC.ru[j]->if_south = REMOTE_IF5; } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw") == 0) { RC.ru[j]->if_south = REMOTE_IF5; RC.ru[j]->function = NGFI_RAU_IF5; @@ -2130,7 +2126,12 @@ static void NRRCconfig_RU(void) { RC.ru[j]->if_frequency = *(RUParamList.paramarray[j][RU_IF_FREQUENCY].u64ptr); RC.ru[j]->if_freq_offset = *(RUParamList.paramarray[j][RU_IF_FREQ_OFFSET].iptr); RC.ru[j]->do_precoding = *(RUParamList.paramarray[j][RU_DO_PRECODING].iptr); - + RC.ru[j]->num_bands = RUParamList.paramarray[j][RU_BAND_LIST_IDX].numelt; + for (i=0; inum_bands; i++) RC.ru[j]->band[i] = RUParamList.paramarray[j][RU_BAND_LIST_IDX].iptr[i]; + RC.ru[j]->openair0_cfg.nr_flag = *(RUParamList.paramarray[j][RU_NR_FLAG].iptr); + RC.ru[j]->openair0_cfg.nr_band = RC.ru[j]->band[0]; + RC.ru[j]->openair0_cfg.nr_scs_for_raster = *(RUParamList.paramarray[j][RU_NR_SCS_FOR_RASTER].iptr); + printf("[RU %d] Setting nr_flag %d, nr_band %d, nr_scs_for_raster %d\n",j,RC.ru[j]->openair0_cfg.nr_flag,RC.ru[j]->openair0_cfg.nr_band,RC.ru[j]->openair0_cfg.nr_scs_for_raster); if (config_isparamset(RUParamList.paramarray[j], RU_BF_WEIGHTS_LIST_IDX)) { RC.ru[j]->nb_bfw = RUParamList.paramarray[j][RU_BF_WEIGHTS_LIST_IDX].numelt; diff --git a/openair2/ENB_APP/enb_paramdef.h b/openair2/ENB_APP/enb_paramdef.h index 22af2a6de0..2757e408d9 100644 --- a/openair2/ENB_APP/enb_paramdef.h +++ b/openair2/ENB_APP/enb_paramdef.h @@ -99,6 +99,8 @@ typedef enum { #define CONFIG_STRING_RU_IF_FREQUENCY "if_freq" #define CONFIG_STRING_RU_IF_FREQ_OFFSET "if_offset" #define CONFIG_STRING_RU_DO_PRECODING "do_precoding" +#define CONFIG_STRING_RU_NR_FLAG "nr_flag" +#define CONFIG_STRING_RU_NR_SCS_FOR_RASTER "nr_scs_for_raster" #define RU_LOCAL_IF_NAME_IDX 0 #define RU_LOCAL_ADDRESS_IDX 1 @@ -129,6 +131,8 @@ typedef enum { #define RU_IF_FREQUENCY 26 #define RU_IF_FREQ_OFFSET 27 #define RU_DO_PRECODING 28 +#define RU_NR_FLAG 29 +#define RU_NR_SCS_FOR_RASTER 30 /*-----------------------------------------------------------------------------------------------------------------------------------------*/ /* RU configuration parameters */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ @@ -163,6 +167,8 @@ typedef enum { {CONFIG_STRING_RU_IF_FREQUENCY, NULL, 0, u64ptr:NULL, defuintval:0, TYPE_UINT64, 0}, \ {CONFIG_STRING_RU_IF_FREQ_OFFSET, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ {CONFIG_STRING_RU_DO_PRECODING, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ + {CONFIG_STRING_RU_NR_FLAG, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ + {CONFIG_STRING_RU_NR_SCS_FOR_RASTER, NULL, 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \ } /*---------------------------------------------------------------------------------------------------------------------------------------*/ diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 9a0c972c09..deeb1b505d 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -451,7 +451,7 @@ void fix_scd(NR_ServingCellConfig_t *scd) { for (int i = scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->frequencyDensity->list.count-1; i >= 0; i--) { if ((*scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->frequencyDensity->list.array[i] < 1) || (*scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->frequencyDensity->list.array[i] > 276)) { - LOG_I(RRC, "DL PTRS frequencyDensity %d not set. Assuming PTRS not present! \n", i); + LOG_I(NR_RRC, "DL PTRS frequencyDensity %d not set. Assuming PTRS not present! \n", i); free(scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS); scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS = NULL; break; @@ -1149,16 +1149,16 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { (NRRRC_CONFIGURATION_REQ (msg_p).mnc_digit_length[l] == 3),"BAD MNC DIGIT LENGTH %d", NRRRC_CONFIGURATION_REQ (msg_p).mnc_digit_length[l]); } - printf("SSB SCO %d\n",*GNBParamList.paramarray[i][GNB_SSB_SUBCARRIEROFFSET_IDX].iptr); + LOG_I(GNB_APP,"SSB SCO %d\n",*GNBParamList.paramarray[i][GNB_SSB_SUBCARRIEROFFSET_IDX].iptr); NRRRC_CONFIGURATION_REQ (msg_p).ssb_SubcarrierOffset = *GNBParamList.paramarray[i][GNB_SSB_SUBCARRIEROFFSET_IDX].iptr; - printf("pdsch_AntennaPorts %d\n",*GNBParamList.paramarray[i][GNB_PDSCH_ANTENNAPORTS_IDX].iptr); + LOG_I(GNB_APP,"pdsch_AntennaPorts %d\n",*GNBParamList.paramarray[i][GNB_PDSCH_ANTENNAPORTS_IDX].iptr); NRRRC_CONFIGURATION_REQ (msg_p).pdsch_AntennaPorts = *GNBParamList.paramarray[i][GNB_PDSCH_ANTENNAPORTS_IDX].iptr; - printf("pusch_AntennaPorts %d\n",*GNBParamList.paramarray[i][GNB_PUSCH_ANTENNAPORTS_IDX].iptr); + LOG_I(GNB_APP,"pusch_AntennaPorts %d\n",*GNBParamList.paramarray[i][GNB_PUSCH_ANTENNAPORTS_IDX].iptr); NRRRC_CONFIGURATION_REQ (msg_p).pusch_AntennaPorts = *GNBParamList.paramarray[i][GNB_PUSCH_ANTENNAPORTS_IDX].iptr; - printf("minTXRXTIME %d\n",*GNBParamList.paramarray[i][GNB_MINRXTXTIME_IDX].iptr); + LOG_I(GNB_APP,"minTXRXTIME %d\n",*GNBParamList.paramarray[i][GNB_MINRXTXTIME_IDX].iptr); NRRRC_CONFIGURATION_REQ (msg_p).minRXTXTIME = *GNBParamList.paramarray[i][GNB_MINRXTXTIME_IDX].iptr; NRRRC_CONFIGURATION_REQ (msg_p).sib1_tda = *GNBParamList.paramarray[i][GNB_SIB1_TDA_IDX].iptr; - printf("Do CSI-RS %d\n",*GNBParamList.paramarray[i][GNB_DO_CSIRS_IDX].iptr); + LOG_I(GNB_APP,"Do CSI-RS %d\n",*GNBParamList.paramarray[i][GNB_DO_CSIRS_IDX].iptr); NRRRC_CONFIGURATION_REQ (msg_p).do_CSIRS = *GNBParamList.paramarray[i][GNB_DO_CSIRS_IDX].iptr; NRRRC_CONFIGURATION_REQ (msg_p).scc = scc; NRRRC_CONFIGURATION_REQ (msg_p).scd = scd; diff --git a/targets/ARCH/AW2SORI/oaiori.c b/targets/ARCH/AW2SORI/oaiori.c index ea39d9c90d..4b0c83ab4c 100644 --- a/targets/ARCH/AW2SORI/oaiori.c +++ b/targets/ARCH/AW2SORI/oaiori.c @@ -228,14 +228,38 @@ int aw2s_startstreaming(openair0_device *device) { ORI_Result_e RE_result; openair0_config_t *openair0_cfg = device->openair0_cfg; + ORI_Object_s *tx0,*tx1,*tx2,*tx3,*rx0,*rx1,*rx2,*rx3; + if (openair0_cfg->nr_flag == 0 ) { + tx0= ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ? ORI_ObjectType_TxEUtraFDD :ORI_ObjectType_TxEUtraTDD, 0, NULL); + tx1= (openair0_cfg->tx_num_channels > 1) ? ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ?ORI_ObjectType_TxEUtraFDD : ORI_ObjectType_TxEUtraTDD, 1, NULL) : NULL; + tx2= (openair0_cfg->tx_num_channels > 2) ? ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ?ORI_ObjectType_TxEUtraFDD : ORI_ObjectType_TxEUtraTDD, 2, NULL) : NULL; + tx3= (openair0_cfg->tx_num_channels > 3) ? ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ?ORI_ObjectType_TxEUtraFDD : ORI_ObjectType_TxEUtraTDD, 3, NULL) : NULL; + rx0= ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ?ORI_ObjectType_RxEUtraFDD : ORI_ObjectType_RxEUtraTDD, 0, NULL); + rx1= (openair0_cfg->rx_num_channels > 1) ? ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ?ORI_ObjectType_RxEUtraFDD : ORI_ObjectType_RxEUtraTDD, 1, NULL) : NULL; + rx2= (openair0_cfg->rx_num_channels > 2) ? ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ?ORI_ObjectType_RxEUtraFDD : ORI_ObjectType_RxEUtraTDD, 2, NULL) : NULL; + rx3= (openair0_cfg->rx_num_channels > 3) ? ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ?ORI_ObjectType_RxEUtraFDD : ORI_ObjectType_RxEUtraTDD, 3, NULL) : NULL; + } else { + tx0= ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ? ORI_ObjectType_TxNRFDD :ORI_ObjectType_TxNRTDD, 0, NULL); + tx1= (openair0_cfg->tx_num_channels > 1) ? ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ?ORI_ObjectType_TxNRFDD : ORI_ObjectType_TxNRTDD, 1, NULL) : NULL; + tx2= (openair0_cfg->tx_num_channels > 2) ? ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ?ORI_ObjectType_TxNRFDD : ORI_ObjectType_TxNRTDD, 2, NULL) : NULL; + tx3= (openair0_cfg->tx_num_channels > 3) ? ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ?ORI_ObjectType_TxNRFDD : ORI_ObjectType_TxNRTDD, 3, NULL) : NULL; + rx0= ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ?ORI_ObjectType_RxEUtraFDD : ORI_ObjectType_RxEUtraTDD, 0, NULL); + rx1= (openair0_cfg->rx_num_channels > 1) ? ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ?ORI_ObjectType_RxNRFDD : ORI_ObjectType_RxNRTDD, 1, NULL) : NULL; + rx2= (openair0_cfg->rx_num_channels > 2) ? ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ?ORI_ObjectType_RxNRFDD : ORI_ObjectType_RxNRTDD, 2, NULL) : NULL; + rx3= (openair0_cfg->rx_num_channels > 3) ? ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ?ORI_ObjectType_RxNRFDD : ORI_ObjectType_RxNRTDD, 3, NULL) : NULL; - ORI_Object_s *tx0= ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ? ORI_ObjectType_TxEUtraFDD :ORI_ObjectType_TxEUtraTDD, 0, NULL); - ORI_Object_s *tx1= (openair0_cfg->tx_num_channels > 1) ? ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ?ORI_ObjectType_TxEUtraFDD : ORI_ObjectType_TxEUtraTDD, 1, NULL) : NULL; - ORI_Object_s *rx0= ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ?ORI_ObjectType_RxEUtraFDD : ORI_ObjectType_RxEUtraTDD, 0, NULL); - ORI_Object_s *rx1= (openair0_cfg->rx_num_channels > 1) ? ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ?ORI_ObjectType_RxEUtraFDD : ORI_ObjectType_RxEUtraTDD, 1, NULL) : NULL; + } ORI_Object_s *link= ORI_FindObject(ori, ORI_ObjectType_ORILink, 0, NULL); - if (tx0 == NULL || (tx1 == NULL && openair0_cfg->tx_num_channels > 1) || rx0 == NULL || (rx1 == NULL && openair0_cfg->rx_num_channels > 1) || link == NULL) return (-1); + if (tx0 == NULL || + (tx1 == NULL && openair0_cfg->tx_num_channels > 1) || + (tx2 == NULL && openair0_cfg->tx_num_channels > 2) || + (tx3 == NULL && openair0_cfg->tx_num_channels > 3) || + rx0 == NULL || + (rx1 == NULL && openair0_cfg->rx_num_channels > 1) || + (rx2 == NULL && openair0_cfg->rx_num_channels > 2) || + (rx3 == NULL && openair0_cfg->rx_num_channels > 3) || + link == NULL) return (-1); /******************************************************************* * UNLOCK Link @@ -284,6 +308,40 @@ int aw2s_startstreaming(openair0_device *device) { } printf("ORI_ObjectStateModify: %s\n", ORI_Result_Print(RE_result)); } + /******************************************************************* + * UNLOCK TX2 + *******************************************************************/ + + if (tx2) { + printf("\n\n\n========================================================\n"); + + /* Put Tx1 into service */ + result = ORI_ObjectStateModification(ori, tx2, ORI_AST_Unlocked, &RE_result); + if(result != ORI_Result_SUCCESS) + { + printf("ORI_ObjectStateModify failed with error: %s\n", ORI_Result_Print(result)); + aw2s_oricleanup(device); + return -1; + } + printf("ORI_ObjectStateModify: %s\n", ORI_Result_Print(RE_result)); + } + /******************************************************************* + * UNLOCK TX3 + *******************************************************************/ + + if (tx3) { + printf("\n\n\n========================================================\n"); + + /* Put Tx3 into service */ + result = ORI_ObjectStateModification(ori, tx1, ORI_AST_Unlocked, &RE_result); + if(result != ORI_Result_SUCCESS) + { + printf("ORI_ObjectStateModify failed with error: %s\n", ORI_Result_Print(result)); + aw2s_oricleanup(device); + return -1; + } + printf("ORI_ObjectStateModify: %s\n", ORI_Result_Print(RE_result)); + } /******************************************************************* * UNLOCK RX0 *******************************************************************/ @@ -320,6 +378,38 @@ int aw2s_startstreaming(openair0_device *device) { printf("ORI_ObjectStateModify: %s\n", ORI_Result_Print(RE_result)); } + /******************************************************************* + * UNLOCK RX2 + *******************************************************************/ + if (rx2) { + printf("\n\n\n========================================================\n"); + + /* Put Rx1 into service */ + result = ORI_ObjectStateModification(ori, rx2, ORI_AST_Unlocked, &RE_result); + if(result != ORI_Result_SUCCESS) + { + printf("ORI_ObjectStateModify failed with error: %s\n", ORI_Result_Print(result)); + aw2s_oricleanup(device); + return -1; + } + printf("ORI_ObjectStateModify: %s\n", ORI_Result_Print(RE_result)); + } + /******************************************************************* + * UNLOCK RX3 + *******************************************************************/ + if (rx3) { + printf("\n\n\n========================================================\n"); + + /* Put Rx1 into service */ + result = ORI_ObjectStateModification(ori, rx3, ORI_AST_Unlocked, &RE_result); + if(result != ORI_Result_SUCCESS) + { + printf("ORI_ObjectStateModify failed with error: %s\n", ORI_Result_Print(result)); + aw2s_oricleanup(device); + return -1; + } + printf("ORI_ObjectStateModify: %s\n", ORI_Result_Print(RE_result)); + } /* while (rx0->fst != ORI_FST_Operational || (openair0_cfg->rx_num_channels > 1 && rx1->fst != ORI_FST_Operational) || @@ -331,6 +421,9 @@ int aw2s_startstreaming(openair0_device *device) { uint64_t TS; char temp_rx[1024] __attribute__((aligned(32))); int aid,r0=0,r1=(openair0_cfg->rx_num_channels > 1) ? 0 : 1; + int r2=(openair0_cfg->rx_num_channels > 2) ? 0 : 1; + int r3=(openair0_cfg->rx_num_channels > 3) ? 0 : 1; + int i; int Npackets=1024000; for (i=0;iduplex_mode == duplex_mode_FDD ? ORI_ObjectType_TxEUtraFDD : ORI_ObjectType_TxEUtraTDD}; + ORI_ObjectTypeRef_s txTypeRef = { NULL, openair0_cfg->duplex_mode == duplex_mode_FDD ? + (openair0_cfg->nr_flag == 0 ? ORI_ObjectType_TxEUtraFDD : ORI_ObjectType_TxNRFDD): + (openair0_cfg->nr_flag == 0 ? ORI_ObjectType_TxEUtraTDD : ORI_ObjectType_TxNRTDD)}; ORI_ObjectParams_u txParams; ORI_ObjectParam_e txParamList[9]; ORI_Result_e txParamResult[9]; int num_txparams; - if (openair0_cfg->duplex_mode == duplex_mode_FDD) { - txParamList[0] = ORI_ObjectParam_SigPath_antPort; - txParamList[1] = ORI_ObjectParam_SigPath_axcW; - txParamList[2] = ORI_ObjectParam_SigPath_axcB; - txParamList[3] = ORI_ObjectParam_SigPath_chanBW; - txParamList[4] = ORI_ObjectParam_SigPath_earfcn; - txParamList[5] = ORI_ObjectParam_TxSigPath_maxTxPwr; - num_txparams = 6; - } - else { - txParamList[0] = ORI_ObjectParam_SigPath_antPort; - txParamList[1] = ORI_ObjectParam_SigPath_axcW; - txParamList[2] = ORI_ObjectParam_SigPath_axcB; - txParamList[3] = ORI_ObjectParam_SigPath_chanBW; - txParamList[4] = ORI_ObjectParam_SigPath_earfcn; - txParamList[5] = ORI_ObjectParam_TxSigPath_maxTxPwr; - txParamList[6] = ORI_ObjectParam_SigPath_tddULDLConfig; - txParamList[7] = ORI_ObjectParam_SigPath_tddSpecialSFConfig; - txParamList[8] = ORI_ObjectParam_TxSigPath_tddCPLengthDL; - num_txparams = 9; - } + txParamList[0] = ORI_ObjectParam_SigPath_antPort; + txParamList[1] = ORI_ObjectParam_SigPath_axcW; + txParamList[2] = ORI_ObjectParam_SigPath_axcB; + txParamList[3] = ORI_ObjectParam_SigPath_chanBW; + txParamList[4] = (openair0_cfg->nr_flag ==0) ? ORI_ObjectParam_SigPath_earfcn : ORI_ObjectParam_SigPath_AWS_arfcn; + txParamList[5] = ORI_ObjectParam_TxSigPath_maxTxPwr; + num_txparams = 6; /* Create tx0 */ ORI_Object_s * tx0; printf("AW2S: duplex_mode %d, tx_bw %f, rx_bw %f\n",openair0_cfg->duplex_mode,openair0_cfg->tx_bw,openair0_cfg->rx_bw); - if (openair0_cfg->duplex_mode == duplex_mode_FDD) { + if (openair0_cfg->duplex_mode == duplex_mode_FDD && openair0_cfg->nr_flag == 0) { txParams.TxEUtraFDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 0, NULL); txParams.TxEUtraFDD.axcW = 1; txParams.TxEUtraFDD.axcB = 0; txParams.TxEUtraFDD.chanBW = openair0_cfg->tx_bw/100e3; - txParams.TxEUtraFDD.earfcn = 3350; - txParams.TxEUtraFDD.maxTxPwr = -100; + txParams.TxEUtraTDD.earfcn = to_earfcn_DL_aw2s(-1,(long long int)openair0_cfg->tx_freq[0],txParams.TxEUtraTDD.chanBW); + txParams.TxEUtraFDD.maxTxPwr = 430-((int)openair0_cfg->tx_gain[0]*10); } - else if (openair0_cfg->duplex_mode == duplex_mode_TDD) { + else if (openair0_cfg->duplex_mode == duplex_mode_FDD && openair0_cfg->nr_flag == 1) { + txParams.TxNRFDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 0, NULL); + txParams.TxNRFDD.axcW = 1; + txParams.TxNRFDD.axcB = 0; + txParams.TxNRFDD.chanBW = openair0_cfg->tx_bw/100e3; + + txParams.TxNRFDD.AWS_arfcn = to_nrarfcn(openair0_cfg->nr_band,(long long int)openair0_cfg->tx_freq[0],openair0_cfg->nr_scs_for_raster,(uint32_t)openair0_cfg->tx_bw); + txParams.TxNRFDD.maxTxPwr = 430-((int)openair0_cfg->tx_gain[0]*10); + } + else if (openair0_cfg->duplex_mode == duplex_mode_TDD && openair0_cfg->nr_flag == 0) { txParams.TxEUtraTDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 0, NULL); txParams.TxEUtraTDD.axcW = 1; txParams.TxEUtraTDD.axcB = 0; txParams.TxEUtraTDD.chanBW = openair0_cfg->tx_bw/100e3; txParams.TxEUtraTDD.earfcn = to_earfcn_DL_aw2s(-1,(long long int)openair0_cfg->tx_freq[0],txParams.TxEUtraTDD.chanBW); txParams.TxEUtraTDD.maxTxPwr = 430-((int)openair0_cfg->tx_gain[0]*10); - txParams.TxEUtraTDD.tddULDLConfig = 1; - txParams.TxEUtraTDD.tddSpecialSFConfig = 0; - txParams.TxEUtraTDD.tddCPLengthDL = ORI_tddCPLength_Normal; - printf("AW2S: Configuring for TDD, EARFCN %u, Power %d, BW %d\n", + printf("AW2S: Configuring for LTE TDD, EARFCN %u, Power %d, BW %d\n", txParams.TxEUtraTDD.earfcn,txParams.TxEUtraTDD.maxTxPwr,txParams.TxEUtraTDD.chanBW); } + else if (openair0_cfg->duplex_mode == duplex_mode_TDD && openair0_cfg->nr_flag == 1) { + txParams.TxNRTDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 0, NULL); + txParams.TxNRTDD.axcW = 1; + txParams.TxNRTDD.axcB = 0; + txParams.TxNRTDD.chanBW = openair0_cfg->tx_bw/100e3; + txParams.TxNRTDD.AWS_arfcn = to_nrarfcn(openair0_cfg->nr_band,(long long int)openair0_cfg->tx_freq[0],openair0_cfg->nr_scs_for_raster,(uint32_t)openair0_cfg->tx_bw); + txParams.TxNRTDD.maxTxPwr = 430-((int)openair0_cfg->tx_gain[0]*10); + + printf("AW2S: Configuring for NR TDD, NRARFCN %u, Power %d, BW %d\n", + txParams.TxNRTDD.AWS_arfcn,txParams.TxNRTDD.maxTxPwr,txParams.TxNRTDD.chanBW); + } else { aw2s_oricleanup(device); return -1; @@ -499,28 +605,51 @@ int aw2s_oriinit(openair0_device *device) { result = ORI_ObjectCreation(ori, txTypeRef, txParams, txParamList, num_txparams, txParamResult, &tx0, &RE_result); if(RE_result != ORI_Result_SUCCESS) { - printf("ORI_ObjectCreation (txParams0.TxEUtraFDD/TDD) failed with error: %s (%s,%s,%s,%s,%s,%s,%s,%s,%s\n", ORI_Result_Print(result), + printf("ORI_ObjectCreation (txParams0.TxEUtra/NRFDD/TDD) failed with error: %s (%s,%s,%s,%s,%s,%s\n", ORI_Result_Print(RE_result), ORI_Result_Print(txParamResult[0]), ORI_Result_Print(txParamResult[1]), ORI_Result_Print(txParamResult[2]), ORI_Result_Print(txParamResult[3]), ORI_Result_Print(txParamResult[4]), - ORI_Result_Print(txParamResult[5]), - ORI_Result_Print(txParamResult[6]), - ORI_Result_Print(txParamResult[7]), - ORI_Result_Print(txParamResult[8])); + ORI_Result_Print(txParamResult[5])); aw2s_oricleanup(device); return -1; } - printf("ORI_ObjectCreation (txParams0.TxEUtraFDD/TDD): %s\n", ORI_Result_Print(RE_result)); + printf("ORI_ObjectCreation (txParams0.TxEUtra/NRFDD/TDD): %s\n", ORI_Result_Print(RE_result)); /* Create tx1 */ if (openair0_cfg->tx_num_channels > 1) { ORI_Object_s * tx1; - if (openair0_cfg->duplex_mode ==duplex_mode_FDD) txParams.TxEUtraFDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 1, NULL); - else txParams.TxEUtraTDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 1, NULL); + if (openair0_cfg->duplex_mode == duplex_mode_FDD && openair0_cfg->nr_flag == 0) + txParams.TxEUtraFDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 1, NULL); + else if (openair0_cfg->duplex_mode == duplex_mode_FDD && openair0_cfg->nr_flag == 1) + txParams.TxNRFDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 1, NULL); + else if (openair0_cfg->duplex_mode == duplex_mode_TDD && openair0_cfg->nr_flag == 0) + txParams.TxEUtraTDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 1, NULL); + else if (openair0_cfg->duplex_mode == duplex_mode_TDD && openair0_cfg->nr_flag == 1) + txParams.TxNRTDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 1, NULL); result = ORI_ObjectCreation(ori, txTypeRef, txParams, txParamList, num_txparams, txParamResult, &tx1, &RE_result); + if(RE_result != ORI_Result_SUCCESS) + { + printf("ORI_ObjectCreation (txParams1.TxEUtra/NRFDD/TDD) failed with error: %s\n", ORI_Result_Print(result)); + aw2s_oricleanup(device); + return -1; + } + printf("ORI_ObjectCreation (txParams1.TxEUtra/NRFDD/TDD): %s\n", ORI_Result_Print(RE_result)); + } + + if (openair0_cfg->tx_num_channels > 2) { + ORI_Object_s * tx2; + if (openair0_cfg->duplex_mode == duplex_mode_FDD && openair0_cfg->nr_flag == 0) + txParams.TxEUtraFDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 2, NULL); + else if (openair0_cfg->duplex_mode == duplex_mode_FDD && openair0_cfg->nr_flag == 1) + txParams.TxNRFDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 2, NULL); + else if (openair0_cfg->duplex_mode == duplex_mode_TDD && openair0_cfg->nr_flag == 0) + txParams.TxEUtraTDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 2, NULL); + else if (openair0_cfg->duplex_mode == duplex_mode_TDD && openair0_cfg->nr_flag == 1) + txParams.TxNRTDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 2, NULL); + result = ORI_ObjectCreation(ori, txTypeRef, txParams, txParamList, num_txparams, txParamResult, &tx2, &RE_result); if(RE_result != ORI_Result_SUCCESS) { printf("ORI_ObjectCreation (txParams1.TxEUtraFDD/TDD) failed with error: %s\n", ORI_Result_Print(result)); @@ -529,7 +658,25 @@ int aw2s_oriinit(openair0_device *device) { } printf("ORI_ObjectCreation (txParams1.TxEUtraFDD/TDD): %s\n", ORI_Result_Print(RE_result)); } - + if (openair0_cfg->tx_num_channels == 4) { + ORI_Object_s * tx3; + if (openair0_cfg->duplex_mode == duplex_mode_FDD && openair0_cfg->nr_flag == 0) + txParams.TxEUtraFDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 3, NULL); + else if (openair0_cfg->duplex_mode == duplex_mode_FDD && openair0_cfg->nr_flag == 1) + txParams.TxNRFDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 3, NULL); + else if (openair0_cfg->duplex_mode == duplex_mode_TDD && openair0_cfg->nr_flag == 0) + txParams.TxEUtraTDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 3, NULL); + else if (openair0_cfg->duplex_mode == duplex_mode_TDD && openair0_cfg->nr_flag == 1) + txParams.TxNRTDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 3, NULL); + result = ORI_ObjectCreation(ori, txTypeRef, txParams, txParamList, num_txparams, txParamResult, &tx3, &RE_result); + if(RE_result != ORI_Result_SUCCESS) + { + printf("ORI_ObjectCreation (txParams1.TxEUtra/NRFDD/TDD) failed with error: %s\n", ORI_Result_Print(result)); + aw2s_oricleanup(device); + return -1; + } + printf("ORI_ObjectCreation (txParams3.TxEUtra/NRFDD/TDD): %s\n", ORI_Result_Print(RE_result)); + } /******************************************************************* @@ -537,42 +684,55 @@ int aw2s_oriinit(openair0_device *device) { *******************************************************************/ /* Prepare parameters */ - ORI_ObjectTypeRef_s rxTypeRef = { NULL, openair0_cfg->duplex_mode == duplex_mode_FDD ? ORI_ObjectType_RxEUtraFDD : ORI_ObjectType_RxEUtraTDD}; - ORI_ObjectParams_u rxParams,rxParams1; - ORI_ObjectParam_e rxParamList[8] = { ORI_ObjectParam_SigPath_antPort, ORI_ObjectParam_SigPath_axcW, ORI_ObjectParam_SigPath_axcB, + ORI_ObjectTypeRef_s rxTypeRef = { NULL, openair0_cfg->duplex_mode == duplex_mode_FDD ? + (openair0_cfg->nr_flag == 0 ? ORI_ObjectType_RxEUtraFDD : ORI_ObjectType_RxNRFDD ) : + (openair0_cfg->nr_flag == 0 ? ORI_ObjectType_RxEUtraTDD : ORI_ObjectType_RxNRTDD)}; + ORI_ObjectParams_u rxParams; + ORI_ObjectParam_e rxParamList[5] = { ORI_ObjectParam_SigPath_antPort, ORI_ObjectParam_SigPath_axcW, ORI_ObjectParam_SigPath_axcB, ORI_ObjectParam_SigPath_chanBW, ORI_ObjectParam_SigPath_earfcn }; - ORI_Result_e rxParamResult[8]; + ORI_Result_e rxParamResult[5]; int num_rxparams = 5; - if (openair0_cfg->duplex_mode == duplex_mode_TDD) { - rxParamList[5] = ORI_ObjectParam_SigPath_tddULDLConfig; - rxParamList[6] = ORI_ObjectParam_SigPath_tddSpecialSFConfig; - rxParamList[7] = ORI_ObjectParam_RxSigPath_tddCPLengthUL; - num_rxparams = 8; - } /* Create rx0 */ ORI_Object_s * rx0; - if (openair0_cfg->duplex_mode == duplex_mode_FDD) { + if (openair0_cfg->duplex_mode == duplex_mode_FDD && openair0_cfg->nr_flag == 0) { rxParams.RxEUtraFDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 0, NULL); rxParams.RxEUtraFDD.axcW = 1; rxParams.RxEUtraFDD.axcB = 0; - rxParams.RxEUtraFDD.chanBW = 200; - rxParams.RxEUtraFDD.earfcn = 21350; + rxParams.RxEUtraFDD.chanBW = txParams.TxEUtraFDD.chanBW; + rxParams.RxEUtraFDD.earfcn = to_earfcn_UL_aw2s(-1,(long long int)openair0_cfg->rx_freq[0],txParams.TxEUtraFDD.chanBW); result = ORI_ObjectCreation(ori, rxTypeRef, rxParams, rxParamList, num_rxparams, rxParamResult, &rx0, &RE_result); } - else { + else if (openair0_cfg->duplex_mode == duplex_mode_FDD && openair0_cfg->nr_flag == 1) { + rxParams.RxNRFDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 0, NULL); + rxParams.RxNRFDD.axcW = 1; + rxParams.RxNRFDD.axcB = 0; + rxParams.RxNRFDD.chanBW = txParams.TxNRFDD.chanBW; + rxParams.RxNRFDD.AWS_arfcn = to_nrarfcn(openair0_cfg->nr_band,(long long int)openair0_cfg->rx_freq[0],openair0_cfg->nr_scs_for_raster,openair0_cfg->rx_bw); + result = ORI_ObjectCreation(ori, rxTypeRef, rxParams, rxParamList, num_rxparams, rxParamResult, &rx0, &RE_result); + } + else if (openair0_cfg->duplex_mode == duplex_mode_TDD && openair0_cfg->nr_flag == 0) { rxParams.RxEUtraTDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 0, NULL); rxParams.RxEUtraTDD.axcW = 1; rxParams.RxEUtraTDD.axcB = 0; rxParams.RxEUtraTDD.chanBW = txParams.TxEUtraTDD.chanBW; rxParams.RxEUtraTDD.earfcn = txParams.TxEUtraTDD.earfcn; - rxParams.RxEUtraTDD.tddULDLConfig = 1; - rxParams.RxEUtraTDD.tddSpecialSFConfig = 1; - rxParams.RxEUtraTDD.tddCPLengthUL = ORI_tddCPLength_Normal; printf("AW2S: Creating RX0 for EARFCN %d\n",rxParams.RxEUtraTDD.earfcn); result = ORI_ObjectCreation(ori, rxTypeRef, rxParams, rxParamList, num_rxparams, rxParamResult, &rx0, &RE_result); + } + else if (openair0_cfg->duplex_mode == duplex_mode_TDD && openair0_cfg->nr_flag == 1) { + rxParams.RxNRTDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 0, NULL); + rxParams.RxNRTDD.axcW = 1; + rxParams.RxNRTDD.axcB = 0; + rxParams.RxNRTDD.chanBW = txParams.TxNRTDD.chanBW; + rxParams.RxNRTDD.AWS_arfcn = txParams.TxNRTDD.AWS_arfcn; + + printf("AW2S: Creating RX0 for NRARFCN %d\n",rxParams.RxNRTDD.AWS_arfcn); + + result = ORI_ObjectCreation(ori, rxTypeRef, rxParams, rxParamList, num_rxparams, rxParamResult, &rx0, &RE_result); + } if(result != ORI_Result_SUCCESS) @@ -581,27 +741,78 @@ int aw2s_oriinit(openair0_device *device) { aw2s_oricleanup(device); return -1; } - printf("ORI_ObjectCreation (rxParams0.RxEUtraFDD/TDD): %s\n", ORI_Result_Print(RE_result)); + printf("ORI_ObjectCreation (rxParams0.RxEUtra/NR/FDD/TDD): %s\n", ORI_Result_Print(RE_result)); if (openair0_cfg->rx_num_channels > 1) { /* Create rx1 */ ORI_Object_s * rx1; - memcpy((void*)&rxParams1,(void*)&rxParams,sizeof(rxParams)); - if (openair0_cfg->duplex_mode == duplex_mode_FDD) rxParams1.RxEUtraFDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 1, NULL); - else rxParams1.RxEUtraTDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 1, NULL); + if (openair0_cfg->duplex_mode == duplex_mode_FDD && openair0_cfg->nr_flag == 0) + rxParams.RxEUtraFDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 1, NULL); + else if (openair0_cfg->duplex_mode == duplex_mode_FDD && openair0_cfg->nr_flag == 1) + rxParams.RxNRFDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 1, NULL); + else if (openair0_cfg->duplex_mode == duplex_mode_TDD && openair0_cfg->nr_flag == 0) + rxParams.RxEUtraTDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 1, NULL); + else if (openair0_cfg->duplex_mode == duplex_mode_TDD && openair0_cfg->nr_flag == 1) + rxParams.RxNRTDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 1, NULL); - result = ORI_ObjectCreation(ori, rxTypeRef, rxParams1, rxParamList, num_rxparams, rxParamResult, &rx1, &RE_result); + result = ORI_ObjectCreation(ori, rxTypeRef, rxParams, rxParamList, num_rxparams, rxParamResult, &rx1, &RE_result); if(result != ORI_Result_SUCCESS) { - printf("ORI_ObjectCreation (rxParams1.RxEUtraFDD/TDD) failed with error: %s\n", ORI_Result_Print(result)); + printf("ORI_ObjectCreation (rxParams1.RxEUtra/NR/FDD/TDD) failed with error: %s\n", ORI_Result_Print(result)); aw2s_oricleanup(device); return -1; } - printf("ORI_ObjectCreation (rxParams1.RxEUtraFDD/TDD): %s\n", ORI_Result_Print(RE_result)); + printf("ORI_ObjectCreation (rxParams1.RxEUtra/NR/FDD/TDD): %s\n", ORI_Result_Print(RE_result)); } + if (openair0_cfg->rx_num_channels > 2) { + /* Create rx2 */ + ORI_Object_s * rx2; + if (openair0_cfg->duplex_mode == duplex_mode_FDD && openair0_cfg->nr_flag == 0) + rxParams.RxEUtraFDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 2, NULL); + else if (openair0_cfg->duplex_mode == duplex_mode_FDD && openair0_cfg->nr_flag == 1) + rxParams.RxNRFDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 2, NULL); + else if (openair0_cfg->duplex_mode == duplex_mode_TDD && openair0_cfg->nr_flag == 0) + rxParams.RxEUtraTDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 2, NULL); + else if (openair0_cfg->duplex_mode == duplex_mode_TDD && openair0_cfg->nr_flag == 1) + rxParams.RxNRTDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 2, NULL); + + result = ORI_ObjectCreation(ori, rxTypeRef, rxParams, rxParamList, num_rxparams, rxParamResult, &rx2, &RE_result); + + + if(result != ORI_Result_SUCCESS) + { + printf("ORI_ObjectCreation (rxParams1.RxEUtra/NR/FDD/TDD) failed with error: %s\n", ORI_Result_Print(result)); + aw2s_oricleanup(device); + return -1; + } + printf("ORI_ObjectCreation (rxParams1.RxEUtra/NR/FDD/TDD): %s\n", ORI_Result_Print(RE_result)); + } + if (openair0_cfg->rx_num_channels > 3) { + /* Create rx3 */ + ORI_Object_s * rx3; + if (openair0_cfg->duplex_mode == duplex_mode_FDD && openair0_cfg->nr_flag == 0) + rxParams.RxEUtraFDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 3, NULL); + else if (openair0_cfg->duplex_mode == duplex_mode_FDD && openair0_cfg->nr_flag == 1) + rxParams.RxNRFDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 3, NULL); + else if (openair0_cfg->duplex_mode == duplex_mode_TDD && openair0_cfg->nr_flag == 0) + rxParams.RxEUtraTDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 3, NULL); + else if (openair0_cfg->duplex_mode == duplex_mode_TDD && openair0_cfg->nr_flag == 1) + rxParams.RxNRTDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 3, NULL); + + result = ORI_ObjectCreation(ori, rxTypeRef, rxParams, rxParamList, num_rxparams, rxParamResult, &rx3, &RE_result); + + + if(result != ORI_Result_SUCCESS) + { + printf("ORI_ObjectCreation (rxParams1.RxEUtra/NR/FDD/TDD) failed with error: %s\n", ORI_Result_Print(result)); + aw2s_oricleanup(device); + return -1; + } + printf("ORI_ObjectCreation (rxParams1.RxEUtra/NR/FDD/TDD): %s\n", ORI_Result_Print(RE_result)); + } /* Create link */ ORI_ObjectParams_u linkParams; diff --git a/targets/ARCH/COMMON/common_lib.h b/targets/ARCH/COMMON/common_lib.h index 0c71a9999a..5c6ff2c669 100644 --- a/targets/ARCH/COMMON/common_lib.h +++ b/targets/ARCH/COMMON/common_lib.h @@ -237,6 +237,12 @@ typedef struct { double tx_sample_rate; //! check for threequarter sampling rate int8_t threequarter_fs; + //! Flag to indicate this configuration is for NR + int nr_flag; + //! NR band number + int nr_band; + //! NR scs for raster + int nr_scs_for_raster; } openair0_config_t; /*! \brief RF mapping */ From 4756c5a167391b019341b97b5dff7484de250eaa Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Sun, 13 Feb 2022 22:15:48 +0100 Subject: [PATCH 022/114] added configurable "sf_ahead" for NR/LTE in RU section. Tested in NR with sf_ahead=2 (normally 3) --- executables/nr-gnb.c | 1 - executables/nr-ru.c | 17 +++++++---------- executables/nr-softmodem.c | 6 +++++- nfapi/oai_integration/nfapi_vnf.c | 8 ++++---- nfapi/open-nFAPI/pnf/src/pnf_p7.c | 3 +-- openair1/PHY/defs_RU.h | 2 ++ openair2/ENB_APP/enb_paramdef.h | 7 +++++-- openair2/LAYER2/NR_MAC_gNB/config.c | 3 +-- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 5 +++-- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 10 ++++------ openair2/NR_PHY_INTERFACE/NR_IF_Module.h | 1 + openair2/PHY_INTERFACE/IF_Module.c | 2 +- targets/RT/USER/lte-enb.c | 14 ++++++-------- targets/RT/USER/lte-ru.c | 18 +++++++++--------- targets/RT/USER/lte-softmodem.c | 1 - 15 files changed, 49 insertions(+), 49 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index 2b1c36407b..da76e07741 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -129,7 +129,6 @@ void rx_func(void *param) { int slot_rx = info->slot_rx; int frame_tx = info->frame_tx; int slot_tx = info->slot_tx; - sl_ahead = sf_ahead*gNB->frame_parms.slots_per_subframe; nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config; start_meas(&softmodem_stats_rxtx_sf); diff --git a/executables/nr-ru.c b/executables/nr-ru.c index e4fc3bc27c..5de1f71efd 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -99,9 +99,6 @@ int attach_rru(RU_t *ru); int connect_rau(RU_t *ru); static void NRRCconfig_RU(void); -uint16_t sf_ahead; -uint16_t slot_ahead; -uint16_t sl_ahead; extern int emulate_rf; extern int numerology; @@ -372,8 +369,8 @@ void fh_if4p5_south_in(RU_t *ru, proc->frame_rx = f; proc->timestamp_rx = (proc->frame_rx * fp->samples_per_subframe * 10) + fp->get_samples_slot_timestamp(proc->tti_rx, fp, 0); // proc->timestamp_tx = proc->timestamp_rx + (4*fp->samples_per_subframe); - proc->tti_tx = (sl+(fp->slots_per_subframe*sf_ahead))%fp->slots_per_frame; - proc->frame_tx = (sl>(fp->slots_per_frame-1-(fp->slots_per_subframe*sf_ahead))) ? (f+1)&1023 : f; + proc->tti_tx = (sl+(fp->slots_per_subframe*ru->sf_ahead))%fp->slots_per_frame; + proc->frame_tx = (sl>(fp->slots_per_frame-1-(fp->slots_per_subframe*ru->sf_ahead))) ? (f+1)&1023 : f; if (proc->first_rx == 0) { if (proc->tti_rx != *slot) { @@ -1293,8 +1290,7 @@ void *ru_thread( void *param ) { } } - sf_ahead = (uint16_t) ceil((float)6/(0x01<numerology_index)); - LOG_I(PHY, "Signaling main thread that RU %d is ready, sf_ahead %d\n",ru->idx,sf_ahead); + LOG_I(PHY, "Signaling main thread that RU %d is ready, sf_ahead %d\n",ru->idx,ru->sf_ahead); pthread_mutex_lock(&RC.ru_mutex); RC.ru_mask &= ~(1<idx); pthread_cond_signal(&RC.ru_cond); @@ -1380,9 +1376,9 @@ void *ru_thread( void *param ) { opp_enabled = opp_enabled0; } if (initial_wait == 0 && ru->rx_fhaul.trials > 1000) reset_meas(&ru->rx_fhaul); - proc->timestamp_tx = proc->timestamp_rx + (sf_ahead*fp->samples_per_subframe); - proc->frame_tx = (proc->tti_rx > (fp->slots_per_frame-1-(fp->slots_per_subframe*sf_ahead))) ? (proc->frame_rx+1)&1023 : proc->frame_rx; - proc->tti_tx = (proc->tti_rx + (fp->slots_per_subframe*sf_ahead))%fp->slots_per_frame; + proc->timestamp_tx = proc->timestamp_rx + (ru->sf_ahead*fp->samples_per_subframe); + proc->frame_tx = (proc->tti_rx > (fp->slots_per_frame-1-(fp->slots_per_subframe*ru->sf_ahead))) ? (proc->frame_rx+1)&1023 : proc->frame_rx; + proc->tti_tx = (proc->tti_rx + (fp->slots_per_subframe*ru->sf_ahead))%fp->slots_per_frame; LOG_D(PHY,"AFTER fh_south_in - SFN/SL:%d%d RU->proc[RX:%d.%d TX:%d.%d] RC.gNB[0]:[RX:%d%d TX(SFN):%d]\n", frame,slot, proc->frame_rx,proc->tti_rx, @@ -2126,6 +2122,7 @@ static void NRRCconfig_RU(void) { RC.ru[j]->if_frequency = *(RUParamList.paramarray[j][RU_IF_FREQUENCY].u64ptr); RC.ru[j]->if_freq_offset = *(RUParamList.paramarray[j][RU_IF_FREQ_OFFSET].iptr); RC.ru[j]->do_precoding = *(RUParamList.paramarray[j][RU_DO_PRECODING].iptr); + RC.ru[j]->sf_ahead = *(RUParamList.paramarray[j][RU_SF_AHEAD].iptr); RC.ru[j]->num_bands = RUParamList.paramarray[j][RU_BAND_LIST_IDX].numelt; for (i=0; inum_bands; i++) RC.ru[j]->band[i] = RUParamList.paramarray[j][RU_BAND_LIST_IDX].iptr[i]; RC.ru[j]->openair0_cfg.nr_flag = *(RUParamList.paramarray[j][RU_NR_FLAG].iptr); diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 5f57919645..6d59137f80 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -764,7 +764,7 @@ int main( int argc, char **argv ) { printf("wait_gNBs()\n"); wait_gNBs(); printf("About to Init RU threads RC.nb_RU:%d\n", RC.nb_RU); - + int sl_ahead=6; if (RC.nb_RU >0) { printf("Initializing RU threads\n"); init_NR_RU(get_softmodem_params()->rf_config_file); @@ -772,7 +772,10 @@ int main( int argc, char **argv ) { for (ru_id=0; ru_idrf_map.card=0; RC.ru[ru_id]->rf_map.chain=CC_id+chain_offset; + if (ru_id==0) sl_ahead = RC.ru[ru_id]->sf_ahead * RC.gNB[0]->frame_parms.slots_per_subframe; + else AssertFatal(RC.ru[ru_id]->sf_ahead != RC.ru[0]->sf_ahead,"RU %d has different sf_ahead %d than RU 0 %d\n",RC.ru[ru_id]->sf_ahead,RC.ru[0]->sf_ahead); } + } config_sync_var=0; @@ -789,6 +792,7 @@ int main( int argc, char **argv ) { // once all RUs are ready initialize the rest of the gNBs ((dependence on final RU parameters after configuration) printf("ALL RUs ready - init gNBs\n"); + for (int idx=0;idxif_inst->sl_ahead = sl_ahead; if(IS_SOFTMODEM_DOSCOPE) { sleep(1); scopeParms_t p; diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index 44ee05940f..87fd3c8e19 100644 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -200,7 +200,6 @@ void install_nr_schedule_handlers(NR_IF_Module_t *if_inst); void install_schedule_handlers(IF_Module_t *if_inst); extern int single_thread_flag; extern uint16_t sf_ahead; -extern uint16_t slot_ahead; void oai_create_enb(void) { int bodge_counter=0; @@ -459,6 +458,7 @@ int wake_gNB_rxtx(PHY_VARS_gNB *gNB, uint16_t sfn, uint16_t slot) { //wait.tv_nsec = 0; // wake up TX for subframe n+sf_ahead // lock the TX mutex and make sure the thread is ready + AssertFatal(gNB->if_inst->sl_ahead==6,"gNB->if_inst->sl_ahead %d : This is hard-coded to 6 in nfapi P7!!!\n",gNB->if_inst->sl_ahead); if (pthread_mutex_timedlock(&L1_proc->mutex,&wait) != 0) { LOG_E( PHY, "[gNB] ERROR pthread_mutex_lock for gNB RXTX thread %d (IC %d)\n", L1_proc->slot_rx&1,L1_proc->instance_cnt ); exit_fun( "error locking mutex_rxtx" ); @@ -485,11 +485,11 @@ int wake_gNB_rxtx(PHY_VARS_gNB *gNB, uint16_t sfn, uint16_t slot) { // The last (TS_rx mod samples_per_frame) was n*samples_per_tti, // we want to generate subframe (n+N), so TS_tx = TX_rx+N*samples_per_tti, // and proc->subframe_tx = proc->subframe_rx+sf_ahead - L1_proc->timestamp_tx = proc->timestamp_rx + (slot_ahead *fp->samples_per_subframe); + L1_proc->timestamp_tx = proc->timestamp_rx + (gNB->if_inst->sl_ahead *fp->samples_per_subframe); L1_proc->frame_rx = proc->frame_rx; L1_proc->slot_rx = proc->slot_rx; - L1_proc->frame_tx = (L1_proc->slot_rx > (19-slot_ahead)) ? (L1_proc->frame_rx+1)&1023 : L1_proc->frame_rx; - L1_proc->slot_tx = (L1_proc->slot_rx + slot_ahead)%20; + L1_proc->frame_tx = (L1_proc->slot_rx > (19-gNB->if_inst->sl_ahead)) ? (L1_proc->frame_rx+1)&1023 : L1_proc->frame_rx; + L1_proc->slot_tx = (L1_proc->slot_rx + gNB->if_inst->sl_ahead)%20; //LOG_I(PHY, "sfn/sf:%d%d proc[rx:%d%d] rx:%d%d] About to wake rxtx thread\n\n", sfn, slot, proc->frame_rx, proc->slot_rx, L1_proc->frame_rx, L1_proc->slot_rx); //NFAPI_TRACE(NFAPI_TRACE_INFO, "\nEntering wake_gNB_rxtx sfn %d slot %d\n",L1_proc->frame_rx,L1_proc->slot_rx); diff --git a/nfapi/open-nFAPI/pnf/src/pnf_p7.c b/nfapi/open-nFAPI/pnf/src/pnf_p7.c index fb1a713e56..0ce847a735 100644 --- a/nfapi/open-nFAPI/pnf/src/pnf_p7.c +++ b/nfapi/open-nFAPI/pnf/src/pnf_p7.c @@ -32,7 +32,6 @@ #define FAPI2_IP_DSCP 0 extern uint16_t sf_ahead; -extern uint16_t slot_ahead; //uint16_t sf_ahead=4; @@ -933,7 +932,7 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl // save the curren time, sfn and slot pnf_p7->slot_start_time_hr = pnf_get_current_time_hr(); - slot_ahead = 6; + int slot_ahead = 6; uint32_t sfn_slot_tx = sfnslot_add_slot(sfn, slot, slot_ahead); uint16_t sfn_tx = NFAPI_SFNSLOT2SFN(sfn_slot_tx); uint8_t slot_tx = NFAPI_SFNSLOT2SLOT(sfn_slot_tx); diff --git a/openair1/PHY/defs_RU.h b/openair1/PHY/defs_RU.h index 76dd92ef5d..5dfb0722db 100644 --- a/openair1/PHY/defs_RU.h +++ b/openair1/PHY/defs_RU.h @@ -506,6 +506,8 @@ typedef struct RU_t_s { int att_tx; /// flag to indicate precoding operation in RU int do_precoding; + /// TX processing advance in subframes + int sf_ahead; /// FAPI confiuration nfapi_nr_config_request_scf_t config; /// Frame parameters diff --git a/openair2/ENB_APP/enb_paramdef.h b/openair2/ENB_APP/enb_paramdef.h index 2757e408d9..840e1a8ab2 100644 --- a/openair2/ENB_APP/enb_paramdef.h +++ b/openair2/ENB_APP/enb_paramdef.h @@ -99,6 +99,7 @@ typedef enum { #define CONFIG_STRING_RU_IF_FREQUENCY "if_freq" #define CONFIG_STRING_RU_IF_FREQ_OFFSET "if_offset" #define CONFIG_STRING_RU_DO_PRECODING "do_precoding" +#define CONFIG_STRING_RU_SF_AHEAD "sf_ahead" #define CONFIG_STRING_RU_NR_FLAG "nr_flag" #define CONFIG_STRING_RU_NR_SCS_FOR_RASTER "nr_scs_for_raster" @@ -131,8 +132,9 @@ typedef enum { #define RU_IF_FREQUENCY 26 #define RU_IF_FREQ_OFFSET 27 #define RU_DO_PRECODING 28 -#define RU_NR_FLAG 29 -#define RU_NR_SCS_FOR_RASTER 30 +#define RU_SF_AHEAD 29 +#define RU_NR_FLAG 30 +#define RU_NR_SCS_FOR_RASTER 31 /*-----------------------------------------------------------------------------------------------------------------------------------------*/ /* RU configuration parameters */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ @@ -167,6 +169,7 @@ typedef enum { {CONFIG_STRING_RU_IF_FREQUENCY, NULL, 0, u64ptr:NULL, defuintval:0, TYPE_UINT64, 0}, \ {CONFIG_STRING_RU_IF_FREQ_OFFSET, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ {CONFIG_STRING_RU_DO_PRECODING, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ + {CONFIG_STRING_RU_SF_AHEAD, NULL, 0, iptr:NULL, defintval:4, TYPE_INT, 0}, \ {CONFIG_STRING_RU_NR_FLAG, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ {CONFIG_STRING_RU_NR_SCS_FOR_RASTER, NULL, 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \ } diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index bbec4817bd..92db25178a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -423,7 +423,6 @@ void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts } -extern uint16_t sl_ahead; int rrc_mac_config_req_gNB(module_id_t Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts, @@ -453,7 +452,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, * variable sl_ahead seems to not be correctly initialized, but I leave * it for information purposes here (the fix would always put 0, what * happens now, too) */ - req->SFN = i < sl_ahead; + req->SFN = i < RC.nrmac[Mod_idP]->if_inst->sl_ahead; req->Slot = i; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 0c935eea09..4ddffc5184 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -400,7 +400,7 @@ void nr_schedule_msg2(uint16_t rach_frame, uint16_t rach_slot, uint16_t monitoring_slot_period, uint16_t monitoring_offset,uint8_t beam_index, uint8_t num_active_ssb, - int16_t *tdd_beam_association){ + int16_t *tdd_beam_association, int sl_ahead){ // preferentially we schedule the msg2 in the mixed slot or in the last dl slot // if they are allowed by search space configuration @@ -628,7 +628,8 @@ void nr_initiate_ra_proc(module_id_t module_idP, monitoring_offset, beam_index, cc->num_active_ssb, - nr_mac->tdd_beam_association); + nr_mac->tdd_beam_association, + nr_mac->if_inst->sl_ahead); ra->Msg2_frame = msg2_frame; ra->Msg2_slot = msg2_slot; diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index 57bb411dcc..46394e7c7a 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -57,8 +57,6 @@ extern int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind); extern int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind); extern int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind); extern uint8_t nfapi_mode; -extern uint16_t sf_ahead; -extern uint16_t sl_ahead; void handle_nr_rach(NR_UL_IND_t *UL_info) @@ -472,14 +470,14 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) { nfapi_nr_config_request_scf_t *cfg = &mac->config[CC_id]; int spf = get_spf(cfg); gNB_dlsch_ulsch_scheduler(module_id, - (UL_info->frame+((UL_info->slot>(spf-1-sl_ahead))?1:0)) % 1024, - (UL_info->slot+sl_ahead)%spf); + (UL_info->frame+((UL_info->slot>(spf-1-ifi->sl_ahead))?1:0)) % 1024, + (UL_info->slot+ifi->sl_ahead)%spf); ifi->CC_mask = 0; sched_info->module_id = module_id; sched_info->CC_id = CC_id; - sched_info->frame = (UL_info->frame + ((UL_info->slot>(spf-1-sl_ahead)) ? 1 : 0)) % 1024; - sched_info->slot = (UL_info->slot+sl_ahead)%spf; + sched_info->frame = (UL_info->frame + ((UL_info->slot>(spf-1-ifi->sl_ahead)) ? 1 : 0)) % 1024; + sched_info->slot = (UL_info->slot+ifi->sl_ahead)%spf; sched_info->DL_req = &mac->DL_req[CC_id]; sched_info->UL_dci_req = &mac->UL_dci_req[CC_id]; diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.h b/openair2/NR_PHY_INTERFACE/NR_IF_Module.h index f857151763..9d543b0918 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.h +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.h @@ -115,6 +115,7 @@ typedef struct NR_IF_Module_s { uint16_t current_frame; uint8_t current_slot; pthread_mutex_t if_mutex; + int sl_ahead; } NR_IF_Module_t; /*Initial */ diff --git a/openair2/PHY_INTERFACE/IF_Module.c b/openair2/PHY_INTERFACE/IF_Module.c index fba9e1d8b6..68d390f097 100644 --- a/openair2/PHY_INTERFACE/IF_Module.c +++ b/openair2/PHY_INTERFACE/IF_Module.c @@ -16,7 +16,7 @@ extern int oai_nfapi_cqi_indication(nfapi_cqi_indication_t *cqi_ind); extern int oai_nfapi_sr_indication(nfapi_sr_indication_t *ind); extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind); -extern uint16_t sf_ahead; +int sf_ahead=4; extern UL_RCC_IND_t UL_RCC_INFO; extern RAN_CONTEXT_t RC; diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index 0b6b0b3a75..49f7db2867 100644 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -112,8 +112,6 @@ extern int transmission_mode; extern int oaisim_flag; -//uint16_t sf_ahead=4; -extern uint16_t sf_ahead; #include "executables/thread-common.h" //extern PARALLEL_CONF_t get_thread_parallel_conf(void); //extern WORKER_CONF_t get_thread_worker_conf(void); @@ -466,11 +464,11 @@ void eNB_top(PHY_VARS_eNB *eNB, if (!oai_exit) { T(T_ENB_MASTER_TICK, T_INT(0), T_INT(ru_proc->frame_rx), T_INT(ru_proc->tti_rx)); - L1_proc->timestamp_tx = ru_proc->timestamp_rx + (sf_ahead*fp->samples_per_tti); + L1_proc->timestamp_tx = ru_proc->timestamp_rx + (ru->sf_ahead*fp->samples_per_tti); L1_proc->frame_rx = ru_proc->frame_rx; L1_proc->subframe_rx = ru_proc->tti_rx; - L1_proc->frame_tx = (L1_proc->subframe_rx > (9-sf_ahead)) ? (L1_proc->frame_rx+1)&1023 : L1_proc->frame_rx; - L1_proc->subframe_tx = (L1_proc->subframe_rx + sf_ahead)%10; + L1_proc->frame_tx = (L1_proc->subframe_rx > (9-ru->sf_ahead)) ? (L1_proc->frame_rx+1)&1023 : L1_proc->frame_rx; + L1_proc->subframe_tx = (L1_proc->subframe_rx + ru->sf_ahead)%10; if (rxtx(eNB,L1_proc,string) < 0) LOG_E(PHY,"eNB %d CC_id %d failed during execution\n",eNB->Mod_id,eNB->CC_id); @@ -614,11 +612,11 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB, // The last (TS_rx mod samples_per_frame) was n*samples_per_tti, // we want to generate subframe (n+sf_ahead), so TS_tx = TX_rx+sf_ahead*samples_per_tti, // and proc->subframe_tx = proc->subframe_rx+sf_ahead - L1_proc->timestamp_tx = ru_proc->timestamp_rx + (sf_ahead*fp->samples_per_tti); + L1_proc->timestamp_tx = ru_proc->timestamp_rx + (ru->sf_ahead*fp->samples_per_tti); L1_proc->frame_rx = ru_proc->frame_rx; L1_proc->subframe_rx = ru_proc->tti_rx; - L1_proc->frame_tx = (L1_proc->subframe_rx > (9-sf_ahead)) ? (L1_proc->frame_rx+1)&1023 : L1_proc->frame_rx; - L1_proc->subframe_tx = (L1_proc->subframe_rx + sf_ahead)%10; + L1_proc->frame_tx = (L1_proc->subframe_rx > (9-ru->sf_ahead)) ? (L1_proc->frame_rx+1)&1023 : L1_proc->frame_rx; + L1_proc->subframe_tx = (L1_proc->subframe_rx + ru->sf_ahead)%10; LOG_D(PHY,"wakeup_rxtx: L1_proc->subframe_rx %d, L1_proc->subframe_tx %d, RU %d\n",L1_proc->subframe_rx,L1_proc->subframe_tx,ru->idx); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_WAKEUP_RXTX_RX_RU+ru->idx, L1_proc->frame_rx); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_WAKEUP_RXTX_RX_RU+ru->idx, L1_proc->subframe_rx); diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index 8ad610f1af..014e8854e2 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -109,7 +109,6 @@ const char ru_states[6][9] = {"RU_IDLE","RU_CONFIG","RU_READY","RU_RUN","RU_ERRO extern const char NB_functions[7][20]; extern const char NB_timing[2][20]; -extern uint16_t sf_ahead; extern const char ru_if_types[MAX_RU_IF_TYPES][20]; @@ -254,8 +253,8 @@ void fh_if4p5_south_in(RU_t *ru, // proc->timestamp_tx = proc->timestamp_rx + (4*fp->samples_per_tti); if (get_thread_parallel_conf() == PARALLEL_SINGLE_THREAD) { - proc->tti_tx = (sf+sf_ahead)%10; - proc->frame_tx = (sf>(9-sf_ahead)) ? (f+1)&1023 : f; + proc->tti_tx = (sf+ru->sf_ahead)%10; + proc->frame_tx = (sf>(9-ru->sf_ahead)) ? (f+1)&1023 : f; } LOG_D(PHY,"Setting proc for (%d,%d)\n",sf,f); @@ -654,13 +653,13 @@ void rx_rf(RU_t *ru, if (get_thread_parallel_conf() == PARALLEL_SINGLE_THREAD && ru->fh_north_asynch_in == NULL) { #ifdef PHY_TX_THREAD - proc->timestamp_phy_tx = proc->timestamp_rx+((sf_ahead-1)*fp->samples_per_tti); - proc->subframe_phy_tx = (proc->tti_rx+(sf_ahead-1))%10; - proc->frame_phy_tx = (proc->tti_rx>(9-(sf_ahead-1))) ? (proc->frame_rx+1)&1023 : proc->frame_rx; + proc->timestamp_phy_tx = proc->timestamp_rx+((ru->sf_ahead-1)*fp->samples_per_tti); + proc->subframe_phy_tx = (proc->tti_rx+(ru->sf_ahead-1))%10; + proc->frame_phy_tx = (proc->tti_rx>(9-(ru->sf_ahead-1))) ? (proc->frame_rx+1)&1023 : proc->frame_rx; #else - proc->timestamp_tx = proc->timestamp_rx+(sf_ahead*fp->samples_per_tti); - proc->tti_tx = (proc->tti_rx+sf_ahead)%10; - proc->frame_tx = (proc->tti_rx>(9-sf_ahead)) ? (proc->frame_rx+1)&1023 : proc->frame_rx; + proc->timestamp_tx = proc->timestamp_rx+(ru->sf_ahead*fp->samples_per_tti); + proc->tti_tx = (proc->tti_rx+ru->sf_ahead)%10; + proc->frame_tx = (proc->tti_rx>(9-ru->sf_ahead)) ? (proc->frame_rx+1)&1023 : proc->frame_rx; #endif //proc->timestamp_tx = proc->timestamp_rx+(sf_ahead*fp->samples_per_tti); //proc->subframe_tx = (proc->tti_rx+sf_ahead)%10; @@ -3072,6 +3071,7 @@ RU_t **RCconfig_RU(int nb_RU,int nb_L1_inst,PHY_VARS_eNB ***eNB,uint64_t *ru_mas ru[j]->nb_rx = *(RUParamList.paramarray[j][RU_NB_RX_IDX].uptr); ru[j]->att_tx = *(RUParamList.paramarray[j][RU_ATT_TX_IDX].uptr); ru[j]->att_rx = *(RUParamList.paramarray[j][RU_ATT_RX_IDX].uptr); + ru[j]->sf_ahead = *(RUParamList.paramarray[j][RU_SF_AHEAD_IDX].uptr); *ru_mask= (*ru_mask)|(1< Date: Sat, 19 Feb 2022 13:07:20 +0100 Subject: [PATCH 023/114] changes for 2.5ms TDD period --- executables/nr-ru.c | 17 ++++++---- executables/nr-softmodem.c | 4 +-- openair1/PHY/defs_RU.h | 4 ++- openair2/ENB_APP/enb_paramdef.h | 7 ++-- openair2/GNB_APP/MACRLC_nr_paramdef.h | 8 ++++- openair2/GNB_APP/gnb_config.c | 2 ++ openair2/LAYER2/NR_MAC_gNB/config.c | 4 +-- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 20 +++++++---- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 16 ++++++++- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 33 +++++++++++-------- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 2 ++ openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 17 +++++++--- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 9 +++-- openair2/RRC/NR/MESSAGES/asn1_msg.c | 8 +---- openair2/RRC/NR/nr_rrc_config.c | 23 +++++++++++-- 15 files changed, 122 insertions(+), 52 deletions(-) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 5de1f71efd..2f74c3524b 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -369,8 +369,8 @@ void fh_if4p5_south_in(RU_t *ru, proc->frame_rx = f; proc->timestamp_rx = (proc->frame_rx * fp->samples_per_subframe * 10) + fp->get_samples_slot_timestamp(proc->tti_rx, fp, 0); // proc->timestamp_tx = proc->timestamp_rx + (4*fp->samples_per_subframe); - proc->tti_tx = (sl+(fp->slots_per_subframe*ru->sf_ahead))%fp->slots_per_frame; - proc->frame_tx = (sl>(fp->slots_per_frame-1-(fp->slots_per_subframe*ru->sf_ahead))) ? (f+1)&1023 : f; + proc->tti_tx = (sl+ru->sl_ahead)%fp->slots_per_frame; + proc->frame_tx = (sl>(fp->slots_per_frame-1-(ru->sl_ahead))) ? (f+1)&1023 : f; if (proc->first_rx == 0) { if (proc->tti_rx != *slot) { @@ -1290,7 +1290,7 @@ void *ru_thread( void *param ) { } } - LOG_I(PHY, "Signaling main thread that RU %d is ready, sf_ahead %d\n",ru->idx,ru->sf_ahead); + LOG_I(PHY, "Signaling main thread that RU %d is ready, sl_ahead %d\n",ru->idx,ru->sl_ahead); pthread_mutex_lock(&RC.ru_mutex); RC.ru_mask &= ~(1<idx); pthread_cond_signal(&RC.ru_cond); @@ -1376,9 +1376,12 @@ void *ru_thread( void *param ) { opp_enabled = opp_enabled0; } if (initial_wait == 0 && ru->rx_fhaul.trials > 1000) reset_meas(&ru->rx_fhaul); - proc->timestamp_tx = proc->timestamp_rx + (ru->sf_ahead*fp->samples_per_subframe); - proc->frame_tx = (proc->tti_rx > (fp->slots_per_frame-1-(fp->slots_per_subframe*ru->sf_ahead))) ? (proc->frame_rx+1)&1023 : proc->frame_rx; - proc->tti_tx = (proc->tti_rx + (fp->slots_per_subframe*ru->sf_ahead))%fp->slots_per_frame; + proc->timestamp_tx = proc->timestamp_rx; + int sl=proc->tti_tx; + for (int slidx=0;slidxsl_ahead;slidx++) + proc->timestamp_tx += fp->get_samples_per_slot((sl+slidx)%fp->slots_per_frame,fp); + proc->frame_tx = (proc->tti_rx > (fp->slots_per_frame-1-(ru->sl_ahead))) ? (proc->frame_rx+1)&1023 : proc->frame_rx; + proc->tti_tx = (proc->tti_rx + ru->sl_ahead)%fp->slots_per_frame; LOG_D(PHY,"AFTER fh_south_in - SFN/SL:%d%d RU->proc[RX:%d.%d TX:%d.%d] RC.gNB[0]:[RX:%d%d TX(SFN):%d]\n", frame,slot, proc->frame_rx,proc->tti_rx, @@ -2122,7 +2125,7 @@ static void NRRCconfig_RU(void) { RC.ru[j]->if_frequency = *(RUParamList.paramarray[j][RU_IF_FREQUENCY].u64ptr); RC.ru[j]->if_freq_offset = *(RUParamList.paramarray[j][RU_IF_FREQ_OFFSET].iptr); RC.ru[j]->do_precoding = *(RUParamList.paramarray[j][RU_DO_PRECODING].iptr); - RC.ru[j]->sf_ahead = *(RUParamList.paramarray[j][RU_SF_AHEAD].iptr); + RC.ru[j]->sl_ahead = *(RUParamList.paramarray[j][RU_SL_AHEAD].iptr); RC.ru[j]->num_bands = RUParamList.paramarray[j][RU_BAND_LIST_IDX].numelt; for (i=0; inum_bands; i++) RC.ru[j]->band[i] = RUParamList.paramarray[j][RU_BAND_LIST_IDX].iptr[i]; RC.ru[j]->openair0_cfg.nr_flag = *(RUParamList.paramarray[j][RU_NR_FLAG].iptr); diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 6d59137f80..dc7b8bf8e3 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -772,8 +772,8 @@ int main( int argc, char **argv ) { for (ru_id=0; ru_idrf_map.card=0; RC.ru[ru_id]->rf_map.chain=CC_id+chain_offset; - if (ru_id==0) sl_ahead = RC.ru[ru_id]->sf_ahead * RC.gNB[0]->frame_parms.slots_per_subframe; - else AssertFatal(RC.ru[ru_id]->sf_ahead != RC.ru[0]->sf_ahead,"RU %d has different sf_ahead %d than RU 0 %d\n",RC.ru[ru_id]->sf_ahead,RC.ru[0]->sf_ahead); + if (ru_id==0) sl_ahead = RC.ru[ru_id]->sl_ahead; + else AssertFatal(RC.ru[ru_id]->sl_ahead != RC.ru[0]->sl_ahead,"RU %d has different sl_ahead %d than RU 0 %d\n",RC.ru[ru_id]->sl_ahead,RC.ru[0]->sl_ahead); } } diff --git a/openair1/PHY/defs_RU.h b/openair1/PHY/defs_RU.h index 5dfb0722db..e70bb811b7 100644 --- a/openair1/PHY/defs_RU.h +++ b/openair1/PHY/defs_RU.h @@ -506,8 +506,10 @@ typedef struct RU_t_s { int att_tx; /// flag to indicate precoding operation in RU int do_precoding; - /// TX processing advance in subframes + /// TX processing advance in subframes (for LTE) int sf_ahead; + /// TX processing advance in slots (for NR) + int sl_ahead; /// FAPI confiuration nfapi_nr_config_request_scf_t config; /// Frame parameters diff --git a/openair2/ENB_APP/enb_paramdef.h b/openair2/ENB_APP/enb_paramdef.h index 840e1a8ab2..a533b8cb23 100644 --- a/openair2/ENB_APP/enb_paramdef.h +++ b/openair2/ENB_APP/enb_paramdef.h @@ -100,6 +100,7 @@ typedef enum { #define CONFIG_STRING_RU_IF_FREQ_OFFSET "if_offset" #define CONFIG_STRING_RU_DO_PRECODING "do_precoding" #define CONFIG_STRING_RU_SF_AHEAD "sf_ahead" +#define CONFIG_STRING_RU_SL_AHEAD "sl_ahead" #define CONFIG_STRING_RU_NR_FLAG "nr_flag" #define CONFIG_STRING_RU_NR_SCS_FOR_RASTER "nr_scs_for_raster" @@ -133,8 +134,9 @@ typedef enum { #define RU_IF_FREQ_OFFSET 27 #define RU_DO_PRECODING 28 #define RU_SF_AHEAD 29 -#define RU_NR_FLAG 30 -#define RU_NR_SCS_FOR_RASTER 31 +#define RU_SL_AHEAD 30 +#define RU_NR_FLAG 31 +#define RU_NR_SCS_FOR_RASTER 32 /*-----------------------------------------------------------------------------------------------------------------------------------------*/ /* RU configuration parameters */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ @@ -170,6 +172,7 @@ typedef enum { {CONFIG_STRING_RU_IF_FREQ_OFFSET, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ {CONFIG_STRING_RU_DO_PRECODING, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ {CONFIG_STRING_RU_SF_AHEAD, NULL, 0, iptr:NULL, defintval:4, TYPE_INT, 0}, \ + {CONFIG_STRING_RU_SL_AHEAD, NULL, 0, iptr:NULL, defintval:4, TYPE_INT, 0}, \ {CONFIG_STRING_RU_NR_FLAG, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ {CONFIG_STRING_RU_NR_SCS_FOR_RASTER, NULL, 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \ } diff --git a/openair2/GNB_APP/MACRLC_nr_paramdef.h b/openair2/GNB_APP/MACRLC_nr_paramdef.h index 436271fc0b..e634f077e2 100644 --- a/openair2/GNB_APP/MACRLC_nr_paramdef.h +++ b/openair2/GNB_APP/MACRLC_nr_paramdef.h @@ -65,6 +65,8 @@ #define CONFIG_STRING_MACRLC_DL_RD2_BLER_THRESHOLD "dl_rd2_bler_threshold" #define CONFIG_STRING_MACRLC_DL_MAX_MCS "dl_max_mcs" #define CONFIG_STRING_MACRLC_HARQ_ROUND_MAX "harq_round_max" +#define CONFIG_STRING_MACRLC_MIN_GRANT_PRB "min_grant_prb" +#define CONFIG_STRING_MACRLC_MIN_GRANT_MCS "min_grant_mcs" /*-------------------------------------------------------------------------------------------------------------------------------------------------------*/ /* MacRLC configuration parameters */ @@ -97,7 +99,9 @@ {CONFIG_STRING_MACRLC_DL_BLER_TARGET_LOWER, "Lower threshold of BLER to increase DL MCS", 0, dblptr:NULL, defdblval:0.05, TYPE_DOUBLE, 0}, \ {CONFIG_STRING_MACRLC_DL_RD2_BLER_THRESHOLD, "Threshold of RD2/RETX2 BLER to decrease DL MCS", 0, dblptr:NULL, defdblval:0.01, TYPE_DOUBLE, 0}, \ {CONFIG_STRING_MACRLC_DL_MAX_MCS, "Maximum DL MCS that should be used", 0, u8ptr:NULL, defintval:28, TYPE_UINT8, 0}, \ -{CONFIG_STRING_MACRLC_HARQ_ROUND_MAX, "Maximum number of HARQ rounds", 0, u8ptr:NULL, defintval:4, TYPE_UINT8, 0} \ +{CONFIG_STRING_MACRLC_HARQ_ROUND_MAX, "Maximum number of HARQ rounds", 0, u8ptr:NULL, defintval:4, TYPE_UINT8, 0}, \ +{CONFIG_STRING_MACRLC_MIN_GRANT_PRB, "Minimal Periodic ULSCH Grant PRBs", 0, u8ptr:NULL, defintval:5, TYPE_UINT8, 0}, \ +{CONFIG_STRING_MACRLC_MIN_GRANT_MCS, "Minimal Periodic ULSCH Grant MCS", 0, u8ptr:NULL, defintval:9, TYPE_UINT8, 0} \ } #define MACRLC_CC_IDX 0 #define MACRLC_TRANSPORT_N_PREFERENCE_IDX 1 @@ -126,5 +130,7 @@ #define MACRLC_DL_RD2_BLER_THRESHOLD_IDX 24 #define MACRLC_DL_MAX_MCS_IDX 25 #define MACRLC_HARQ_ROUND_MAX_IDX 26 +#define MACRLC_MIN_GRANT_PRB_IDX 27 +#define MACRLC_MIN_GRANT_MCS_IDX 28 /*---------------------------------------------------------------------------------------------------------------------------------------------------------*/ #endif diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 72237bf6c9..b088cf7ed1 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -811,6 +811,8 @@ void RCconfig_nr_macrlc() { RC.nrmac[j]->dl_rd2_bler_threshold = *(MacRLC_ParamList.paramarray[j][MACRLC_DL_RD2_BLER_THRESHOLD_IDX].dblptr); RC.nrmac[j]->dl_max_mcs = *(MacRLC_ParamList.paramarray[j][MACRLC_DL_MAX_MCS_IDX].u8ptr); RC.nrmac[j]->harq_round_max = *(MacRLC_ParamList.paramarray[j][MACRLC_HARQ_ROUND_MAX_IDX].u8ptr); + 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]->num_ulprbbl = num_prbbl; memcpy(RC.nrmac[j]->ulprbbl,prbbl,275*sizeof(prbbl[0])); }// for (j=0;jnrofDownlinkSlots + (tdd->nrofUplinkSymbols == 0); for (int slot = 0; slot < n; ++slot) { - /* FIXME: it seems there is a problem with slot 0/10/slots right after UL: - * we just get retransmissions. Thus, do not schedule such slots in DL */ - if (slot % nr_slots_period != 0) + if (slot != 0) RC.nrmac[Mod_idP]->dlsch_slot_bitmap[slot / 64] |= (uint64_t)((slot % nr_slots_period) < nr_dlmix_slots) << (slot % 64); RC.nrmac[Mod_idP]->ulsch_slot_bitmap[slot / 64] |= (uint64_t)((slot % nr_slots_period) >= nr_ulstart_slot) << (slot % 64); LOG_D(NR_MAC, "slot %d DL %d UL %d\n", diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 4ddffc5184..c5ec5e04e8 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -916,16 +916,23 @@ void nr_get_Msg3alloc(module_id_t module_id, int nb_slots_per_period = ((1<list.count; i++) { k2 = *pusch_TimeDomainAllocationList->list.array[i]->k2; - // we want to transmit in the uplink symbols of mixed slot + int start_symbol_index,nr_of_symbols; + SLIV2SL(pusch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength, &start_symbol_index, &nr_of_symbols); + LOG_I(NR_MAC,"Checking Msg3 TDA %d : k2 %d, sliv %d,S %d L %d\n",i,(int)k2,(int)pusch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength,start_symbol_index,nr_of_symbols); + // we want to transmit in the uplink symbols of mixed slot AND assuming Msg2 was in the mixed slot if ((k2 + DELTA[mu])%nb_slots_per_period == 0) { temp_slot = current_slot + k2 + DELTA[mu]; // msg3 slot according to 8.3 in 38.213 ra->Msg3_slot = temp_slot%nr_slots_per_frame[mu]; - if (is_xlsch_in_slot(RC.nrmac[module_id]->ulsch_slot_bitmap[ra->Msg3_slot / 64], ra->Msg3_slot)) { + + if (is_xlsch_in_slot(RC.nrmac[module_id]->ulsch_slot_bitmap[ra->Msg3_slot / 64], ra->Msg3_slot) && + nr_of_symbols<=scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols&& + start_symbol_index>=(14-scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols)) { ra->Msg3_tda_id = i; break; } } } + AssertFatal(ra->Msg3_tda_id < 16, "Couldn't find an appropriate TD allocation for Msg3\n"); } else { ra->Msg3_tda_id = 0; @@ -953,7 +960,7 @@ void nr_get_Msg3alloc(module_id_t module_id, tdd_beam_association[num_tdd_period] = ra->beam_id; } - LOG_D(NR_MAC, "[RAPROC] Msg3 slot %d: current slot %u Msg3 frame %u k2 %u Msg3_tda_id %u\n", ra->Msg3_slot, current_slot, ra->Msg3_frame, k2,ra->Msg3_tda_id); + LOG_I(NR_MAC, "[RAPROC] Msg3 slot %d: current slot %u Msg3 frame %u k2 %u Msg3_tda_id %u\n", ra->Msg3_slot, current_slot, ra->Msg3_frame, k2,ra->Msg3_tda_id); uint16_t *vrb_map_UL = &RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[ra->Msg3_slot * MAX_BWP_SIZE]; @@ -1021,7 +1028,7 @@ void fill_msg3_pusch_pdu(nfapi_nr_pusch_pdu_t *pusch_pdu, pusch_pdu->data_scrambling_id = *scc->physCellId; pusch_pdu->nrOfLayers = 1; pusch_pdu->ul_dmrs_symb_pos = get_l_prime(nr_of_symbols,mappingtype,pusch_dmrs_pos2,pusch_len1,start_symbol_index, scc->dmrs_TypeA_Position); - LOG_D(MAC, "MSG3 start_sym:%d NR Symb:%d mappingtype:%d , ul_dmrs_symb_pos:%x\n", start_symbol_index, nr_of_symbols, mappingtype, pusch_pdu->ul_dmrs_symb_pos); + LOG_I(MAC, "MSG3 mcs %d, nb_rb %d, first_rb %d, start_sym:%d NR Symb:%d mappingtype:%d , ul_dmrs_symb_pos:%x\n", pusch_pdu->mcs_index,msg3_nb_rb,msg3_first_rb, start_symbol_index, nr_of_symbols, mappingtype, pusch_pdu->ul_dmrs_symb_pos); pusch_pdu->dmrs_config_type = 0; pusch_pdu->ul_dmrs_scrambling_id = *scc->physCellId; //If provided and the PUSCH is not a msg3 PUSCH, otherwise, L2 should set this to physical cell id. pusch_pdu->scid = 0; //DMRS sequence initialization [TS38.211, sec 6.4.1.1.1]. Should match what is sent in DCI 0_1, otherwise set to 0. @@ -1115,7 +1122,7 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t fh = ubwp->bwp_Dedicated->pusch_Config->choice.setup->frequencyHopping ? 1 : 0; } - LOG_D(NR_MAC, "Frame %d, Slot %d Adding Msg3 UL Config Request for (%d,%d) : (%d,%d,%d) for rnti: %d\n", + LOG_I(NR_MAC, "Frame %d, Slot %d Adding Msg3 UL Config Request for (%d,%d) : (%d,%d,%d) for rnti: %d\n", frameP, slotP, ra->Msg3_frame, @@ -1404,8 +1411,9 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra nr_add_msg3(module_idP, CC_id, frameP, slotP, ra, (uint8_t *) &tx_req->TLVs[0].value.direct[0]); if(ra->cfra) { - LOG_I(NR_MAC, "Frame %d, Subframe %d: Setting RA-Msg3 reception for Frame %d Subframe %d\n", frameP, slotP, ra->Msg3_frame, ra->Msg3_slot); + LOG_I(NR_MAC, "Frame %d, Subframe %d: Setting RA-Msg3 reception (CFRA) for SFN.Slot %d.%d\n", frameP, slotP, ra->Msg3_frame, ra->Msg3_slot); } + else LOG_I(NR_MAC, "Frame %d, Subframe %d: Setting RA-Msg3 reception (CBRA) for SFN.Slot %d.%d\n", frameP, slotP, ra->Msg3_frame, ra->Msg3_slot); T(T_GNB_MAC_DL_RAR_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), T_INT(ra->RA_rnti), T_INT(frameP), T_INT(slotP), T_INT(0), T_BUFFER(&tx_req->TLVs[0].value.direct[0], tx_req->TLVs[0].length)); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 689f621b86..a48a59b67b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -979,7 +979,6 @@ void nr_schedule_ue_spec(module_id_t module_id, gNB_MAC_INST *gNB_mac = RC.nrmac[module_id]; if (!is_xlsch_in_slot(gNB_mac->dlsch_slot_bitmap[slot / 64], slot)) return; - /* PREPROCESSOR */ gNB_mac->pre_processor_dl(module_id, frame, slot); @@ -1351,6 +1350,21 @@ void nr_schedule_ue_spec(module_id_t module_id, size); if (len == 0) break; + struct timespec time_request; + clock_gettime(CLOCK_REALTIME, &time_request); + if (lcid>=4) + LOG_D(NR_MAC, + "%4d.%2d [UE %04x]: Time %lu.%lu: %d bytes %s %d -> DLSCH (ndata %lu, remaining size %lu)\n", + frame, + slot, + rnti, + time_request.tv_sec, + time_request.tv_nsec, + len, + lcid < 4 ? "DCCH" : "DTCH", + lcid, + (unsigned long)ndata, + (unsigned long)size); header->R = 0; header->F = 1; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index e54e1f203a..eb51f1ca26 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -463,12 +463,14 @@ int nr_process_mac_pdu(module_id_t module_idP, mac_sdu_len = (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; mac_subheader_len = 2; } - - LOG_D(NR_MAC, "In %s: [UE %d] %d.%d : ULSCH -> UL-%s %d (gNB %d, %d bytes)\n", - __func__, - module_idP, + struct timespec time_request; + clock_gettime(CLOCK_REALTIME, &time_request); + LOG_D(NR_MAC, "[UE %x] %d.%d : Time %lu.%lu ULSCH -> UL-%s %d (gNB %d, %d bytes)\n", + UE_info->rnti[UE_id], frameP, slot, + time_request.tv_sec, + time_request.tv_nsec, rx_lcid<4?"DCCH":"DTCH", rx_lcid, module_idP, @@ -711,8 +713,8 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, UE_info->mac_stats[UE_id].ulsch_DTX++; } if (UE_info->UE_sched_ctrl[UE_id].pusch_consecutive_dtx_cnt >= pusch_failure_thres) { - LOG_W(NR_MAC,"Detected UL Failure on PUSCH after %d PUSCH DTX, stopping scheduling\n", - UE_info->UE_sched_ctrl[UE_id].pusch_consecutive_dtx_cnt); + LOG_W(NR_MAC,"%d.%d Detected UL Failure on PUSCH after %d PUSCH DTX, stopping scheduling\n", + frameP,slotP,UE_info->UE_sched_ctrl[UE_id].pusch_consecutive_dtx_cnt); UE_info->UE_sched_ctrl[UE_id].ul_failure = 1; nr_mac_gNB_rrc_ul_failure(gnb_mod_idP,CC_idP,frameP,slotP,rntiP); } @@ -909,17 +911,22 @@ bool nr_UE_is_to_be_scheduled(module_id_t mod_id, int CC_id, int UE_id, frame_t const struct gNB_MAC_INST_s *nrmac = RC.nrmac[mod_id]; const NR_UE_sched_ctrl_t *sched_ctrl = &nrmac->UE_info.UE_sched_ctrl[UE_id]; - const int last_ul_sched = sched_ctrl->last_ul_frame * n + sched_ctrl->last_ul_slot; const NR_TDD_UL_DL_Pattern_t *tdd = scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL; int num_slots_per_period; + int last_ul_slot,last_ul_sched; int tdd_period_len[8] = {500,625,1000,1250,2000,2500,5000,10000}; - if (tdd) + if (tdd) { // Force the default transmission in a full slot as early as possible in the UL portion of TDD period (last_ul_slot) num_slots_per_period = n*tdd_period_len[tdd->dl_UL_TransmissionPeriodicity]/10000; - else + last_ul_slot=1+tdd->nrofDownlinkSlots; + } + else { num_slots_per_period = n; + last_ul_slot = sched_ctrl->last_ul_slot; + } + last_ul_sched = sched_ctrl->last_ul_frame * n + last_ul_slot; const int diff = (now - last_ul_sched + 1024 * n) % (1024 * n); /* UE is to be scheduled if * (1) we think the UE has more bytes awaiting than what we scheduled @@ -1111,7 +1118,7 @@ void pf_ul(module_id_t module_id, gNB_MAC_INST *nrmac = RC.nrmac[module_id]; NR_ServingCellConfigCommon_t *scc = nrmac->common_channels[CC_id].ServingCellConfigCommon; NR_UE_info_t *UE_info = &nrmac->UE_info; - const int min_rb = 5; + const int min_rb = nrmac->min_grant_prb; float coeff_ue[MAX_MOBILES_PER_GNB]; // UEs that could be scheduled int ue_array[MAX_MOBILES_PER_GNB]; @@ -1226,7 +1233,7 @@ void pf_ul(module_id_t module_id, || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data) nr_set_pusch_semi_static(scc, sched_ctrl->active_ubwp, ubwpd, dci_format, tda, num_dmrs_cdm_grps_no_data, ps); NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; - sched_pusch->mcs = 9; + sched_pusch->mcs = nrmac->min_grant_mcs; update_ul_ue_R_Qm(sched_pusch, ps); sched_pusch->rbStart = rbStart; sched_pusch->rbSize = min_rb; @@ -1252,7 +1259,7 @@ void pf_ul(module_id_t module_id, add_tail_nr_list(&UE_sched, UE_id); /* Calculate coefficient*/ - sched_pusch->mcs = 9; + sched_pusch->mcs = nrmac->min_grant_mcs; const uint32_t tbs = ul_pf_tbs[ps->mcs_table][sched_pusch->mcs]; coeff_ue[UE_id] = (float) tbs / ul_thr_ue[UE_id]; LOG_D(NR_MAC,"b %d, ul_thr_ue[%d] %f, tbs %d, coeff_ue[%d] %f\n", @@ -1401,7 +1408,7 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t if (tda < 0) return false; int K2 = get_K2(scc, sched_ctrl->active_ubwp, tda, mu); - const int sched_frame = frame + (slot + K2 >= nr_slots_per_frame[mu]); + const int sched_frame = (frame + (slot + K2 >= nr_slots_per_frame[mu]))&1023; const int sched_slot = (slot + K2) % nr_slots_per_frame[mu]; if (!is_xlsch_in_slot(nr_mac->ulsch_slot_bitmap[sched_slot / 64], sched_slot)) diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 417318f8a3..d78fe4e154 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -806,6 +806,8 @@ typedef struct gNB_MAC_INST_s { double dl_rd2_bler_threshold; uint8_t dl_max_mcs; uint8_t harq_round_max; + uint8_t min_grant_prb; + uint8_t min_grant_mcs; } gNB_MAC_INST; #endif /*__LAYER2_NR_MAC_GNB_H__ */ diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index 5129d46ddc..1442a9af72 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -655,6 +655,7 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity, if (entity->has_sdap == 1 && entity->has_sdapULheader == 1) offset = 1; // this is the offset of the SDAP header in bytes + message_p = itti_alloc_new_message_sized(TASK_PDCP_ENB, 0, GTPV1U_GNB_TUNNEL_DATA_REQ, sizeof(gtpv1u_gnb_tunnel_data_req_t) + size @@ -673,7 +674,10 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity, LOG_I(PDCP, "%s() (drb %d) SDAP header %2x\n",__func__, rb_id, buf[0]); sdap_gnb_ul_header_handler(buf[0]); // Handler for the UL gNB SDAP Header } - LOG_D(PDCP, "%s() (drb %d) sending message to gtp size %d\n", __func__, rb_id, size-offset); + struct timespec time_request; + clock_gettime(CLOCK_REALTIME, &time_request); + LOG_D(PDCP, "%s() (drb %d) Time %lu.%lu sending message to gtp size %d\n", __func__, rb_id, time_request.tv_sec,time_request.tv_nsec, + size-offset); itti_send_msg_to_task(TASK_VARIABLE, INSTANCE_DEFAULT, message_p); } } @@ -725,7 +729,7 @@ rb_found: req->offset = GTPU_HEADER_OVERHEAD_MAX; req->rnti = ue->rnti; req->pdusession_id = rb_id; - LOG_D(PDCP, "%s() (drb %d) sending message to gtp size %d\n", + LOG_I(PDCP, "%s() (drb %d) sending message to gtp size %d\n", __func__, rb_id, size); extern instance_t CUuniqInstance; itti_send_msg_to_task(TASK_VARIABLE, CUuniqInstance, message_p); @@ -733,8 +737,9 @@ rb_found: memblock = get_free_mem_block(size, __FUNCTION__); memcpy(memblock->data, buf, size); - - LOG_D(PDCP, "%s(): (srb %d) calling rlc_data_req size %d\n", __func__, rb_id, size); + struct timespec time_request; + clock_gettime(CLOCK_REALTIME, &time_request); + LOG_D(PDCP, "%s(): (rb %d) calling enqueue_rlc_data_req size %d at time %lu.%lu\n", __func__, rb_id, size,time_request.tv_sec,time_request.tv_nsec); //for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)memblock->data[i]); //printf("\n"); enqueue_rlc_data_req(&ctxt, 0, MBMS_FLAG_NO, rb_id, sdu_id, 0, size, memblock); @@ -1342,7 +1347,9 @@ static boolean_t pdcp_data_req_drb( const sdu_size_t sdu_buffer_size, unsigned char *const sdu_buffer) { - LOG_D(PDCP, "%s() called, size %d\n", __func__, sdu_buffer_size); + struct timespec time_request; + clock_gettime(CLOCK_REALTIME, &time_request); + LOG_D(PDCP, "%s() called at time %lu.%lu, size %d\n", __func__, time_request.tv_sec,time_request.tv_nsec,sdu_buffer_size); nr_pdcp_ue_t *ue; nr_pdcp_entity_t *rb; int rnti = ctxt_pP->rnti; diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 78e06d37e2..b9d617d2eb 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -462,9 +462,14 @@ static void deliver_sdu(void *_ue, nr_rlc_entity_t *entity, char *buf, int size) exit(1); rb_found: - LOG_D(RLC, "%s:%d:%s: delivering SDU (rnti %d is_srb %d rb_id %d) size %d\n", - __FILE__, __LINE__, __FUNCTION__, ue->rnti, is_srb, rb_id, size); + if (is_srb==0) { + struct timespec time_request; + clock_gettime(CLOCK_REALTIME, &time_request); + LOG_D(RLC, "%s:%d:%s: delivering SDU Time %lu.%lu (rnti %d is_srb %d rb_id %d) size %d\n", + __FILE__, __LINE__, __FUNCTION__, time_request.tv_sec,time_request.tv_nsec, + ue->rnti, is_srb, rb_id, size); + } /* unused fields? */ ctx.instance = 0; ctx.frame = 0; diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 65f835d3fd..4eb5b06585 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1051,7 +1051,7 @@ void fill_initial_SpCellConfig(rnti_t rnti, NR_PUCCH_Resource_t *pucchres0=calloc(1,sizeof(*pucchres0)); pucchres0->pucch_ResourceId=0; //pucchres0->startingPRB=0; - pucchres0->startingPRB=(8+rnti) % curr_bwp; + pucchres0->startingPRB=(8+rnti) % (curr_bwp/2); LOG_D(NR_RRC, "pucchres0->startPRB %ld rnti %d curr_bwp %d\n", pucchres0->startingPRB, rnti, curr_bwp); pucchres0->intraSlotFrequencyHopping=NULL; pucchres0->secondHopPRB=NULL; @@ -1260,14 +1260,8 @@ void fill_initial_SpCellConfig(rnti_t rnti, schedulingRequestResourceConfig->schedulingRequestID= 0; schedulingRequestResourceConfig->periodicityAndOffset = calloc(1,sizeof(*schedulingRequestResourceConfig->periodicityAndOffset)); schedulingRequestResourceConfig->periodicityAndOffset->present = NR_SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl40; - // note: make sure that there is no issue here. Later choose the RNTI accordingly. - // Here we would be limited to 3 UEs on this resource (1 1/2 Frames 30 kHz SCS, 5 ms TDD periodicity => slots 7,8,9). - // This should be a temporary resource until the first RRCReconfiguration gives new pucch resources. - // Check for above configuration and exit for now if it is not the case AssertFatal(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing==NR_SubcarrierSpacing_kHz30, "SCS != 30kHz\n"); - AssertFatal(scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity==NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms5, - "TDD period != 5ms : %ld\n",scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity); schedulingRequestResourceConfig->periodicityAndOffset->choice.sl40 = 8; schedulingRequestResourceConfig->resource = calloc(1,sizeof(*schedulingRequestResourceConfig->resource)); diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index 6b7f9a21b9..af1fb92247 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -62,12 +62,30 @@ void nr_rrc_config_ul_tda(NR_ServingCellConfigCommon_t *scc, int min_fb_delay){ //TODO change to accomodate for SRS - int temp_min_delay = 6; // k2 = 2 or 3 won'r work as well as higher values + lte_frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); + int temp_min_delay; + if(frame_type==TDD && scc->tdd_UL_DL_ConfigurationCommon) { + + switch (scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity) { + default: + temp_min_delay = 6; + break; + case NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms2p5: // 30kHz SCS + case NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms2: // 60kHz SCS + case NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms1p25: // 60kHz SCS + case NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms1: // 120kHz SCS + case NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms0p625: // 120kHz SCS + case NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms0p5: // 120kHz SCS + temp_min_delay = 2; + break; + } + } + + int k2 = (min_fb_delayuplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing; - lte_frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); struct NR_PUSCH_TimeDomainResourceAllocation *pusch_timedomainresourceallocation = CALLOC(1,sizeof(struct NR_PUSCH_TimeDomainResourceAllocation)); pusch_timedomainresourceallocation->k2 = CALLOC(1,sizeof(long)); @@ -77,6 +95,7 @@ void nr_rrc_config_ul_tda(NR_ServingCellConfigCommon_t *scc, int min_fb_delay){ ASN_SEQUENCE_ADD(&scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list,pusch_timedomainresourceallocation); if(frame_type==TDD) { + // TDD if(scc->tdd_UL_DL_ConfigurationCommon) { int ul_symb = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols; From 1976f433dcebbe7f7b2e9bfc6abd4bfab24f043b Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Tue, 22 Feb 2022 16:15:29 +0100 Subject: [PATCH 024/114] changes for Panther --- openair1/PHY/LTE_TRANSPORT/if5_tools.c | 32 ++++++++++++++---- targets/ARCH/AW2SORI/oaiori.c | 45 ++++++++++++++------------ 2 files changed, 49 insertions(+), 28 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/if5_tools.c b/openair1/PHY/LTE_TRANSPORT/if5_tools.c index 9d53cafe71..e71b1e31f6 100644 --- a/openair1/PHY/LTE_TRANSPORT/if5_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/if5_tools.c @@ -1106,9 +1106,9 @@ void send_IF5(RU_t *ru, openair0_timestamp proc_timestamp, int tti, uint8_t *seq NR_DL_FRAME_PARMS *nrfp = ru->nr_frame_parms; - int offset,siglen; + int offset,siglen,factor=1; if (nrfp) { - offset = nrfp->get_samples_slot_timestamp(tti,nrfp,0); + offset = nrfp->get_samples_slot_timestamp(tti,nrfp,0); siglen = nrfp->get_samples_per_slot(tti,nrfp); } else { @@ -1116,6 +1116,13 @@ void send_IF5(RU_t *ru, openair0_timestamp proc_timestamp, int tti, uint8_t *seq siglen = spsf; } + if (ru->openair0_cfg.nr_flag==1) { + if (nrfp->N_RB_DL <= 162 && nrfp->N_RB_DL >= 106) factor = 2; + else if (nrfp->N_RB_DL < 106) factor=4; + } + else { + factor = 30720/spsf; + } for (i=0; i < ru->nb_tx; i++) txp[i] = (int32_t*)&ru->common.txdata[i][offset]; @@ -1125,7 +1132,7 @@ void send_IF5(RU_t *ru, openair0_timestamp proc_timestamp, int tti, uint8_t *seq //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_IF0, 1 ); clock_gettime( CLOCK_MONOTONIC, &start_comp); ru->ifdevice.trx_write_func2(&ru->ifdevice, - (proc_timestamp + packet_id*spp_eth-600)*(30720/spsf), + (proc_timestamp + packet_id*spp_eth-600)*factor, (void*)txp[aid], spp_eth, aid, @@ -1326,6 +1333,8 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int tti, uint16_t pa NR_DL_FRAME_PARMS *nrfp = ru->nr_frame_parms; int offset,siglen; + int factor=1; + int ts_offset; if (nrfp) { offset = nrfp->get_samples_slot_timestamp(tti,nrfp,0); siglen = nrfp->get_samples_per_slot(tti,nrfp); @@ -1334,6 +1343,15 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int tti, uint16_t pa offset = tti*fp->samples_per_subframe; siglen = spsf; } + if (ru->openair0_cfg.nr_flag==1) { // This check if RRU knows about NR numerologies + if (nrfp->N_RB_DL <= 162 && nrfp->N_RB_DL >= 106) factor = 2; + else if (nrfp->N_RB_DL < 106) factor=4; + ts_offset = 64; + } + else { + factor = 30720/spsf; + ts_offset = 256; + } for (i=0; i < ru->nb_rx; i++) rxp[i] = &ru->common.rxdata[i][offset]; int aid; @@ -1352,12 +1370,12 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int tti, uint16_t pa &aid); clock_gettime( CLOCK_MONOTONIC, &if_time); timeout[packet_id] = if_time.tv_nsec; - timestamp[packet_id] /= (30720/spsf); - LOG_D(PHY,"TTI %d: Received packet %d: aid %d, TS %llu, oldTS %llu, diff %lld, \n",tti,packet_id,aid,(unsigned long long)timestamp[packet_id],(unsigned long long)oldTS,(unsigned long long)(timestamp[packet_id]-timestamp[0])); + timestamp[packet_id] /= factor; // for LTE this is the sample rate reduction w.r.t 30.72, for NR 122.88 + LOG_D(PHY,"TTI %d: factor = %d Received packet %d: aid %d, TS %llu, oldTS %llu, diff %lld, \n",tti,factor,packet_id,aid,(unsigned long long)timestamp[packet_id],(unsigned long long)oldTS,(unsigned long long)(timestamp[packet_id]-timestamp[0])); if (aid==0) { if (firstTS==1) firstTS=0; - else if (oldTS + 256 != timestamp[packet_id]) { + else if (oldTS + ts_offset != timestamp[packet_id]) { LOG_I(PHY,"oldTS %llu, newTS %llu, diff %llu, timein %lu, timeout %lu\n",(long long unsigned int)oldTS,(long long unsigned int)timestamp[packet_id],(long long unsigned int)timestamp[packet_id]-oldTS,timein[packet_id],timeout[packet_id]); for (int i=0;i<=packet_id;i++) LOG_I(PHY,"packet %d TS %llu, timein %lu, timeout %lu\n",i,(long long unsigned int)timestamp[i],timein[i],timeout[i]); AssertFatal(1==0,"fronthaul problem\n"); @@ -1369,7 +1387,7 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int tti, uint16_t pa // HYPOTHESIS: first packet per subframe has lowest timestamp of subframe // should detect out of order and act accordingly .... - AssertFatal(aid==0 || aid==1,"aid %d != 0 or 1\n",aid); + AssertFatal(aid==0 || aid==1 || aid==2 || aid==3,"aid %d != 0,1,2 or 3\n",aid); LOG_D(PHY,"rxp[%d] %p, dest %p, offset %d (%llu,%llu)\n",aid,rxp[aid],rxp[aid]+(timestamp[packet_id]-timestamp[0]),(int)(timestamp[packet_id]-timestamp[0]),(long long unsigned int)timestamp[packet_id],(long long unsigned int)timestamp[0]); memcpy((void*)(rxp[aid]+(timestamp[packet_id]-timestamp[0])), (void*)temp_rx, diff --git a/targets/ARCH/AW2SORI/oaiori.c b/targets/ARCH/AW2SORI/oaiori.c index 3872b05b3b..9cf15237cf 100644 --- a/targets/ARCH/AW2SORI/oaiori.c +++ b/targets/ARCH/AW2SORI/oaiori.c @@ -243,7 +243,7 @@ int aw2s_startstreaming(openair0_device *device) { tx1= (openair0_cfg->tx_num_channels > 1) ? ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ?ORI_ObjectType_TxNRFDD : ORI_ObjectType_TxNRTDD, 1, NULL) : NULL; tx2= (openair0_cfg->tx_num_channels > 2) ? ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ?ORI_ObjectType_TxNRFDD : ORI_ObjectType_TxNRTDD, 2, NULL) : NULL; tx3= (openair0_cfg->tx_num_channels > 3) ? ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ?ORI_ObjectType_TxNRFDD : ORI_ObjectType_TxNRTDD, 3, NULL) : NULL; - rx0= ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ?ORI_ObjectType_RxEUtraFDD : ORI_ObjectType_RxEUtraTDD, 0, NULL); + rx0= ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ?ORI_ObjectType_RxNRFDD : ORI_ObjectType_RxNRTDD, 0, NULL); rx1= (openair0_cfg->rx_num_channels > 1) ? ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ?ORI_ObjectType_RxNRFDD : ORI_ObjectType_RxNRTDD, 1, NULL) : NULL; rx2= (openair0_cfg->rx_num_channels > 2) ? ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ?ORI_ObjectType_RxNRFDD : ORI_ObjectType_RxNRTDD, 2, NULL) : NULL; rx3= (openair0_cfg->rx_num_channels > 3) ? ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ?ORI_ObjectType_RxNRFDD : ORI_ObjectType_RxNRTDD, 3, NULL) : NULL; @@ -259,8 +259,10 @@ int aw2s_startstreaming(openair0_device *device) { (rx1 == NULL && openair0_cfg->rx_num_channels > 1) || (rx2 == NULL && openair0_cfg->rx_num_channels > 2) || (rx3 == NULL && openair0_cfg->rx_num_channels > 3) || - link == NULL) return (-1); - + link == NULL) { + printf("tx0 %p, tx1 %p, tx2 %p, tx3 %p, rx0 %p, rx1 %p, rx2 %p, rx3 %p\n",tx0,tx1,tx2,tx3,rx0,rx1,rx2,rx3); + return (-1); + } /******************************************************************* * UNLOCK Link *******************************************************************/ @@ -415,7 +417,7 @@ int aw2s_startstreaming(openair0_device *device) { (openair0_cfg->rx_num_channels > 1 && rx1->fst != ORI_FST_Operational) || tx0->fst != ORI_FST_Operational || (openair0_cfg->tx_num_channels > 1 && tx1->fst != ORI_FST_Operational)) - {} + {}*/ // test RX interface uint64_t TS; char temp_rx[1024] __attribute__((aligned(32))); @@ -604,7 +606,7 @@ int aw2s_oriinit(openair0_device *device) { result = ORI_ObjectCreation(ori, txTypeRef, txParams, txParamList, num_txparams, txParamResult, &tx0, &RE_result); if(RE_result != ORI_Result_SUCCESS) { - printf("ORI_ObjectCreation (txParams0.TxEUtra/NRFDD/TDD) failed with error: %s (%s,%s,%s,%s,%s,%s\n", ORI_Result_Print(RE_result), + printf("ORI_ObjectCreation (txParams0.TxEUtra/NR/FDD/TDD) failed with error: %s (%s,%s,%s,%s,%s,%s\n", ORI_Result_Print(RE_result), ORI_Result_Print(txParamResult[0]), ORI_Result_Print(txParamResult[1]), ORI_Result_Print(txParamResult[2]), @@ -614,7 +616,7 @@ int aw2s_oriinit(openair0_device *device) { aw2s_oricleanup(device); return -1; } - printf("ORI_ObjectCreation (txParams0.TxEUtra/NRFDD/TDD): %s\n", ORI_Result_Print(RE_result)); + printf("ORI_ObjectCreation (txParams0.TxEUtra/NR/FDD/TDD): %s\n", ORI_Result_Print(RE_result)); /* Create tx1 */ @@ -631,11 +633,11 @@ int aw2s_oriinit(openair0_device *device) { result = ORI_ObjectCreation(ori, txTypeRef, txParams, txParamList, num_txparams, txParamResult, &tx1, &RE_result); if(RE_result != ORI_Result_SUCCESS) { - printf("ORI_ObjectCreation (txParams1.TxEUtra/NRFDD/TDD) failed with error: %s\n", ORI_Result_Print(result)); + printf("ORI_ObjectCreation (txParams1.TxEUtra/NR/FDD/TDD) failed with error: %s\n", ORI_Result_Print(result)); aw2s_oricleanup(device); return -1; } - printf("ORI_ObjectCreation (txParams1.TxEUtra/NRFDD/TDD): %s\n", ORI_Result_Print(RE_result)); + printf("ORI_ObjectCreation (txParams1.TxEUtra/NR/FDD/TDD): %s\n", ORI_Result_Print(RE_result)); } if (openair0_cfg->tx_num_channels > 2) { @@ -651,11 +653,11 @@ int aw2s_oriinit(openair0_device *device) { result = ORI_ObjectCreation(ori, txTypeRef, txParams, txParamList, num_txparams, txParamResult, &tx2, &RE_result); if(RE_result != ORI_Result_SUCCESS) { - printf("ORI_ObjectCreation (txParams1.TxEUtraFDD/TDD) failed with error: %s\n", ORI_Result_Print(result)); + printf("ORI_ObjectCreation (txParams2.TxEUtra/NR/FDD/TDD) failed with error: %s\n", ORI_Result_Print(result)); aw2s_oricleanup(device); return -1; } - printf("ORI_ObjectCreation (txParams1.TxEUtraFDD/TDD): %s\n", ORI_Result_Print(RE_result)); + printf("ORI_ObjectCreation (txParams2.TxEUtra/NR/FDD/TDD): %s\n", ORI_Result_Print(RE_result)); } if (openair0_cfg->tx_num_channels == 4) { ORI_Object_s * tx3; @@ -670,7 +672,7 @@ int aw2s_oriinit(openair0_device *device) { result = ORI_ObjectCreation(ori, txTypeRef, txParams, txParamList, num_txparams, txParamResult, &tx3, &RE_result); if(RE_result != ORI_Result_SUCCESS) { - printf("ORI_ObjectCreation (txParams1.TxEUtra/NRFDD/TDD) failed with error: %s\n", ORI_Result_Print(result)); + printf("ORI_ObjectCreation (txParams3.TxEUtra/NRFDD/TDD) failed with error: %s\n", ORI_Result_Print(result)); aw2s_oricleanup(device); return -1; } @@ -688,7 +690,8 @@ int aw2s_oriinit(openair0_device *device) { (openair0_cfg->nr_flag == 0 ? ORI_ObjectType_RxEUtraTDD : ORI_ObjectType_RxNRTDD)}; ORI_ObjectParams_u rxParams; ORI_ObjectParam_e rxParamList[5] = { ORI_ObjectParam_SigPath_antPort, ORI_ObjectParam_SigPath_axcW, ORI_ObjectParam_SigPath_axcB, - ORI_ObjectParam_SigPath_chanBW, ORI_ObjectParam_SigPath_earfcn }; + ORI_ObjectParam_SigPath_chanBW, + openair0_cfg->nr_flag == 0 ? ORI_ObjectParam_SigPath_earfcn : ORI_ObjectParam_SigPath_AWS_arfcn}; ORI_Result_e rxParamResult[5]; int num_rxparams = 5; /* Create rx0 */ @@ -783,11 +786,11 @@ int aw2s_oriinit(openair0_device *device) { if(result != ORI_Result_SUCCESS) { - printf("ORI_ObjectCreation (rxParams1.RxEUtra/NR/FDD/TDD) failed with error: %s\n", ORI_Result_Print(result)); + printf("ORI_ObjectCreation (rxParams2.RxEUtra/NR/FDD/TDD) failed with error: %s\n", ORI_Result_Print(result)); aw2s_oricleanup(device); return -1; } - printf("ORI_ObjectCreation (rxParams1.RxEUtra/NR/FDD/TDD): %s\n", ORI_Result_Print(RE_result)); + printf("ORI_ObjectCreation (rxParams2.RxEUtra/NR/FDD/TDD): %s\n", ORI_Result_Print(RE_result)); } if (openair0_cfg->rx_num_channels > 3) { /* Create rx3 */ @@ -806,11 +809,11 @@ int aw2s_oriinit(openair0_device *device) { if(result != ORI_Result_SUCCESS) { - printf("ORI_ObjectCreation (rxParams1.RxEUtra/NR/FDD/TDD) failed with error: %s\n", ORI_Result_Print(result)); + printf("ORI_ObjectCreation (rxParams3.RxEUtra/NR/FDD/TDD) failed with error: %s\n", ORI_Result_Print(result)); aw2s_oricleanup(device); return -1; } - printf("ORI_ObjectCreation (rxParams1.RxEUtra/NR/FDD/TDD): %s\n", ORI_Result_Print(RE_result)); + printf("ORI_ObjectCreation (rxParams3.RxEUtra/NR/FDD/TDD): %s\n", ORI_Result_Print(RE_result)); } /* Create link */ @@ -827,14 +830,14 @@ int aw2s_oriinit(openair0_device *device) { result = ORI_ObjectParamModify(ori,link,linkParams,linkParamList,3,linkParamResult,&RE_result); if(result != ORI_Result_SUCCESS) { - printf("ORI_ObjectParamModify (linkParams) failed with error: %s\n", ORI_Result_Print(result)); + printf("ORI_ObjectParamModify (linkParams) failed with error: %s\n", ORI_Result_Print(RE_result)); aw2s_oricleanup(device); return -1; } result = ORI_ObjectStateModification(ori, link, ORI_AST_Locked, &RE_result); if(result != ORI_Result_SUCCESS) { - printf("ORI_ObjectStateModify failed with error: %s\n", ORI_Result_Print(result)); + printf("ORI_ObjectStateModify failed with error: %s\n", ORI_Result_Print(RE_result)); aw2s_oricleanup(device); return -1; } @@ -850,7 +853,7 @@ int aw2s_oriinit(openair0_device *device) { result = ORI_ObjectParamReport(ori, NULL, 0, ORI_ObjectParam_All, &RE_result); if(result != ORI_Result_SUCCESS) { - printf("ORI_ObjectParamReport failed with error: %s\n", ORI_Result_Print(result)); + printf("ORI_ObjectParamReport failed with error: %s\n", ORI_Result_Print(RE_result)); aw2s_oricleanup(device); return -1; } @@ -869,7 +872,7 @@ int aw2s_oriinit(openair0_device *device) { result = ORI_ObjectStateReport(ori, NULL, 0, ORI_StateType_All, ORI_EventDrivenReport_True, &RE_result); if(result != ORI_Result_SUCCESS) { - printf("ORI_ObjectStateReport failed with error: %s\n", ORI_Result_Print(result)); + printf("ORI_ObjectStateReport failed with error: %s\n", ORI_Result_Print(RE_result)); aw2s_oricleanup(device); return -1; } @@ -893,7 +896,7 @@ int aw2s_oriinit(openair0_device *device) { result = ORI_ObjectFaultReport(ori, NULL, 0, ORI_EventDrivenReport_True, &RE_result); if(result != ORI_Result_SUCCESS) { - printf("ORI_ObjectFaultReport failed with error: %s\n", ORI_Result_Print(result)); + printf("ORI_ObjectFaultReport failed with error: %s\n", ORI_Result_Print(RE_result)); aw2s_oricleanup(device); return -1; } From 79a5249a725bec9f251e5f676436e4a4e945f270 Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Sat, 5 Mar 2022 16:18:06 +0100 Subject: [PATCH 025/114] for testing --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index a48a59b67b..4c902e2675 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -979,6 +979,9 @@ void nr_schedule_ue_spec(module_id_t module_id, gNB_MAC_INST *gNB_mac = RC.nrmac[module_id]; if (!is_xlsch_in_slot(gNB_mac->dlsch_slot_bitmap[slot / 64], slot)) return; + + //if (slot==7 || slot == 17) return; + /* PREPROCESSOR */ gNB_mac->pre_processor_dl(module_id, frame, slot); From 4ca985858ffaf42bbb000da04a4a002d48c13f5d Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Sat, 5 Mar 2022 22:24:34 +0100 Subject: [PATCH 026/114] to trigger CI --- targets/ARCH/AW2SORI/oaiori.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/targets/ARCH/AW2SORI/oaiori.c b/targets/ARCH/AW2SORI/oaiori.c index fc35e021b8..3c424086dd 100644 --- a/targets/ARCH/AW2SORI/oaiori.c +++ b/targets/ARCH/AW2SORI/oaiori.c @@ -417,7 +417,7 @@ int aw2s_startstreaming(openair0_device *device) { (openair0_cfg->rx_num_channels > 1 && rx1->fst != ORI_FST_Operational) || tx0->fst != ORI_FST_Operational || (openair0_cfg->tx_num_channels > 1 && tx1->fst != ORI_FST_Operational)) - {}*/ + {}*/ // test RX interface uint64_t TS; char temp_rx[2048] __attribute__((aligned(32))); From 091386174e476a224ebcaeddb0bfbf2f346ea12f Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Sat, 5 Mar 2022 23:20:35 +0100 Subject: [PATCH 027/114] bugfix for new sf_ahead parameter --- targets/RT/USER/lte-ru.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index 16f26cc95c..8a5ae99f19 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -3070,7 +3070,7 @@ RU_t **RCconfig_RU(int nb_RU,int nb_L1_inst,PHY_VARS_eNB ***eNB,uint64_t *ru_mas ru[j]->nb_rx = *(RUParamList.paramarray[j][RU_NB_RX_IDX].uptr); ru[j]->att_tx = *(RUParamList.paramarray[j][RU_ATT_TX_IDX].uptr); ru[j]->att_rx = *(RUParamList.paramarray[j][RU_ATT_RX_IDX].uptr); - ru[j]->sf_ahead = *(RUParamList.paramarray[j][RU_SF_AHEAD_IDX].uptr); + ru[j]->sf_ahead = *(RUParamList.paramarray[j][RU_SF_AHEAD].uptr); *ru_mask= (*ru_mask)|(1< Date: Sun, 6 Mar 2022 09:40:36 +0100 Subject: [PATCH 028/114] build for NR UE --- openair2/RRC/NR/MESSAGES/asn1_msg.c | 56 ++++++++++++++++++++ openair2/RRC/NR/nr_rrc_proto.h | 1 + openair2/RRC/NR/rrc_gNB_reconfig.c | 55 ------------------- targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp | 4 +- 4 files changed, 58 insertions(+), 58 deletions(-) diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 665e27f7b7..d3e4b615a4 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1004,6 +1004,62 @@ long rrc_get_max_nr_csrs(uint8_t max_rbs, long b_SRS) { return c_srs; } +void config_csirs(NR_ServingCellConfigCommon_t *servingcellconfigcommon, + NR_CSI_MeasConfig_t *csi_MeasConfig, + int dl_antenna_ports, + int curr_bwp, + int do_csirs) { + + if (do_csirs) { + csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList = calloc(1,sizeof(*csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList)); + NR_NZP_CSI_RS_Resource_t *nzpcsi0 = calloc(1,sizeof(*nzpcsi0)); + nzpcsi0->nzp_CSI_RS_ResourceId = 0; + NR_CSI_RS_ResourceMapping_t resourceMapping; + switch (dl_antenna_ports) { + case 1: + resourceMapping.frequencyDomainAllocation.present = NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row2; + resourceMapping.frequencyDomainAllocation.choice.row2.buf = calloc(2, sizeof(uint8_t)); + resourceMapping.frequencyDomainAllocation.choice.row2.size = 2; + resourceMapping.frequencyDomainAllocation.choice.row2.bits_unused = 4; + resourceMapping.frequencyDomainAllocation.choice.row2.buf[0] = 0; + resourceMapping.frequencyDomainAllocation.choice.row2.buf[1] = 16; + resourceMapping.nrofPorts = NR_CSI_RS_ResourceMapping__nrofPorts_p1; + resourceMapping.cdm_Type = NR_CSI_RS_ResourceMapping__cdm_Type_noCDM; + break; + case 2: + resourceMapping.frequencyDomainAllocation.present = NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_other; + resourceMapping.frequencyDomainAllocation.choice.other.buf = calloc(2, sizeof(uint8_t)); + resourceMapping.frequencyDomainAllocation.choice.other.size = 1; + resourceMapping.frequencyDomainAllocation.choice.other.bits_unused = 2; + resourceMapping.frequencyDomainAllocation.choice.other.buf[0] = 4; + resourceMapping.nrofPorts = NR_CSI_RS_ResourceMapping__nrofPorts_p2; + resourceMapping.cdm_Type = NR_CSI_RS_ResourceMapping__cdm_Type_fd_CDM2; + break; + default: + AssertFatal(1==0,"Number of ports not yet supported\n"); + } + resourceMapping.firstOFDMSymbolInTimeDomain = 6; + resourceMapping.firstOFDMSymbolInTimeDomain2 = NULL; + resourceMapping.density.present = NR_CSI_RS_ResourceMapping__density_PR_one; + resourceMapping.density.choice.one = (NULL_t)0; + resourceMapping.freqBand.startingRB = 0; + resourceMapping.freqBand.nrofRBs = ((curr_bwp>>2)+(curr_bwp%4>0))<<2; + nzpcsi0->resourceMapping = resourceMapping; + nzpcsi0->powerControlOffset = 0; + nzpcsi0->powerControlOffsetSS=calloc(1,sizeof(*nzpcsi0->powerControlOffsetSS)); + *nzpcsi0->powerControlOffsetSS = NR_NZP_CSI_RS_Resource__powerControlOffsetSS_db0; + nzpcsi0->scramblingID = *servingcellconfigcommon->physCellId; + nzpcsi0->periodicityAndOffset = calloc(1,sizeof(*nzpcsi0->periodicityAndOffset)); + nzpcsi0->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots320; + nzpcsi0->periodicityAndOffset->choice.slots320 = 0; + nzpcsi0->qcl_InfoPeriodicCSI_RS = calloc(1,sizeof(*nzpcsi0->qcl_InfoPeriodicCSI_RS)); + *nzpcsi0->qcl_InfoPeriodicCSI_RS=0; + ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList->list,nzpcsi0); + } + else + csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList = NULL; +} + void fill_initial_SpCellConfig(int uid, NR_SpCellConfig_t *SpCellConfig, NR_ServingCellConfigCommon_t *scc, diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index 205267e288..08c6709497 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -84,6 +84,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco int do_srs, int uid); + void config_csirs(NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_CSI_MeasConfig_t *csi_MeasConfig, int dl_antenna_ports, diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 120a508cdf..7c733a19e6 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -1318,61 +1318,6 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco } -void config_csirs(NR_ServingCellConfigCommon_t *servingcellconfigcommon, - NR_CSI_MeasConfig_t *csi_MeasConfig, - int dl_antenna_ports, - int curr_bwp, - int do_csirs) { - - if (do_csirs) { - csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList = calloc(1,sizeof(*csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList)); - NR_NZP_CSI_RS_Resource_t *nzpcsi0 = calloc(1,sizeof(*nzpcsi0)); - nzpcsi0->nzp_CSI_RS_ResourceId = 0; - NR_CSI_RS_ResourceMapping_t resourceMapping; - switch (dl_antenna_ports) { - case 1: - resourceMapping.frequencyDomainAllocation.present = NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row2; - resourceMapping.frequencyDomainAllocation.choice.row2.buf = calloc(2, sizeof(uint8_t)); - resourceMapping.frequencyDomainAllocation.choice.row2.size = 2; - resourceMapping.frequencyDomainAllocation.choice.row2.bits_unused = 4; - resourceMapping.frequencyDomainAllocation.choice.row2.buf[0] = 0; - resourceMapping.frequencyDomainAllocation.choice.row2.buf[1] = 16; - resourceMapping.nrofPorts = NR_CSI_RS_ResourceMapping__nrofPorts_p1; - resourceMapping.cdm_Type = NR_CSI_RS_ResourceMapping__cdm_Type_noCDM; - break; - case 2: - resourceMapping.frequencyDomainAllocation.present = NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_other; - resourceMapping.frequencyDomainAllocation.choice.other.buf = calloc(2, sizeof(uint8_t)); - resourceMapping.frequencyDomainAllocation.choice.other.size = 1; - resourceMapping.frequencyDomainAllocation.choice.other.bits_unused = 2; - resourceMapping.frequencyDomainAllocation.choice.other.buf[0] = 4; - resourceMapping.nrofPorts = NR_CSI_RS_ResourceMapping__nrofPorts_p2; - resourceMapping.cdm_Type = NR_CSI_RS_ResourceMapping__cdm_Type_fd_CDM2; - break; - default: - AssertFatal(1==0,"Number of ports not yet supported\n"); - } - resourceMapping.firstOFDMSymbolInTimeDomain = 6; - resourceMapping.firstOFDMSymbolInTimeDomain2 = NULL; - resourceMapping.density.present = NR_CSI_RS_ResourceMapping__density_PR_one; - resourceMapping.density.choice.one = (NULL_t)0; - resourceMapping.freqBand.startingRB = 0; - resourceMapping.freqBand.nrofRBs = ((curr_bwp>>2)+(curr_bwp%4>0))<<2; - nzpcsi0->resourceMapping = resourceMapping; - nzpcsi0->powerControlOffset = 0; - nzpcsi0->powerControlOffsetSS=calloc(1,sizeof(*nzpcsi0->powerControlOffsetSS)); - *nzpcsi0->powerControlOffsetSS = NR_NZP_CSI_RS_Resource__powerControlOffsetSS_db0; - nzpcsi0->scramblingID = *servingcellconfigcommon->physCellId; - nzpcsi0->periodicityAndOffset = calloc(1,sizeof(*nzpcsi0->periodicityAndOffset)); - nzpcsi0->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots320; - nzpcsi0->periodicityAndOffset->choice.slots320 = 0; - nzpcsi0->qcl_InfoPeriodicCSI_RS = calloc(1,sizeof(*nzpcsi0->qcl_InfoPeriodicCSI_RS)); - *nzpcsi0->qcl_InfoPeriodicCSI_RS=0; - ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList->list,nzpcsi0); - } - else - csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList = NULL; -} void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon, diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index 5da5cd0b67..0533f2f100 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -673,7 +673,7 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp if (samples_received == nsamps) s->wait_for_first_pps=0; // bring RX data into 12 LSBs for softmodem RX - for (int i=0; itype==USRP_X300_DEV) { openair0_cfg[0].rx_gain_calib_table = calib_table_x310; std::cerr << "-- Using calibration table: calib_table_x310" << std::endl; - // s->usrp->set_rx_dc_offset(true); } if (device->type==USRP_N300_DEV) { From fcd88de2ab2fe1b640ce5eb1f4070fb5fe57ceaa Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Mon, 7 Mar 2022 00:08:12 +0100 Subject: [PATCH 029/114] SR/CSI multiplexing fix. default sl_head=6 instead of 4 to check if RF simulator behaves better --- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 2 + openair1/SCHED_NR/phy_procedures_nr_gNB.c | 1 + openair2/ENB_APP/enb_paramdef.h | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 5 +- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 1 + .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 49 +++++++++++++++++-- openair2/RRC/NR/MESSAGES/asn1_msg.c | 6 +-- 7 files changed, 55 insertions(+), 11 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index 283ff1934c..db36b39f99 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -104,6 +104,8 @@ void nr_fill_pucch(PHY_VARS_gNB *gNB, pucch->frame = frame; pucch->slot = slot; pucch->active = 1; + if (pucch->pucch_pdu.format_type > 0) LOG_D(PHY,"Programming PUCCH[%d] for %d.%d, format %d, nb_harq %d, nb_sr %d, nb_csi %d\n",id, + pucch->frame,pucch->slot,pucch->pucch_pdu.format_type,pucch->pucch_pdu.bit_len_harq,pucch->pucch_pdu.sr_flag,pucch->pucch_pdu.bit_len_csi_part1); memcpy((void*)&pucch->pucch_pdu, (void*)pucch_pdu, sizeof(nfapi_nr_pucch_pdu_t)); } diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 6ba673dbc7..435b633c3b 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -699,6 +699,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { gNB->uci_pdu_list[num_ucis].pdu_size = sizeof(nfapi_nr_uci_pucch_pdu_format_2_3_4_t); nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu_format2 = &gNB->uci_pdu_list[num_ucis].pucch_pdu_format_2_3_4; + LOG_D(PHY,"%d.%d Calling nr_decode_pucch2\n",frame_rx,slot_rx); nr_decode_pucch2(gNB, slot_rx, uci_pdu_format2, diff --git a/openair2/ENB_APP/enb_paramdef.h b/openair2/ENB_APP/enb_paramdef.h index a533b8cb23..21e2e1b703 100644 --- a/openair2/ENB_APP/enb_paramdef.h +++ b/openair2/ENB_APP/enb_paramdef.h @@ -172,7 +172,7 @@ typedef enum { {CONFIG_STRING_RU_IF_FREQ_OFFSET, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ {CONFIG_STRING_RU_DO_PRECODING, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ {CONFIG_STRING_RU_SF_AHEAD, NULL, 0, iptr:NULL, defintval:4, TYPE_INT, 0}, \ - {CONFIG_STRING_RU_SL_AHEAD, NULL, 0, iptr:NULL, defintval:4, TYPE_INT, 0}, \ + {CONFIG_STRING_RU_SL_AHEAD, NULL, 0, iptr:NULL, defintval:6, TYPE_INT, 0}, \ {CONFIG_STRING_RU_NR_FLAG, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ {CONFIG_STRING_RU_NR_SCS_FOR_RASTER, NULL, 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \ } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 51541353f4..e97e75ea16 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -368,8 +368,6 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, schedule_nr_prach(module_idP, f, s); } - // This schedule SR - nr_sr_reporting(module_idP, frame, slot); // Schedule CSI-RS transmission nr_csirs_scheduling(module_idP, frame, slot, nr_slots_per_frame[*scc->ssbSubcarrierSpacing]); @@ -398,6 +396,9 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, nr_schedule_pucch(module_idP, frame, slot); + // This schedule SR after PUCCH for multiplexing + nr_sr_reporting(module_idP, frame, slot); + stop_meas(&RC.nrmac[module_idP]->eNB_scheduler); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_OUT); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 3203b536f6..886b675e41 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1225,6 +1225,7 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, } } AssertFatal(res_found==1,"No PUCCH resource found corresponding to id %ld\n",*resource_id); + LOG_D(NR_MAC,"Configure pucch: pucch_pdu->format_type %d pucch_pdu->bit_len_harq %d, pucch->pdu->bit_len_csi %d\n",pucch_pdu->format_type,pucch_pdu->bit_len_harq,pucch_pdu->bit_len_csi_part1); } else { // this is the default PUCCH configuration, PUCCH format 0 or 1 LOG_D(NR_MAC,"pucch_acknak: Filling default PUCCH configuration from Tables (r_pucch %d, bwp %p)\n",r_pucch,bwp); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 8ca409695e..3688ac7771 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -153,7 +153,8 @@ void nr_schedule_pucch(int Mod_idP, || frameP != curr_pucch->frame || slotP != curr_pucch->ul_slot) continue; - LOG_D(NR_MAC,"Scheduling PUCCH[%d] RX for UE %d in %d.%d O_ack %d\n",i,UE_id,curr_pucch->frame,curr_pucch->ul_slot,O_ack); + if (O_csi > 0) LOG_D(NR_MAC,"Scheduling PUCCH[%d] RX for UE %d in %d.%d O_ack %d, O_sr %d, O_csi %d\n", + i,UE_id,curr_pucch->frame,curr_pucch->ul_slot,O_ack,O_sr,O_csi); nr_fill_nfapi_pucch(Mod_idP, frameP, slotP, curr_pucch, UE_id); memset(curr_pucch, 0, sizeof(*curr_pucch)); } @@ -773,6 +774,7 @@ void nr_csi_meas_reporting(int Mod_idP, len = pucchres->format.choice.format2->nrofPRBs; mask = ((1 << pucchres->format.choice.format2->nrofSymbols) - 1) << pucchres->format.choice.format2->startingSymbolIndex; curr_pucch->simultaneous_harqcsi = pucch_Config->format2->choice.setup->simultaneousHARQ_ACK_CSI; + LOG_D(NR_MAC,"%d.%d Allocating PUCCH format 2, startPRB %d, nPRB %d, simulHARQ %d, num_bits %d\n", frame, sched_slot,start,len,curr_pucch->simultaneous_harqcsi,curr_pucch->csi_bits); break; case NR_PUCCH_Resource__format_PR_format3: len = pucchres->format.choice.format3->nrofPRBs; @@ -1171,9 +1173,6 @@ void evaluate_rsrp_report(NR_UE_info_t *UE_info, // including ssb rsrp in mac stats stats->cumul_rsrp += strongest_ssb_rsrp; stats->num_rsrp_meas++; - LOG_D(MAC,"rsrp_id = %d rsrp = %d\n", - sched_ctrl->CSI_report.ssb_cri_report.RSRP, - get_measured_rsrp(sched_ctrl->CSI_report.ssb_cri_report.RSRP)); } @@ -1888,11 +1887,51 @@ void nr_sr_reporting(int Mod_idP, frame_t SFN, sub_frame_t slot) && pdu->initial_cyclic_shift == pucch_res->format.choice.format0->initialCyclicShift && pdu->nr_of_symbols == pucch_res->format.choice.format0->nrofSymbols && pdu->start_symbol_index == pucch_res->format.choice.format0->startingSymbolIndex) { - LOG_D(NR_MAC,"%4d.%2d adding SR_flag 1 to PUCCH nFAPI SR for RNTI %04x\n", SFN, slot, pdu->rnti); + LOG_D(NR_MAC,"%4d.%2d adding SR_flag 1 to PUCCH format 0 nFAPI SR for RNTI %04x\n", SFN, slot, pdu->rnti); pdu->sr_flag = 1; nfapi_allocated = true; break; } + else if (pdu->rnti == UE_info->rnti[UE_id] + && pdu->format_type == 2 // does not use NR_PUCCH_Resource__format_PR_format0 + && pdu->nr_of_symbols == pucch_res->format.choice.format2->nrofSymbols + && pdu->start_symbol_index == pucch_res->format.choice.format2->startingSymbolIndex) { + LOG_D(NR_MAC,"%4d.%2d adding SR_flag 1 to PUCCH format 2 nFAPI SR for RNTI %04x\n", SFN, slot, pdu->rnti); + pdu->sr_flag = 1; + nfapi_allocated = true; + break; + + } + else if (pdu->rnti == UE_info->rnti[UE_id] + && pdu->format_type == 1 // does not use NR_PUCCH_Resource__format_PR_format0 + && pdu->nr_of_symbols == pucch_res->format.choice.format1->nrofSymbols + && pdu->start_symbol_index == pucch_res->format.choice.format1->startingSymbolIndex) { + LOG_D(NR_MAC,"%4d.%2d adding SR_flag 1 to PUCCH format 1 nFAPI SR for RNTI %04x\n", SFN, slot, pdu->rnti); + pdu->sr_flag = 1; + nfapi_allocated = true; + break; + + } + else if (pdu->rnti == UE_info->rnti[UE_id] + && pdu->format_type == 3 // does not use NR_PUCCH_Resource__format_PR_format0 + && pdu->nr_of_symbols == pucch_res->format.choice.format3->nrofSymbols + && pdu->start_symbol_index == pucch_res->format.choice.format3->startingSymbolIndex) { + LOG_D(NR_MAC,"%4d.%2d adding SR_flag 1 to PUCCH format 3 nFAPI SR for RNTI %04x\n", SFN, slot, pdu->rnti); + pdu->sr_flag = 1; + nfapi_allocated = true; + break; + + } + else if (pdu->rnti == UE_info->rnti[UE_id] + && pdu->format_type == 4 // does not use NR_PUCCH_Resource__format_PR_format0 + && pdu->nr_of_symbols == pucch_res->format.choice.format4->nrofSymbols + && pdu->start_symbol_index == pucch_res->format.choice.format4->startingSymbolIndex) { + LOG_D(NR_MAC,"%4d.%2d adding SR_flag 1 to PUCCH format 4 nFAPI SR for RNTI %04x\n", SFN, slot, pdu->rnti); + pdu->sr_flag = 1; + nfapi_allocated = true; + break; + + } } if (nfapi_allocated) // break scheduling resource loop, continue next UE diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index d3e4b615a4..f5d6b228f9 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1051,7 +1051,7 @@ void config_csirs(NR_ServingCellConfigCommon_t *servingcellconfigcommon, nzpcsi0->scramblingID = *servingcellconfigcommon->physCellId; nzpcsi0->periodicityAndOffset = calloc(1,sizeof(*nzpcsi0->periodicityAndOffset)); nzpcsi0->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots320; - nzpcsi0->periodicityAndOffset->choice.slots320 = 0; + nzpcsi0->periodicityAndOffset->choice.slots320 = 20; nzpcsi0->qcl_InfoPeriodicCSI_RS = calloc(1,sizeof(*nzpcsi0->qcl_InfoPeriodicCSI_RS)); *nzpcsi0->qcl_InfoPeriodicCSI_RS=0; ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList->list,nzpcsi0); @@ -1596,7 +1596,7 @@ void fill_initial_SpCellConfig(int uid, csirep1->reportConfigType.present = NR_CSI_ReportConfig__reportConfigType_PR_periodic; csirep1->reportConfigType.choice.periodic = calloc(1,sizeof(*csirep1->reportConfigType.choice.periodic)); csirep1->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots320; - csirep1->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = 8 + (20 * uid) % 320; + csirep1->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = (8 + (20 * uid)) % 320; ASN_SEQUENCE_ADD(&csirep1->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list,pucchcsires1); csirep1->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI; csirep1->reportQuantity.choice.cri_RI_PMI_CQI=(NULL_t)0; @@ -1655,7 +1655,7 @@ void fill_initial_SpCellConfig(int uid, csirep2->reportConfigType.present = NR_CSI_ReportConfig__reportConfigType_PR_periodic; csirep2->reportConfigType.choice.periodic = calloc(1,sizeof(*csirep2->reportConfigType.choice.periodic)); csirep2->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots320; - csirep2->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = 28 + (20 * uid) % 320; + csirep2->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = (28 + (20 * uid)) % 320; ASN_SEQUENCE_ADD(&csirep2->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list,pucchcsires1); csirep2->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP; csirep2->reportQuantity.choice.cri_RSRP=(NULL_t)0; From f2e21b73812fe7a453807b9a696f044c5394ef1f Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Tue, 8 Mar 2022 07:47:46 +0100 Subject: [PATCH 030/114] removed AssertFatal in nr_sch_dmrs.c which prevented using type B configuration (e.g. for 10 MHz test in CI) --- openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.c | 1 - 1 file changed, 1 deletion(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.c b/openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.c index 159f1172f8..a62138621d 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.c +++ b/openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.c @@ -92,6 +92,5 @@ uint8_t get_l0(uint16_t dlDmrsSymbPos) { if ((mask&1) == 1) break; mask>>=1; } - AssertFatal(l0 < 4,"impossible l0 %d, dlDmrsSymbPos %x\n",l0,dlDmrsSymbPos); return (l0); } From d24068a33b173d9d8ba9a49310e5c843db0e8767 Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Fri, 11 Mar 2022 01:23:39 +0100 Subject: [PATCH 031/114] some bugfixes for CSI reporting with PUCCH2. Configuration of cqi_Table 2 for CSI reporting when 256-QAM is enabled. --- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 6 ++-- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 2 -- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 3 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 32 ++++++++++++++----- openair2/RRC/NR/MESSAGES/asn1_msg.c | 4 +-- openair2/RRC/NR/nr_rrc_config.c | 12 +++++++ openair2/RRC/NR/nr_rrc_config.h | 1 + openair2/RRC/NR/rrc_gNB_reconfig.c | 2 +- 8 files changed, 45 insertions(+), 17 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index db36b39f99..beab48b977 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -1178,9 +1178,9 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, } } } -#ifdef DEBUG_NR_PUCCH_RX - printf("Decoding pucch2 for %d symbols, %d PRB\n",pucch_pdu->nr_of_symbols,pucch_pdu->prb_size); -#endif + LOG_D(PHY,"Decoding pucch2 for %d symbols, %d PRB, nb_harq %d, nb_sr %d, nb_csi %d/%d\n", + pucch_pdu->nr_of_symbols,pucch_pdu->prb_size, + pucch_pdu->bit_len_harq,pucch_pdu->sr_flag,pucch_pdu->bit_len_csi_part1,pucch_pdu->bit_len_csi_part2); int nc_group_size=1; // 2 PRB int ngroup = prb_size_ext/nc_group_size/2; diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 94b7ab18bf..d36e02b606 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -4057,8 +4057,6 @@ uint16_t compute_pucch_prb_size(uint8_t format, if ((O_tot+O_csi)>(nr_prbs*n_re_ctrl*n_symb*Qm*r)) AssertFatal(1==0,"MaxCodeRate %.2f can't support %d UCI bits and %d CRC bits with %d PRBs", r,O_tot,O_crc,nr_prbs); - else - return nr_prbs; } if (format==2){ diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 81f4169e13..d2f726e0fc 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -156,7 +156,8 @@ void set_dl_mcs(NR_sched_pdsch_t *sched_pdsch, uint16_t target_coderate,target_qm; if (cqi_idx>0) { int cqi_table = sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.cqi_table; - AssertFatal(cqi_table == mcs_table_idx, "Indices of MCS tables don't correspond\n"); + if (cqi_table != mcs_table_idx) + LOG_W(NR_MAC,"Indices of MCS tables don't correspond yet, cri_ri_li_pmi_cqi_report.cqi_table %d, mcs_table_index %d\n",cqi_table,mcs_table_idx); switch (cqi_table) { case 0: target_qm = cqi_table1[cqi_idx][0]; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 3688ac7771..53df37d139 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -1559,7 +1559,6 @@ int nr_acknack_scheduling(int mod_id, // if TDD configuration is not present and the band is not FDD, it means it is a dynamic TDD configuration AssertFatal(RC.nrmac[mod_id]->common_channels[CC_id].frame_type == FDD,"Dynamic TDD not handled yet\n"); - NR_sched_pucch_t *csi_pucch; /* for the moment, we consider: * * only pucch_sched[0] holds HARQ (and SR) @@ -1578,13 +1577,18 @@ int nr_acknack_scheduling(int mod_id, pucch->csi_bits); /* if the currently allocated PUCCH of this UE is full, allocate it */ + NR_sched_pucch_t *csi_pucch = &sched_ctrl->sched_pucch[1]; if (pucch->dai_c == 2) { /* advance the UL slot information in PUCCH by one so we won't schedule in * the same slot again */ const int f = pucch->frame; const int s = pucch->ul_slot; LOG_D(NR_MAC, "In %s: %d.%d DAI = 2 pucch currently in %d.%d, advancing by 1 slot\n", __FUNCTION__, frame, slot, f, s); - nr_fill_nfapi_pucch(mod_id, frame, slot, pucch, UE_id); + if (!(csi_pucch + && csi_pucch->csi_bits > 0 + && csi_pucch->frame == f + && csi_pucch->ul_slot == s)) + nr_fill_nfapi_pucch(mod_id, frame, slot, pucch, UE_id); memset(pucch, 0, sizeof(*pucch)); pucch->frame = s == n_slots_frame - 1 ? (f + 1) % 1024 : f; if(((s + 1)%nr_slots_period) == 0) @@ -1592,11 +1596,11 @@ int nr_acknack_scheduling(int mod_id, else pucch->ul_slot = (s + 1) % n_slots_frame; // we assume that only two indices over the array sched_pucch exist - csi_pucch = &sched_ctrl->sched_pucch[1]; // skip the CSI PUCCH if it is present and if in the next frame/slot // and if we don't multiplex csi_pucch->r_pucch=-1; - if (csi_pucch->csi_bits > 0 + if (csi_pucch + && csi_pucch->csi_bits > 0 && csi_pucch->frame == pucch->frame && csi_pucch->ul_slot == pucch->ul_slot && !csi_pucch->simultaneous_harqcsi) { @@ -1653,7 +1657,10 @@ int nr_acknack_scheduling(int mod_id, const int s = pucch->ul_slot; const int n_slots_frame = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; LOG_D(NR_MAC, "In %s: %d.%d DAI > 0, cannot reach timing for pucch in %d.%d, advancing slot by 1 and trying again\n", __FUNCTION__, frame, slot, f, s); - nr_fill_nfapi_pucch(mod_id, frame, slot, pucch, UE_id); + if (!(csi_pucch && + csi_pucch->csi_bits > 0 && + csi_pucch->frame == f && + csi_pucch->ul_slot == s)) nr_fill_nfapi_pucch(mod_id, frame, slot, pucch, UE_id); memset(pucch, 0, sizeof(*pucch)); pucch->frame = s == n_slots_frame - 1 ? (f + 1) % 1024 : f; if(((s + 1)%nr_slots_period) == 0) @@ -1665,6 +1672,14 @@ int nr_acknack_scheduling(int mod_id, pucch->timing_indicator = i; pucch->dai_c++; + // if there is CSI in this slot update the HARQ information for that one too + if (csi_pucch && + csi_pucch->csi_bits > 0 && + csi_pucch->frame == pucch->frame && + csi_pucch->ul_slot == pucch->ul_slot) { + csi_pucch->timing_indicator = i; + csi_pucch->dai_c++; + } // retain old resource indicator, and we are good LOG_D(NR_MAC, "In %s: %d.%d. DAI > 0, pucch allocated for %d.%d (index %d)\n", __FUNCTION__, frame,slot,pucch->frame,pucch->ul_slot,pucch->timing_indicator); return 0; @@ -1725,8 +1740,6 @@ int nr_acknack_scheduling(int mod_id, return -1; } - // is there already CSI in this slot? - csi_pucch = &sched_ctrl->sched_pucch[1]; if (csi_pucch && csi_pucch->csi_bits > 0 && csi_pucch->frame == pucch->frame && @@ -1755,7 +1768,10 @@ int nr_acknack_scheduling(int mod_id, else { csi_pucch->timing_indicator = ind_found; csi_pucch->dai_c++; - memset(pucch,0,sizeof(*pucch)); + // keep updating format 2 indicator + pucch->timing_indicator = ind_found; // index in the list of timing indicators + pucch->dai_c++; + LOG_D(NR_MAC,"multiplexing csi_pucch %d +csi_pucch->dai_c %d for %d.%d\n",csi_pucch->csi_bits,csi_pucch->dai_c,csi_pucch->frame,csi_pucch->ul_slot); return 1; } diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 73bb941af9..1bbecb3328 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1782,14 +1782,14 @@ void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_BWP_DownlinkDedicated_t *bwp_Dedicated = SpCellConfig->spCellConfigDedicated->initialDownlinkBWP; set_dl_mcs_table(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing, - uecap, bwp_Dedicated, scc); + uecap, SpCellConfig, bwp_Dedicated, scc); struct NR_ServingCellConfig__downlinkBWP_ToAddModList *DL_BWP_list = SpCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList; if (DL_BWP_list) { for (int i=0; ilist.count; i++){ NR_BWP_Downlink_t *bwp = DL_BWP_list->list.array[i]; int scs = bwp->bwp_Common->genericParameters.subcarrierSpacing; - set_dl_mcs_table(scs, uecap, bwp->bwp_Dedicated, carrier->servingcellconfigcommon); + set_dl_mcs_table(scs, uecap, SpCellConfig,bwp->bwp_Dedicated, carrier->servingcellconfigcommon); } } } diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index 3cde364fb8..87543da5f9 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -172,6 +172,7 @@ void nr_rrc_config_ul_tda(NR_ServingCellConfigCommon_t *scc, int min_fb_delay){ void set_dl_mcs_table(int scs, NR_UE_NR_Capability_t *cap, + NR_SpCellConfig_t *SpCellConfig, NR_BWP_DownlinkDedicated_t *bwp_Dedicated, NR_ServingCellConfigCommon_t *scc) { @@ -210,6 +211,17 @@ void set_dl_mcs_table(int scs, NR_UE_NR_Capability_t *cap, if(bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table == NULL) bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table = calloc(1, sizeof(*bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table)); *bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table = NR_PDSCH_Config__mcs_Table_qam256; +// set table 2 in correct entry in SpCellConfig->spCellConfigDedicated->csi_MeasConfig->csi_ReportConfigToAddModList->list + AssertFatal(SpCellConfig!=NULL,"SpCellConfig shouldn't be null\n"); + AssertFatal(SpCellConfig->spCellConfigDedicated!=NULL,"SpCellConfigDedicated shouldn't be null\n"); + if (SpCellConfig->spCellConfigDedicated->csi_MeasConfig && + SpCellConfig->spCellConfigDedicated->csi_MeasConfig->present== NR_SetupRelease_CSI_MeasConfig_PR_setup && + SpCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup && + SpCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup->csi_ReportConfigToAddModList) + for (int i=0;ispCellConfigDedicated->csi_MeasConfig->choice.setup->csi_ReportConfigToAddModList->list.count;i++) { + if (SpCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup->csi_ReportConfigToAddModList->list.array[i]->cqi_Table) + *SpCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup->csi_ReportConfigToAddModList->list.array[i]->cqi_Table=NR_CSI_ReportConfig__cqi_Table_table2; + } } else bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table = NULL; diff --git a/openair2/RRC/NR/nr_rrc_config.h b/openair2/RRC/NR/nr_rrc_config.h index 1a0d091e35..16a92b9a7e 100644 --- a/openair2/RRC/NR/nr_rrc_config.h +++ b/openair2/RRC/NR/nr_rrc_config.h @@ -114,6 +114,7 @@ typedef struct physicalcellgroup_s{ void nr_rrc_config_dl_tda(NR_ServingCellConfigCommon_t *scc); void nr_rrc_config_ul_tda(NR_ServingCellConfigCommon_t *scc, int min_fb_delay); void set_dl_mcs_table(int scs, NR_UE_NR_Capability_t *cap, + NR_SpCellConfig_t *SpCellConfig, NR_BWP_DownlinkDedicated_t *bwp_Dedicated, NR_ServingCellConfigCommon_t *scc); void prepare_sim_uecap(NR_UE_NR_Capability_t *cap, diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 35412f4c0c..747db7878c 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -605,7 +605,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternGroup1=NULL; bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternGroup2=NULL; bwp->bwp_Dedicated->pdsch_Config->choice.setup->rbg_Size=NR_PDSCH_Config__rbg_Size_config1; - set_dl_mcs_table(bwp->bwp_Common->genericParameters.subcarrierSpacing, uecap, bwp->bwp_Dedicated, servingcellconfigcommon); + set_dl_mcs_table(bwp->bwp_Common->genericParameters.subcarrierSpacing, uecap, secondaryCellGroup->spCellConfig, bwp->bwp_Dedicated, servingcellconfigcommon); bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI)); *bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = NR_PDSCH_Config__maxNrofCodeWordsScheduledByDCI_n1; bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.present = NR_PDSCH_Config__prb_BundlingType_PR_staticBundling; From 1ab1fde7b83c4b57582cd43c1a34672a8fa17d65 Mon Sep 17 00:00:00 2001 From: francescomani Date: Fri, 11 Mar 2022 14:00:30 +0100 Subject: [PATCH 032/114] fix for fdd and other warnings --- executables/nr-softmodem.c | 2 +- openair2/LAYER2/NR_MAC_gNB/config.c | 8 ++------ openair2/RRC/NR/MESSAGES/asn1_msg.c | 1 + openair2/RRC/NR/nr_rrc_config.c | 8 ++------ 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 2fe6c86b41..1c75d9a155 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -741,7 +741,7 @@ int main( int argc, char **argv ) { RC.ru[ru_id]->rf_map.card=0; RC.ru[ru_id]->rf_map.chain=CC_id+chain_offset; if (ru_id==0) sl_ahead = RC.ru[ru_id]->sl_ahead; - else AssertFatal(RC.ru[ru_id]->sl_ahead != RC.ru[0]->sl_ahead,"RU %d has different sl_ahead %d than RU 0 %d\n",RC.ru[ru_id]->sl_ahead,RC.ru[0]->sl_ahead); + else AssertFatal(RC.ru[ru_id]->sl_ahead != RC.ru[0]->sl_ahead,"RU %d has different sl_ahead %d than RU 0 %d\n",ru_id,RC.ru[ru_id]->sl_ahead,RC.ru[0]->sl_ahead); } } diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index aaa97fea87..943bb04cb7 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -446,11 +446,8 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, AssertFatal(RC.nrmac[Mod_idP]->UL_tti_req_ahead[0], "could not allocate memory for RC.nrmac[]->UL_tti_req_ahead[]\n"); /* fill in slot/frame numbers: slot is fixed, frame will be updated by scheduler - extern sf_ahead is initialized in ru_thread but that function is not executed yet here*/ - const uint16_t sf_ahead = (uint16_t) ceil((float)6/(0x01<<(*scc->ssbSubcarrierSpacing))); - const uint16_t sl_ahead = sf_ahead * (0x01<<(*scc->ssbSubcarrierSpacing)); - /* consider that scheduler runs sl_ahead: the first sl_ahead slots are - * already "in the past" and thus we put frame 1 instead of 0!*/ + * consider that scheduler runs sl_ahead: the first sl_ahead slots are + * already "in the past" and thus we put frame 1 instead of 0! */ for (int i = 0; i < n; ++i) { nfapi_nr_ul_tti_request_t *req = &RC.nrmac[Mod_idP]->UL_tti_req_ahead[0][i]; req->SFN = i < (RC.nrmac[Mod_idP]->if_inst->sl_ahead-1); @@ -667,7 +664,6 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT); - return(0); }// END rrc_mac_config_req_gNB diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 1bbecb3328..1830a3ca3a 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -41,6 +41,7 @@ #include #include +#include "LAYER2/nr_rlc/nr_rlc_oai_api.h" #include "asn1_msg.h" #include "../nr_rrc_proto.h" #include "RRC/NR/nr_rrc_extern.h" diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index 87543da5f9..2dbb8c93d5 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -110,13 +110,10 @@ void nr_rrc_config_ul_tda(NR_ServingCellConfigCommon_t *scc, int min_fb_delay){ //TODO change to accomodate for SRS lte_frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); - int temp_min_delay; + int temp_min_delay = 6; // k2 = 2 or 3 won'r work as well as higher values if(frame_type==TDD && scc->tdd_UL_DL_ConfigurationCommon) { - + switch (scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity) { - default: - temp_min_delay = 6; - break; case NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms2p5: // 30kHz SCS case NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms2: // 60kHz SCS case NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms1p25: // 60kHz SCS @@ -128,7 +125,6 @@ void nr_rrc_config_ul_tda(NR_ServingCellConfigCommon_t *scc, int min_fb_delay){ } } - int k2 = (min_fb_delay Date: Fri, 18 Mar 2022 18:51:22 +0100 Subject: [PATCH 033/114] removal of some logs. Temporary suppression of QAM256 for 5G Records testing --- openair1/PHY/CODING/nr_rate_matching.c | 2 +- openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c | 18 ++++++++-- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 4 +-- openair1/SCHED_NR/nr_prach_procedures.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 34 +++++++++---------- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 14 ++++---- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 2 +- openair2/RRC/NR/MESSAGES/asn1_msg.c | 4 +-- 8 files changed, 47 insertions(+), 33 deletions(-) diff --git a/openair1/PHY/CODING/nr_rate_matching.c b/openair1/PHY/CODING/nr_rate_matching.c index 29cba0a557..e693e8542a 100644 --- a/openair1/PHY/CODING/nr_rate_matching.c +++ b/openair1/PHY/CODING/nr_rate_matching.c @@ -409,7 +409,7 @@ int nr_rate_matching_ldpc(uint8_t Ilbrm, #endif if (Foffset > E) { - LOG_E(PHY,"nr_rate_matching: invalid parameters (Foffset %d > E %d)\n",Foffset,E); + LOG_E(PHY,"nr_rate_matching: invalid parameters (Foffset %d > E %d) F %d, k0 %d, Ncb %d, rvidx %d, Ilbrm %d\n",Foffset,E,F, ind, Ncb, rvidx, Ilbrm); return -1; } if (Foffset > Ncb) { diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c index cdf0e6c152..8803e6ff26 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c @@ -218,14 +218,14 @@ void ldpc8blocks( void *p) { #endif uint32_t E = nr_get_E(G, impp->n_segments, mod_order, rel15->nrOfLayers, rr); //#ifdef DEBUG_DLSCH_CODING - LOG_D(NR_PHY,"Rate Matching, Code segment %d/%d (coded bits (G) %u, E %d, Filler bits %d, Filler offset %d mod_order %d, nb_rb %d)...\n", + LOG_D(NR_PHY,"Rate Matching, Code segment %d/%d (coded bits (G) %u, E %d, Filler bits %d, Filler offset %d mod_order %d, nb_rb %d,nrOfLayer %d)...\n", rr, impp->n_segments, G, E, impp->F, Kr-impp->F-2*(*impp->Zc), - mod_order,nb_rb); + mod_order,nb_rb,rel15->nrOfLayers); // for tbslbrm calculation according to 5.4.2.1 of 38.212 uint8_t Nl = 4; @@ -248,6 +248,20 @@ void ldpc8blocks( void *p) { Kr-impp->F-2*(*impp->Zc), rel15->rvIndex[0], E); + if (Kr-impp->F-2*(*impp->Zc)> E) { + LOG_E(PHY,"dlsch coding A %d Kr %d G %d (nb_rb %d, nb_symb_sch %d, nb_re_dmrs %d, length_dmrs %d, mod_order %d)\n", + A,impp->K,G, nb_rb,nb_symb_sch,nb_re_dmrs,length_dmrs,(int)mod_order); + + LOG_E(NR_PHY,"Rate Matching, Code segment %d/%d (coded bits (G) %u, E %d, Kr %d, Filler bits %d, Filler offset %d mod_order %d, nb_rb %d)...\n", + rr, + impp->n_segments, + G, + E, + Kr, + impp->F, + Kr-impp->F-2*(*impp->Zc), + mod_order,nb_rb); + } #ifdef DEBUG_DLSCH_CODING for (int i =0; i<16; i++) diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index beab48b977..7e4f9a9eaa 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -439,7 +439,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_pdu->harq->harq_confidence_level = no_conf ? 1 : 0; uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1); uci_pdu->harq->harq_list[0].harq_value = !(index&0x01); - if (no_conf) LOG_I(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ value %d (0 pass, 1 fail) with confidence level %d (0 is good, 1 is bad) xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d, energy %f, sync_pos %d\n", + LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ value %d (0 pass, 1 fail) with confidence level %d (0 is good, 1 is bad) xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d, energy %f, sync_pos %d\n", frame,slot,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10,10*log10((double)sigenergy),gNB->ulsch_stats[0].sync_pos); if (pucch_pdu->sr_flag == 1) { @@ -458,7 +458,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_pdu->harq->harq_list[1].harq_value = !(index&0x01); uci_pdu->harq->harq_list[0].harq_value = !((index>>1)&0x01); - if (no_conf) LOG_I(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ values %d (0 pass, 1 fail) and %d with confidence level %d (0 is good, 1 is bad), xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d,sync_pos %d\n", + LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ values %d (0 pass, 1 fail) and %d with confidence level %d (0 is good, 1 is bad), xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d,sync_pos %d\n", frame,slot,uci_pdu->harq->harq_list[1].harq_value,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10,gNB->ulsch_stats[0].sync_pos); if (pucch_pdu->sr_flag == 1) { uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); diff --git a/openair1/SCHED_NR/nr_prach_procedures.c b/openair1/SCHED_NR/nr_prach_procedures.c index b0f59d5f47..7b5b6d22ff 100644 --- a/openair1/SCHED_NR/nr_prach_procedures.c +++ b/openair1/SCHED_NR/nr_prach_procedures.c @@ -173,7 +173,7 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) { if ((gNB->prach_energy_counter == 100) && (max_preamble_energy[0] > gNB->measurements.prach_I0+gNB->prach_thres)) { - LOG_I(NR_PHY,"[gNB %d][RAPROC] Frame %d, slot %d Initiating RA procedure with preamble %d, energy %d.%d dB (I0 %d, thres %d), delay %d start symbol %u freq index %u\n", + LOG_D(NR_PHY,"[gNB %d][RAPROC] Frame %d, slot %d Initiating RA procedure with preamble %d, energy %d.%d dB (I0 %d, thres %d), delay %d start symbol %u freq index %u\n", gNB->Mod_id, frame, slot, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index fe0ba251cb..19145aadb9 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -228,7 +228,7 @@ void find_SSB_and_RO_available(module_id_t module_idP) { cc->total_prach_occasions = total_RA_occasions - unused_RA_occasion; cc->num_active_ssb = num_active_ssb; - LOG_I(NR_MAC, + LOG_D(NR_MAC, "Total available RO %d, num of active SSB %d: unused RO = %d association_period %u N_RA_sfn %u total_prach_occasions_per_config_period %u\n", cc->total_prach_occasions, cc->num_active_ssb, @@ -676,7 +676,7 @@ void nr_initiate_ra_proc(module_id_t module_idP, ra->preamble_index = preamble_index; ra->beam_id = beam_index; - LOG_I(NR_MAC, + LOG_D(NR_MAC, "[gNB %d][RAPROC] CC_id %d Frame %d Activating Msg2 generation in frame %d, slot %d using RA rnti %x SSB " "index %u RA index %d\n", module_idP, @@ -791,7 +791,7 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t return; } - LOG_I(NR_MAC, "[gNB %d][RAPROC] Frame %d, Slot %d : CC_id %d Scheduling retransmission of Msg3 in (%d,%d)\n", + LOG_D(NR_MAC, "[gNB %d][RAPROC] Frame %d, Slot %d : CC_id %d Scheduling retransmission of Msg3 in (%d,%d)\n", module_idP, frame, slot, CC_id, sched_frame, sched_slot); nfapi_nr_ul_tti_request_t *future_ul_tti_req = &RC.nrmac[module_idP]->UL_tti_req_ahead[CC_id][sched_slot]; @@ -946,7 +946,7 @@ void nr_get_Msg3alloc(module_id_t module_id, k2 = *pusch_TimeDomainAllocationList->list.array[i]->k2; int start_symbol_index,nr_of_symbols; SLIV2SL(pusch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength, &start_symbol_index, &nr_of_symbols); - LOG_I(NR_MAC,"Checking Msg3 TDA %d : k2 %d, sliv %d,S %d L %d\n",i,(int)k2,(int)pusch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength,start_symbol_index,nr_of_symbols); + LOG_D(NR_MAC,"Checking Msg3 TDA %d : k2 %d, sliv %d,S %d L %d\n",i,(int)k2,(int)pusch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength,start_symbol_index,nr_of_symbols); // we want to transmit in the uplink symbols of mixed slot AND assuming Msg2 was in the mixed slot if ((k2 + DELTA[mu])%nb_slots_per_period == 0) { temp_slot = current_slot + k2 + DELTA[mu]; // msg3 slot according to 8.3 in 38.213 @@ -987,7 +987,7 @@ void nr_get_Msg3alloc(module_id_t module_id, tdd_beam_association[num_tdd_period] = ra->beam_id; } - LOG_I(NR_MAC, "[RAPROC] Msg3 slot %d: current slot %u Msg3 frame %u k2 %u Msg3_tda_id %u\n", ra->Msg3_slot, current_slot, ra->Msg3_frame, k2,ra->Msg3_tda_id); + LOG_D(NR_MAC, "[RAPROC] Msg3 slot %d: current slot %u Msg3 frame %u k2 %u Msg3_tda_id %u\n", ra->Msg3_slot, current_slot, ra->Msg3_frame, k2,ra->Msg3_tda_id); uint16_t *vrb_map_UL = &RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[ra->Msg3_slot * MAX_BWP_SIZE]; @@ -1156,7 +1156,7 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t fh = ubwp->bwp_Dedicated->pusch_Config->choice.setup->frequencyHopping ? 1 : 0; } - LOG_I(NR_MAC, "Frame %d, Slot %d Adding Msg3 UL Config Request for (%d,%d) : (%d,%d,%d) for rnti: %d\n", + LOG_D(NR_MAC, "Frame %d, Slot %d Adding Msg3 UL Config Request for (%d,%d) : (%d,%d,%d) for rnti: %d\n", frameP, slotP, ra->Msg3_frame, @@ -1310,7 +1310,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra dl_req->nPDUs+=1; nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15; - LOG_A(NR_MAC,"[gNB %d][RAPROC] CC_id %d Frame %d, slotP %d: Generating RA-Msg2 DCI, rnti 0x%x, state %d, CoreSetType %d\n", + LOG_D(NR_MAC,"[gNB %d][RAPROC] CC_id %d Frame %d, slotP %d: Generating RA-Msg2 DCI, rnti 0x%x, state %d, CoreSetType %d\n", module_idP, CC_id, frameP, slotP, ra->RA_rnti, ra->state,pdcch_pdu_rel15->CoreSetType); // SCF222: PDU index incremented for each PDSCH PDU sent in TX control message. This is used to associate control @@ -1471,9 +1471,9 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra nr_add_msg3(module_idP, CC_id, frameP, slotP, ra, (uint8_t *) &tx_req->TLVs[0].value.direct[0]); if(ra->cfra) { - LOG_I(NR_MAC, "Frame %d, Subframe %d: Setting RA-Msg3 reception (CFRA) for SFN.Slot %d.%d\n", frameP, slotP, ra->Msg3_frame, ra->Msg3_slot); + LOG_D(NR_MAC, "Frame %d, Subframe %d: Setting RA-Msg3 reception (CFRA) for SFN.Slot %d.%d\n", frameP, slotP, ra->Msg3_frame, ra->Msg3_slot); } - else LOG_I(NR_MAC, "Frame %d, Subframe %d: Setting RA-Msg3 reception (CBRA) for SFN.Slot %d.%d\n", frameP, slotP, ra->Msg3_frame, ra->Msg3_slot); + else LOG_D(NR_MAC, "Frame %d, Subframe %d: Setting RA-Msg3 reception (CBRA) for SFN.Slot %d.%d\n", frameP, slotP, ra->Msg3_frame, ra->Msg3_slot); T(T_GNB_MAC_DL_RAR_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), T_INT(ra->RA_rnti), T_INT(frameP), T_INT(slotP), T_INT(0), T_BUFFER(&tx_req->TLVs[0].value.direct[0], tx_req->TLVs[0].length)); @@ -1749,7 +1749,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra dl_req->nPDUs+=1; nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15; - LOG_A(NR_MAC, "[gNB %d] [RAPROC] CC_id %d Frame %d, slotP %d: Generating RA-Msg4 DCI, state %d\n", module_idP, CC_id, frameP, slotP, ra->state); + LOG_D(NR_MAC, "[gNB %d] [RAPROC] CC_id %d Frame %d, slotP %d: Generating RA-Msg4 DCI, state %d\n", module_idP, CC_id, frameP, slotP, ra->state); // SCF222: PDU index incremented for each PDSCH PDU sent in TX control message. This is used to associate control // information to data and is reset every slot. @@ -1823,7 +1823,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra dci_payload.pucch_resource_indicator = delta_PRI; // This is delta_PRI from 9.2.1 in 38.213 dci_payload.pdsch_to_harq_feedback_timing_indicator.val = pucch->timing_indicator; - LOG_I(NR_MAC, + LOG_D(NR_MAC, "[RAPROC] DCI 1_0 payload: freq_alloc %d (%d,%d,%d), time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d pucchres %d harqtiming %d\n", dci_payload.frequency_domain_assignment.val, pdsch_pdu_rel15->rbStart, @@ -1836,7 +1836,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra dci_payload.pucch_resource_indicator, dci_payload.pdsch_to_harq_feedback_timing_indicator.val); - LOG_I(NR_MAC, + LOG_D(NR_MAC, "[RAPROC] DCI params: rnti 0x%x, rnti_type %d, dci_format %d coreset params: FreqDomainResource %llx, start_symbol %d n_symb %d, BWPsize %d\n", pdcch_pdu_rel15->dci_pdu[0].RNTI, NR_RNTI_TC, @@ -1906,7 +1906,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra if(ra->msg3_dcch_dtch) { // If the UE used MSG3 to transfer a DCCH or DTCH message, then contention resolution is successful upon transmission of PDCCH - LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) CBRA procedure succeeded!\n", UE_id, ra->rnti); + LOG_D(NR_MAC, "(ue %i, rnti 0x%04x) CBRA procedure succeeded!\n", UE_id, ra->rnti); nr_clear_ra_proc(module_idP, CC_id, frameP, ra); UE_info->active[UE_id] = true; UE_info->Msg4_ACKed[UE_id] = true; @@ -1939,12 +1939,12 @@ void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_fram if (harq->is_waiting == 0) { if (harq->round == 0) { if (stats->dlsch_errors == 0) { - LOG_A(NR_MAC, "(ue %i, rnti 0x%04x) Received Ack of RA-Msg4. CBRA procedure succeeded!\n", UE_id, ra->rnti); + LOG_D(NR_MAC, "(ue %i, rnti 0x%04x) Received Ack of RA-Msg4. CBRA procedure succeeded!\n", UE_id, ra->rnti); UE_info->active[UE_id] = true; UE_info->Msg4_ACKed[UE_id] = true; } else { - LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) RA Procedure failed at Msg4!\n", UE_id, ra->rnti); + LOG_D(NR_MAC, "(ue %i, rnti 0x%04x) RA Procedure failed at Msg4!\n", UE_id, ra->rnti); } nr_clear_ra_proc(module_id, CC_id, frame, ra); @@ -1953,7 +1953,7 @@ void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_fram } } else { - LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) Received Nack of RA-Msg4. Preparing retransmission!\n", UE_id, ra->rnti); + LOG_D(NR_MAC, "(ue %i, rnti 0x%04x) Received Nack of RA-Msg4. Preparing retransmission!\n", UE_id, ra->rnti); ra->Msg4_frame = (frame + 1) % 1024; ra->Msg4_slot = 1; ra->state = Msg4; @@ -2010,7 +2010,7 @@ void nr_fill_rar(uint8_t Mod_idP, uint8_t * dlsch_buffer, nfapi_nr_pusch_pdu_t *pusch_pdu){ - LOG_I(NR_MAC, "[gNB] Generate RAR MAC PDU frame %d slot %d preamble index %u TA command %d \n", ra->Msg2_frame, ra-> Msg2_slot, ra->preamble_index, ra->timing_offset); + LOG_D(NR_MAC, "[gNB] Generate RAR MAC PDU frame %d slot %d preamble index %u TA command %d \n", ra->Msg2_frame, ra-> Msg2_slot, ra->preamble_index, ra->timing_offset); NR_RA_HEADER_BI *rarbi = (NR_RA_HEADER_BI *) dlsch_buffer; NR_RA_HEADER_RAPID *rarh = (NR_RA_HEADER_RAPID *) (dlsch_buffer + 1); NR_MAC_RAR *rar = (NR_MAC_RAR *) (dlsch_buffer + 2); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 342880f293..30d484ae08 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -756,20 +756,20 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, continue; if(no_sig) { - LOG_W(NR_MAC, "Random Access %i failed at state %i (no signal)\n", i, ra->state); + LOG_D(NR_MAC, "Random Access %i failed at state %i (no signal)\n", i, ra->state); nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti); nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); } else { // random access pusch with TC-RNTI if (ra->rnti != current_rnti) { - LOG_W(NR_MAC, + LOG_D(NR_MAC, "expected TC_RNTI %04x to match current RNTI %04x\n", ra->rnti, current_rnti); if( (frameP==ra->Msg3_frame) && (slotP==ra->Msg3_slot) ) { - LOG_W(NR_MAC, "Random Access %i failed at state %i (TC_RNTI %04x RNTI %04x)\n", i, ra->state,ra->rnti,current_rnti); + LOG_D(NR_MAC, "Random Access %i failed at state %i (TC_RNTI %04x RNTI %04x)\n", i, ra->state,ra->rnti,current_rnti); nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti); nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); } @@ -781,7 +781,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, UE_id = add_new_nr_ue(gnb_mod_idP, ra->rnti, ra->CellGroup); if (UE_id<0) { - LOG_W(NR_MAC, "Random Access %i discarded at state %i (TC_RNTI %04x RNTI %04x): max number of users achieved!\n", i, ra->state,ra->rnti,current_rnti); + LOG_D(NR_MAC, "Random Access %i discarded at state %i (TC_RNTI %04x RNTI %04x): max number of users achieved!\n", i, ra->state,ra->rnti,current_rnti); nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti); nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); return; @@ -877,20 +877,20 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, // for CFRA (NSA) do not schedule retransmission of msg3 if (ra->cfra) { - LOG_W(NR_MAC, "Random Access %i failed at state %i (NSA msg3 reception failed)\n", i, ra->state); + LOG_D(NR_MAC, "Random Access %i failed at state %i (NSA msg3 reception failed)\n", i, ra->state); nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti); nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); return; } if (ra->msg3_round >= MAX_HARQ_ROUNDS - 1) { - LOG_W(NR_MAC, "Random Access %i failed at state %i (Reached msg3 max harq rounds)\n", i, ra->state); + LOG_D(NR_MAC, "Random Access %i failed at state %i (Reached msg3 max harq rounds)\n", i, ra->state); nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti); nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); return; } - LOG_W(NR_MAC, "Random Access %i Msg3 CRC did not pass)\n", i); + LOG_D(NR_MAC, "Random Access %i Msg3 CRC did not pass)\n", i); ra->msg3_round++; ra->state = Msg3_retransmission; } diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index ad4ab7da05..c860d847d9 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -77,7 +77,7 @@ void handle_nr_rach(NR_UL_IND_t *UL_info) bool in_timewindow = frame_diff == 0 || (frame_diff == 1 && UL_info->slot < 7); if (UL_info->rach_ind.number_of_pdus > 0 && in_timewindow) { - LOG_A(MAC,"UL_info[Frame %d, Slot %d] Calling initiate_ra_proc RACH:SFN/SLOT:%d/%d\n", + LOG_D(MAC,"UL_info[Frame %d, Slot %d] Calling initiate_ra_proc RACH:SFN/SLOT:%d/%d\n", UL_info->frame, UL_info->slot, UL_info->rach_ind.sfn, UL_info->rach_ind.slot); for (int i = 0; i < UL_info->rach_ind.number_of_pdus; i++) { UL_info->rach_ind.number_of_pdus--; diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 1830a3ca3a..02c42b4e5f 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1783,14 +1783,14 @@ void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_BWP_DownlinkDedicated_t *bwp_Dedicated = SpCellConfig->spCellConfigDedicated->initialDownlinkBWP; set_dl_mcs_table(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing, - uecap, SpCellConfig, bwp_Dedicated, scc); + NULL/*uecap*/, SpCellConfig, bwp_Dedicated, scc); struct NR_ServingCellConfig__downlinkBWP_ToAddModList *DL_BWP_list = SpCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList; if (DL_BWP_list) { for (int i=0; ilist.count; i++){ NR_BWP_Downlink_t *bwp = DL_BWP_list->list.array[i]; int scs = bwp->bwp_Common->genericParameters.subcarrierSpacing; - set_dl_mcs_table(scs, uecap, SpCellConfig,bwp->bwp_Dedicated, carrier->servingcellconfigcommon); + set_dl_mcs_table(scs, NULL,/*uecap,*/ SpCellConfig,bwp->bwp_Dedicated, carrier->servingcellconfigcommon); } } } From 3dc7da3b2269c9902bc58f5339a48e41833f88b8 Mon Sep 17 00:00:00 2001 From: francescomani Date: Sun, 20 Mar 2022 15:08:56 +0100 Subject: [PATCH 034/114] fix for bad merge issues --- openair1/PHY/NR_TRANSPORT/nr_dlsch.c | 12 +----------- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 4 ++-- openair1/SIMULATION/NR_PHY/dlsim.c | 2 +- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 1 - 4 files changed, 4 insertions(+), 15 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index 89ba28b0c3..de3a1d274a 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -241,7 +241,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, #ifdef DEBUG_DLSCH_MAPPING uint8_t dmrs_symbol = l0+l_prime; - printf("DMRS Type %d params for ap %d: Wt %d %d \t Wf %d %d \t delta %d \t l_prime %d \t l0 %d\tDMRS symbol %d\n", + printf("DMRS Type %d params for nl %d: Wt %d %d \t Wf %d %d \t delta %d \t l_prime %d \t l0 %d\tDMRS symbol %d\n", 1+dmrs_Type,nl, Wt[0], Wt[1], Wf[0], Wf[1], delta, l_prime, l0, dmrs_symbol); #endif @@ -338,13 +338,8 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (beta_ptrs*amp*mod_ptrs[(ptrs_idx<<1) + 1])>> 15; #ifdef DEBUG_DLSCH_MAPPING printf("ptrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t txdataF: %d %d, mod_ptrs: %d %d\n", -<<<<<<< HEAD - ptrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)], - ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)],mod_ptrs[ptrs_idx<<1],mod_ptrs[(ptrs_idx<<1)+1]); -======= ptrs_idx, l, k, k_prime, n, ((int16_t*)txdataF_precoding[nl])[((l*frame_parms->ofdm_symbol_size + k)<<1)], ((int16_t*)txdataF_precoding[nl])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1],mod_ptrs[ptrs_idx<<1],mod_ptrs[(ptrs_idx<<1)+1]); ->>>>>>> origin/develop #endif ptrs_idx++; } @@ -354,13 +349,8 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (amp * tx_layers[nl][(m<<1) + 1]) >> 15; #ifdef DEBUG_DLSCH_MAPPING printf("m %d\t l %d \t k %d \t txdataF: %d %d\n", -<<<<<<< HEAD - m, l, k, txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1)], - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1]); -======= m, l, k, txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1)], txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1]); ->>>>>>> origin/develop #endif m++; } diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index beab48b977..7e4f9a9eaa 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -439,7 +439,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_pdu->harq->harq_confidence_level = no_conf ? 1 : 0; uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1); uci_pdu->harq->harq_list[0].harq_value = !(index&0x01); - if (no_conf) LOG_I(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ value %d (0 pass, 1 fail) with confidence level %d (0 is good, 1 is bad) xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d, energy %f, sync_pos %d\n", + LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ value %d (0 pass, 1 fail) with confidence level %d (0 is good, 1 is bad) xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d, energy %f, sync_pos %d\n", frame,slot,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10,10*log10((double)sigenergy),gNB->ulsch_stats[0].sync_pos); if (pucch_pdu->sr_flag == 1) { @@ -458,7 +458,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_pdu->harq->harq_list[1].harq_value = !(index&0x01); uci_pdu->harq->harq_list[0].harq_value = !((index>>1)&0x01); - if (no_conf) LOG_I(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ values %d (0 pass, 1 fail) and %d with confidence level %d (0 is good, 1 is bad), xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d,sync_pos %d\n", + LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ values %d (0 pass, 1 fail) and %d with confidence level %d (0 is good, 1 is bad), xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d,sync_pos %d\n", frame,slot,uci_pdu->harq->harq_list[1].harq_value,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10,gNB->ulsch_stats[0].sync_pos); if (pucch_pdu->sr_flag == 1) { uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index f165656f95..e797c01096 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -286,7 +286,7 @@ void nr_dlsim_preprocessor(module_id_t module_id, UE_info->CellGroup[0], sched_ctrl->active_bwp, NULL, - /* tda = */ 0, + /* tda = */ 2, g_nrOfLayers, sched_ctrl, ps); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 9270540d26..c57736990c 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -1154,7 +1154,6 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr (table_7_3_2_3_3_1[dci->antenna_ports.val][2]<<1) + (table_7_3_2_3_3_1[dci->antenna_ports.val][3]<<2) + (table_7_3_2_3_3_1[dci->antenna_ports.val][4]<<3)); - dlsch_config_pdu_1_1->n_front_load_symb = 1; } if ((dmrs_type == NULL) && (max_length != NULL)){ // Table 7.3.1.2.2-2: Antenna port(s) (1000 + DMRS port), dmrs-Type=1, maxLength=2 From 3387a94ae3008c35b7c3e271cd9ef90b5200d762 Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 23 Mar 2022 15:47:07 +0100 Subject: [PATCH 035/114] fix for fr2 sl_ahead --- .../conf_files/gnb.band261.tm1.32PRB.usrpn300.conf | 1 + openair1/PHY/NR_UE_TRANSPORT/nr_prach.c | 9 ++++++--- openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h | 2 +- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 4 ++-- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf index e8c6cab1b4..0bb8346f6a 100644 --- a/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf @@ -227,6 +227,7 @@ RUs = ( att_tx = 0; att_rx = 0; bands = [7]; + sl_ahead = 12; max_pdschReferenceSignalPower = -27; max_rxgain = 75; eNB_instances = [0]; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c index 24299fd788..4927fe37a2 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c @@ -57,7 +57,7 @@ extern const char *prachfmt[]; // - idft for short sequence assumes we are transmitting starting in symbol 0 of a PRACH slot // - Assumes that PRACH SCS is same as PUSCH SCS @ 30 kHz, take values for formats 0-2 and adjust for others below // - Preamble index different from 0 is not detected by gNB -int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ +int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, int frame, uint8_t slot){ NR_DL_FRAME_PARMS *fp=&ue->frame_parms; fapi_nr_config_request_t *nrUE_config = &ue->nrUE_config; @@ -190,8 +190,9 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ // now generate PRACH signal #ifdef NR_PRACH_DEBUG if (NCS>0) - LOG_I(PHY, "PRACH [UE %d] generate PRACH in slot %d for RootSeqIndex %d, Preamble Index %d, PRACH Format %s, NCS %d (N_ZC %d): Preamble_offset %d, Preamble_shift %d msg1 frequency start %d\n", + LOG_I(PHY, "PRACH [UE %d] generate PRACH in frame.slot %d.%d for RootSeqIndex %d, Preamble Index %d, PRACH Format %s, NCS %d (N_ZC %d): Preamble_offset %d, Preamble_shift %d msg1 frequency start %d\n", Mod_id, + frame, slot, rootSequenceIndex, preamble_index, @@ -221,7 +222,9 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ k += kbar; k *= 2; - LOG_I(PHY, "PRACH [UE %d] in slot %d, placing PRACH in position %d, msg1 frequency start %d (k1 %d), preamble_offset %d, first_nonzero_root_idx %d\n", Mod_id, + LOG_I(PHY, "PRACH [UE %d] in frame.slot %d.%d, placing PRACH in position %d, msg1 frequency start %d (k1 %d), preamble_offset %d, first_nonzero_root_idx %d\n", + Mod_id, + frame, slot, k, n_ra_prb, diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h index aac59a7da1..35e30d63bf 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h @@ -1704,7 +1704,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, unsigned char i_mod, unsigned char harq_pid); -int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t subframe); +int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, int frame, uint8_t slot); void dump_nrdlsch(PHY_VARS_NR_UE *ue,uint8_t gNB_id,uint8_t nr_slot_rx,unsigned int *coded_bits_per_codeword,int round, unsigned char harq_pid); /**@}*/ diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index ddddcd09e2..be229f68c3 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -1801,7 +1801,7 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GENERATE_PRACH, VCD_FUNCTION_IN); - prach_power = generate_nr_prach(ue, gNB_id, nr_slot_tx); + prach_power = generate_nr_prach(ue, gNB_id, frame_tx, nr_slot_tx); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GENERATE_PRACH, VCD_FUNCTION_OUT); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 670f337c31..a63419f8e9 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -466,12 +466,12 @@ void nr_schedule_msg2(uint16_t rach_frame, uint16_t rach_slot, uint8_t start_next_period = (rach_slot-(rach_slot%tdd_period_slot)+tdd_period_slot)%nr_slots_per_frame[mu]; *msg2_slot = start_next_period + last_dl_slot_period; // initializing scheduling of slot to next mixed (or last dl) slot *msg2_frame = ((*msg2_slot>(rach_slot))? rach_frame : (rach_frame+1))%1024; - // we can't schedule msg2 before sl_ahead since prach int eff_slot = *msg2_slot+(*msg2_frame-rach_frame)*nr_slots_per_frame[mu]; - if ((eff_slot-rach_slot)<=sl_ahead) { + while ((eff_slot-rach_slot)<=sl_ahead) { *msg2_slot = (*msg2_slot+tdd_period_slot)%nr_slots_per_frame[mu]; *msg2_frame = ((*msg2_slot>(rach_slot))? rach_frame : (rach_frame+1))%1024; + eff_slot = *msg2_slot+(*msg2_frame-rach_frame)*nr_slots_per_frame[mu]; } if (FR==nr_FR2) { int num_tdd_period = *msg2_slot/tdd_period_slot; From ed1c87b59816b3979146f5d33bd33f0f6d597a1f Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Mon, 14 Mar 2022 17:53:57 +0100 Subject: [PATCH 036/114] commit before rebase --- cmake_targets/phy_simulators | 1 - common/utils/lte/ue_power.c | 6 +- executables/nr-uesoftmodem.c | 9 +- .../PHY/NR_ESTIMATION/nr_measurements_gNB.c | 23 ++--- openair1/PHY/NR_TRANSPORT/nr_dci.c | 2 +- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 92 +++++++++++-------- openair1/PHY/NR_UE_TRANSPORT/dci_nr.c | 9 +- .../PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 8 +- openair1/PHY/TOOLS/dB_routines.h | 35 ------- openair1/PHY/TOOLS/tools_defs.h | 22 +++-- openair1/SCHED/sched_common_vars.h | 1 + openair1/SCHED_NR_UE/harq_nr.c | 64 ++++--------- openair2/LAYER2/MAC/config.c | 5 - openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 1 + .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 3 +- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 24 ++--- targets/RT/USER/lte-ue.c | 12 +-- 17 files changed, 125 insertions(+), 192 deletions(-) delete mode 120000 cmake_targets/phy_simulators delete mode 100644 openair1/PHY/TOOLS/dB_routines.h diff --git a/cmake_targets/phy_simulators b/cmake_targets/phy_simulators deleted file mode 120000 index 2a12e92f3e..0000000000 --- a/cmake_targets/phy_simulators +++ /dev/null @@ -1 +0,0 @@ -ran_build/ \ No newline at end of file diff --git a/common/utils/lte/ue_power.c b/common/utils/lte/ue_power.c index b377abf2ff..aaa2826275 100644 --- a/common/utils/lte/ue_power.c +++ b/common/utils/lte/ue_power.c @@ -33,10 +33,8 @@ #include #include #include "PHY/defs_eNB.h" -#include "PHY/TOOLS/dB_routines.h" - -extern int16_t hundred_times_delta_TF[100]; -extern uint16_t hundred_times_log10_NPRB[100]; +#include +#include int16_t estimate_ue_tx_power(int norm,uint32_t tbs, uint32_t nb_rb, uint8_t control_only, int ncp, uint8_t use_srs) { diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 76c21bb422..649b68631b 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -241,14 +241,17 @@ nrUE_params_t *get_nrUE_params(void) { } /* initialie thread pools used for NRUE processing paralleliation */ void init_tpools(uint8_t nun_dlsch_threads) { - char *params = NULL; - params = calloc(1,(NR_RX_NB_TH*NR_NB_TH_SLOT*3)+1); + char params[NR_RX_NB_TH*NR_NB_TH_SLOT*3+1]; for (int i=0; iframe_parms; NR_gNB_COMMON *common_vars = &gNB->common_vars; PHY_MEASUREMENTS_gNB *measurements = &gNB->measurements; - int rb, offset, offset0, nb_symb[275], len; - int32_t *ul_ch; - - LOG_D(PHY,"slot %d Doing I0 for first_symb %d, num_symb %d\n",slot,first_symb,num_symb); + int rb, nb_symb[275]={0}; + + memset(measurements->n0_subband_power, 0, sizeof(measurements->n0_subband_power)); + for (int s=first_symb;s<(first_symb+num_symb);s++) { for (rb=0; rbN_RB_UL; rb++) { - - if (s==first_symb) { - nb_symb[rb]=0; - for (int aarx=0; aarxnb_antennas_rx;aarx++) - measurements->n0_subband_power[aarx][rb]=0; - } - offset0 = (slot&3)*(frame_parms->symbols_per_slot * frame_parms->ofdm_symbol_size) + (frame_parms->first_carrier_offset + (rb*12))%frame_parms->ofdm_symbol_size; + int offset0 = (slot&3)*(frame_parms->symbols_per_slot * frame_parms->ofdm_symbol_size) + + (frame_parms->first_carrier_offset + (rb*12))%frame_parms->ofdm_symbol_size; if ((gNB->rb_mask_ul[s][rb>>5]&(1<<(rb&31))) == 0) { // check that rb was not used in this subframe nb_symb[rb]++; for (int aarx=0; aarxnb_antennas_rx; aarx++) { - offset = offset0 + (s*frame_parms->ofdm_symbol_size); - ul_ch = &common_vars->rxdataF[aarx][offset]; - len = 12; + int offset = offset0 + (s*frame_parms->ofdm_symbol_size); + int32_t *ul_ch = &common_vars->rxdataF[aarx][offset]; + int len = 12; if (((frame_parms->N_RB_UL&1) == 1) && (rb==(frame_parms->N_RB_UL>>1))) { len=6; diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index 0af56ba706..ae96eb26bc 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -132,7 +132,7 @@ void nr_generate_dci(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15, polar_encoder_fast((uint64_t*)dci_pdu->Payload, (void*)encoder_output, n_RNTI, 1, NR_POLAR_DCI_MESSAGE_TYPE, dci_pdu->PayloadSizeBits, dci_pdu->AggregationLevel); -#ifdef DEBUG_CHANNEL_CODING +#if 1 printf("polar rnti %x,length %d, L %d\n",n_RNTI, dci_pdu->PayloadSizeBits,pdcch_pdu_rel15->dci_pdu->AggregationLevel); printf("DCI PDU: [0]->0x%lx \t [1]->0x%lx\n", ((uint64_t*)dci_pdu->Payload)[0], ((uint64_t*)dci_pdu->Payload)[1]); diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index 50c3b62f50..17f145b98a 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -243,7 +243,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, * x(l*12+n) = r_u_v_alpha_delta(n) */ // the value of u,v (delta always 0 for PUCCH) has to be calculated according to TS 38.211 Subclause 6.3.2.2.1 - uint8_t u[2]={0,0},v[2]={0,0}; + uint8_t u[2]={0},v[2]={0}; // x_n contains the sequence r_u_v_alpha_delta(n) @@ -262,7 +262,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, AssertFatal(pucch_pdu->nr_of_symbols < 3,"nr_of_symbols %d not allowed\n",pucch_pdu->nr_of_symbols); - uint32_t re_offset[2]={0,0}; + uint32_t re_offset[2]={0}; uint8_t l2; const int16_t *x_re[2],*x_im[2]; @@ -271,16 +271,11 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, x_re[1] = table_5_2_2_2_2_Re[u[1]]; x_im[1] = table_5_2_2_2_2_Im[u[1]]; - int16_t xr[1+frame_parms->nb_antennas_rx][1+pucch_pdu->nr_of_symbols][24] __attribute__((aligned(32))); + c64_t xr[frame_parms->nb_antennas_rx][pucch_pdu->nr_of_symbols][12] __attribute__((aligned(32))); + memset(xr, 0, sizeof(xr)); int64_t xrtmag=0,xrtmag_next=0; uint8_t maxpos=0; uint8_t index=0; - for (int l=0; lnr_of_symbols; l++) { - for (int aarx=0;aarxnb_antennas_rx;aarx++) { - memset((void*)xr[aarx][l],0,24*sizeof(int16_t)); - } - } - int n2; for (int l=0; lnr_of_symbols; l++) { l2 = l+pucch_pdu->start_symbol_index; @@ -289,23 +284,23 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, re_offset[l]-=frame_parms->ofdm_symbol_size; AssertFatal(re_offset[l]+12 < frame_parms->ofdm_symbol_size,"pucch straddles DC carrier, handle this!\n"); - int16_t *r; for (int aa=0;aanb_antennas_rx;aa++) { - r=(int16_t*)&rxdataF[aa][soffset+(l2*frame_parms->ofdm_symbol_size)+re_offset[l]]; - n2=0; - for (n=0;n<12;n++,n2+=2) { - xr[aa][l][n2] +=(int16_t)(((int32_t)x_re[l][n]*r[n2]+(int32_t)x_im[l][n]*r[n2+1])>>15); - xr[aa][l][n2+1]+=(int16_t)(((int32_t)x_re[l][n]*r[n2+1]-(int32_t)x_im[l][n]*r[n2])>>15); + c16_t *r=(c16_t*)&rxdataF[aa][soffset+(l2*frame_parms->ofdm_symbol_size)+re_offset[l]]; + for (n=0;n<12;n++) { + xr[aa][l][n].r +=(int32_t)x_re[l][n]*r[n].r+(int32_t)x_im[l][n]*r[n].i; + xr[aa][l][n].i +=(int32_t)x_re[l][n]*r[n].i-(int32_t)x_im[l][n]*r[n].r; #ifdef DEBUG_NR_PUCCH_RX - printf("x (%d,%d), r%d.%d (%d,%d), xr (%d,%d)\n", - x_re[l][n],x_im[l][n],l2,re_offset[l],r[n2],r[n2+1],xr[aa][l][n2],xr[aa][l][n2+1]); + printf("x (%d,%d), r%d.%d (%d,%d), xr (%lld,%lld)\n", + x_re[l][n],x_im[l][n],l2,re_offset[l],r[n].r,r[n].i,xr[aa][l][n].r,xr[aa][l][n].i); #endif } + xr[aa][l][n].r>>=15; + xr[aa][l][n].i>>=15; } } - int32_t corr_re[1+frame_parms->nb_antennas_rx][2]; - int32_t corr_im[1+frame_parms->nb_antennas_rx][2]; + int64_t corr_re[frame_parms->nb_antennas_rx][2]; + int64_t corr_im[frame_parms->nb_antennas_rx][2]; //int32_t no_corr = 0; int seq_index = 0; int64_t temp; @@ -322,19 +317,19 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, for (int aa=0;aanb_antennas_rx;aa++) { corr_re[aa][l]=0; corr_im[aa][l]=0; - - n2=0; - for (n=0;n<12;n++,n2+=2) { - corr_re[aa][l]+=(xr[aa][l][n2]*idft12_re[seq_index][n]+xr[aa][l][n2+1]*idft12_im[seq_index][n])>>15; - corr_im[aa][l]+=(xr[aa][l][n2]*idft12_im[seq_index][n]-xr[aa][l][n2+1]*idft12_re[seq_index][n])>>15; + for (n=0;n<12;n++) { + corr_re[aa][l]+=xr[aa][l][n].r*idft12_re[seq_index][n]+xr[aa][l][n].i*idft12_im[seq_index][n]; + corr_im[aa][l]+=xr[aa][l][n].r*idft12_im[seq_index][n]-xr[aa][l][n].i*idft12_re[seq_index][n]; } + corr_re[aa][l]>>=15; + corr_im[aa][l]>>=15; } } - LOG_D(PHY,"PUCCH IDFT[%d/%d] = (%d,%d)=>%f\n", + LOG_D(PHY,"PUCCH IDFT[%d/%d] = (%ld,%ld)=>%f\n", mcs[i],seq_index,corr_re[0][0],corr_im[0][0], 10*log10((double)corr_re[0][0]*corr_re[0][0] + (double)corr_im[0][0]*corr_im[0][0])); if (pucch_pdu->nr_of_symbols==2) - LOG_D(PHY,"PUCCH 2nd symbol IDFT[%d/%d] = (%d,%d)=>%f\n", + LOG_D(PHY,"PUCCH 2nd symbol IDFT[%d/%d] = (%ld,%ld)=>%f\n", mcs[i],seq_index,corr_re[0][1],corr_im[0][1], 10*log10((double)corr_re[0][1]*corr_re[0][1] + (double)corr_im[0][1]*corr_im[0][1])); if (pucch_pdu->freq_hop_flag == 0) { @@ -392,7 +387,8 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_stats->pucch0_n01 = gNB->measurements.n0_subband_power_tot_dB[prb_offset[1]]; LOG_D(PHY,"n00[%d] = %d, n01[%d] = %d\n",prb_offset[0],uci_stats->pucch0_n00,prb_offset[1],uci_stats->pucch0_n01); // estimate CQI for MAC (from antenna port 0 only) - int max_n0 = uci_stats->pucch0_n00>uci_stats->pucch0_n01 ? uci_stats->pucch0_n00:uci_stats->pucch0_n01; + int max_n0 = max(gNB->measurements.n0_subband_power_tot_dB[prb_offset[0]], + gNB->measurements.n0_subband_power_tot_dB[prb_offset[1]]); int SNRtimes10,sigenergy=0; for (int aa=0;aanb_antennas_rx;aa++) sigenergy += signal_energy_nodc(&rxdataF[aa][soffset+ @@ -407,8 +403,16 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_stats->pucch0_thres = gNB->pucch0_thres; /* + (10*max_n0);*/ bool no_conf=false; if (nr_sequences>1) { - if (xrtmag_dBtimes10 < (50+xrtmag_next_dBtimes10) || SNRtimes10 < uci_stats->pucch0_thres) + if (xrtmag_dBtimes10 < (50+xrtmag_next_dBtimes10) || SNRtimes10 < gNB->pucch0_thres) { no_conf=true; + LOG_W(PHY,"%d.%d PUCCH bad confidence: %d threshold, %d, %d, %d\n", + frame, slot, + uci_stats->pucch0_thres, + SNRtimes10, + xrtmag_dBtimes10, + xrtmag_next_dBtimes10); + abort(); + } } gNB->bad_pucch += no_conf; // first bit of bitmap for sr presence and second bit for acknack presence @@ -422,7 +426,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, if (pucch_pdu->bit_len_harq==0) { uci_pdu->harq = NULL; uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); - uci_pdu->sr->sr_confidence_level = no_conf ? 1 : 0; + uci_pdu->sr->sr_confidence_level = no_conf; uci_stats->pucch0_sr_trials++; if (xrtmag_dBtimes10>(10*gNB->measurements.n0_power_tot_dB)) { uci_pdu->sr->sr_indication = 1; @@ -434,17 +438,19 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, else if (pucch_pdu->bit_len_harq==1) { uci_pdu->harq = calloc(1,sizeof(*uci_pdu->harq)); uci_pdu->harq->num_harq = 1; - uci_pdu->harq->harq_confidence_level = no_conf ? 1 : 0; - uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1); + uci_pdu->harq->harq_confidence_level = no_conf; + uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(sizeof *uci_pdu->harq->harq_list); uci_pdu->harq->harq_list[0].harq_value = !(index&0x01); - LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ value %d (0 pass, 1 fail) with confidence level %d (0 is good, 1 is bad) xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d, energy %f, sync_pos %d\n", - frame,slot,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10,10*log10((double)sigenergy),gNB->ulsch_stats[0].sync_pos); + LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ %s with confidence level %s xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d, energy %f, sync_pos %d\n", + frame,slot,uci_pdu->harq->harq_list[0].harq_value==0?"ACK":"NACK", + uci_pdu->harq->harq_confidence_level==0?"good":"bad", + xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10,10*log10((double)sigenergy),gNB->ulsch_stats[0].sync_pos); if (pucch_pdu->sr_flag == 1) { uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); - uci_pdu->sr->sr_indication = (index>1) ? 1 : 0; - uci_pdu->sr->sr_confidence_level = no_conf ? 1 : 0; + uci_pdu->sr->sr_indication = (index>1); + uci_pdu->sr->sr_confidence_level = no_conf; uci_stats->pucch0_positive_SR++; } uci_stats->pucch01_trials++; @@ -452,17 +458,23 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, else { uci_pdu->harq = calloc(1,sizeof(*uci_pdu->harq)); uci_pdu->harq->num_harq = 2; - uci_pdu->harq->harq_confidence_level = (no_conf) ? 1 : 0; - uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(2); + uci_pdu->harq->harq_confidence_level = no_conf; + uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(2 * sizeof( *uci_pdu->harq->harq_list)); uci_pdu->harq->harq_list[1].harq_value = !(index&0x01); uci_pdu->harq->harq_list[0].harq_value = !((index>>1)&0x01); - LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ values %d and %d (0 pass, 1 fail) with confidence level %d (0 is good, 1 is bad), xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d,sync_pos %d\n", - frame,slot,uci_pdu->harq->harq_list[1].harq_value,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10,gNB->ulsch_stats[0].sync_pos); + LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ values (%s, %s) with confidence level %s, xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d,sync_pos %d\n", + frame,slot, + uci_pdu->harq->harq_list[1].harq_value == 0 ? "ACK" : "NACK", + uci_pdu->harq->harq_list[0].harq_value == 0 ? "ACK" : "NACK", + uci_pdu->harq->harq_confidence_level == 0 ? "good" : "bad", + xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0, + uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi, + SNRtimes10,gNB->ulsch_stats[0].sync_pos); if (pucch_pdu->sr_flag == 1) { uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); uci_pdu->sr->sr_indication = (index>3) ? 1 : 0; - uci_pdu->sr->sr_confidence_level = (no_conf) ? 1 : 0; + uci_pdu->sr->sr_confidence_level = no_conf; } } } diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index 5e18f6cc6d..9f0e1bea71 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -817,6 +817,10 @@ void nr_pdcch_unscrambling(int16_t *z, if (((s >> (i % 32)) & 1) == 1) z2[i] = -z[i]; else z2[i]=z[i]; } + printf("Encoded Payload (length:%d dwords):\n", length>>5); + + for (int i=0; i>5; i++) + printf("[%d]->0x%08x \t", i, z2[i]); } @@ -868,6 +872,7 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, int L = rel15->L[j]; // Loop over possible DCI lengths + for (int k = 0; k < rel15->num_dci_options; k++) { // skip this candidate if we've already found one with the // same rnti and format at a different aggregation level @@ -902,8 +907,8 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, NR_POLAR_DCI_MESSAGE_TYPE, dci_length, L); n_rnti = rel15->rnti; - LOG_D(PHY, "(%i.%i) dci indication (rnti %x,dci format %s,n_CCE %d,payloadSize %d)\n", - proc->frame_rx, proc->nr_slot_rx,n_rnti,nr_dci_format_string[rel15->dci_format_options[k]],CCEind,dci_length); + LOG_D(PHY, "(%i.%i) dci indication (rnti %x,dci format %s,n_CCE %d,payloadSize %d,payload %llx )\n", + proc->frame_rx, proc->nr_slot_rx,n_rnti,nr_dci_format_string[rel15->dci_format_options[k]],CCEind,dci_length, *(unsigned long long*)dci_estimation); if (crc == n_rnti) { LOG_D(PHY, "(%i.%i) Received dci indication (rnti %x,dci format %s,n_CCE %d,payloadSize %d,payload %llx)\n", proc->frame_rx, proc->nr_slot_rx,n_rnti,nr_dci_format_string[rel15->dci_format_options[k]],CCEind,dci_length,*(unsigned long long*)dci_estimation); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index 54b7c34608..bf9cfaaa70 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -172,6 +172,7 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint memset(dlsch->harq_processes[i]->d[r],0,5*8448); else exit_flag=2; + } } else { exit_flag=1; @@ -299,17 +300,14 @@ void nr_processDLSegment(void* arg) { K_bits_F = Kr-harq_process->F; t_nrLDPC_time_stats procTime = {0}; - t_nrLDPC_time_stats* p_procTime = &procTime ; t_nrLDPC_procBuf **p_nrLDPC_procBuf = harq_process->p_nrLDPC_procBuf; - int16_t w[5*8448]; - memset(w,0,(5*8448)*sizeof(short)); - start_meas(&rdata->ts_deinterleave); //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING, VCD_FUNCTION_IN); + int16_t w[E]; nr_deinterleaving_ldpc(E, Qm, w, // [hna] w is e @@ -397,7 +395,7 @@ void nr_processDLSegment(void* arg) { (int8_t *)&pl[0], llrProcBuf, p_nrLDPC_procBuf[r], - p_procTime); + &procTime); //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_LDPC, VCD_FUNCTION_OUT); // Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int diff --git a/openair1/PHY/TOOLS/dB_routines.h b/openair1/PHY/TOOLS/dB_routines.h deleted file mode 100644 index 185913cf5b..0000000000 --- a/openair1/PHY/TOOLS/dB_routines.h +++ /dev/null @@ -1,35 +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 - */ - -/* - * dB_routines.h - * - * Created on: Nov 12, 2013 - * Author: winckel - */ - -#ifndef DB_ROUTINES_H_ -#define DB_ROUTINES_H_ - -int16_t dB_fixed_times10(uint32_t x); -int16_t dB_fixed_x10(uint32_t x); - -#endif /* DB_ROUTINES_H_ */ diff --git a/openair1/PHY/TOOLS/tools_defs.h b/openair1/PHY/TOOLS/tools_defs.h index 966e93440e..13ce9d85c7 100644 --- a/openair1/PHY/TOOLS/tools_defs.h +++ b/openair1/PHY/TOOLS/tools_defs.h @@ -39,26 +39,30 @@ extern "C" { #define CEILIDIV(a,b) ((a+b-1)/b) #define ROUNDIDIV(a,b) (((a<<1)+b)/(b<<1)) -struct complexd { +typedef struct complexd { double r; double i; -}; +} cd_t; -struct complexf { +typedef struct complexf { float r; float i; -}; +} cf_t; -struct complex16 { +typedef struct complex16 { int16_t r; int16_t i; -}; +} c16_t; -struct complex32 { +typedef struct complex32 { int32_t r; int32_t i; -}; - +} c32_t; + +typedef struct complex64 { + int64_t r; + int64_t i; +} c64_t; //cmult_sv.h /*!\fn void multadd_real_vector_complex_scalar(int16_t *x,int16_t *alpha,int16_t *y,uint32_t N) diff --git a/openair1/SCHED/sched_common_vars.h b/openair1/SCHED/sched_common_vars.h index 2cae2aa96f..8886e0d576 100644 --- a/openair1/SCHED/sched_common_vars.h +++ b/openair1/SCHED/sched_common_vars.h @@ -20,6 +20,7 @@ */ #include +#include // This is the formula from Section 5.1.1.1 in 36.213 100*10*log10((2^(MPR*Ks)-1)), where MPR is in the range [0,6] and Ks=1.25 diff --git a/openair1/SCHED_NR_UE/harq_nr.c b/openair1/SCHED_NR_UE/harq_nr.c index 4afe5f41d3..6508e2568e 100644 --- a/openair1/SCHED_NR_UE/harq_nr.c +++ b/openair1/SCHED_NR_UE/harq_nr.c @@ -339,55 +339,23 @@ void downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int ndi, int dl_harq->first_rx = 1; } else{ - switch(rv){ - case 0: - dl_harq->round = 0; + LOG_D(PHY,"receive harq process: %p harqPid=%d, rv=%d, ndi=%d, rntiType=%d, DCIndi=%d\n", + dl_harq, harq_pid, rv, ndi, rnti_type, dl_harq->DCINdi); + AssertFatal(rv<4 && rv>=0, "invalid redondancy version %d\n", rv); + if (rv!=0 && dl_harq->ack == DL_NACK) + LOG_D(PHY,"New transmission on a harq pid (%d) never acknowledged\n", harq_pid); + if (rv==0 && ndi == dl_harq->DCINdi ) + LOG_D(PHY,"Missed previous DCI detections. redondancy version is new transmission, but ndi doesn't toogle\n"); + dl_harq->first_rx = (rv==0); + const int rounds[4]={0,3,1,2}; + dl_harq->round = rounds[rv]; dl_harq->status = ACTIVE; - dl_harq->first_rx = 1; - if (dl_harq->DCINdi == ndi) - LOG_E(PHY,"Warning! rv %d indicates new transmission but new ndi %d is the same as old ndi %d\n",rv,ndi,dl_harq->DCINdi); + if (rv!=0 && dl_harq->DCINdi != ndi ) + LOG_E(PHY,"Missed previous DCI detections. redondancy version (%d) is retransmission, but ndi toogle\n", rv); + if (rv!=0 && dl_harq->ack != DL_NACK) + LOG_E(PHY,"Missed previous DCI detections. redondancy version (%d) is retransmission, but status is not DL_NACK\n", rv); dl_harq->DCINdi = ndi; - break; - case 1: - dl_harq->round = 3; - dl_harq->status = ACTIVE; - dl_harq->first_rx = 0; - if (dl_harq->DCINdi != ndi) { - LOG_E(PHY,"Missed previous DCI detections. NDI toggled but rv %d does not correspond to first reception\n",rv); - dl_harq->first_rx = 1; - dl_harq->DCINdi = ndi; - } - else if (dl_harq->ack == 1) - dl_harq->status = SCH_IDLE; - break; - case 2: - dl_harq->round = 1; - dl_harq->status = ACTIVE; - dl_harq->first_rx = 0; - if (dl_harq->DCINdi != ndi) { - LOG_E(PHY,"Missed previous DCI detections. NDI toggled but rv %d does not correspond to first reception\n",rv); - dl_harq->first_rx = 1; - dl_harq->DCINdi = ndi; - } - else if (dl_harq->ack == 1) - dl_harq->status = SCH_IDLE; - break; - case 3: - dl_harq->round = 2; - dl_harq->status = ACTIVE; - dl_harq->first_rx = 0; - if (dl_harq->DCINdi != ndi) { - LOG_E(PHY,"Missed previous DCI detections. NDI toggled but rv %d does not correspond to first reception\n",rv); - dl_harq->first_rx = 1; - dl_harq->DCINdi = ndi; - } - else if (dl_harq->ack == 1) - dl_harq->status = SCH_IDLE; - break; - default: - AssertFatal(1==0,"Invalid value for rv %d\n",rv); - } - } - + //dl_harq->status = SCH_IDLE; + } } diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c index 209275acb3..d22485d23f 100644 --- a/openair2/LAYER2/MAC/config.c +++ b/openair2/LAYER2/MAC/config.c @@ -58,11 +58,6 @@ extern int l2_init_eNB(void); extern void mac_top_init_eNB(void); extern void mac_init_cell_params(int Mod_idP,int CC_idP); - -int32_t **rxdata; -int32_t **txdata; - - typedef struct eutra_bandentry_s { int16_t band; uint32_t ul_min; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index c57736990c..0c339ee70a 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -2092,6 +2092,7 @@ uint8_t get_downlink_ack(NR_UE_MAC_INST_t *mac, pucch->is_common = current_harq->is_common; current_harq->active = false; current_harq->ack_received = false; + LOG_D(PHY,"%d.%d Sent %d ack on harq pid %d\n", frame, slot, current_harq->ack, dl_harq_pid); } } } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index cedc78097e..fad5643370 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -811,6 +811,7 @@ static void handle_dl_harq(module_id_t mod_id, stats->dlsch_errors++; LOG_D(NR_MAC, "retransmission error for UE %d (total %"PRIu64")\n", UE_id, stats->dlsch_errors); } else { + LOG_D(PHY,"NACK for: pid %d, ue %x\n",harq_pid, UE_id); add_tail_nr_list(&UE_info->UE_sched_ctrl[UE_id].retrans_dl_harq, harq_pid); harq->round++; } @@ -1442,7 +1443,7 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id, DevAssert(harq->is_waiting); const int8_t pid = sched_ctrl->feedback_dl_harq.head; remove_front_nr_list(&sched_ctrl->feedback_dl_harq); - LOG_D(NR_MAC,"bit %d pid %d ack/nack %d\n",harq_bit,pid,harq_value); + LOG_D(NR_MAC,"%d.%d bit %d pid %d ack/nack %d\n",frame, slot, harq_bit,pid,harq_value); handle_dl_harq(mod_id, UE_id, pid, harq_value == 0 && harq_confidence == 0); if (harq_confidence == 1) UE_info->mac_stats[UE_id].pucch0_DTX++; } diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index f7323010cb..99897f9060 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -78,13 +78,13 @@ void nrue_init_standalone_socket(int tx_port, int rx_port) int sd = socket(server_address.sin_family, SOCK_DGRAM, 0); if (sd < 0) { - LOG_E(MAC, "Socket creation error standalone PNF\n"); + LOG_E(NR_MAC, "Socket creation error standalone PNF\n"); return; } if (inet_pton(server_address.sin_family, stub_eth_params.remote_addr, &server_address.sin_addr) <= 0) { - LOG_E(MAC, "Invalid standalone PNF Address\n"); + LOG_E(NR_MAC, "Invalid standalone PNF Address\n"); close(sd); return; } @@ -92,7 +92,7 @@ void nrue_init_standalone_socket(int tx_port, int rx_port) // Using connect to use send() instead of sendto() if (connect(sd, (struct sockaddr *)&server_address, addr_len) < 0) { - LOG_E(MAC, "Connection to standalone PNF failed: %s\n", strerror(errno)); + LOG_E(NR_MAC, "Connection to standalone PNF failed: %s\n", strerror(errno)); close(sd); return; } @@ -118,7 +118,7 @@ void nrue_init_standalone_socket(int tx_port, int rx_port) if (bind(sd, (struct sockaddr *)&server_address, addr_len) < 0) { - LOG_E(MAC, "Connection to standalone PNF failed: %s\n", strerror(errno)); + LOG_E(NR_MAC, "Connection to standalone PNF failed: %s\n", strerror(errno)); close(sd); return; } @@ -603,10 +603,6 @@ static void copy_ul_tti_data_req_to_dl_info(nr_downlink_indication_t *dl_info, n pdu_0_1->harq->num_harq = 1; pdu_0_1->harq->harq_confidence_level = 0; pdu_0_1->harq->harq_list = CALLOC(pdu_0_1->harq->num_harq, sizeof(*pdu_0_1->harq->harq_list)); - for (int k = 0; k < pdu_0_1->harq->num_harq; k++) - { - pdu_0_1->harq->harq_list[k].harq_value = 0; - } } } LOG_I(NR_MAC, "We have dequeued the previously filled uci_ind and updated the snf/slot to %d/%d.\n", @@ -986,7 +982,7 @@ void *nrue_standalone_pnf_task(void *context) if (sem_post(&sfn_slot_semaphore) != 0) { - LOG_E(MAC, "sem_post() error\n"); + LOG_E(NR_MAC, "sem_post() error\n"); abort(); } } @@ -1062,7 +1058,7 @@ void update_harq_status(module_id_t module_id, uint8_t harq_pid, uint8_t ack_nac } else { //shouldn't get here - LOG_E(MAC, "Trying to process acknack for an inactive harq process (%d)\n", harq_pid); + LOG_E(NR_MAC, "Trying to process acknack for an inactive harq process (%d)\n", harq_pid); } } @@ -1121,9 +1117,9 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_ } else { // UL indication after reception of DCI or DL PDU if (dl_info && dl_info->dci_ind && dl_info->dci_ind->number_of_dcis) { - LOG_D(MAC,"[L2][IF MODULE][DL INDICATION][DCI_IND]\n"); + LOG_D(NR_MAC,"[L2][IF MODULE][DL INDICATION][DCI_IND]\n"); for (int i = 0; i < dl_info->dci_ind->number_of_dcis; i++) { - LOG_D(MAC,">>>NR_IF_Module i=%d, dl_info->dci_ind->number_of_dcis=%d\n",i,dl_info->dci_ind->number_of_dcis); + LOG_D(NR_MAC,">>>NR_IF_Module i=%d, dl_info->dci_ind->number_of_dcis=%d\n",i,dl_info->dci_ind->number_of_dcis); nr_scheduled_response_t scheduled_response; int8_t ret = handle_dci(dl_info->module_id, dl_info->cc_id, @@ -1137,7 +1133,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_ /* The check below filters out UL_DCIs (format 7) which are being processed as DL_DCIs. */ if (dci_index->dci_format == 7 && mac->ra.ra_state == RA_SUCCEEDED) { LOG_D(NR_MAC, "We are filtering a UL_DCI to prevent it from being treated like a DL_DCI\n"); - break; + continue; } dci_pdu_rel15_t *def_dci_pdu_rel15 = &mac->def_dci_pdu_rel15[dci_index->dci_format]; g_harq_pid = def_dci_pdu_rel15->harq_pid; @@ -1160,7 +1156,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_ for (int i=0; irx_ind->number_pdus; ++i) { - LOG_D(MAC, "In %s sending DL indication to MAC. 1 PDU type %d of %d total number of PDUs \n", + LOG_D(NR_MAC, "In %s sending DL indication to MAC. 1 PDU type %d of %d total number of PDUs \n", __FUNCTION__, dl_info->rx_ind->rx_indication_body[i].pdu_type, dl_info->rx_ind->number_pdus); diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 25da395b90..13a09db5a3 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -93,9 +93,6 @@ extern uint16_t sf_ahead; void ue_stub_rx_handler(unsigned int, char *); -int32_t **rxdata; -int32_t **txdata; - int timer_subframe = 0; int timer_frame = 0; SF_ticking *phy_stub_ticking = NULL; @@ -2498,23 +2495,18 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, AssertFatal( phy_vars_ue[CC_id] !=0, ""); frame_parms = &(phy_vars_ue[CC_id]->frame_parms); // replace RX signal buffers with mmaped HW versions - rxdata = (int32_t **)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t *) ); - txdata = (int32_t **)malloc16( frame_parms->nb_antennas_tx*sizeof(int32_t *) ); - for (i=0; inb_antennas_rx; i++) { LOG_I(PHY, "Mapping UE CC_id %d, rx_ant %d, freq %lu on card %d, chain %d\n", CC_id, i, downlink_frequency[CC_id][i], phy_vars_ue[CC_id]->rf_map.card, (phy_vars_ue[CC_id]->rf_map.chain)+i ); free( phy_vars_ue[CC_id]->common_vars.rxdata[i] ); - rxdata[i] = (int32_t *)malloc16_clear( 307200*sizeof(int32_t) ); - phy_vars_ue[CC_id]->common_vars.rxdata[i] = rxdata[i]; // what about the "-N_TA_offset" ? // N_TA offset for TDD + phy_vars_ue[CC_id]->common_vars.rxdata[i] = malloc16_clear( 307200*sizeof(int32_t) ); // what about the "-N_TA_offset" ? // N_TA offset for TDD } for (i=0; inb_antennas_tx; i++) { LOG_I(PHY, "Mapping UE CC_id %d, tx_ant %d, freq %lu on card %d, chain %d\n", CC_id, i, downlink_frequency[CC_id][i], phy_vars_ue[CC_id]->rf_map.card, (phy_vars_ue[CC_id]->rf_map.chain)+i ); free( phy_vars_ue[CC_id]->common_vars.txdata[i] ); - txdata[i] = (int32_t *)malloc16_clear( 307200*sizeof(int32_t) ); - phy_vars_ue[CC_id]->common_vars.txdata[i] = txdata[i]; + phy_vars_ue[CC_id]->common_vars.txdata[i] = malloc16_clear( 307200*sizeof(int32_t) ); } // rxdata[x] points now to the same memory region as phy_vars_ue[CC_id]->common_vars.rxdata[x] From 42c16795454fdaaed2617ac32e4eada3ec71318f Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Tue, 15 Mar 2022 14:23:25 +0100 Subject: [PATCH 037/114] remove one global --- openair1/PHY/INIT/nr_init_ue.c | 2 -- openair1/PHY/NR_TRANSPORT/nr_dci.c | 3 +- openair1/PHY/NR_UE_TRANSPORT/dci_nr.c | 28 +++++++++++-------- .../NR_UE_TRANSPORT/nr_transport_proto_ue.h | 7 +++-- openair1/PHY/defs_nr_UE.h | 3 -- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 5 ++-- 6 files changed, 25 insertions(+), 23 deletions(-) diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index 75315187d9..5a3c2569da 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -404,7 +404,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) ue->pdcch_vars[th_id][gNB_id]->llr = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) ); ue->pdcch_vars[th_id][gNB_id]->llr16 = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) ); ue->pdcch_vars[th_id][gNB_id]->wbar = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) ); - ue->pdcch_vars[th_id][gNB_id]->e_rx = (int16_t *)malloc16_clear( 4*2*100*12 ); ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); ue->pdcch_vars[th_id][gNB_id]->rho = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) ); @@ -574,7 +573,6 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) free_and_zero(ue->pdcch_vars[th_id][gNB_id]->llr); free_and_zero(ue->pdcch_vars[th_id][gNB_id]->llr16); free_and_zero(ue->pdcch_vars[th_id][gNB_id]->wbar); - free_and_zero(ue->pdcch_vars[th_id][gNB_id]->e_rx); free_and_zero(ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp); free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext); free_and_zero(ue->pdcch_vars[th_id][gNB_id]->rho); diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index ae96eb26bc..9876dfca86 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -132,7 +132,8 @@ void nr_generate_dci(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15, polar_encoder_fast((uint64_t*)dci_pdu->Payload, (void*)encoder_output, n_RNTI, 1, NR_POLAR_DCI_MESSAGE_TYPE, dci_pdu->PayloadSizeBits, dci_pdu->AggregationLevel); -#if 1 +#ifdef DEBUG_CHANNEL_CODING +//debug dump dci printf("polar rnti %x,length %d, L %d\n",n_RNTI, dci_pdu->PayloadSizeBits,pdcch_pdu_rel15->dci_pdu->AggregationLevel); printf("DCI PDU: [0]->0x%lx \t [1]->0x%lx\n", ((uint64_t*)dci_pdu->Payload)[0], ((uint64_t*)dci_pdu->Payload)[1]); diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index 9f0e1bea71..66422a9dfa 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -83,7 +83,7 @@ char nr_dci_format_string[8][30] = { //static const int16_t conjugate[8]__attribute__((aligned(32))) = {-1,1,-1,1,-1,1,-1,1}; -void nr_pdcch_demapping_deinterleaving(uint32_t *llr, +static void nr_pdcch_demapping_deinterleaving(uint32_t *llr, uint32_t *z, uint8_t coreset_time_dur, uint8_t start_symbol, @@ -685,7 +685,8 @@ void nr_pdcch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms, int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, - fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15) { + fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15, + int16_t e_rx[4*2*100*12] ) { uint32_t frame = proc->frame_rx; uint32_t slot = proc->nr_slot_rx; @@ -772,7 +773,7 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, LOG_D(PHY,"we enter nr_pdcch_demapping_deinterleaving(), number of candidates %d\n",rel15->number_of_candidates); nr_pdcch_demapping_deinterleaving((uint32_t *) pdcch_vars->llr, - (uint32_t *) pdcch_vars->e_rx, + (uint32_t *) e_rx, rel15->coreset.duration, rel15->coreset.StartSymbolIndex, n_rb, @@ -791,7 +792,7 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, -void nr_pdcch_unscrambling(int16_t *z, +void nr_pdcch_unscrambling(int16_t e_rx[4*2*100*12], uint16_t scrambling_RNTI, uint32_t length, uint16_t pdcch_DMRS_scrambling_id, @@ -814,13 +815,15 @@ void nr_pdcch_unscrambling(int16_t *z, reset = 0; } - if (((s >> (i % 32)) & 1) == 1) z2[i] = -z[i]; - else z2[i]=z[i]; + if (((s >> (i % 32)) & 1) == 1) + z2[i] = -e_rx[i]; + else + z2[i]=e_rx[i]; } - printf("Encoded Payload (length:%d dwords):\n", length>>5); + printf("Encoded Payload (length:%d dwords):\n", length); - for (int i=0; i>5; i++) - printf("[%d]->0x%08x \t", i, z2[i]); + for (int i=0; i0x%x \t", i, z2[i]); } @@ -855,7 +858,8 @@ static uint16_t nr_dci_false_detection(uint64_t *dci, return x; } -uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, +uint8_t nr_dci_decoding_procedure(int16_t e_rx[4*2*100*12], + PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, fapi_nr_dci_indication_t *dci_ind, fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15) { @@ -891,10 +895,10 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, LOG_D(PHY, "Trying DCI candidate %d of %d number of candidates, CCE %d (%d), L %d, length %d, format %s\n", j, rel15->number_of_candidates, CCEind, e_rx_cand_idx, L, dci_length,nr_dci_format_string[rel15->dci_format_options[k]]); - nr_pdcch_unscrambling(&pdcch_vars->e_rx[e_rx_cand_idx], rel15->coreset.scrambling_rnti, L*108, rel15->coreset.pdcch_dmrs_scrambling_id, tmp_e); + nr_pdcch_unscrambling(&e_rx[e_rx_cand_idx], rel15->coreset.scrambling_rnti, L*108, rel15->coreset.pdcch_dmrs_scrambling_id, tmp_e); #ifdef DEBUG_DCI_DECODING - uint32_t *z = (uint32_t *) &pdcch_vars->e_rx[e_rx_cand_idx]; + uint32_t *z = (uint32_t *) &e_rx[e_rx_cand_idx]; for (int index_z = 0; index_z < L*6; index_z++){ for (int i=0; i<9; i++) { LOG_D(PHY,"z[%d]=(%d,%d) \n", (9*index_z + i), *(int16_t *) &z[index_z + i],*(1 + (int16_t *) &z[index_z + i])); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h index aac59a7da1..945eb5df0f 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h @@ -1105,8 +1105,8 @@ uint32_t dlsch_decoding_emul(PHY_VARS_NR_UE *phy_vars_ue, int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, - fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15); - + fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15, + int16_t e_rx[4*2*100*12]); /*! \brief Extract PSS and SSS resource elements @param phy_vars_ue Pointer to UE variables @@ -1667,7 +1667,8 @@ uint8_t get_prach_prb_offset(NR_DL_FRAME_PARMS *frame_parms, #include -uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, +uint8_t nr_dci_decoding_procedure(int16_t e_rx[4*2*100*12], + PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, fapi_nr_dci_indication_t *dci_ind, fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15); diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 04080e7215..3762107d5d 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -611,9 +611,6 @@ typedef struct { /// \brief \f$\overline{w}\f$ from 36-211. /// - first index: ? [0..48*N_RB_DL[ int16_t *wbar; - /// \brief PDCCH/DCI e-sequence (input to rate matching). - /// - first index: ? [0..96*N_RB_DL[ - int16_t *e_rx; /// Total number of PDU errors (diagnostic mode) uint32_t dci_errors; /// Total number of PDU received diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index ddddcd09e2..52fa0d4b2f 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -500,7 +500,8 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id, start_meas(&ue->dlsch_rx_pdcch_stats); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PDCCH, VCD_FUNCTION_IN); - nr_rx_pdcch(ue, proc, rel15); + int16_t e_rx[4*2*100*12]={0}; + nr_rx_pdcch(ue, proc, rel15, e_rx); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PDCCH, VCD_FUNCTION_OUT); @@ -511,7 +512,7 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id, n_ss); #endif - dci_cnt = nr_dci_decoding_procedure(ue, proc, dci_ind, rel15); + dci_cnt = nr_dci_decoding_procedure(e_rx, ue, proc, dci_ind, rel15); #ifdef NR_PDCCH_SCHED_DEBUG LOG_I(PHY,"<-NR_PDCCH_PHY_PROCEDURES_LTE_UE (nr_ue_pdcch_procedures)-> Ending function nr_dci_decoding_procedure() -> dci_cnt=%u\n",dci_cnt); From a7e7d05da340aa0aadb134a49773071e3e159c8e Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Wed, 16 Mar 2022 21:23:53 +0100 Subject: [PATCH 038/114] fix difficult to read code --- executables/nr-gnb.c | 1 + executables/nr-uesoftmodem.c | 10 +- .../PHY/LTE_ESTIMATION/lte_est_freq_offset.c | 18 +-- openair1/PHY/LTE_ESTIMATION/lte_sync_time.c | 22 +-- openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c | 2 +- .../LTE_TRANSPORT/transport_common_proto.h | 2 +- openair1/PHY/LTE_UE_TRANSPORT/get_pmi.c | 2 +- .../PHY/LTE_UE_TRANSPORT/transport_proto_ue.h | 10 -- openair1/PHY/NR_REFSIG/pss_nr.h | 6 - openair1/PHY/NR_REFSIG/ptrs_nr.c | 6 +- openair1/PHY/NR_TRANSPORT/nr_dlsch.c | 46 +++--- openair1/PHY/NR_TRANSPORT/nr_dlsch.h | 4 +- openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c | 12 +- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 3 +- openair1/PHY/NR_UE_TRANSPORT/dci_nr.c | 6 +- .../PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 12 +- .../NR_UE_TRANSPORT/nr_transport_proto_ue.h | 10 -- openair1/PHY/NR_UE_TRANSPORT/pss_nr.c | 75 ++++------ openair1/PHY/TOOLS/angle.c | 2 +- openair1/PHY/TOOLS/cadd_sv.c | 2 +- openair1/PHY/TOOLS/cadd_vv.c | 2 +- openair1/PHY/TOOLS/calibration_test.c | 10 +- openair1/PHY/TOOLS/nr_phy_scope.c | 2 +- openair1/SIMULATION/NR_PHY/dlschsim.c | 2 +- openair1/SIMULATION/NR_PHY/pucchsim.c | 2 +- .../unit_tests/src/frame_config_test.c | 2 +- .../NR_UE_PHY/unit_tests/src/harq_test.c | 2 +- .../NR_UE_PHY/unit_tests/src/pbch_test.c | 2 +- .../NR_UE_PHY/unit_tests/src/pss_test.c | 2 +- .../NR_UE_PHY/unit_tests/src/pss_util_test.c | 2 +- .../NR_UE_PHY/unit_tests/src/pss_util_test.h | 2 +- .../unit_tests/src/pucch_uci_generator_test.c | 2 +- .../NR_UE_PHY/unit_tests/src/pucch_uci_test.c | 2 +- .../NR_UE_PHY/unit_tests/src/srs_test.c | 2 +- .../NR_UE_PHY/unit_tests/src/sss_test.c | 2 +- openair2/LAYER2/NR_MAC_COMMON/nr_mac.h | 15 +- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 128 +++++----------- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 3 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 6 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 79 ++++------ .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 137 ++++++------------ openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 2 +- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 2 +- openair2/RRC/NR/rrc_gNB_NGAP.c | 6 +- openair3/NAS/NR_UE/nr_nas_msg_sim.c | 2 +- targets/ARCH/rfsimulator/apply_channelmod.c | 6 +- targets/ARCH/rfsimulator/rfsimulator.h | 4 +- targets/ARCH/rfsimulator/simulator.c | 8 +- targets/RT/USER/lte-ue.c | 2 +- 49 files changed, 258 insertions(+), 431 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index 4793ef4e95..b6c95de4ce 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -458,6 +458,7 @@ void init_gNB_Tpool(int inst) { for (int i=0; i < 2; i++) { notifiedFIFO_elt_t *msgL1Tx = newNotifiedFIFO_elt(sizeof(processingData_L1tx_t),0,gNB->L1_tx_out,tx_func); processingData_L1tx_t *msgDataTx = (processingData_L1tx_t *)NotifiedFifoData(msgL1Tx); + memset(msgDataTx,0, sizeof(processingData_L1tx_t)); init_DLSCH_struct(gNB, msgDataTx); memset(msgDataTx->ssb, 0, 64*sizeof(NR_gNB_SSB_t)); pushNotifiedFIFO(gNB->L1_tx_free,msgL1Tx); // to unblock the process in the beginning diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 649b68631b..82ba86ea63 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -241,16 +241,16 @@ nrUE_params_t *get_nrUE_params(void) { } /* initialie thread pools used for NRUE processing paralleliation */ void init_tpools(uint8_t nun_dlsch_threads) { - char params[NR_RX_NB_TH*NR_NB_TH_SLOT*3+1]; + char params[NR_RX_NB_TH*NR_NB_TH_SLOT*3+1]={0}; for (int i=0; iN_RB_DL/2 - 1)*12,dl_ch_shift); //omega = dot_product(dl_ch,dl_ch_prev,frame_parms->ofdm_symbol_size,15); - omega_cpx.r = ((struct complex16*) &omega)->r; - omega_cpx.i = ((struct complex16*) &omega)->i; + omega_cpx.r = ((c16_t*) &omega)->r; + omega_cpx.i = ((c16_t*) &omega)->i; dl_ch = (int16_t *)&dl_ch_estimates[aa][(((frame_parms->N_RB_DL/2) + 1)*12) + ch_offset]; @@ -155,8 +155,8 @@ int lte_est_freq_offset(int **dl_ch_estimates, // calculate omega = angle(conj(dl_ch)*dl_ch_prev)) omega = dot_product(dl_ch,dl_ch_prev,((frame_parms->N_RB_DL/2) - 1)*12,dl_ch_shift); - omega_cpx.r += ((struct complex16*) &omega)->r; - omega_cpx.i += ((struct complex16*) &omega)->i; + omega_cpx.r += ((c16_t*) &omega)->r; + omega_cpx.i += ((c16_t*) &omega)->i; // phase_offset += atan2((double)omega_cpx->i,(double)omega_cpx->r); phase_offset += atan2((double)omega_cpx.i,(double)omega_cpx.r); @@ -195,7 +195,7 @@ int lte_mbsfn_est_freq_offset(int **dl_ch_estimates, { int ch_offset, omega, dl_ch_shift; - struct complex16 *omega_cpx; + c16_t *omega_cpx; double phase_offset; int freq_offset_est; unsigned char aa; @@ -234,7 +234,7 @@ int lte_mbsfn_est_freq_offset(int **dl_ch_estimates, // printf("Computing freq_offset\n"); omega = dot_product(dl_ch,dl_ch_prev,(frame_parms->N_RB_DL/2 - 1)*12,dl_ch_shift); //omega = dot_product(dl_ch,dl_ch_prev,frame_parms->ofdm_symbol_size,15); - omega_cpx = (struct complex16*) ω + omega_cpx = (c16_t*) ω // printf("omega (%d,%d)\n",omega_cpx->r,omega_cpx->i); @@ -247,8 +247,8 @@ int lte_mbsfn_est_freq_offset(int **dl_ch_estimates, // calculate omega = angle(conj(dl_ch)*dl_ch_prev)) omega = dot_product(dl_ch,dl_ch_prev,((frame_parms->N_RB_DL/2) - 1)*12,dl_ch_shift); - omega_cpx->r += ((struct complex16*) &omega)->r; - omega_cpx->i += ((struct complex16*) &omega)->i; + omega_cpx->r += ((c16_t*) &omega)->r; + omega_cpx->i += ((c16_t*) &omega)->i; // phase_offset += atan2((double)omega_cpx->i,(double)omega_cpx->r); phase_offset += atan2((double)omega_cpx->i,(double)omega_cpx->r); // printf("omega (%d,%d) -> %f\n",omega_cpx->r,omega_cpx->i,phase_offset); diff --git a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c index 1fbc8b7ef2..b21f526fcc 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c @@ -34,9 +34,9 @@ // Note: this is for prototype of generate_drs_pusch (OTA synchronization of RRUs) #include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" -static struct complex16 *primary_synch0_time __attribute__((aligned(32))); -static struct complex16 *primary_synch1_time __attribute__((aligned(32))); -static struct complex16 *primary_synch2_time __attribute__((aligned(32))); +static c16_t *primary_synch0_time __attribute__((aligned(32))); +static c16_t *primary_synch1_time __attribute__((aligned(32))); +static c16_t *primary_synch2_time __attribute__((aligned(32))); static void doIdft(int size, short *in, short *out) { switch (size) { @@ -67,7 +67,7 @@ static void doIdft(int size, short *in, short *out) { } } -static void copyPrimary( struct complex16 *out, struct complex16 *in, int ofdmSize) { +static void copyPrimary( c16_t *out, struct complex16 *in, int ofdmSize) { int k=ofdmSize-36; for (int i=0; i<72; i++) { @@ -83,20 +83,20 @@ static void copyPrimary( struct complex16 *out, struct complex16 *in, int ofdmSi } int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) { // LTE_UE_COMMON *common_vars - struct complex16 syncF_tmp[2048]__attribute__((aligned(32)))= {{0}}; + c16_t syncF_tmp[2048]__attribute__((aligned(32)))= {{0}}; int sz=frame_parms->ofdm_symbol_size*sizeof(*primary_synch0_time); - AssertFatal( NULL != (primary_synch0_time = (struct complex16 *)malloc16(sz)),""); + AssertFatal( NULL != (primary_synch0_time = (c16_t *)malloc16(sz)),""); bzero(primary_synch0_time,sz); - AssertFatal( NULL != (primary_synch1_time = (struct complex16 *)malloc16(sz)),""); + AssertFatal( NULL != (primary_synch1_time = (c16_t *)malloc16(sz)),""); bzero(primary_synch1_time,sz); - AssertFatal( NULL != (primary_synch2_time = (struct complex16 *)malloc16(sz)),""); + AssertFatal( NULL != (primary_synch2_time = (c16_t *)malloc16(sz)),""); bzero(primary_synch2_time,sz); // generate oversampled sync_time sequences - copyPrimary( syncF_tmp, (struct complex16 *) primary_synch0, frame_parms->ofdm_symbol_size); + copyPrimary( syncF_tmp, (c16_t *) primary_synch0, frame_parms->ofdm_symbol_size); doIdft(frame_parms->N_RB_DL, (short *)syncF_tmp,(short *)primary_synch0_time); - copyPrimary( syncF_tmp, (struct complex16 *) primary_synch1, frame_parms->ofdm_symbol_size); + copyPrimary( syncF_tmp, (c16_t *) primary_synch1, frame_parms->ofdm_symbol_size); doIdft(frame_parms->N_RB_DL, (short *)syncF_tmp,(short *)primary_synch1_time); - copyPrimary( syncF_tmp, (struct complex16 *) primary_synch2, frame_parms->ofdm_symbol_size); + copyPrimary( syncF_tmp, (c16_t *) primary_synch2, frame_parms->ofdm_symbol_size); doIdft(frame_parms->N_RB_DL, (short *)syncF_tmp,(short *)primary_synch2_time); if ( LOG_DUMPFLAG(DEBUG_LTEESTIM)){ diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c index c6b312cc61..de21b7f4e2 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c @@ -2237,7 +2237,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, int P1_SHIFT[13],P2_SHIFT[13]; int offset,nushiftmod3; - uint8_t get_pmi_temp; + int get_pmi_temp; MIMO_mode_t mimo_mode = -1; uint8_t mprime=0,Ns; diff --git a/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h b/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h index af8e63c3ed..e6240a4e78 100644 --- a/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h +++ b/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h @@ -299,7 +299,7 @@ uint64_t pmi2hex_2Ar1(uint32_t pmi); uint64_t pmi2hex_2Ar2(uint32_t pmi); -uint8_t get_pmi(uint8_t N_RB_DL,MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb); +uint8_t get_pmi(int N_RB_DL,MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb); // DL power control functions double get_pa_dB(uint8_t pa); diff --git a/openair1/PHY/LTE_UE_TRANSPORT/get_pmi.c b/openair1/PHY/LTE_UE_TRANSPORT/get_pmi.c index 7bbe8e8942..6ab2ad9fdd 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/get_pmi.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/get_pmi.c @@ -21,7 +21,7 @@ #include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" -uint8_t get_pmi(uint8_t N_RB_DL, MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb) +uint8_t get_pmi(int N_RB_DL, MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb) { /* MIMO_mode_t mode = dlsch_harq->mimo_mode; diff --git a/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h index c5d096ceb7..bdfe0b8d07 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h +++ b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h @@ -1550,16 +1550,6 @@ uint64_t cqi2hex(uint32_t cqi); uint16_t computeRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs); - -/** \brief This routine extracts a single subband PMI from a bitmap coming from UCI or the pmi_extend function - @param N_RB_DL number of resource blocks - @param mimo_mode - @param pmi_alloc subband PMI bitmap - @param rb resource block for which to extract PMI - @returns subband PMI -*/ -uint8_t get_pmi(uint8_t N_RB_DL,MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb); - int get_nCCE_offset_l1(int *CCE_table, const unsigned char L, const int nCCE, diff --git a/openair1/PHY/NR_REFSIG/pss_nr.h b/openair1/PHY/NR_REFSIG/pss_nr.h index b32d48a2e9..c65ca3799d 100644 --- a/openair1/PHY/NR_REFSIG/pss_nr.h +++ b/openair1/PHY/NR_REFSIG/pss_nr.h @@ -113,12 +113,6 @@ EXTERN int16_t *primary_synchro_time_nr[NUMBER_PSS_SEQUENCE] #endif ; -EXTERN int64_t *pss_corr_ue[NUMBER_PSS_SEQUENCE] -#ifdef INIT_VARIABLES_PSS_NR_H -= { NULL, NULL, NULL} -#endif -; - /* profiling structure */ EXTERN time_stats_t generic_time[TIME_LAST]; diff --git a/openair1/PHY/NR_REFSIG/ptrs_nr.c b/openair1/PHY/NR_REFSIG/ptrs_nr.c index 40a6a56611..68134eb02d 100644 --- a/openair1/PHY/NR_REFSIG/ptrs_nr.c +++ b/openair1/PHY/NR_REFSIG/ptrs_nr.c @@ -268,8 +268,8 @@ void nr_ptrs_cpe_estimation(uint8_t K_ptrs, return; } uint16_t sc_per_symbol = (nb_rb + K_ptrs - 1)/K_ptrs; - struct complex16 ptrs_p[(1 + sc_per_symbol/4)*4]; - struct complex16 dmrs_comp_p[(1 + sc_per_symbol/4)*4]; + c16_t ptrs_p[(1 + sc_per_symbol/4)*4]; + c16_t dmrs_comp_p[(1 + sc_per_symbol/4)*4]; double abs = 0.0; double real = 0.0; double imag = 0.0; @@ -422,7 +422,7 @@ void get_slope_from_estimates(uint8_t start, uint8_t end, int16_t *est_p, double /* estimate from slope */ void ptrs_estimate_from_slope(int16_t *error_est, double *slope_p, uint8_t start, uint8_t end) { - struct complex16 *error=(struct complex16 *) error_est; + c16_t *error=(struct complex16 *) error_est; for(uint8_t i = 1; i< (end -start);i++) { error[start+i].r = error[start].r + (int16_t)(i * slope_p[0]);// real error[start+i].i = error[start].i + (int16_t)(i * slope_p[1]); //imag diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index 876d6cc83a..e4fe9b8371 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -98,7 +98,6 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, uint16_t nb_re = ((12*rel15->NrOfSymbols)-nb_re_dmrs*dmrs_len-xOverhead)*rel15->rbSize*rel15->nrOfLayers; uint8_t Qm = rel15->qamModOrder[0]; uint32_t encoded_length = nb_re*Qm; - uint32_t scrambled_output[rel15->NrOfCodewords][(encoded_length>>5)+1]; int16_t mod_dmrs[n_dmrs<<1] __attribute__ ((aligned(16))); /* PTRS */ @@ -125,7 +124,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, start_meas(dlsch_encoding_stats); if (nr_dlsch_encoding(gNB, - harq->pdu, frame, slot, dlsch, frame_parms,output,tinput,tprep,tparity,toutput, + frame, slot, harq, frame_parms,output,tinput,tprep,tparity,toutput, dlsch_rate_matching_stats, dlsch_interleaving_stats, dlsch_segmentation_stats) == -1) @@ -148,46 +147,41 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, #endif /// scrambling - start_meas(dlsch_scrambling_stats); for (int q=0; qNrOfCodewords; q++) { - memset((void*)scrambled_output[q], 0, ((encoded_length>>5)+1)*sizeof(uint32_t)); + uint32_t scrambled_output[encoded_length]; + start_meas(dlsch_scrambling_stats); nr_pdsch_codeword_scrambling(output, encoded_length, q, rel15->dataScramblingId, rel15->rnti, - scrambled_output[q]); - } - - stop_meas(dlsch_scrambling_stats); + scrambled_output); + stop_meas(dlsch_scrambling_stats); + #ifdef DEBUG_DLSCH - printf("PDSCH scrambling:\n"); - for (int i=0; i>8; i++) { - for (int j=0; j<8; j++) - printf("0x%08x\t", scrambled_output[0][(i<<3)+j]); - printf("\n"); - } + printf("PDSCH scrambling:\n"); + for (int i=0; i>8; i++) { + for (int j=0; j<8; j++) + printf("0x%08x\t", scrambled_output[(i<<3)+j]); + printf("\n"); + } #endif - - /// Modulation start_meas(dlsch_modulation_stats); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PDSCH_MODULATION, 1); - for (int q=0; qNrOfCodewords; q++) - nr_modulation(scrambled_output[q], + nr_modulation(scrambled_output, encoded_length, Qm, mod_symbs[q]); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PDSCH_MODULATION, 0); stop_meas(dlsch_modulation_stats); #ifdef DEBUG_DLSCH - printf("PDSCH Modulation: Qm %d(%d)\n", Qm, nb_re); - for (int i=0; i>3; i++) { - for (int j=0; j<8; j++) { - printf("%d %d\t", mod_symbs[0][((i<<3)+j)<<1], mod_symbs[0][(((i<<3)+j)<<1)+1]); + printf("PDSCH Modulation: Qm %d(%d)\n", Qm, nb_re); + for (int i=0; i>3; i++) { + for (int j=0; j<8; j++) { + printf("%d %d\t", mod_symbs[0][((i<<3)+j)<<1], mod_symbs[0][(((i<<3)+j)<<1)+1]); + } + printf("\n"); } - printf("\n"); - } #endif + } start_meas(&gNB->dlsch_layer_mapping_stats); /// Layer mapping diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.h b/openair1/PHY/NR_TRANSPORT/nr_dlsch.h index 28676b49f2..daa4ed1723 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.h +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.h @@ -78,9 +78,9 @@ int16_t find_nr_dlsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type); NR_gNB_SCH_STATS_t *find_nr_dlsch_stats(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type); int nr_dlsch_encoding(PHY_VARS_gNB *gNB, - unsigned char *a,int frame, + int frame, uint8_t slot, - NR_gNB_DLSCH_t *dlsch, + NR_DL_gNB_HARQ_t *harq, NR_DL_FRAME_PARMS* frame_parms, unsigned char * output, time_stats_t *tinput, diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c index 229f59032e..bf33457aaa 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c @@ -286,10 +286,9 @@ void ldpc8blocks( void *p) { } int nr_dlsch_encoding(PHY_VARS_gNB *gNB, - unsigned char *a, int frame, uint8_t slot, - NR_gNB_DLSCH_t *dlsch, + NR_DL_gNB_HARQ_t *harq, NR_DL_FRAME_PARMS *frame_parms, unsigned char * output, time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput, @@ -298,13 +297,12 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, encoder_implemparams_t impp; impp.output=output; unsigned int crc=1; - NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process; nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &harq->pdsch_pdu.pdsch_pdu_rel15; - impp.Zc = &dlsch->harq_process.Z; + impp.Zc = &harq->Z; float Coderate = 0.0; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING, VCD_FUNCTION_IN); uint32_t A = rel15->TBSize[0]<<3; - + unsigned char *a=harq->pdu; if ( rel15->rnti != SI_RNTI) trace_NRpdu(DIRECTION_DOWNLINK, a, rel15->TBSize[0], 0, WS_C_RNTI, rel15->rnti, frame, slot,0, 0); @@ -317,14 +315,14 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, stats=&gNB->dlsch_stats[i]; } - if (gNB->dlsch_stats[i].rnti == dlsch->rnti) { + if (gNB->dlsch_stats[i].rnti == rel15->rnti) { stats=&gNB->dlsch_stats[i]; break; } } if (stats) { - stats->rnti = dlsch->rnti; + stats->rnti = rel15->rnti; stats->total_bytes_tx += rel15->TBSize[0]; stats->current_RI = rel15->nrOfLayers; stats->current_Qm = rel15->qamModOrder[0]; diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index 17f145b98a..eda53e1c84 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -405,13 +405,12 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, if (nr_sequences>1) { if (xrtmag_dBtimes10 < (50+xrtmag_next_dBtimes10) || SNRtimes10 < gNB->pucch0_thres) { no_conf=true; - LOG_W(PHY,"%d.%d PUCCH bad confidence: %d threshold, %d, %d, %d\n", + LOG_D(PHY,"%d.%d PUCCH bad confidence: %d threshold, %d, %d, %d\n", frame, slot, uci_stats->pucch0_thres, SNRtimes10, xrtmag_dBtimes10, xrtmag_next_dBtimes10); - abort(); } } gNB->bad_pucch += no_conf; diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index 66422a9dfa..5b0544bf21 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -820,10 +820,6 @@ void nr_pdcch_unscrambling(int16_t e_rx[4*2*100*12], else z2[i]=e_rx[i]; } - printf("Encoded Payload (length:%d dwords):\n", length); - - for (int i=0; i0x%x \t", i, z2[i]); } @@ -898,7 +894,7 @@ uint8_t nr_dci_decoding_procedure(int16_t e_rx[4*2*100*12], nr_pdcch_unscrambling(&e_rx[e_rx_cand_idx], rel15->coreset.scrambling_rnti, L*108, rel15->coreset.pdcch_dmrs_scrambling_id, tmp_e); #ifdef DEBUG_DCI_DECODING - uint32_t *z = (uint32_t *) &e_rx[e_rx_cand_idx]; + uint32_t *z = (uint32_t *) &pdcch_vars->e_rx[e_rx_cand_idx]; for (int index_z = 0; index_z < L*6; index_z++){ for (int i=0; i<9; i++) { LOG_D(PHY,"z[%d]=(%d,%d) \n", (9*index_z + i), *(int16_t *) &z[index_z + i],*(1 + (int16_t *) &z[index_z + i])); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index bf9cfaaa70..6163a95e5c 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -168,8 +168,6 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint dlsch->harq_processes[i]->d[r] = (int16_t *)malloc16(5*8448*sizeof(int16_t)); if (dlsch->harq_processes[i]->c[r]) memset(dlsch->harq_processes[i]->c[r],0,1056); - if (dlsch->harq_processes[i]->d[r]) - memset(dlsch->harq_processes[i]->d[r],0,5*8448); else exit_flag=2; @@ -326,12 +324,12 @@ void nr_processDLSegment(void* arg) { harq_process->rvidx, harq_process->round); */ //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_RATE_MATCHING, VCD_FUNCTION_IN); - + int16_t d[5*8448]; if (nr_rate_matching_ldpc_rx(Ilbrm, Tbslbrm, p_decoderParms->BG, p_decoderParms->Z, - harq_process->d[r], + d, w, harq_process->C, harq_process->rvidx, @@ -353,7 +351,7 @@ void nr_processDLSegment(void* arg) { LOG_D(PHY,"decoder input(segment %u) :",r); for (int i=0; id[r][i]); + LOG_D(PHY,"%d : %d\n",i,d[i]); LOG_D(PHY,"\n"); } @@ -379,9 +377,9 @@ void nr_processDLSegment(void* arg) { //set Filler bits memset((&z[0]+K_bits_F),127,harq_process->F*sizeof(int16_t)); //Move coded bits before filler bits - memcpy((&z[0]+2*harq_process->Z),harq_process->d[r],(K_bits_F-2*harq_process->Z)*sizeof(int16_t)); + memcpy((&z[0]+2*harq_process->Z),d,(K_bits_F-2*harq_process->Z)*sizeof(int16_t)); //skip filler bits - memcpy((&z[0]+Kr),harq_process->d[r]+(Kr-2*harq_process->Z),(kc*harq_process->Z-Kr)*sizeof(int16_t)); + memcpy((&z[0]+Kr),d+(Kr-2*harq_process->Z),(kc*harq_process->Z-Kr)*sizeof(int16_t)); //Saturate coded bits before decoding into 8 bits values for (i=0, j=0; j < ((kc*harq_process->Z)>>4)+1; i+=2, j++) { diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h index 945eb5df0f..ead5ec2da5 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h @@ -1480,16 +1480,6 @@ uint64_t cqi2hex(uint32_t cqi); uint16_t computeRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs); - -/** \brief This routine extracts a single subband PMI from a bitmap coming from UCI or the pmi_extend function - @param N_RB_DL number of resource blocks - @param mimo_mode - @param pmi_alloc subband PMI bitmap - @param rb resource block for which to extract PMI - @returns subband PMI -*/ -uint8_t get_pmi(uint8_t N_RB_DL,MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb); - int get_nCCE_offset_l1(int *CCE_table, const unsigned char L, const int nCCE, diff --git a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c index 54712cb64e..13ed436273 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c @@ -381,7 +381,6 @@ void init_context_pss_nr(NR_DL_FRAME_PARMS *frame_parms_ue) int sizePss = LENGTH_PSS_NR * IQ_SIZE; /* complex value i & q signed 16 bits */ int size = ofdm_symbol_size * IQ_SIZE; /* i and q samples signed 16 bits */ int16_t *p = NULL; - int64_t *q = NULL; AssertFatal(ofdm_symbol_size > 127, "illegal ofdm_symbol_size %d\n",ofdm_symbol_size); for (int i = 0; i < NUMBER_PSS_SEQUENCE; i++) { @@ -410,17 +409,6 @@ void init_context_pss_nr(NR_DL_FRAME_PARMS *frame_parms_ue) assert(0); } - size = sizeof(int64_t)*(frame_parms_ue->samples_per_frame + (2*ofdm_symbol_size)); - q = (int64_t*)malloc16(size); - if (q != NULL) { - pss_corr_ue[i] = q; - bzero( pss_corr_ue[i], size); - } - else { - LOG_E(PHY,"Fatal memory allocation problem \n"); - assert(0); - } - generate_pss_nr(frame_parms_ue,i); } } @@ -443,7 +431,6 @@ void free_context_pss_nr(void) free_and_zero(primary_synchro_nr[i]); free_and_zero(primary_synchro_nr2[i]); free_and_zero(primary_synchro_time_nr[i]); - free_and_zero(pss_corr_ue[i]); } } @@ -801,7 +788,6 @@ static inline double angle64(int64_t x) *********************************************************************/ #define DOT_PRODUCT_SCALING_SHIFT (17) - int pss_search_time_nr(int **rxdata, ///rx data in time domain NR_DL_FRAME_PARMS *frame_parms, int fo_flag, @@ -812,7 +798,7 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain unsigned int n, ar, peak_position, pss_source; int64_t peak_value; int64_t result; - int64_t avg[NUMBER_PSS_SEQUENCE]; + int64_t avg[NUMBER_PSS_SEQUENCE]={0}; double ffo_est=0; // performing the correlation on a frame length plus one symbol for the first of the two frame @@ -823,9 +809,8 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain else length = frame_parms->samples_per_frame; - AssertFatal(length>0,"illegal length %d\n",length); - for (int i = 0; i < NUMBER_PSS_SEQUENCE; i++) AssertFatal(pss_corr_ue[i] != NULL,"pss_corr_ue[%d] not yet allocated! Exiting.\n", i); + AssertFatal(length>0,"illegal length %d\n",length); peak_value = 0; peak_position = 0; pss_source = 0; @@ -846,47 +831,41 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain /* Correlation computation is based on a a dot product which is realized thank to SIMS extensions */ for (int pss_index = 0; pss_index < NUMBER_PSS_SEQUENCE; pss_index++) { - avg[pss_index]=0; - memset(pss_corr_ue[pss_index],0,length*sizeof(int64_t)); - } - for (n=0; n < length; n+=4) { // + for (n=0; n < length; n+=4) { // - for (int pss_index = 0; pss_index < NUMBER_PSS_SEQUENCE; pss_index++) { + int64_t pss_corr_ue=0; + /* calculate dot product of primary_synchro_time_nr and rxdata[ar][n] + * (ar=0..nb_ant_rx) and store the sum in temp[n]; */ + for (ar=0; arnb_antennas_rx; ar++) { - if ( n < (length - frame_parms->ofdm_symbol_size)) { + /* perform correlation of rx data and pss sequence ie it is a dot product */ + result = dot_product64((short*)primary_synchro_time_nr[pss_index], + (short*)&(rxdata[ar][n+is*frame_parms->samples_per_frame]), + frame_parms->ofdm_symbol_size, + shift); + pss_corr_ue += abs64(result); + //((short*)pss_corr_ue[pss_index])[2*n] += ((short*) &result)[0]; /* real part */ + //((short*)pss_corr_ue[pss_index])[2*n+1] += ((short*) &result)[1]; /* imaginary part */ + //((short*)&synchro_out)[0] += ((int*) &result)[0]; /* real part */ + //((short*)&synchro_out)[1] += ((int*) &result)[1]; /* imaginary part */ - /* calculate dot product of primary_synchro_time_nr and rxdata[ar][n] (ar=0..nb_ant_rx) and store the sum in temp[n]; */ - for (ar=0; arnb_antennas_rx; ar++) { - - /* perform correlation of rx data and pss sequence ie it is a dot product */ - result = dot_product64((short*)primary_synchro_time_nr[pss_index], - (short*)&(rxdata[ar][n+is*frame_parms->samples_per_frame]), - frame_parms->ofdm_symbol_size, - shift); - pss_corr_ue[pss_index][n] += abs64(result); - //((short*)pss_corr_ue[pss_index])[2*n] += ((short*) &result)[0]; /* real part */ - //((short*)pss_corr_ue[pss_index])[2*n+1] += ((short*) &result)[1]; /* imaginary part */ - //((short*)&synchro_out)[0] += ((int*) &result)[0]; /* real part */ - //((short*)&synchro_out)[1] += ((int*) &result)[1]; /* imaginary part */ - - } } - + /* calculate the absolute value of sync_corr[n] */ - avg[pss_index]+=pss_corr_ue[pss_index][n]; - if (pss_corr_ue[pss_index][n] > peak_value) { - peak_value = pss_corr_ue[pss_index][n]; + avg[pss_index]+=pss_corr_ue; + if (pss_corr_ue > peak_value) { + peak_value = pss_corr_ue; peak_position = n; pss_source = pss_index; - + #ifdef DEBUG_PSS_NR - printf("pss_index %d: n %6u peak_value %15llu\n", pss_index, n, (unsigned long long)pss_corr_ue[pss_index][n]); + printf("pss_index %d: n %6u peak_value %15llu\n", pss_index, n, (unsigned long long)pss_corr_ue[n]); #endif } } } - + if (fo_flag){ // fractional frequency offset computation according to Cross-correlation Synchronization Algorithm Using PSS @@ -922,7 +901,8 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain // computing absolute value of frequency offset *f_off = ffo_est*frame_parms->subcarrier_spacing; - for (int pss_index = 0; pss_index < NUMBER_PSS_SEQUENCE; pss_index++) avg[pss_index]/=(length/4); + for (int pss_index = 0; pss_index < NUMBER_PSS_SEQUENCE; pss_index++) + avg[pss_index]/=(length/4); *eNB_id = pss_source; @@ -937,9 +917,6 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain static int debug_cnt = 0; if (debug_cnt == 0) { - LOG_M("pss_corr_ue0.m","pss_corr_ue0",pss_corr_ue[0],length,1,6); - LOG_M("pss_corr_ue1.m","pss_corr_ue1",pss_corr_ue[1],length,1,6); - LOG_M("pss_corr_ue2.m","pss_corr_ue2",pss_corr_ue[2],length,1,6); if (is) LOG_M("rxdata1.m","rxd0",rxdata[frame_parms->samples_per_frame],length,1,1); else diff --git a/openair1/PHY/TOOLS/angle.c b/openair1/PHY/TOOLS/angle.c index a06640d1cf..89ffc3cb60 100644 --- a/openair1/PHY/TOOLS/angle.c +++ b/openair1/PHY/TOOLS/angle.c @@ -29,7 +29,7 @@ #include "costable.h" #include "defs.h" -unsigned int angle(struct complex16 perror) +unsigned int angle(c16_t perror) { int a; diff --git a/openair1/PHY/TOOLS/cadd_sv.c b/openair1/PHY/TOOLS/cadd_sv.c index caa8d1cc04..56dcb71847 100644 --- a/openair1/PHY/TOOLS/cadd_sv.c +++ b/openair1/PHY/TOOLS/cadd_sv.c @@ -129,7 +129,7 @@ main () short output[256] __attribute__((aligned(16))); int i; - struct complex16 alpha; + c16_t alpha; Zero_Buffer(output,256*2); diff --git a/openair1/PHY/TOOLS/cadd_vv.c b/openair1/PHY/TOOLS/cadd_vv.c index 77346a97f7..08bf514cb3 100644 --- a/openair1/PHY/TOOLS/cadd_vv.c +++ b/openair1/PHY/TOOLS/cadd_vv.c @@ -278,7 +278,7 @@ main () short output[256] __attribute__((aligned(16))); int i; - struct complex16 alpha; + c16_t alpha; Zero_Buffer(output,256*2); diff --git a/openair1/PHY/TOOLS/calibration_test.c b/openair1/PHY/TOOLS/calibration_test.c index 5dced27060..650d5e420c 100644 --- a/openair1/PHY/TOOLS/calibration_test.c +++ b/openair1/PHY/TOOLS/calibration_test.c @@ -305,15 +305,15 @@ int main(int argc, char **argv) { openair0_device_load(&rfdevice,&openair0_cfg); - void ** samplesRx = (void **)malloc16(antennas* sizeof(struct complex16 *) ); - void ** samplesTx = (void **)malloc16(antennas* sizeof(struct complex16 *) ); + void ** samplesRx = (void **)malloc16(antennas* sizeof(c16_t *) ); + void ** samplesTx = (void **)malloc16(antennas* sizeof(c16_t *) ); int fd=open(getenv("rftestInputFile"),O_RDONLY); AssertFatal(fd>=0,"%s",strerror(errno)); for (int i=0; irbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS] __attribute__((aligned(32))); bzero(output,rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS); if (input_fd == NULL) { - nr_dlsch_encoding(gNB, test_input, frame, slot, dlsch, frame_parms,output,NULL,NULL,NULL,NULL,NULL,NULL,NULL); + nr_dlsch_encoding(gNB, frame, slot, &dlsch->harq_process, frame_parms,output,NULL,NULL,NULL,NULL,NULL,NULL,NULL); } for (SNR = snr0; SNR < snr1; SNR += snr_step) { diff --git a/openair1/SIMULATION/NR_PHY/pucchsim.c b/openair1/SIMULATION/NR_PHY/pucchsim.c index 151d51d726..b6dc3d8f11 100644 --- a/openair1/SIMULATION/NR_PHY/pucchsim.c +++ b/openair1/SIMULATION/NR_PHY/pucchsim.c @@ -551,7 +551,7 @@ int main(int argc, char **argv) if (n_trials==1) printf("txlev %d (%f dB), offset %d, sigma2 %f ( %f dB)\n",txlev,10*log10(txlev),startingSymbolIndex*frame_parms->ofdm_symbol_size,sigma2,sigma2_dB); - struct complex16 **rxdataF = (struct complex16 **)gNB->common_vars.rxdataF; + c16_t **rxdataF = (struct complex16 **)gNB->common_vars.rxdataF; for (int symb=0; symbframe_parms.symbols_per_slot;symb++) { if (symb= startingSymbolIndex+nrofSymbols) { int i0 = symb*gNB->frame_parms.ofdm_symbol_size; diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/frame_config_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/frame_config_test.c index c88c261667..093bb2d000 100644 --- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/frame_config_test.c +++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/frame_config_test.c @@ -285,7 +285,7 @@ int main(int argc, char *argv[]) uint8_t nb_antennas_tx = 1; uint8_t nb_antennas_rx = 1; uint8_t frame_type = FDD; - uint8_t N_RB_DL=100; + int N_RB_DL=100; lte_prefix_type_t extended_prefix_flag = NORMAL; int Nid_cell[] = {(3*0+0)}; VOID_PARAMETER argc; diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/harq_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/harq_test.c index 05170e0bc9..96d7382f2b 100644 --- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/harq_test.c +++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/harq_test.c @@ -200,7 +200,7 @@ int main(int argc, char *argv[]) uint8_t nb_antennas_tx = 1; uint8_t nb_antennas_rx = 1; uint8_t frame_type = FDD; - uint8_t N_RB_DL=100; + int N_RB_DL=100; lte_prefix_type_t extended_prefix_flag = NORMAL; int Nid_cell[] = {(3*0+0)}; VOID_PARAMETER argc; diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pbch_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pbch_test.c index 7600dfb08f..5c7f3157e7 100644 --- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pbch_test.c +++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pbch_test.c @@ -379,7 +379,7 @@ int main(int argc, char *argv[]) uint8_t nb_antennas_tx = 1; uint8_t nb_antennas_rx = 1; uint8_t frame_type = FDD; - uint8_t N_RB_DL=100; + int N_RB_DL=100; lte_prefix_type_t extended_prefix_flag = NORMAL; int decoded_pbch = -1; int Nid1, Nid2; diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_test.c index 2088d558cb..de1249457f 100644 --- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_test.c +++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_test.c @@ -184,7 +184,7 @@ int main(int argc, char *argv[]) uint8_t nb_antennas_rx = 1; uint16_t Nid_cell=123; uint8_t frame_type=FDD; - uint8_t N_RB_DL=100; + int N_RB_DL=100; lte_prefix_type_t extended_prefix_flag=NORMAL; const char *name_test = "PSS NR"; test_t test = { name_test, 0, 0, 0, 0}; diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c index 4334bd12f9..2302c50ab1 100644 --- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c +++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c @@ -206,7 +206,7 @@ void undefined_function(const char *function) { *********************************************************************/ int init_test(unsigned char N_tx, unsigned char N_rx, unsigned char transmission_mode, - unsigned char extended_prefix_flag, uint8_t frame_type, uint16_t Nid_cell, uint8_t N_RB_DL) { + unsigned char extended_prefix_flag, uint8_t frame_type, uint16_t Nid_cell, int N_RB_DL) { (void) transmission_mode; NR_DL_FRAME_PARMS *frame_parms; int log_level = OAILOG_TRACE; diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.h b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.h index f0929e88c0..78efc2234b 100644 --- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.h +++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.h @@ -90,7 +90,7 @@ int set_pss_in_rx_buffer(PHY_VARS_NR_UE *PHY_vars_UE, int position_symbol, int p int init_test(unsigned char N_tx, unsigned char N_rx, unsigned char transmission_mode, unsigned char extended_prefix_flag, uint8_t frame_type, uint16_t Nid_cell, - uint8_t N_RB_DL); + int N_RB_DL); void display_test_configuration_pss(int position, int pss_sequence_number); diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_generator_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_generator_test.c index 68acea6d98..4948d0a876 100644 --- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_generator_test.c +++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_generator_test.c @@ -142,7 +142,7 @@ int main(int argc, char *argv[]) { uint8_t nb_antennas_tx = 1; uint8_t nb_antennas_rx = 1; uint8_t frame_type = FDD; - uint8_t N_RB_DL=106; + int N_RB_DL=106; lte_prefix_type_t extended_prefix_flag = NORMAL; int Nid_cell[] = {(3*1+3)}; VOID_PARAMETER argc; diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_test.c index f731edc20a..31fe15a6de 100644 --- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_test.c +++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_test.c @@ -1239,7 +1239,7 @@ int main(int argc, char *argv[]) uint8_t nb_antennas_tx = 1; uint8_t nb_antennas_rx = 1; uint8_t frame_type = FDD; - uint8_t N_RB_DL=100; + int N_RB_DL=100; lte_prefix_type_t extended_prefix_flag = NORMAL; int Nid_cell[] = {(3*1+3)}; VOID_PARAMETER argc; diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/srs_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/srs_test.c index 34ea68bc61..235387acf7 100644 --- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/srs_test.c +++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/srs_test.c @@ -442,7 +442,7 @@ int main(int argc, char *argv[]) uint8_t nb_antennas_tx = 1; uint8_t nb_antennas_rx = 1; uint8_t frame_type = FDD; - uint8_t N_RB_DL=100; + int N_RB_DL=100; lte_prefix_type_t extended_prefix_flag = NORMAL; int Nid_cell[] = {(3*0+0)}; VOID_PARAMETER argc; diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/sss_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/sss_test.c index 34127b604f..6f6594861a 100644 --- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/sss_test.c +++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/sss_test.c @@ -181,7 +181,7 @@ int main(int argc, char *argv[]) uint8_t nb_antennas_tx = 1; uint8_t nb_antennas_rx = 1; uint8_t frame_type = FDD; - uint8_t N_RB_DL=100; + int N_RB_DL=100; lte_prefix_type_t extended_prefix_flag = NORMAL; int phase; int Nid1, Nid2; diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h index ba3128923f..f084cb2d63 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h @@ -109,8 +109,7 @@ typedef struct { uint8_t LCID: 6; // octet 1 [5:0] uint8_t F: 1; // octet 1 [6] uint8_t R: 1; // octet 1 [7] - uint8_t L1: 8; // octet 2 [7:0] - uint8_t L2: 8; // octet 3 [7:0] + uint16_t L: 16; // octet 2 [7:0] } __attribute__ ((__packed__)) NR_MAC_SUBHEADER_LONG; typedef struct { @@ -118,6 +117,18 @@ typedef struct { uint8_t R: 2; // octet 1 [7:6] } __attribute__ ((__packed__)) NR_MAC_SUBHEADER_FIXED; +static inline void getMacLen(uint8_t* pdu, uint16_t *mac_ce_len, uint16_t *mac_subheader_len) { + NR_MAC_SUBHEADER_SHORT *s=(NR_MAC_SUBHEADER_SHORT*) pdu; + NR_MAC_SUBHEADER_LONG *l=(NR_MAC_SUBHEADER_LONG*) pdu; + if (s->F) { + *mac_subheader_len=sizeof(*l); + *mac_ce_len=ntohs(l->L); + } else { + *mac_subheader_len=sizeof(*s); + *mac_ce_len=s->L; + } +} + // BSR MAC CEs // TS 38.321 ch. 6.1.3.1 // Short BSR for a specific logical channel group ID diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 0c339ee70a..05313f388a 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -3326,10 +3326,6 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment, int pdu_id){ - uint8_t rx_lcid; - uint16_t mac_ce_len; - uint16_t mac_subheader_len; - uint16_t mac_sdu_len; module_id_t module_idP = dl_info->module_id; frame_t frameP = dl_info->frame; int slot = dl_info->slot; @@ -3348,10 +3344,9 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, LOG_D(MAC, "In %s [%d.%d]: processing PDU %d (with length %d) of %d total number of PDUs...\n", __FUNCTION__, frameP, slot, pdu_id, pdu_len, dl_info->rx_ind->number_pdus); while (!done && pdu_len > 0){ - mac_ce_len = 0x0000; - mac_subheader_len = 0x0001; // default to fixed-length subheader = 1-oct - mac_sdu_len = 0x0000; - rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID; + uint16_t mac_len = 0x0000; + uint16_t mac_subheader_len = 0x0001; // default to fixed-length subheader = 1-oct + uint8_t rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID; LOG_D(MAC, "[UE] LCID %d, PDU length %d\n", rx_lcid, pdu_len); switch(rx_lcid){ @@ -3359,128 +3354,89 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, case DL_SCH_LCID_CCCH: // MSG4 RRC Setup 38.331 // variable length - if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ - mac_sdu_len = ((uint16_t)(((NR_MAC_SUBHEADER_LONG *) pduP)->L1 & 0x7f) << 8) - | ((uint16_t)((NR_MAC_SUBHEADER_LONG *) pduP)->L2 & 0xff); - mac_subheader_len = 3; - } else { - mac_sdu_len = ((NR_MAC_SUBHEADER_SHORT *) pduP)->L; - mac_subheader_len = 2; - } - - AssertFatal(pdu_len > mac_sdu_len, "The mac_sdu_len (%d) has an invalid size. PDU len = %d! \n", - mac_sdu_len, pdu_len); + getMacLen(pduP, &mac_len, &mac_subheader_len); + AssertFatal(pdu_len > mac_len, "The mac_len (%d) has an invalid size. PDU len = %d! \n", + mac_len, pdu_len); // Check if it is a valid CCCH message, we get all 00's messages very often int i = 0; - for(i=0; i<(mac_subheader_len+mac_sdu_len); i++) { + for(i=0; i<(mac_subheader_len+mac_len); i++) { if(pduP[i] != 0) { break; } } - if (i == (mac_subheader_len+mac_sdu_len)) { + if (i == (mac_subheader_len+mac_len)) { LOG_D(NR_MAC, "%s() Invalid CCCH message!, pdu_len: %d\n", __func__, pdu_len); done = 1; break; } - if ( mac_sdu_len > 0 ) { - LOG_D(NR_MAC,"DL_SCH_LCID_CCCH (e.g. RRCSetup) with payload len %d\n", mac_sdu_len); + if ( mac_len > 0 ) { + LOG_D(NR_MAC,"DL_SCH_LCID_CCCH (e.g. RRCSetup) with payload len %d\n", mac_len); for (int i = 0; i < mac_subheader_len; i++) { LOG_D(NR_MAC, "MAC header %d: 0x%x\n", i, pduP[i]); } - for (int i = 0; i < mac_sdu_len; i++) { + for (int i = 0; i < mac_len; i++) { LOG_D(NR_MAC, "%d: 0x%x\n", i, pduP[mac_subheader_len + i]); } - nr_mac_rrc_data_ind_ue(module_idP, CC_id, gNB_index, frameP, 0, mac->crnti, CCCH, pduP+mac_subheader_len, mac_sdu_len); + nr_mac_rrc_data_ind_ue(module_idP, CC_id, gNB_index, frameP, 0, mac->crnti, CCCH, pduP+mac_subheader_len, mac_len); } break; case DL_SCH_LCID_TCI_STATE_ACT_UE_SPEC_PDSCH: + case DL_SCH_LCID_APERIODIC_CSI_TRI_STATE_SUBSEL: + case DL_SCH_LCID_SP_CSI_RS_CSI_IM_RES_SET_ACT: + case DL_SCH_LCID_SP_SRS_ACTIVATION: // 38.321 Ch6.1.3.14 // varialbe length - mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ - mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8; - mac_subheader_len = 3; - } - break; - case DL_SCH_LCID_APERIODIC_CSI_TRI_STATE_SUBSEL: - // 38.321 Ch6.1.3.13 - // varialbe length - mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ - mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8; - mac_subheader_len = 3; - } - break; - case DL_SCH_LCID_SP_CSI_RS_CSI_IM_RES_SET_ACT: - // 38.321 Ch6.1.3.12 - // varialbe length - mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ - mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8; - mac_subheader_len = 3; - } - break; - case DL_SCH_LCID_SP_SRS_ACTIVATION: - // 38.321 Ch6.1.3.17 - // varialbe length - mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ - mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8; - mac_subheader_len = 3; - } + getMacLen(pduP, &mac_len, &mac_subheader_len); break; + case DL_SCH_LCID_RECOMMENDED_BITRATE: // 38.321 Ch6.1.3.20 - mac_ce_len = 2; + mac_len = 2; break; case DL_SCH_LCID_SP_ZP_CSI_RS_RES_SET_ACT: // 38.321 Ch6.1.3.19 - mac_ce_len = 2; + mac_len = 2; break; case DL_SCH_LCID_PUCCH_SPATIAL_RELATION_ACT: // 38.321 Ch6.1.3.18 - mac_ce_len = 3; + mac_len = 3; break; case DL_SCH_LCID_SP_CSI_REP_PUCCH_ACT: // 38.321 Ch6.1.3.16 - mac_ce_len = 2; + mac_len = 2; break; case DL_SCH_LCID_TCI_STATE_IND_UE_SPEC_PDCCH: // 38.321 Ch6.1.3.15 - mac_ce_len = 2; + mac_len = 2; break; case DL_SCH_LCID_DUPLICATION_ACT: // 38.321 Ch6.1.3.11 - mac_ce_len = 1; + mac_len = 1; break; case DL_SCH_LCID_SCell_ACT_4_OCT: // 38.321 Ch6.1.3.10 - mac_ce_len = 4; + mac_len = 4; break; case DL_SCH_LCID_SCell_ACT_1_OCT: // 38.321 Ch6.1.3.10 - mac_ce_len = 1; + mac_len = 1; break; case DL_SCH_LCID_L_DRX: // 38.321 Ch6.1.3.6 // fixed length but not yet specify. - mac_ce_len = 0; + mac_len = 0; break; case DL_SCH_LCID_DRX: // 38.321 Ch6.1.3.5 // fixed length but not yet specify. - mac_ce_len = 0; + mac_len = 0; break; case DL_SCH_LCID_TA_COMMAND: // 38.321 Ch6.1.3.4 - mac_ce_len = 1; + mac_len = 1; /*uint8_t ta_command = ((NR_MAC_CE_TA *)pduP)[1].TA_COMMAND; uint8_t tag_id = ((NR_MAC_CE_TA *)pduP)[1].TAGID;*/ @@ -3502,14 +3458,14 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, // Clause 5.1.5 and 6.1.3.3 of 3GPP TS 38.321 version 16.2.1 Release 16 // MAC Header: 1 byte (R/R/LCID) // MAC SDU: 6 bytes (UE Contention Resolution Identity) - mac_ce_len = 6; + mac_len = 6; if(ra->ra_state == WAIT_CONTENTION_RESOLUTION) { LOG_I(MAC, "[UE %d][RAPROC] Frame %d : received contention resolution identity: 0x%02x%02x%02x%02x%02x%02x Terminating RA procedure\n", module_idP, frameP, pduP[1], pduP[2], pduP[3], pduP[4], pduP[5], pduP[6]); bool ra_success = true; - for(int i = 0; icont_res_id[i] != pduP[i+1]) { ra_success = false; break; @@ -3540,22 +3496,8 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, // check if LCID is valid at current time. if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT)) return; - NR_MAC_SUBHEADER_SHORT *shs = (NR_MAC_SUBHEADER_SHORT *)pduP; - if (shs->F) { - //mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8; - mac_subheader_len = 3; - if (pdu_len < sizeof(NR_MAC_SUBHEADER_LONG)) - return; - NR_MAC_SUBHEADER_LONG *shl = (NR_MAC_SUBHEADER_LONG *)pduP; - mac_sdu_len = ((uint16_t)(shl->L1 & 0x7f) << 8) | (uint16_t)(shl->L2 & 0xff); - } else { - if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT)) - return; - mac_sdu_len = (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - } - - LOG_D(NR_MAC, "[UE %d] Frame %d : DLSCH -> DL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid, gNB_index, mac_sdu_len); + getMacLen(pduP, &mac_len, &mac_subheader_len); + LOG_D(NR_MAC, "[UE %d] Frame %d : DLSCH -> DL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid, gNB_index, mac_len); #if defined(ENABLE_MAC_PAYLOAD_DEBUG) LOG_T(MAC, "[UE %d] First 32 bytes of DLSCH : \n", module_idP); @@ -3576,7 +3518,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, MBMS_FLAG_NO, rx_lcid, (char *) (pduP + mac_subheader_len), - mac_sdu_len, + mac_len, 1, NULL); } else { @@ -3587,8 +3529,8 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, break; } } - pduP += ( mac_subheader_len + mac_ce_len + mac_sdu_len ); - pdu_len -= ( mac_subheader_len + mac_ce_len + mac_sdu_len ); + pduP += ( mac_subheader_len + mac_len ); + pdu_len -= ( mac_subheader_len + mac_len ); if (pdu_len < 0) LOG_E(MAC, "[UE %d][%d.%d] nr_ue_process_mac_pdu, residual mac pdu length %d < 0!\n", module_idP, frameP, slot, pdu_len); } diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index bc9895ac2e..05c57d19ea 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -3118,8 +3118,7 @@ uint8_t nr_ue_get_sdu(module_id_t module_idP, header->R = 0; header->F = 1; header->LCID = lcid; - header->L1 = ((unsigned short) sdu_length >> 8) & 0x7f; - header->L2 = (unsigned short) sdu_length & 0xff; + header->L = htons(sdu_length); #ifdef ENABLE_MAC_PAYLOAD_DEBUG LOG_I(NR_MAC, "In %s: dumping MAC sub-header with length %d: \n", __FUNCTION__, sh_size); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index f36dbc4a16..2263f4656b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -1619,7 +1619,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra harq->feedback_slot = pucch->ul_slot; harq->feedback_frame = pucch->frame; - uint8_t *buf = (uint8_t *) harq->tb; + uint8_t *buf = (uint8_t *) harq->transportBlock; // Bytes to be transmitted if (harq->round == 0) { if (ra->msg3_dcch_dtch) { @@ -1866,11 +1866,11 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra } T(T_GNB_MAC_DL_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), T_INT(ra->rnti), - T_INT(frameP), T_INT(slotP), T_INT(current_harq_pid), T_BUFFER(harq->tb, harq->tb_size)); + T_INT(frameP), T_INT(slotP), T_INT(current_harq_pid), T_BUFFER(harq->transportBlock, harq->tb_size)); // DL TX request nfapi_nr_pdu_t *tx_req = &nr_mac->TX_req[CC_id].pdu_list[nr_mac->TX_req[CC_id].Number_of_PDUs]; - memcpy(tx_req->TLVs[0].value.direct, harq->tb, sizeof(uint8_t) * harq->tb_size); + memcpy(tx_req->TLVs[0].value.direct, harq->transportBlock, sizeof(uint8_t) * harq->tb_size); tx_req->PDU_length = harq->tb_size; tx_req->PDU_index = pduindex; tx_req->num_TLV = 1; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 5032ee601f..ccbd6d43f8 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -1320,12 +1320,12 @@ void nr_schedule_ue_spec(module_id_t module_id, current_harq_pid); T(T_GNB_MAC_RETRANSMISSION_DL_PDU_WITH_DATA, T_INT(module_id), T_INT(CC_id), T_INT(rnti), - T_INT(frame), T_INT(slot), T_INT(current_harq_pid), T_INT(harq->round), T_BUFFER(harq->tb, TBS)); + T_INT(frame), T_INT(slot), T_INT(current_harq_pid), T_INT(harq->round), T_BUFFER(harq->transportBlock, TBS)); } else { /* initial transmission */ LOG_D(NR_MAC, "[%s] Initial HARQ transmission in %d.%d\n", __FUNCTION__, frame, slot); - uint8_t *buf = (uint8_t *) harq->tb; + uint8_t *buf = (uint8_t *) harq->transportBlock; /* first, write all CEs that might be there */ int written = nr_write_ce_dlsch_pdu(module_id, @@ -1334,8 +1334,8 @@ void nr_schedule_ue_spec(module_id_t module_id, 255, // no drx NULL); // contention res id buf += written; - int size = TBS - written; - DevAssert(size >= 0); + uint8_t* bufEnd = buf + TBS - written; + DevAssert(TBS > written); /* next, get RLC data */ @@ -1345,18 +1345,15 @@ void nr_schedule_ue_spec(module_id_t module_id, start_meas(&gNB_mac->rlc_data_req); if (sched_ctrl->num_total_bytes > 0) { tbs_size_t len = 0; - while (size > 3) { + while (bufEnd-buf > sizeof(NR_MAC_SUBHEADER_LONG) + 1 ) { // we do not know how much data we will get from RLC, i.e., whether it // will be longer than 256B or not. Therefore, reserve space for long header, then // fetch data, then fill real length NR_MAC_SUBHEADER_LONG *header = (NR_MAC_SUBHEADER_LONG *) buf; - buf += 3; - size -= 3; - /* limit requested number of bytes to what preprocessor specified, or * such that TBS is full */ - const rlc_buffer_occupancy_t ndata = min(sched_ctrl->rlc_status[lcid].bytes_in_buffer, size); - + const rlc_buffer_occupancy_t ndata = min(sched_ctrl->rlc_status[lcid].bytes_in_buffer, + bufEnd-buf-+sizeof(NR_MAC_SUBHEADER_LONG)); len = mac_rlc_data_req(module_id, rnti, module_id, @@ -1365,12 +1362,12 @@ void nr_schedule_ue_spec(module_id_t module_id, MBMS_FLAG_NO, lcid, ndata, - (char *)buf, + (char *)buf+sizeof(NR_MAC_SUBHEADER_LONG), 0, 0); - + LOG_D(NR_MAC, - "%4d.%2d RNTI %04x: %d bytes from %s %d (ndata %d, remaining size %d)\n", + "%4d.%2d RNTI %04x: %d bytes from %s %d (ndata %d, remaining size %ld)\n", frame, slot, rnti, @@ -1378,59 +1375,45 @@ void nr_schedule_ue_spec(module_id_t module_id, lcid < 4 ? "DCCH" : "DTCH", lcid, ndata, - size); + bufEnd-buf-+sizeof(NR_MAC_SUBHEADER_LONG)); if (len == 0) break; header->R = 0; header->F = 1; header->LCID = lcid; - header->L1 = (len >> 8) & 0xff; - header->L2 = len & 0xff; - size -= len; - buf += len; + header->L = htons(len); + buf += len+sizeof(NR_MAC_SUBHEADER_LONG); dlsch_total_bytes += len; } - if (len == 0) { - /* RLC did not have data anymore, mark buffer as unused */ - buf -= 3; - size += 3; - } } else if (get_softmodem_params()->phy_test || get_softmodem_params()->do_ra || get_softmodem_params()->sa) { /* we will need the large header, phy-test typically allocates all * resources and fills to the last byte below */ - NR_MAC_SUBHEADER_LONG *header = (NR_MAC_SUBHEADER_LONG *) buf; - buf += 3; - size -= 3; - DevAssert(size > 0); - LOG_D(NR_MAC, "Configuring DL_TX in %d.%d: TBS %d with %d B of random data\n", frame, slot, TBS, size); - // fill dlsch_buffer with random data - for (int i = 0; i < size; i++) - buf[i] = lrand48() & 0xff; - header->R = 0; - header->F = 1; - header->LCID = DL_SCH_LCID_PADDING; - header->L1 = (size >> 8) & 0xff; - header->L2 = size & 0xff; - size -= size; - buf += size; - dlsch_total_bytes += size; + LOG_D(NR_MAC, "Configuring DL_TX in %d.%d: TBS %d of random data\n", frame, slot, TBS); + if (bufEnd-buf > sizeof(NR_MAC_SUBHEADER_LONG) ) { + NR_MAC_SUBHEADER_LONG *header = (NR_MAC_SUBHEADER_LONG *) buf; + // fill dlsch_buffer with random data + header->R = 0; + header->F = 1; + header->LCID = DL_SCH_LCID_PADDING; + buf += sizeof(NR_MAC_SUBHEADER_LONG); + header->L = htons(bufEnd-buf); + dlsch_total_bytes += bufEnd-buf; + for (; buf < bufEnd; buf++) + *buf = lrand48() & 0xff; + } } stop_meas(&gNB_mac->rlc_data_req); // Add padding header and zero rest out if there is space left - if (size > 0) { + if (bufEnd-buf > 0) { NR_MAC_SUBHEADER_FIXED *padding = (NR_MAC_SUBHEADER_FIXED *) buf; padding->R = 0; padding->LCID = DL_SCH_LCID_PADDING; - size -= 1; buf += 1; - while (size > 0) { - *buf = 0; - buf += 1; - size -= 1; - } + memset(buf,0,bufEnd-buf); + buf=bufEnd; } UE_info->mac_stats[UE_id].dlsch_total_bytes += TBS; @@ -1455,7 +1438,7 @@ void nr_schedule_ue_spec(module_id_t module_id, } T(T_GNB_MAC_DL_PDU_WITH_DATA, T_INT(module_id), T_INT(CC_id), T_INT(rnti), - T_INT(frame), T_INT(slot), T_INT(current_harq_pid), T_BUFFER(harq->tb, TBS)); + T_INT(frame), T_INT(slot), T_INT(current_harq_pid), T_BUFFER(harq->transportBlock, TBS)); } const int ntx_req = gNB_mac->TX_req[CC_id].Number_of_PDUs; @@ -1464,7 +1447,7 @@ void nr_schedule_ue_spec(module_id_t module_id, tx_req->PDU_index = pduindex; tx_req->num_TLV = 1; tx_req->TLVs[0].length = TBS + 2; - memcpy(tx_req->TLVs[0].value.direct, harq->tb, TBS); + memcpy(tx_req->TLVs[0].value.direct, harq->transportBlock, TBS); gNB_mac->TX_req[CC_id].Number_of_PDUs++; gNB_mac->TX_req[CC_id].SFN = frame; gNB_mac->TX_req[CC_id].Slot = slot; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index aa49b14fe5..6c89d30800 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -205,11 +205,7 @@ int nr_process_mac_pdu(module_id_t module_idP, int pdu_len) { - uint8_t rx_lcid; uint8_t done = 0; - uint16_t mac_ce_len; - uint16_t mac_subheader_len; - uint16_t mac_sdu_len; NR_UE_info_t *UE_info = &RC.nrmac[module_idP]->UE_info; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; @@ -223,10 +219,9 @@ int nr_process_mac_pdu(module_id_t module_idP, #endif while (!done && pdu_len > 0){ - mac_ce_len = 0; - mac_subheader_len = sizeof(NR_MAC_SUBHEADER_FIXED); - mac_sdu_len = 0; - rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID; + uint16_t mac_len=0; + uint16_t mac_subheader_len=sizeof(NR_MAC_SUBHEADER_FIXED); + uint8_t rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID; LOG_D(NR_MAC, "In %s: received UL-SCH sub-PDU with LCID 0x%x in %d.%d (remaining PDU length %d)\n", __func__, rx_lcid, frameP, slot, pdu_len); @@ -241,7 +236,7 @@ int nr_process_mac_pdu(module_id_t module_idP, #endif*/ case UL_SCH_LCID_RECOMMENDED_BITRATE_QUERY: // 38.321 Ch6.1.3.20 - mac_ce_len = 2; + mac_len = 2; break; case UL_SCH_LCID_CONFIGURED_GRANT_CONFIRMATION: // 38.321 Ch6.1.3.7 @@ -251,7 +246,7 @@ int nr_process_mac_pdu(module_id_t module_idP, case UL_SCH_LCID_S_TRUNCATED_BSR: //38.321 section 6.1.3.1 //fixed length - mac_ce_len =1; + mac_len =1; /* Extract short BSR value */ ce_ptr = &pduP[mac_subheader_len]; NR_BSR_SHORT *bsr_s = (NR_BSR_SHORT *) ce_ptr; @@ -269,25 +264,20 @@ int nr_process_mac_pdu(module_id_t module_idP, case UL_SCH_LCID_L_BSR: case UL_SCH_LCID_L_TRUNCATED_BSR: - //38.321 section 6.1.3.1 - //variable length - mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ - mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8; - mac_subheader_len = 3; - } - /* Extract long BSR value */ - ce_ptr = &pduP[mac_subheader_len]; - NR_BSR_LONG *bsr_l = (NR_BSR_LONG *) ce_ptr; - sched_ctrl->estimated_ul_buffer = 0; + //38.321 section 6.1.3.1 + //variable length + getMacLen(pduP, &mac_len, &mac_subheader_len); + /* Extract long BSR value */ + ce_ptr = &pduP[mac_subheader_len]; + NR_BSR_LONG *bsr_l = (NR_BSR_LONG *) ce_ptr; + sched_ctrl->estimated_ul_buffer = 0; + + n_Lcg = bsr_l->LcgID7 + bsr_l->LcgID6 + bsr_l->LcgID5 + bsr_l->LcgID4 + + bsr_l->LcgID3 + bsr_l->LcgID2 + bsr_l->LcgID1 + bsr_l->LcgID0; - n_Lcg = bsr_l->LcgID7 + bsr_l->LcgID6 + bsr_l->LcgID5 + bsr_l->LcgID4 + - bsr_l->LcgID3 + bsr_l->LcgID2 + bsr_l->LcgID1 + bsr_l->LcgID0; - - LOG_D(NR_MAC, "LONG BSR, LCG ID(7-0) %d/%d/%d/%d/%d/%d/%d/%d\n", - bsr_l->LcgID7, bsr_l->LcgID6, bsr_l->LcgID5, bsr_l->LcgID4, - bsr_l->LcgID3, bsr_l->LcgID2, bsr_l->LcgID1, bsr_l->LcgID0); + LOG_D(NR_MAC, "LONG BSR, LCG ID(7-0) %d/%d/%d/%d/%d/%d/%d/%d\n", + bsr_l->LcgID7, bsr_l->LcgID6, bsr_l->LcgID5, bsr_l->LcgID4, + bsr_l->LcgID3, bsr_l->LcgID2, bsr_l->LcgID1, bsr_l->LcgID0); for (int n = 0; n < n_Lcg; n++){ LOG_D(NR_MAC, "LONG BSR, %d/%d (n/n_Lcg), BS Index %d, BS value < %d", @@ -322,14 +312,14 @@ int nr_process_mac_pdu(module_id_t module_idP, //38.321 section 6.1.3.2 //fixed length - mac_ce_len = 2; + mac_len = 2; /* Extract CRNTI value */ break; case UL_SCH_LCID_SINGLE_ENTRY_PHR: //38.321 section 6.1.3.8 //fixed length - mac_ce_len = 2; + mac_len = 2; /* Extract SINGLE ENTRY PHR elements for PHR calculation */ ce_ptr = &pduP[mac_subheader_len]; NR_SINGLE_ENTRY_PHR_MAC_CE *phr = (NR_SINGLE_ENTRY_PHR_MAC_CE *) ce_ptr; @@ -348,26 +338,11 @@ int nr_process_mac_pdu(module_id_t module_idP, break; case UL_SCH_LCID_MULTI_ENTRY_PHR_1_OCT: - //38.321 section 6.1.3.9 - // varialbe length - mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ - mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8; - mac_subheader_len = 3; - } - /* Extract MULTI ENTRY PHR elements from single octet bitmap for PHR calculation */ - break; - case UL_SCH_LCID_MULTI_ENTRY_PHR_4_OCT: - //38.321 section 6.1.3.9 - // varialbe length - mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ - mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8; - mac_subheader_len = 3; - } + // varialbe length + getMacLen(pduP, &mac_len, &mac_subheader_len); + //Extract MULTI ENTRY PHR elements from single octet bitmap for PHR calculation */ + break; /* Extract MULTI ENTRY PHR elements from four octets bitmap for PHR calculation */ break; @@ -378,23 +353,14 @@ int nr_process_mac_pdu(module_id_t module_idP, case UL_SCH_LCID_SRB1: case UL_SCH_LCID_SRB2: - if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ - //mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8; - mac_subheader_len = 3; - mac_sdu_len = ((uint16_t)(((NR_MAC_SUBHEADER_LONG *) pduP)->L1 & 0x7f) << 8) - | ((uint16_t)((NR_MAC_SUBHEADER_LONG *) pduP)->L2 & 0xff); - } else { - mac_sdu_len = (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - } - + getMacLen(pduP, &mac_len, &mac_subheader_len); rnti_t crnti = UE_info->rnti[UE_id]; int UE_idx = UE_id; for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) { NR_RA_t *ra = &RC.nrmac[module_idP]->common_channels[CC_id].ra[i]; if (ra->state >= WAIT_Msg3 && ra->rnti == UE_info->rnti[UE_id]) { - uint8_t *next_subpduP = pduP + mac_subheader_len + mac_sdu_len; - if ((pduP[mac_subheader_len+mac_sdu_len] & 0x3F) == UL_SCH_LCID_C_RNTI) { + uint8_t *next_subpduP = pduP + mac_subheader_len + mac_len; + if ((pduP[mac_subheader_len+mac_len] & 0x3F) == UL_SCH_LCID_C_RNTI) { crnti = ((next_subpduP[1]&0xFF)<<8)|(next_subpduP[2]&0xFF); UE_idx = find_nr_UE_id(module_idP, crnti); break; @@ -403,7 +369,7 @@ int nr_process_mac_pdu(module_id_t module_idP, } if (UE_info->CellGroup[UE_idx]) { - LOG_D(NR_MAC, "[UE %d] Frame %d : ULSCH -> UL-DCCH %d (gNB %d, %d bytes), rnti: 0x%04x \n", module_idP, frameP, rx_lcid, module_idP, mac_sdu_len, crnti); + LOG_D(NR_MAC, "[UE %d] Frame %d : ULSCH -> UL-DCCH %d (gNB %d, %d bytes), rnti: 0x%04x \n", module_idP, frameP, rx_lcid, module_idP, mac_len, crnti); mac_rlc_data_ind(module_idP, crnti, module_idP, @@ -412,7 +378,7 @@ int nr_process_mac_pdu(module_id_t module_idP, MBMS_FLAG_NO, rx_lcid, (char *) (pduP + mac_subheader_len), - mac_sdu_len, + mac_len, 1, NULL); } else { @@ -430,23 +396,23 @@ int nr_process_mac_pdu(module_id_t module_idP, if ( rx_lcid == UL_SCH_LCID_CCCH1 ) { // RRCResumeRequest1 message includes the full I-RNTI and has a size of 8 bytes - mac_sdu_len = 8; + mac_len = 8; // Check if it is a valid CCCH1 message, we get all 00's messages very often int i = 0; - for(i=0; i<(mac_subheader_len+mac_sdu_len); i++) { + for(i=0; i<(mac_subheader_len+mac_len); i++) { if(pduP[i] != 0) { break; } } - if (i == (mac_subheader_len+mac_sdu_len)) { + if (i == (mac_subheader_len+mac_len)) { LOG_D(NR_MAC, "%s() Invalid CCCH1 message!, pdu_len: %d\n", __func__, pdu_len); done = 1; break; } } else { // fixed length of 6 bytes - mac_sdu_len = 6; + mac_len = 6; } nr_mac_rrc_data_ind(module_idP, @@ -457,23 +423,12 @@ int nr_process_mac_pdu(module_id_t module_idP, UE_info->rnti[UE_id], CCCH, pduP + mac_subheader_len, - mac_sdu_len, + mac_len, 0); break; case UL_SCH_LCID_DTCH: - // check if LCID is valid at current time. - if (((NR_MAC_SUBHEADER_SHORT *)pduP)->F) { - // mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8; - mac_subheader_len = 3; - mac_sdu_len = ((uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L1 & 0x7f) << 8) - | ((uint16_t)((NR_MAC_SUBHEADER_LONG *)pduP)->L2 & 0xff); - - } else { - mac_sdu_len = (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - } - + getMacLen(pduP, &mac_len, &mac_subheader_len); LOG_D(NR_MAC, "In %s: [UE %d] %d.%d : ULSCH -> UL-%s %d (gNB %d, %d bytes)\n", __func__, module_idP, @@ -482,8 +437,8 @@ int nr_process_mac_pdu(module_id_t module_idP, rx_lcid<4?"DCCH":"DTCH", rx_lcid, module_idP, - mac_sdu_len); - UE_info->mac_stats[UE_id].lc_bytes_rx[rx_lcid] += mac_sdu_len; + mac_len); + UE_info->mac_stats[UE_id].lc_bytes_rx[rx_lcid] += mac_len; mac_rlc_data_ind(module_idP, UE_info->rnti[UE_id], @@ -493,13 +448,13 @@ int nr_process_mac_pdu(module_id_t module_idP, MBMS_FLAG_NO, rx_lcid, (char *)(pduP + mac_subheader_len), - mac_sdu_len, + mac_len, 1, NULL); /* Updated estimated buffer when receiving data */ - if (sched_ctrl->estimated_ul_buffer >= mac_sdu_len) - sched_ctrl->estimated_ul_buffer -= mac_sdu_len; + if (sched_ctrl->estimated_ul_buffer >= mac_len) + sched_ctrl->estimated_ul_buffer -= mac_len; else sched_ctrl->estimated_ul_buffer = 0; break; @@ -514,16 +469,16 @@ int nr_process_mac_pdu(module_id_t module_idP, if (rx_lcid < 45 || rx_lcid == 52 || rx_lcid == 63) { LOG_I(NR_MAC, "In %s: dumping UL MAC SDU sub-header with length %d (LCID = 0x%02x):\n", __func__, mac_subheader_len, rx_lcid); log_dump(NR_MAC, pduP, mac_subheader_len, LOG_DUMP_CHAR, "\n"); - LOG_I(NR_MAC, "In %s: dumping UL MAC SDU with length %d (LCID = 0x%02x):\n", __func__, mac_sdu_len, rx_lcid); - log_dump(NR_MAC, pduP + mac_subheader_len, mac_sdu_len, LOG_DUMP_CHAR, "\n"); + LOG_I(NR_MAC, "In %s: dumping UL MAC SDU with length %d (LCID = 0x%02x):\n", __func__, mac_len, rx_lcid); + log_dump(NR_MAC, pduP + mac_subheader_len, mac_len, LOG_DUMP_CHAR, "\n"); } else { - LOG_I(NR_MAC, "In %s: dumping UL MAC CE with length %d (LCID = 0x%02x):\n", __func__, mac_ce_len, rx_lcid); - log_dump(NR_MAC, pduP + mac_subheader_len + mac_sdu_len, mac_ce_len, LOG_DUMP_CHAR, "\n"); + LOG_I(NR_MAC, "In %s: dumping UL MAC CE with length %d (LCID = 0x%02x):\n", __func__, mac_len, rx_lcid); + log_dump(NR_MAC, pduP + mac_subheader_len + mac_len, mac_len, LOG_DUMP_CHAR, "\n"); } #endif - pduP += ( mac_subheader_len + mac_ce_len + mac_sdu_len ); - pdu_len -= ( mac_subheader_len + mac_ce_len + mac_sdu_len ); + pduP += ( mac_subheader_len + mac_len ); + pdu_len -= ( mac_subheader_len + mac_len ); if (pdu_len < 0) { LOG_E(NR_MAC, "In %s: residual UL MAC PDU in %d.%d with length < 0!, pdu_len %d \n", __func__, frameP, slot, pdu_len); diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index eccffca031..eba9bc52b3 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -444,7 +444,7 @@ typedef struct NR_UE_harq { /* Transport block to be sent using this HARQ process, its size is in * sched_pdsch */ - uint32_t tb[16384]; + uint32_t transportBlock[16384]; uint32_t tb_size; /// sched_pdsch keeps information on MCS etc used for the initial transmission diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 99897f9060..59cf465ac1 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -1065,7 +1065,7 @@ void update_harq_status(module_id_t module_id, uint8_t harq_pid, uint8_t ack_nac int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){ - NR_UE_L2_STATE_t ret; + NR_UE_L2_STATE_t ret=0; module_id_t module_id = ul_info->module_id; NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index 4492380d7f..c73c3d9649 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -969,9 +969,9 @@ rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ( uint16_t ue_initial_id; uint32_t gNB_ue_ngap_id; rrc_gNB_ue_context_t *ue_context_p = NULL; - protocol_ctxt_t ctxt; - gtpv1u_gnb_create_tunnel_req_t create_tunnel_req; - gtpv1u_gnb_create_tunnel_resp_t create_tunnel_resp; + protocol_ctxt_t ctxt={0}; + gtpv1u_gnb_create_tunnel_req_t create_tunnel_req={0}; + gtpv1u_gnb_create_tunnel_resp_t create_tunnel_resp={0}; uint8_t pdu_sessions_done; uint8_t inde_list[NR_NB_RB_MAX - 3]= {0}; int ret = 0; diff --git a/openair3/NAS/NR_UE/nr_nas_msg_sim.c b/openair3/NAS/NR_UE/nr_nas_msg_sim.c index 283f3b7311..e151fec9b4 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg_sim.c +++ b/openair3/NAS/NR_UE/nr_nas_msg_sim.c @@ -428,7 +428,7 @@ void generateRegistrationRequest(as_nas_info_t *initialNasMsg, int Mod_id) { size += 10; // encode the message - initialNasMsg->data = (Byte_t *)malloc(size * sizeof(Byte_t)); + initialNasMsg->data = malloc16_clear(size * sizeof(Byte_t)); registration_request_buf = initialNasMsg->data; initialNasMsg->length = mm_msg_encode(mm_msg, (uint8_t*)(initialNasMsg->data), size); diff --git a/targets/ARCH/rfsimulator/apply_channelmod.c b/targets/ARCH/rfsimulator/apply_channelmod.c index d7d3a68965..6e26120e29 100644 --- a/targets/ARCH/rfsimulator/apply_channelmod.c +++ b/targets/ARCH/rfsimulator/apply_channelmod.c @@ -52,7 +52,7 @@ either we regenerate the channel (call again random_channel(desc,0)), or we keep it over subframes legacy: we regenerate each sub frame in UL, and each frame only in DL */ -void rxAddInput( struct complex16 *input_sig, struct complex16 *after_channel_sig, +void rxAddInput( c16_t *input_sig, c16_t *after_channel_sig, int rxAnt, channel_desc_t *channelDesc, int nbSamples, @@ -73,7 +73,7 @@ void rxAddInput( struct complex16 *input_sig, struct complex16 *after_channel_si const int nbTx=channelDesc->nb_tx; for (int i=0; i<((int)nbSamples-dd); i++) { - struct complex16 *out_ptr=after_channel_sig+dd+i; + c16_t *out_ptr=after_channel_sig+dd+i; struct complexd rx_tmp= {0}; for (int txAnt=0; txAnt < nbTx; txAnt++) { @@ -87,7 +87,7 @@ void rxAddInput( struct complex16 *input_sig, struct complex16 *after_channel_si // but it is not very usefull // it would be better to split out each antenna in a separate flow // that will allow to mix ru antennas freely - struct complex16 tx16=input_sig[((TS+i-l)*nbTx+txAnt)%CirSize]; + c16_t tx16=input_sig[((TS+i-l)*nbTx+txAnt)%CirSize]; rx_tmp.r += tx16.r * channelModel[l].r - tx16.i * channelModel[l].i; rx_tmp.i += tx16.i * channelModel[l].r + tx16.r * channelModel[l].i; } //l diff --git a/targets/ARCH/rfsimulator/rfsimulator.h b/targets/ARCH/rfsimulator/rfsimulator.h index 292873032e..33583f2d32 100644 --- a/targets/ARCH/rfsimulator/rfsimulator.h +++ b/targets/ARCH/rfsimulator/rfsimulator.h @@ -25,8 +25,8 @@ #define __RFSIMULATOR_H double gaussZiggurat(double mean, double variance); void tableNor(unsigned long seed); -void rxAddInput( struct complex16 *input_sig, - struct complex16 *after_channel_sig, +void rxAddInput( c16_t *input_sig, + c16_t *after_channel_sig, int rxAnt, channel_desc_t *channelDesc, int nbSamples, diff --git a/targets/ARCH/rfsimulator/simulator.c b/targets/ARCH/rfsimulator/simulator.c index 013e542689..0a05f2cbef 100644 --- a/targets/ARCH/rfsimulator/simulator.c +++ b/targets/ARCH/rfsimulator/simulator.c @@ -100,7 +100,7 @@ static telnetshell_vardef_t rfsimu_vardef[] = { }; pthread_mutex_t Sockmutex; -typedef struct complex16 sample_t; // 2*16 bits complex number +typedef c16_t sample_t; // 2*16 bits complex number typedef struct buffer_s { int conn_sock; @@ -495,7 +495,7 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initi setblocking(conn_sock, notBlocking); allocCirBuf(t, conn_sock); LOG_I(HW,"A client connected, sending the current time\n"); - struct complex16 v= {0}; + c16_t v= {0}; void *samplesVoid[t->tx_num_channels]; for ( int i=0; i < t->tx_num_channels; i++) @@ -665,7 +665,7 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest // We send timestamp for nb samples required // assuming this should have been done earlier if a Tx would exist pthread_mutex_unlock(&Sockmutex); - struct complex16 v= {0}; + c16_t v= {0}; void *dummyS[t->tx_num_channels]; for ( int i=0; i < t->tx_num_channels; i++) @@ -728,7 +728,7 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest for (int a=0; achannel_model != NULL ) // apply a channel model - rxAddInput( ptr->circularBuf, (struct complex16 *) samplesVoid[a], + rxAddInput( ptr->circularBuf, (c16_t *) samplesVoid[a], a, ptr->channel_model, nsamps, diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 13a09db5a3..1b59ba9b2b 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -1941,7 +1941,7 @@ void write_dummy(PHY_VARS_UE *UE, openair0_timestamp timestamp) { // we have to write to tell explicitly to the eNB, else it will wait for us forever // we write the next subframe (always write in future of what we received) // - struct complex16 v= {0}; + c16_t v= {0}; void *samplesVoid[UE->frame_parms.nb_antennas_tx]; for ( int i=0; i < UE->frame_parms.nb_antennas_tx; i++) From 288c29da84fa2466ea4d503bbdbcce16e8528bf1 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 18 Mar 2022 19:46:42 +0000 Subject: [PATCH 039/114] Apply review suggestions --- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 14 +++++++------- openair2/LAYER2/NR_MAC_COMMON/nr_mac.h | 12 ++++++------ openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index eda53e1c84..b8eaefedb1 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -287,8 +287,8 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, for (int aa=0;aanb_antennas_rx;aa++) { c16_t *r=(c16_t*)&rxdataF[aa][soffset+(l2*frame_parms->ofdm_symbol_size)+re_offset[l]]; for (n=0;n<12;n++) { - xr[aa][l][n].r +=(int32_t)x_re[l][n]*r[n].r+(int32_t)x_im[l][n]*r[n].i; - xr[aa][l][n].i +=(int32_t)x_re[l][n]*r[n].i-(int32_t)x_im[l][n]*r[n].r; + xr[aa][l][n].r += (int32_t)x_re[l][n] * r[n].r + (int32_t)x_im[l][n] * r[n].i; + xr[aa][l][n].i += (int32_t)x_re[l][n] * r[n].i - (int32_t)x_im[l][n] * r[n].r; #ifdef DEBUG_NR_PUCCH_RX printf("x (%d,%d), r%d.%d (%d,%d), xr (%lld,%lld)\n", x_re[l][n],x_im[l][n],l2,re_offset[l],r[n].r,r[n].i,xr[aa][l][n].r,xr[aa][l][n].i); @@ -317,12 +317,12 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, for (int aa=0;aanb_antennas_rx;aa++) { corr_re[aa][l]=0; corr_im[aa][l]=0; - for (n=0;n<12;n++) { - corr_re[aa][l]+=xr[aa][l][n].r*idft12_re[seq_index][n]+xr[aa][l][n].i*idft12_im[seq_index][n]; - corr_im[aa][l]+=xr[aa][l][n].r*idft12_im[seq_index][n]-xr[aa][l][n].i*idft12_re[seq_index][n]; + for (n = 0; n < 12; n++) { + corr_re[aa][l] += xr[aa][l][n].r * idft12_re[seq_index][n] + xr[aa][l][n].i * idft12_im[seq_index][n]; + corr_im[aa][l] += xr[aa][l][n].r * idft12_im[seq_index][n] - xr[aa][l][n].i * idft12_re[seq_index][n]; } - corr_re[aa][l]>>=15; - corr_im[aa][l]>>=15; + corr_re[aa][l] >>= 15; + corr_im[aa][l] >>= 15; } } LOG_D(PHY,"PUCCH IDFT[%d/%d] = (%ld,%ld)=>%f\n", diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h index f084cb2d63..248c30f26f 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h @@ -118,14 +118,14 @@ typedef struct { } __attribute__ ((__packed__)) NR_MAC_SUBHEADER_FIXED; static inline void getMacLen(uint8_t* pdu, uint16_t *mac_ce_len, uint16_t *mac_subheader_len) { - NR_MAC_SUBHEADER_SHORT *s=(NR_MAC_SUBHEADER_SHORT*) pdu; - NR_MAC_SUBHEADER_LONG *l=(NR_MAC_SUBHEADER_LONG*) pdu; + NR_MAC_SUBHEADER_SHORT *s = (NR_MAC_SUBHEADER_SHORT*) pdu; + NR_MAC_SUBHEADER_LONG *l = (NR_MAC_SUBHEADER_LONG*) pdu; if (s->F) { - *mac_subheader_len=sizeof(*l); - *mac_ce_len=ntohs(l->L); + *mac_subheader_len = sizeof(*l); + *mac_ce_len = ntohs(l->L); } else { - *mac_subheader_len=sizeof(*s); - *mac_ce_len=s->L; + *mac_subheader_len = sizeof(*s); + *mac_ce_len = s->L; } } diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 05313f388a..61a2902690 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -2092,7 +2092,7 @@ uint8_t get_downlink_ack(NR_UE_MAC_INST_t *mac, pucch->is_common = current_harq->is_common; current_harq->active = false; current_harq->ack_received = false; - LOG_D(PHY,"%d.%d Sent %d ack on harq pid %d\n", frame, slot, current_harq->ack, dl_harq_pid); + LOG_D(PHY,"%4d.%2d Sent %d ack on harq pid %d\n", frame, slot, current_harq->ack, dl_harq_pid); } } } @@ -3497,7 +3497,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT)) return; getMacLen(pduP, &mac_len, &mac_subheader_len); - LOG_D(NR_MAC, "[UE %d] Frame %d : DLSCH -> DL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid, gNB_index, mac_len); + LOG_D(NR_MAC, "[UE %d] %4d.%2d : DLSCH -> DL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, slot, rx_lcid, gNB_index, mac_len); #if defined(ENABLE_MAC_PAYLOAD_DEBUG) LOG_T(MAC, "[UE %d] First 32 bytes of DLSCH : \n", module_idP); From b153d2d1ee021116226707fbdef90b62b31126c0 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Thu, 24 Mar 2022 21:10:23 +0100 Subject: [PATCH 040/114] fix bug in nr_rate_matching --- openair1/PHY/CODING/nr_rate_matching.c | 97 ++++++++++++++------------ 1 file changed, 54 insertions(+), 43 deletions(-) diff --git a/openair1/PHY/CODING/nr_rate_matching.c b/openair1/PHY/CODING/nr_rate_matching.c index 29cba0a557..84e6615ed9 100644 --- a/openair1/PHY/CODING/nr_rate_matching.c +++ b/openair1/PHY/CODING/nr_rate_matching.c @@ -309,60 +309,71 @@ void nr_interleaving_ldpc(uint32_t E, uint8_t Qm, uint8_t *e,uint8_t *f) void nr_deinterleaving_ldpc(uint32_t E, uint8_t Qm, int16_t *e,int16_t *f) { - int16_t *e1,*e2,*e3,*e4,*e5,*e6,*e7; switch(Qm) { case 2: - e1=e+(E/2); - for (int j = 0,j2=0; j< E/2; j+=2,j2+=4){ - e[j] = f[j2]; - e1[j] = f[j2+1]; - e[j+1] = f[j2+2]; - e1[j+1] = f[j2+3]; + { + int16_t *e1=e+(E/2); + int16_t *end=f+E-4; + while( f Date: Fri, 25 Mar 2022 16:32:07 +0100 Subject: [PATCH 041/114] fix bug introduced in this branch --- openair1/PHY/CODING/nr_rate_matching.c | 2 +- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 60 +++++++++++--------------- openair1/PHY/TOOLS/tools_defs.h | 3 ++ 3 files changed, 30 insertions(+), 35 deletions(-) diff --git a/openair1/PHY/CODING/nr_rate_matching.c b/openair1/PHY/CODING/nr_rate_matching.c index 84e6615ed9..29a1e363e9 100644 --- a/openair1/PHY/CODING/nr_rate_matching.c +++ b/openair1/PHY/CODING/nr_rate_matching.c @@ -307,7 +307,7 @@ void nr_interleaving_ldpc(uint32_t E, uint8_t Qm, uint8_t *e,uint8_t *f) void nr_deinterleaving_ldpc(uint32_t E, uint8_t Qm, int16_t *e,int16_t *f) -{ +{ switch(Qm) { case 2: diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index b8eaefedb1..06b3c6e9e7 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -272,7 +272,6 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, x_im[1] = table_5_2_2_2_2_Im[u[1]]; c64_t xr[frame_parms->nb_antennas_rx][pucch_pdu->nr_of_symbols][12] __attribute__((aligned(32))); - memset(xr, 0, sizeof(xr)); int64_t xrtmag=0,xrtmag_next=0; uint8_t maxpos=0; uint8_t index=0; @@ -287,72 +286,65 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, for (int aa=0;aanb_antennas_rx;aa++) { c16_t *r=(c16_t*)&rxdataF[aa][soffset+(l2*frame_parms->ofdm_symbol_size)+re_offset[l]]; for (n=0;n<12;n++) { - xr[aa][l][n].r += (int32_t)x_re[l][n] * r[n].r + (int32_t)x_im[l][n] * r[n].i; - xr[aa][l][n].i += (int32_t)x_re[l][n] * r[n].i - (int32_t)x_im[l][n] * r[n].r; + xr[aa][l][n].r = (int32_t)x_re[l][n] * r[n].r + (int32_t)x_im[l][n] * r[n].i; + xr[aa][l][n].i = (int32_t)x_re[l][n] * r[n].i - (int32_t)x_im[l][n] * r[n].r; #ifdef DEBUG_NR_PUCCH_RX printf("x (%d,%d), r%d.%d (%d,%d), xr (%lld,%lld)\n", x_re[l][n],x_im[l][n],l2,re_offset[l],r[n].r,r[n].i,xr[aa][l][n].r,xr[aa][l][n].i); #endif } - xr[aa][l][n].r>>=15; - xr[aa][l][n].i>>=15; } } - int64_t corr_re[frame_parms->nb_antennas_rx][2]; - int64_t corr_im[frame_parms->nb_antennas_rx][2]; //int32_t no_corr = 0; int seq_index = 0; int64_t temp; for(i=0;inr_of_symbols;l++) { - seq_index = (pucch_pdu->initial_cyclic_shift+ - mcs[i]+ - gNB->pucch0_lut.lut[cs_ind][slot][l+pucch_pdu->start_symbol_index])%12; + c64_t corr[frame_parms->nb_antennas_rx][2]; + for (int aa=0;aanb_antennas_rx;aa++) { + for (int l=0;lnr_of_symbols;l++) { + seq_index = (pucch_pdu->initial_cyclic_shift+ + mcs[i]+ + gNB->pucch0_lut.lut[cs_ind][slot][l+pucch_pdu->start_symbol_index])%12; #ifdef DEBUG_NR_PUCCH_RX - printf("PUCCH symbol %d seq %d, seq_index %d, mcs %d\n",l,i,seq_index,mcs[i]); + printf("PUCCH symbol %d seq %d, seq_index %d, mcs %d\n",l,i,seq_index,mcs[i]); #endif - for (int aa=0;aanb_antennas_rx;aa++) { - corr_re[aa][l]=0; - corr_im[aa][l]=0; + corr[aa][l]=(c64_t){0}; for (n = 0; n < 12; n++) { - corr_re[aa][l] += xr[aa][l][n].r * idft12_re[seq_index][n] + xr[aa][l][n].i * idft12_im[seq_index][n]; - corr_im[aa][l] += xr[aa][l][n].r * idft12_im[seq_index][n] - xr[aa][l][n].i * idft12_re[seq_index][n]; + corr[aa][l].r += xr[aa][l][n].r * idft12_re[seq_index][n] + xr[aa][l][n].i * idft12_im[seq_index][n]; + corr[aa][l].i += xr[aa][l][n].r * idft12_im[seq_index][n] - xr[aa][l][n].i * idft12_re[seq_index][n]; } - corr_re[aa][l] >>= 15; - corr_im[aa][l] >>= 15; + corr[aa][l].r >>= 31; + corr[aa][l].i >>= 31; } } LOG_D(PHY,"PUCCH IDFT[%d/%d] = (%ld,%ld)=>%f\n", - mcs[i],seq_index,corr_re[0][0],corr_im[0][0], - 10*log10((double)corr_re[0][0]*corr_re[0][0] + (double)corr_im[0][0]*corr_im[0][0])); + mcs[i],seq_index,corr[0][0].r,corr[0][0].i, + 10*log10((double)squaredMod(corr[0][0]))); if (pucch_pdu->nr_of_symbols==2) LOG_D(PHY,"PUCCH 2nd symbol IDFT[%d/%d] = (%ld,%ld)=>%f\n", - mcs[i],seq_index,corr_re[0][1],corr_im[0][1], - 10*log10((double)corr_re[0][1]*corr_re[0][1] + (double)corr_im[0][1]*corr_im[0][1])); + mcs[i],seq_index,corr[0][1].r,corr[0][1].i, + 10*log10((double)squaredMod(corr[0][1]))); if (pucch_pdu->freq_hop_flag == 0) { if (pucch_pdu->nr_of_symbols==1) {// non-coherent correlation temp=0; for (int aa=0;aanb_antennas_rx;aa++) - temp+=(int64_t)corr_re[aa][0]*corr_re[aa][0] + (int64_t)corr_im[aa][0]*corr_im[aa][0]; + temp+=squaredMod(corr[aa][0]); } else { - int64_t corr_re2=0; - int64_t corr_im2=0; temp=0; for (int aa=0;aanb_antennas_rx;aa++) { - corr_re2 = (int64_t)corr_re[aa][0]+corr_re[aa][1]; - corr_im2 = (int64_t)corr_im[aa][0]+corr_im[aa][1]; - // coherent combining of 2 symbols and then complex modulus for single-frequency case - temp+=corr_re2*corr_re2 + corr_im2*corr_im2; + c64_t corr2; + csum(corr2, corr[aa][0], corr[aa][1]); + // coherent combining of 2 symbols and then complex modulus for single-frequency case + temp+=corr2.r*corr2.r + corr2.i*corr2.i; } } } else if (pucch_pdu->freq_hop_flag == 1) { // full non-coherent combining of 2 symbols for frequency-hopping case temp=0; for (int aa=0;aanb_antennas_rx;aa++) - temp += (int64_t)corr_re[aa][0]*corr_re[aa][0] + (int64_t)corr_im[aa][0]*corr_im[aa][0] + (int64_t)corr_re[aa][1]*corr_re[aa][1] + (int64_t)corr_im[aa][1]*corr_im[aa][1]; + temp += squaredMod(corr[aa][0]) + squaredMod(corr[aa][1]); } else AssertFatal(1==0,"shouldn't happen\n"); @@ -364,9 +356,9 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_stats->current_pucch0_stat0 = 0; int64_t temp2=0,temp3=0;; for (int aa=0;aanb_antennas_rx;aa++) { - temp2 += ((int64_t)corr_re[aa][0]*corr_re[aa][0] + (int64_t)corr_im[aa][0]*corr_im[aa][0]); + temp2 += squaredMod(corr[aa][0]); if (pucch_pdu->nr_of_symbols==2) - temp3 += ((int64_t)corr_re[aa][1]*corr_re[aa][1] + (int64_t)corr_im[aa][1]*corr_im[aa][1]); + temp3 += squaredMod(corr[aa][1]); } uci_stats->current_pucch0_stat0= dB_fixed64(temp2); if ( pucch_pdu->nr_of_symbols==2) diff --git a/openair1/PHY/TOOLS/tools_defs.h b/openair1/PHY/TOOLS/tools_defs.h index 13ce9d85c7..c763ec6bac 100644 --- a/openair1/PHY/TOOLS/tools_defs.h +++ b/openair1/PHY/TOOLS/tools_defs.h @@ -63,6 +63,9 @@ typedef struct complex64 { int64_t r; int64_t i; } c64_t; + +#define squaredMod(a) ((a).r*(a).r+(a).i*(a).i) +#define csum(res, i1, i2) (res).r=(i1).r+(i2).r ; (res).i=(i1).i+(i2).i //cmult_sv.h /*!\fn void multadd_real_vector_complex_scalar(int16_t *x,int16_t *alpha,int16_t *y,uint32_t N) From 9be58373bc35b076b07f8bcc9d5aedb487956e5c Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Fri, 25 Mar 2022 18:20:05 +0100 Subject: [PATCH 042/114] fix regression on harq in UE --- openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 12 +++++++----- openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h | 1 + openair1/SIMULATION/NR_PHY/dlschsim.c | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index 6163a95e5c..eac595b39e 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -168,6 +168,8 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint dlsch->harq_processes[i]->d[r] = (int16_t *)malloc16(5*8448*sizeof(int16_t)); if (dlsch->harq_processes[i]->c[r]) memset(dlsch->harq_processes[i]->c[r],0,1056); + if (dlsch->harq_processes[i]->d[r]) + memset(dlsch->harq_processes[i]->d[r],0,5*8448); else exit_flag=2; @@ -306,6 +308,7 @@ void nr_processDLSegment(void* arg) { //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING, VCD_FUNCTION_IN); int16_t w[E]; + memset(w, 0, sizeof(w)); nr_deinterleaving_ldpc(E, Qm, w, // [hna] w is e @@ -324,12 +327,11 @@ void nr_processDLSegment(void* arg) { harq_process->rvidx, harq_process->round); */ //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_RATE_MATCHING, VCD_FUNCTION_IN); - int16_t d[5*8448]; if (nr_rate_matching_ldpc_rx(Ilbrm, Tbslbrm, p_decoderParms->BG, p_decoderParms->Z, - d, + harq_process->d[r], w, harq_process->C, harq_process->rvidx, @@ -351,7 +353,7 @@ void nr_processDLSegment(void* arg) { LOG_D(PHY,"decoder input(segment %u) :",r); for (int i=0; id[r][i]); LOG_D(PHY,"\n"); } @@ -377,9 +379,9 @@ void nr_processDLSegment(void* arg) { //set Filler bits memset((&z[0]+K_bits_F),127,harq_process->F*sizeof(int16_t)); //Move coded bits before filler bits - memcpy((&z[0]+2*harq_process->Z),d,(K_bits_F-2*harq_process->Z)*sizeof(int16_t)); + memcpy((&z[0]+2*harq_process->Z),harq_process->d[r],(K_bits_F-2*harq_process->Z)*sizeof(int16_t)); //skip filler bits - memcpy((&z[0]+Kr),d+(Kr-2*harq_process->Z),(kc*harq_process->Z-Kr)*sizeof(int16_t)); + memcpy((&z[0]+Kr),harq_process->d[r]+(Kr-2*harq_process->Z),(kc*harq_process->Z-Kr)*sizeof(int16_t)); //Saturate coded bits before decoding into 8 bits values for (i=0, j=0; j < ((kc*harq_process->Z)>>4)+1; i+=2, j++) { diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h index f76119250f..ef42bb2abd 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h @@ -181,6 +181,7 @@ typedef struct { /// Pointers to transport block segments uint8_t **c; /// soft bits for each received segment ("d"-sequence)(for definition see 36-212 V8.6 2009-03, p.15) + /// Accumulates the soft bits for each round to increase decoding success (HARQ) int16_t **d; /// Index of current HARQ round for this DLSCH uint8_t round; diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c index c8969d7a0f..eb48d26908 100644 --- a/openair1/SIMULATION/NR_PHY/dlschsim.c +++ b/openair1/SIMULATION/NR_PHY/dlschsim.c @@ -483,7 +483,7 @@ int main(int argc, char **argv) //unsigned char test_input[TBS / 8] __attribute__ ((aligned(16))); for (i = 0; i < TBS / 8; i++) test_input[i] = (unsigned char) rand(); - + harq->pdu=test_input; //estimated_output = harq_process->b; #ifdef DEBUG_NR_DLSCHSIM From a79ccb99926ab6e93e826a93441347436a6f5269 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Fri, 25 Mar 2022 21:45:37 +0100 Subject: [PATCH 043/114] fix nr_deinterleaving_ldpc() again, we are now too short in the buffer --- common/utils/assertions.h | 4 ++-- openair1/PHY/CODING/nr_rate_matching.c | 27 +++++++++++++++----------- openair1/SIMULATION/NR_PHY/dlschsim.c | 2 +- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/common/utils/assertions.h b/common/utils/assertions.h index 573036b1d9..c8959d0adb 100644 --- a/common/utils/assertions.h +++ b/common/utils/assertions.h @@ -44,9 +44,9 @@ #define _Assert_(cOND, aCTION, fORMAT, aRGS...) \ do { \ if (!(cOND)) { \ - fprintf(stderr, "\nAssertion ("#cOND") failed!\n" \ + fprintf(stderr, "\nAssertion (%s) failed!\n" \ "In %s() %s:%d\n" fORMAT, \ - __FUNCTION__, __FILE__, __LINE__, ##aRGS); \ + #cOND, __FUNCTION__, __FILE__, __LINE__, ##aRGS); \ aCTION; \ } \ } while(0) diff --git a/openair1/PHY/CODING/nr_rate_matching.c b/openair1/PHY/CODING/nr_rate_matching.c index 29a1e363e9..fbad79cad7 100644 --- a/openair1/PHY/CODING/nr_rate_matching.c +++ b/openair1/PHY/CODING/nr_rate_matching.c @@ -309,25 +309,28 @@ void nr_interleaving_ldpc(uint32_t E, uint8_t Qm, uint8_t *e,uint8_t *f) void nr_deinterleaving_ldpc(uint32_t E, uint8_t Qm, int16_t *e,int16_t *f) { + switch(Qm) { case 2: { - int16_t *e1=e+(E/2); - int16_t *end=f+E-4; - while( fpdu=test_input; + dlsch->harq_process.pdu=test_input; //estimated_output = harq_process->b; #ifdef DEBUG_NR_DLSCHSIM From c0568a997a003b15b64e47c3ae8c4868d0630425 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Tue, 22 Mar 2022 15:23:44 +0100 Subject: [PATCH 044/114] fix bugs, delete dead code --- executables/nr-ue.c | 27 +++--- openair1/PHY/defs_RU.h | 1 - openair1/PHY/defs_UE.h | 14 --- openair1/PHY/defs_gNB.h | 3 - openair1/SCHED_UE/phy_procedures_lte_ue.c | 106 ---------------------- openair2/RRC/LTE/rrc_UE.c | 3 +- targets/ARCH/rfsimulator/simulator.c | 72 ++++----------- targets/RT/USER/lte-ru.c | 19 +++- targets/RT/USER/lte-softmodem.h | 1 - targets/RT/USER/lte-uesoftmodem.c | 9 -- 10 files changed, 51 insertions(+), 204 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 3cc71b8b3a..aef0370e53 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -654,17 +654,15 @@ static void UE_synch(void *arg) { openair0_cfg[UE->rf_map.card].rx_freq[0], openair0_cfg[UE->rf_map.card].tx_freq[0]); - if (UE->mode != loop_through_memory) { - UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0); - //UE->rfdevice.trx_set_gains_func(&openair0,&openair0_cfg[0]); - //UE->rfdevice.trx_stop_func(&UE->rfdevice); - // sleep(1); - /*if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) { - LOG_E(HW,"Could not start the device\n"); - oai_exit=1; - }*/ - } - + UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0); + //UE->rfdevice.trx_set_gains_func(&openair0,&openair0_cfg[0]); + //UE->rfdevice.trx_stop_func(&UE->rfdevice); + // sleep(1); + /*if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) { + LOG_E(HW,"Could not start the device\n"); + oai_exit=1; + }*/ + if (UE->UE_scan_carrier == 1) { UE->UE_scan_carrier = 0; } else { @@ -683,8 +681,7 @@ static void UE_synch(void *arg) { LOG_I(PHY, "Initial sync failed: trying carrier off %d Hz\n", freq_offset); - if (UE->mode != loop_through_memory) - UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0); + UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0); } break; @@ -729,7 +726,7 @@ void processSlotTX(void *arg) { stop_meas(&UE->ue_ul_indication_stats); } - if ((UE->mode != loop_through_memory) && (rxtxD->ue_sched_mode != NOT_PUSCH)) { + if (rxtxD->ue_sched_mode != NOT_PUSCH) { phy_procedures_nrUE_TX(UE,proc,0); } } @@ -873,7 +870,7 @@ void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) { *timestamp += UE->frame_parms.get_samples_per_slot(1,&UE->frame_parms); for ( int size=UE->rx_offset ; size > 0 ; size -= UE->frame_parms.samples_per_subframe ) { int unitTransfer=size>UE->frame_parms.samples_per_subframe ? UE->frame_parms.samples_per_subframe : size ; - // we write before read becasue gNB waits for UE to write and both executions halt + // we write before read because gNB waits for UE to write and both executions halt // this happens here as the read size is samples_per_subframe which is very much larger than samp_per_slot if (IS_SOFTMODEM_RFSIM) dummyWrite(UE,*timestamp, unitTransfer); AssertFatal(unitTransfer == diff --git a/openair1/PHY/defs_RU.h b/openair1/PHY/defs_RU.h index 0b20aa409b..243e76f851 100644 --- a/openair1/PHY/defs_RU.h +++ b/openair1/PHY/defs_RU.h @@ -54,7 +54,6 @@ typedef enum { no_L2_connect=5, calib_prach_tx=6, rx_dump_frame=7, - loop_through_memory=8 } runmode_t; /*! \brief Extension Type */ diff --git a/openair1/PHY/defs_UE.h b/openair1/PHY/defs_UE.h index 7f4d07ddae..a634a0d585 100644 --- a/openair1/PHY/defs_UE.h +++ b/openair1/PHY/defs_UE.h @@ -168,19 +168,6 @@ typedef struct { struct sched_param sched_param_ue; /// pthread descriptor main UE thread pthread_t pthread_ue; - /// \brief Instance count for synch thread. - /// \internal This variable is protected by \ref mutex_synch. - int instance_cnt_synch; - /// pthread attributes for synch processing thread - pthread_attr_t attr_synch; - /// scheduling parameters for synch thread - struct sched_param sched_param_synch; - /// pthread descriptor synch thread - pthread_t pthread_synch; - /// condition variable for UE synch thread; - pthread_cond_t cond_synch; - /// mutex for UE synch thread - pthread_mutex_t mutex_synch; /// instance count for eNBs int instance_cnt_eNBs; /// set of scheduling variables RXn-TXnp4 threads @@ -833,7 +820,6 @@ typedef struct { pthread_mutex_t timer_mutex; pthread_cond_t timer_cond; int instance_cnt_timer; - /// RF and Interface devices per CC openair0_device rfdevice; diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 6dcce5df0a..66bf3e8b03 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -589,9 +589,6 @@ typedef struct gNB_L1_proc_t_s { int instance_cnt_te; /// \internal This variable is protected by \ref mutex_prach. int instance_cnt_prach; - - // instance count for over-the-air gNB synchronization - int instance_cnt_synch; /// \internal This variable is protected by \ref mutex_asynch_rxtx. int instance_cnt_asynch_rxtx; /// pthread structure for eNB single processing thread diff --git a/openair1/SCHED_UE/phy_procedures_lte_ue.c b/openair1/SCHED_UE/phy_procedures_lte_ue.c index b02f24e04e..52e7351e24 100644 --- a/openair1/SCHED_UE/phy_procedures_lte_ue.c +++ b/openair1/SCHED_UE/phy_procedures_lte_ue.c @@ -4870,109 +4870,3 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue, LOG_D(PHY," ****** end RX-Chain for AbsSubframe %d.%d ****** \n", frame_rx%1024, subframe_rx); return (0); } - - -void phy_procedures_UE_lte(PHY_VARS_UE *ue, - UE_rxtx_proc_t *proc, - uint8_t eNB_id, - uint8_t abstraction_flag, - uint8_t do_pdcch_flag, - runmode_t mode) { - MessageDef *msg_p; - int result; - int frame_rx = proc->frame_rx; - int frame_tx = proc->frame_tx; - int subframe_rx = proc->subframe_rx; - int subframe_tx = proc->subframe_tx; - UE_L2_STATE_t ret; - int slot; - - if (ue->mac_enabled == 0) { - ue->UE_mode[eNB_id]=PUSCH; - } - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_LTE,1); - - if ( LOG_DEBUGFLAG(UE_TIMING)) { - start_meas(&ue->phy_proc[ue->current_thread_id[subframe_rx]]); - } - do { - // Checks if a message has been sent to PHY sub-task - itti_poll_msg (TASK_PHY_UE, &msg_p); - - if (msg_p != NULL) { - switch (ITTI_MSG_ID(msg_p)) { - case PHY_FIND_CELL_REQ: - LOG_I(PHY, "[UE ] Received %s\n", ITTI_MSG_NAME (msg_p)); - /* TODO process the message */ - break; - - default: - LOG_E(PHY, "[UE %ld] Received unexpected message %s\n", ITTI_MSG_DESTINATION_INSTANCE (msg_p), ITTI_MSG_NAME (msg_p)); - break; - } - - result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p); - AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); - } - } while(msg_p != NULL); - - for (slot=0; slot<2; slot++) { - if ((subframe_select(&ue->frame_parms,subframe_tx)==SF_UL)|| - (ue->frame_parms.frame_type == FDD)) { - phy_procedures_UE_TX(ue,proc,eNB_id,abstraction_flag,mode); - } - - if ((subframe_select(&ue->frame_parms,subframe_rx)==SF_DL) || - (ue->frame_parms.frame_type == FDD)) { - phy_procedures_UE_RX(ue,proc,eNB_id,abstraction_flag,do_pdcch_flag,mode); - } - - if ((subframe_select(&ue->frame_parms,subframe_tx)==SF_S) && - (slot==1)) { - phy_procedures_UE_S_TX(ue,eNB_id,abstraction_flag); - } - - if ((subframe_select(&ue->frame_parms,subframe_rx)==SF_S) && - (slot==0)) { - phy_procedures_UE_RX(ue,proc,eNB_id,abstraction_flag,do_pdcch_flag,mode); - } - - if (ue->mac_enabled==1) { - if (slot==0) { - //LOG_I(PHY,"[UE %d] Frame %d, subframe %d, star ue_scheduler\n", ue->Mod_id,frame_rx,subframe_tx); - ret = ue_scheduler(ue->Mod_id, - frame_rx, - subframe_rx, - frame_tx, - subframe_tx, - subframe_select(&ue->frame_parms,subframe_tx), - eNB_id, - 0/*FIXME CC_id*/); - - if (ret == CONNECTION_LOST) { - LOG_E(PHY,"[UE %d] Frame %d, subframe %d RRC Connection lost, returning to PRACH\n",ue->Mod_id, - frame_rx,subframe_tx); - ue->UE_mode[eNB_id] = PRACH; - // mac_xface->macphy_exit("Connection lost"); - } else if (ret == PHY_RESYNCH) { - LOG_E(PHY,"[UE %d] Frame %d, subframe %d RRC Connection lost, trying to resynch\n", - ue->Mod_id, - frame_rx,subframe_tx); - ue->UE_mode[eNB_id] = RESYNCH; - // mac_xface->macphy_exit("Connection lost"); - } else if (ret == PHY_HO_PRACH) { - LOG_I(PHY,"[UE %d] Frame %d, subframe %d, return to PRACH and perform a contention-free access\n", - ue->Mod_id,frame_rx,subframe_tx); - ue->UE_mode[eNB_id] = PRACH; - } - } - } - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_LTE,0); - - if (LOG_DEBUGFLAG(UE_TIMING)) { - stop_meas(&ue->phy_proc[ue->current_thread_id[subframe_rx]]); - } - } // slot -} diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c index b46bba2492..9b37853ed2 100644 --- a/openair2/RRC/LTE/rrc_UE.c +++ b/openair2/RRC/LTE/rrc_UE.c @@ -3175,7 +3175,8 @@ int decode_SIB1( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, const size_t num_plmn_data = sizeof(plmn_data) / sizeof(plmn_data[0]); for (size_t plmn_ind = 0;; ++plmn_ind) { if (plmn_ind == num_plmn_data) { - LOG_E( RRC, "Did not find name from internal table for %u %u\n", mcc, mnc); + LOG_W( RRC, "Did not find operator name from internal table for MCC %0*d, MNC %0*d\n", + mccdigits, mcc, mncdigits, mnc); break; } if ((plmn_data[plmn_ind].mcc == mcc) && (plmn_data[plmn_ind].mnc == mnc)) { diff --git a/targets/ARCH/rfsimulator/simulator.c b/targets/ARCH/rfsimulator/simulator.c index 013e542689..dc5eab2f34 100644 --- a/targets/ARCH/rfsimulator/simulator.c +++ b/targets/ARCH/rfsimulator/simulator.c @@ -117,7 +117,7 @@ typedef struct buffer_s { typedef struct { int listen_sock, epollfd; - openair0_timestamp nextTimestamp; + openair0_timestamp nextRxTstamp; openair0_timestamp lastWroteTS; uint64_t typeStamp; char *ip; @@ -196,7 +196,7 @@ static void removeCirBuf(rfsimulator_state_t *bridge, int sock) { free(bridge->buf[sock].circularBuf); // Fixme: no free_channel_desc_scm(bridge->buf[sock].channel_model) implemented // a lot of mem leaks - free(bridge->buf[sock].channel_model); + //free(bridge->buf[sock].channel_model); memset(&bridge->buf[sock], 0, sizeof(buffer_t)); bridge->buf[sock].conn_sock=-1; } @@ -429,8 +429,6 @@ static int rfsimulator_write_internal(rfsimulator_state_t *t, openair0_timestamp if (!alreadyLocked) pthread_mutex_lock(&Sockmutex); - LOG_D(HW,"sending %d samples at time: %ld\n", nsamps, timestamp); - for (int i=0; ibuf[i]; @@ -549,14 +547,14 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initi (t->typeStamp == ENB_MAGICDL && b->th.magic==UE_MAGICDL), "Socket Error in protocol"); b->headerMode=false; - if ( t->nextTimestamp == 0 ) { // First block in UE, resync with the eNB current TS - t->nextTimestamp=b->th.timestamp> nsamps_for_initial ? + if ( t->nextRxTstamp == 0 ) { // First block in UE, resync with the eNB current TS + t->nextRxTstamp=b->th.timestamp> nsamps_for_initial ? b->th.timestamp - nsamps_for_initial : 0; b->lastReceivedTS=b->th.timestamp> nsamps_for_initial ? b->th.timestamp : nsamps_for_initial; - LOG_W(HW,"UE got first timestamp: starting at %lu\n", t->nextTimestamp); + LOG_W(HW,"UE got first timestamp: starting at %lu\n", t->nextRxTstamp); b->trashingPacket=true; } else if ( b->lastReceivedTS < b->th.timestamp) { int nbAnt= b->th.nbAnt; @@ -623,7 +621,7 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest } rfsimulator_state_t *t = device->priv; - LOG_D(HW, "Enter rfsimulator_read, expect %d samples, will release at TS: %ld\n", nsamps, t->nextTimestamp+nsamps); + LOG_D(HW, "Enter rfsimulator_read, expect %d samples, will release at TS: %ld\n", nsamps, t->nextRxTstamp+nsamps); // deliver data from received data // check if a UE is connected int first_sock; @@ -634,54 +632,22 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest if ( first_sock == FD_SETSIZE ) { // no connected device (we are eNB, no UE is connected) - if ( t->nextTimestamp == 0) + if ( t->nextRxTstamp == 0) LOG_W(HW,"No connected device, generating void samples...\n"); if (!flushInput(t, 10, nsamps)) { for (int x=0; x < nbAnt; x++) memset(samplesVoid[x],0,sampleToByte(nsamps,1)); - t->nextTimestamp+=nsamps; + t->nextRxTstamp+=nsamps; - if ( ((t->nextTimestamp/nsamps)%100) == 0) - LOG_D(HW,"No UE, Generated void samples for Rx: %ld\n", t->nextTimestamp); + if ( ((t->nextRxTstamp/nsamps)%100) == 0) + LOG_D(HW,"No UE, Generated void samples for Rx: %ld\n", t->nextRxTstamp); - *ptimestamp = t->nextTimestamp-nsamps; + *ptimestamp = t->nextRxTstamp-nsamps; return nsamps; } } else { - pthread_mutex_lock(&Sockmutex); - - if ( t->nextTimestamp > 0 && t->lastWroteTS < t->nextTimestamp) { - pthread_mutex_unlock(&Sockmutex); - usleep(10000); - pthread_mutex_lock(&Sockmutex); - - if ( t->lastWroteTS < t->nextTimestamp ) { - // Assuming Tx is not done fully in another thread - // We can never write is the past from the received time - // So, the node perform receive but will never write these symbols - // let's tell this to the opposite node - // We send timestamp for nb samples required - // assuming this should have been done earlier if a Tx would exist - pthread_mutex_unlock(&Sockmutex); - struct complex16 v= {0}; - void *dummyS[t->tx_num_channels]; - - for ( int i=0; i < t->tx_num_channels; i++) - dummyS[i]=(void *)&v; - - LOG_I(HW, "No samples Tx occured, so we send 1 sample to notify it: Tx:%lu, Rx:%lu\n", - t->lastWroteTS, t->nextTimestamp); - rfsimulator_write_internal(t, t->nextTimestamp, - dummyS, 1, - t->tx_num_channels, 1, true); - } else { - pthread_mutex_unlock(&Sockmutex); - LOG_W(HW, "trx_write came from another thread\n"); - } - } else - pthread_mutex_unlock(&Sockmutex); bool have_to_wait; @@ -692,7 +658,7 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest buffer_t *b=&t->buf[sock]; if ( b->circularBuf ) - if ( t->nextTimestamp+nsamps > b->lastReceivedTS ) { + if ( t->nextRxTstamp+nsamps > b->lastReceivedTS ) { have_to_wait=true; break; } @@ -701,7 +667,7 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest if (have_to_wait) /*printf("Waiting on socket, current last ts: %ld, expected at least : %ld\n", ptr->lastReceivedTS, - t->nextTimestamp+nsamps); + t->nextRxTstamp+nsamps); */ flushInput(t, 3, nsamps); } while (have_to_wait); @@ -732,7 +698,7 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest a, ptr->channel_model, nsamps, - t->nextTimestamp, + t->nextRxTstamp, CirSize ); else { // no channel modeling @@ -747,8 +713,8 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest //LOG_I(HW, "nbAnt_tx %d\n",nbAnt_tx); for (int i=0; i < nsamps; i++) {//loop over nsamps for (int a_tx=0; a_txcircularBuf[((t->nextTimestamp+i)*nbAnt_tx+a_tx)%CirSize].r*H_awgn_mimo[a][a_tx]); - out[i].i += (short)(ptr->circularBuf[((t->nextTimestamp+i)*nbAnt_tx+a_tx)%CirSize].i*H_awgn_mimo[a][a_tx]); + out[i].r += (short)(ptr->circularBuf[((t->nextRxTstamp+i)*nbAnt_tx+a_tx)%CirSize].r*H_awgn_mimo[a][a_tx]); + out[i].i += (short)(ptr->circularBuf[((t->nextRxTstamp+i)*nbAnt_tx+a_tx)%CirSize].i*H_awgn_mimo[a][a_tx]); } // end for a_tx } // end for i (number of samps) } // end of no channel modeling @@ -756,11 +722,11 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest } } - *ptimestamp = t->nextTimestamp; // return the time of the first sample - t->nextTimestamp+=nsamps; + *ptimestamp = t->nextRxTstamp; // return the time of the first sample + t->nextRxTstamp+=nsamps; LOG_D(HW,"Rx to upper layer: %d from %ld to %ld, energy in first antenna %d\n", nsamps, - *ptimestamp, t->nextTimestamp, + *ptimestamp, t->nextRxTstamp, signal_energy(samplesVoid[0], nsamps)); return nsamps; } diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index 66ce6ef247..f6cf51f101 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -733,7 +733,7 @@ void tx_rf(RU_t *ru, int sf_extension = 0; if ((SF_type == SF_DL) || - (SF_type == SF_S)) { + (SF_type == SF_S) ) { int siglen=fp->samples_per_tti,flags=1; if (SF_type == SF_S) { @@ -831,6 +831,23 @@ void tx_rf(RU_t *ru, late_control=STATE_BURST_TERMINATE; LOG_E(PHY,"TX : Timeout (sent %d/%d) state =%d\n",txs, siglen,late_control); } + } else if (IS_SOFTMODEM_RFSIM ) { + // in case of rfsim, we always enable tx because we need to feed rx of the opposite side + // we write 1 single I/Q sample to trigger Rx (rfsim will fill gaps with 0 I/Q) + void *dummy_tx[ru->frame_parms->nb_antennas_tx]; + for (int i=0; iframe_parms->nb_antennas_tx; i++) + dummy_tx[i]=malloc16_clear(4); + + AssertFatal( 1 == + ru->rfdevice.trx_write_func(&ru->rfdevice, + timestamp+ru->ts_offset-ru->openair0_cfg.tx_sample_advance-sf_extension, + dummy_tx, + 1, + ru->frame_parms->nb_antennas_tx, + 4),""); + + for (int i=0; iframe_parms->nb_antennas_tx; i++) + free(dummy_tx[i]); } } diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h index 0267ad8ce0..1c887dd3c8 100644 --- a/targets/RT/USER/lte-softmodem.h +++ b/targets/RT/USER/lte-softmodem.h @@ -49,7 +49,6 @@ {"debug-ue-prach", CONFIG_HLP_DBGUEPR, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \ {"no-L2-connect", CONFIG_HLP_NOL2CN, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \ {"calib-prach-tx", CONFIG_HLP_CALPRACH, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \ - {"loop-memory", CONFIG_HLP_UELOOP, 0, strptr:&loopfile, defstrval:"iqs.in", TYPE_STRING,0}, \ {"ue-dump-frame", CONFIG_HLP_DUMPFRAME, PARAMFLAG_BOOL, iptr:&dumpframe, defintval:0, TYPE_INT, 0}, \ } #define CMDLINE_CALIBUERX_IDX 0 diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index 8cdef647ca..089941c7df 100644 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -276,7 +276,6 @@ uint16_t node_number; static void get_options(void) { int CC_id=0; int tddflag=0; - char *loopfile=NULL; int dumpframe=0; int timingadv=0; uint8_t nfapi_mode = NFAPI_MONOLITHIC; @@ -293,14 +292,6 @@ static void get_options(void) { config_process_cmdline( cmdline_ueparams,sizeof(cmdline_ueparams)/sizeof(paramdef_t),NULL); nfapi_setmode(nfapi_mode); - - if (loopfile != NULL) { - printf("Input file for hardware emulation: %s",loopfile); - mode=loop_through_memory; - input_fd = fopen(loopfile,"r"); - AssertFatal(input_fd != NULL,"Please provide a valid input file\n"); - } - get_softmodem_params()->hw_timing_advance = timingadv; if ( (cmdline_uemodeparams[CMDLINE_CALIBUERX_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue; From 9bd16f3c664af14b3d8f2184c91a698cef6ce1b8 Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Mon, 28 Mar 2022 21:45:50 +0200 Subject: [PATCH 045/114] - fix for CSI-RS allocation (slot slot 0 in symbol 13, SIB1 10 symbols instead of 12 by default) - extra logging for CRNTI procedure (to catch bug in nr_free_list --- openair2/GNB_APP/gnb_paramdef.h | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 11 ++++++++++- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 4 ++-- openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c | 2 +- openair2/RRC/NR/MESSAGES/asn1_msg.c | 5 +++-- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/openair2/GNB_APP/gnb_paramdef.h b/openair2/GNB_APP/gnb_paramdef.h index 28aa60d54b..e5f15969ac 100644 --- a/openair2/GNB_APP/gnb_paramdef.h +++ b/openair2/GNB_APP/gnb_paramdef.h @@ -146,7 +146,7 @@ typedef enum { {GNB_CONFIG_STRING_SSBSUBCARRIEROFFSET, NULL, 0, iptr:NULL, defintval:31, TYPE_INT, 0}, \ {GNB_CONFIG_STRING_PDSCHANTENNAPORTS, NULL, 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \ {GNB_CONFIG_STRING_PUSCHANTENNAPORTS, NULL, 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \ -{GNB_CONFIG_STRING_SIB1TDA, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_SIB1TDA, NULL, 0, iptr:NULL, defintval:2, TYPE_INT, 0}, \ {GNB_CONFIG_STRING_DOCSIRS, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ {GNB_CONFIG_STRING_DOSRS, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ {GNB_CONFIG_STRING_NRCELLID, NULL, 0, u64ptr:NULL, defint64val:1, TYPE_UINT64, 0}, \ diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index d2f726e0fc..b9615eb99d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2015,7 +2015,16 @@ void remove_nr_list(NR_list_t *listP, int id) prev = cur; cur = &listP->next[*cur]; } - AssertFatal(*cur != -1, "ID %d not found in UE_list\n", id); + if (*cur == -1) { + cur = &listP->head; + prev=&listP->head; + while (*cur != -1 && *cur != id) { + LOG_I(NR_MAC,"remove_nr_list : id %d, *cur %d\n",id,*cur); + prev = cur; + cur = &listP->next[*cur]; + } + AssertFatal(1==0, "ID %d not found in UE_list\n", id); + } int *next = &listP->next[*cur]; *cur = listP->next[*cur]; *next = -1; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 30d484ae08..1a66f336c8 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -679,11 +679,11 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, UE_scheduling_control->ta_update = timing_advance; UE_scheduling_control->raw_rssi = rssi; UE_scheduling_control->pusch_snrx10 = ul_cqi * 5 - 640; - LOG_D(NR_MAC, "[UE %d] PUSCH TPC %d and TA %d\n",UE_id,UE_scheduling_control->tpc0,UE_scheduling_control->ta_update); + LOG_D(NR_MAC, "[UE %d] PUSCH TPC %d(SNRx10 %d) and TA %d\n",UE_id,UE_scheduling_control->tpc0,UE_scheduling_control->pusch_snrx10,UE_scheduling_control->ta_update); } else{ LOG_D(NR_MAC,"[UE %d] Detected DTX : increasing UE TX power\n",UE_id); - UE_scheduling_control->tpc0 = 3; + UE_scheduling_control->tpc0 = 1; } #if defined(ENABLE_MAC_PAYLOAD_DEBUG) diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c index 62aa101a50..007750c9fe 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c @@ -108,7 +108,7 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity, if (rcvd_count < entity->rx_deliv || nr_pdcp_sdu_in_list(entity->rx_list, rcvd_count)) { - LOG_W(PDCP, "discard NR PDU rcvd_count=%d\n", rcvd_count); + LOG_W(PDCP, "discard NR PDU rcvd_count=%d, entity->rx_deliv %d,sdu_in_list %d\n", rcvd_count,entity->rx_deliv,nr_pdcp_sdu_in_list(entity->rx_list,rcvd_count)); return; } diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 02c42b4e5f..18e4d76075 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1039,7 +1039,8 @@ void config_csirs(NR_ServingCellConfigCommon_t *servingcellconfigcommon, default: AssertFatal(1==0,"Number of ports not yet supported\n"); } - resourceMapping.firstOFDMSymbolInTimeDomain = 6; + // This programs CSI-RS in slot 0 symbol 13. Note: need to use a SIB1 configuration which leaves the last symbol free for CSI-RS. + resourceMapping.firstOFDMSymbolInTimeDomain = 13; resourceMapping.firstOFDMSymbolInTimeDomain2 = NULL; resourceMapping.density.present = NR_CSI_RS_ResourceMapping__density_PR_one; resourceMapping.density.choice.one = (NULL_t)0; @@ -1052,7 +1053,7 @@ void config_csirs(NR_ServingCellConfigCommon_t *servingcellconfigcommon, nzpcsi0->scramblingID = *servingcellconfigcommon->physCellId; nzpcsi0->periodicityAndOffset = calloc(1,sizeof(*nzpcsi0->periodicityAndOffset)); nzpcsi0->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots320; - nzpcsi0->periodicityAndOffset->choice.slots320 = 20; + nzpcsi0->periodicityAndOffset->choice.slots320 = 0; nzpcsi0->qcl_InfoPeriodicCSI_RS = calloc(1,sizeof(*nzpcsi0->qcl_InfoPeriodicCSI_RS)); *nzpcsi0->qcl_InfoPeriodicCSI_RS=0; ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList->list,nzpcsi0); From 10b4f4331e940131fae968bfa7071f2c8a8e8eaa Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Tue, 29 Mar 2022 23:10:08 +0200 Subject: [PATCH 046/114] CQI report in slots 7/27 --- openair2/RRC/NR/MESSAGES/asn1_msg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 18e4d76075..9854398501 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1598,7 +1598,7 @@ void fill_initial_SpCellConfig(int uid, csirep1->reportConfigType.present = NR_CSI_ReportConfig__reportConfigType_PR_periodic; csirep1->reportConfigType.choice.periodic = calloc(1,sizeof(*csirep1->reportConfigType.choice.periodic)); csirep1->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots320; - csirep1->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = (8 + (20 * uid)) % 320; + csirep1->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = (7 + (20 * uid)) % 320; ASN_SEQUENCE_ADD(&csirep1->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list,pucchcsires1); csirep1->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI; csirep1->reportQuantity.choice.cri_RI_PMI_CQI=(NULL_t)0; @@ -1657,7 +1657,7 @@ void fill_initial_SpCellConfig(int uid, csirep2->reportConfigType.present = NR_CSI_ReportConfig__reportConfigType_PR_periodic; csirep2->reportConfigType.choice.periodic = calloc(1,sizeof(*csirep2->reportConfigType.choice.periodic)); csirep2->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots320; - csirep2->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = (28 + (20 * uid)) % 320; + csirep2->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = (27 + (20 * uid)) % 320; ASN_SEQUENCE_ADD(&csirep2->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list,pucchcsires1); csirep2->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP; csirep2->reportQuantity.choice.cri_RSRP=(NULL_t)0; From 665db19ed6d2c1330c6be343486c3e3c0fa14c6a Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 30 Mar 2022 17:25:37 +0200 Subject: [PATCH 047/114] Change first SA test to DDSUU 2.5ms TDD period + ping to 10ms --- ...nd78.sa.fr1.106PRB.ddsuu.2x2.usrpn310.conf | 305 ++++++++++++++++++ ci-scripts/xml_files/fr1_sa_quectel.xml | 8 +- 2 files changed, 309 insertions(+), 4 deletions(-) create mode 100644 ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.ddsuu.2x2.usrpn310.conf diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.ddsuu.2x2.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.ddsuu.2x2.usrpn310.conf new file mode 100644 index 0000000000..6fd04bf569 --- /dev/null +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.ddsuu.2x2.usrpn310.conf @@ -0,0 +1,305 @@ +Active_gNBs = ( "gNB-OAI"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_CU_ID = 0xe00; + +# cell_type = "CELL_MACRO_GNB"; + + 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; + sd = 0x010203; // 0 false, else true + }, + { + sst = 1; + sd = 0x112233; // 0 false, else true + } + ); + }); + + nr_cellid = 12345678L + +# tr_s_preference = "local_mac" + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 0; + pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 2; + ul_prbblacklist = "51,52,53,54" + do_SRS = 1; + + pdcch_ConfigSIB1 = ( + { + controlResourceSetZero = 11; + searchSpaceZero = 0; + } + ); + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 3301.68 MHz + 22*12*30e-3 MHz = 3309.6 + #absoluteFrequencySSB = 620640; + # this is 3300.60 MHz + 53*12*30e-3 MHz = 3319.68 + absoluteFrequencySSB = 621312; + # this is 3503.28 MHz + 22*12*30e-3 MHz = 3511.2 + #absoluteFrequencySSB = 634080; + # this is 3600.48 MHz + #absoluteFrequencySSB = 640032; + #dl_frequencyBand = 78; + # this is 3301.68 MHz + #dl_absoluteFrequencyPointA = 620112; + # this is 3300.60 MHz + dl_absoluteFrequencyPointA = 620040; + # this is 3502.56 MHz + #dl_absoluteFrequencyPointA = 633552; + # this is 3600.48 MHz + #dl_absoluteFrequencyPointA = 640032; + #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=0,L=106 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 28875; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 11; + 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 = 12; + preambleReceivedTargetPower = -104; +#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 = -90; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 2; + 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 = 2; + 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 = "CI_MME_IP_ADDR"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_NG_AMF = "em1"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "CI_GNB_IP_ADDR"; + GNB_INTERFACE_NAME_FOR_NGU = "em1"; + GNB_IPV4_ADDRESS_FOR_NGU = "CI_GNB_IP_ADDR"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; +# pusch_TargetSNRx10 = 200; +# pucch_TargetSNRx10 = 150; + ulsch_max_frame_inactivity = 0; + } +); + +L1s = ( +{ + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 8; + prach_dtx_threshold = 120; +# pucch0_dtx_threshold = 150; +} +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 2 + nb_rx = 2 + att_tx = 0 + att_rx = 0; + bands = [78]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 75; + eNB_instances = [0]; + ##beamforming 1x2 matrix: 1 layer x 2 antennas + bf_weights = [0x00007fff, 0x0000]; + ##beamforming 1x4 matrix: 1 layer x 4 antennas + #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; + ## beamforming 2x2 matrix: + # bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + ## beamforming 4x4 matrix: + #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; + sf_extension = 0 + sdr_addrs = "mgmt_addr=192.168.18.252,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" + sl_ahead = 5; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_SINGLE_THREAD"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + +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"; + f1ap_log_level ="debug"; + }; diff --git a/ci-scripts/xml_files/fr1_sa_quectel.xml b/ci-scripts/xml_files/fr1_sa_quectel.xml index 8d15015c07..69399597c1 100644 --- a/ci-scripts/xml_files/fr1_sa_quectel.xml +++ b/ci-scripts/xml_files/fr1_sa_quectel.xml @@ -22,7 +22,7 @@ --> TEST-SA-FR1-Tab1 - SA Ping DL UL with QUECTEL + SA Ping DL UL with Quectel, 2.5ms TDD tasks 1 @@ -63,7 +63,7 @@ Initialize_eNB Initialize gNB - -O ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf --sa -q --usrp-tx-thread-config 1 --T_stdout 2 --log_config.global_log_options level,nocolor,time + -O ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.ddsuu.2x2.usrpn310.conf --sa -q --usrp-tx-thread-config 1 --T_stdout 2 --log_config.global_log_options level,nocolor,time 0 0 nr @@ -92,7 +92,7 @@ nrmodule2_quectel -c 40 1 - 20 + 10 @@ -101,7 +101,7 @@ nrmodule2_quectel -c 100 -i 0,2 1 - 20 + 10 From f2e6537195b2bb553f291c914923da0f7a9f8ecf Mon Sep 17 00:00:00 2001 From: Laurent Thomas Date: Sun, 10 Apr 2022 22:11:37 +0200 Subject: [PATCH 048/114] roolback regression --- openair1/PHY/defs_UE.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/openair1/PHY/defs_UE.h b/openair1/PHY/defs_UE.h index a634a0d585..4f9bc076ff 100644 --- a/openair1/PHY/defs_UE.h +++ b/openair1/PHY/defs_UE.h @@ -168,6 +168,19 @@ typedef struct { struct sched_param sched_param_ue; /// pthread descriptor main UE thread pthread_t pthread_ue; + /// \brief Instance count for synch thread. + /// \internal This variable is protected by \ref mutex_synch. + int instance_cnt_synch; + /// pthread attributes for synch processing thread + pthread_attr_t attr_synch; + /// scheduling parameters for synch thread + struct sched_param sched_param_synch; + /// pthread descriptor synch thread + pthread_t pthread_synch; + /// condition variable for UE synch thread; + pthread_cond_t cond_synch; + /// mutex for UE synch thread + pthread_mutex_t mutex_synch; /// instance count for eNBs int instance_cnt_eNBs; /// set of scheduling variables RXn-TXnp4 threads From b860d76cd62ecdb1dba5d8743482cd92c3a2f09e Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Mon, 11 Apr 2022 09:39:16 +0200 Subject: [PATCH 049/114] fix lte-ue.c main loop with 5G common vars --- targets/RT/USER/lte-ue.c | 1003 ++++++++++++++++++-------------------- 1 file changed, 482 insertions(+), 521 deletions(-) diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 9010a40bf9..8565e36e87 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -87,7 +87,7 @@ extern void multicast_link_start(void (*rx_handlerP) (unsigned int, char *), extern int multicast_link_write_sock(int groupP, char *dataP, uint32_t sizeP); -int tx_req_num_elems; +int tx_req_num_elems; extern uint16_t sf_ahead; //extern int tx_req_UE_MAC1(); @@ -176,6 +176,7 @@ PHY_VARS_UE *init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms, { PHY_VARS_UE *ue = (PHY_VARS_UE *)calloc(1,sizeof(PHY_VARS_UE)); AssertFatal(ue,""); + if (frame_parms!=(LTE_DL_FRAME_PARMS *)NULL) { // if we want to give initial frame parms, allocate the PHY_VARS_UE structure and put them in memcpy(&(ue->frame_parms), frame_parms, sizeof(LTE_DL_FRAME_PARMS)); } @@ -204,8 +205,7 @@ void init_thread(int sched_runtime, int sched_deadline, int sched_fifo, cpu_set_t *cpuset, - char *name) -{ + char *name) { #ifdef DEADLINE_SCHEDULER if (sched_runtime!=0) { @@ -266,8 +266,7 @@ void init_UE(int nb_inst, runmode_t mode, int rxgain, int txpowermax, - LTE_DL_FRAME_PARMS *fp0) -{ + LTE_DL_FRAME_PARMS *fp0) { PHY_VARS_UE *UE; int inst; int ret; @@ -283,9 +282,7 @@ void init_UE(int nb_inst, if (PHY_vars_UE_g[inst]==NULL) PHY_vars_UE_g[inst] = (PHY_VARS_UE **)calloc(1+MAX_NUM_CCs,sizeof(PHY_VARS_UE *)); LOG_I(PHY,"Allocating UE context %d\n",inst); - PHY_vars_UE_g[inst][0] = init_ue_vars(fp0,inst,0); - // turn off timing control loop in UE PHY_vars_UE_g[inst][0]->no_timing_correction = timing_correction; UE = PHY_vars_UE_g[inst][0]; @@ -362,7 +359,6 @@ void init_UE(int nb_inst, LOG_I(PHY,"Intializing UE Threads for instance %d (%p,%p)...\n",inst,PHY_vars_UE_g[inst],PHY_vars_UE_g[inst][0]); init_UE_threads(inst); - ret = openair0_device_load(&(UE->rfdevice), &openair0_cfg[0]); if (ret !=0) { @@ -385,8 +381,7 @@ void init_UE(int nb_inst, void init_UE_stub_single_thread(int nb_inst, int eMBMS_active, int uecap_xer_in, - char *emul_iface) -{ + char *emul_iface) { int inst; LOG_I(PHY,"UE : Calling Layer 2 for initialization, nb_inst: %d \n", nb_inst); l2_init_ue(eMBMS_active,(uecap_xer_in==1)?uecap_xer:NULL, @@ -411,24 +406,23 @@ void init_UE_stub_single_thread(int nb_inst, } } -void init_UE_standalone_thread(int ue_idx) -{ +void init_UE_standalone_thread(int ue_idx) { int standalone_tx_port = 3211 + ue_idx * 2; int standalone_rx_port = 3212 + ue_idx * 2; ue_init_standalone_socket(standalone_tx_port, standalone_rx_port); - pthread_t thread; + if (pthread_create(&thread, NULL, ue_standalone_pnf_task, NULL) != 0) { LOG_E(MAC, "pthread_create failed for calling ue_standalone_pnf_task"); } + pthread_setname_np(thread, "oai:ue-stand"); } void init_UE_stub(int nb_inst, int eMBMS_active, int uecap_xer_in, - char *emul_iface) -{ + char *emul_iface) { int inst; LOG_I(PHY,"UE : Calling Layer 2 for initialization\n"); l2_init_ue(eMBMS_active,(uecap_xer_in==1)?uecap_xer:NULL, @@ -462,8 +456,7 @@ void init_UE_stub(int nb_inst, * \returns a pointer to an int. The storage is not on the heap and must not be freed. */ -static void *UE_thread_synch(void *arg) -{ +static void *UE_thread_synch(void *arg) { static int UE_thread_synch_retval; int i ; PHY_VARS_UE *UE = (PHY_VARS_UE *) arg; @@ -478,6 +471,7 @@ static void *UE_thread_synch(void *arg) printf("UE_thread_sync in with PHY_vars_UE %p\n",arg); cpu_set_t cpuset; CPU_ZERO(&cpuset); + if ( threads.sync != -1 ) CPU_SET(threads.sync, &cpuset); @@ -757,8 +751,7 @@ static void *UE_thread_synch(void *arg) * \param arg is a pointer to a \ref PHY_VARS_UE structure. * \returns a pointer to an int. The storage is not on the heap and must not be freed. */ -const char *get_connectionloss_errstr(int errcode) -{ +const char *get_connectionloss_errstr(int errcode) { switch (errcode) { case CONNECTION_LOST: return "RRC Connection lost, returning to PRACH"; @@ -773,8 +766,7 @@ const char *get_connectionloss_errstr(int errcode) return "UNKNOWN RETURN CODE"; } -static void *UE_thread_rxn_txnp4(void *arg) -{ +static void *UE_thread_rxn_txnp4(void *arg) { static __thread int UE_thread_rxtx_retval; struct rx_tx_thread_data *rtd = arg; UE_rxtx_proc_t *proc = rtd->proc; @@ -867,13 +859,11 @@ static void *UE_thread_rxn_txnp4(void *arg) if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_UL) || (UE->frame_parms.frame_type == FDD) ) - if (UE->mode != loop_through_memory) - phy_procedures_UE_TX(UE,proc,0,0,UE->mode); + phy_procedures_UE_TX(UE,proc,0,0,UE->mode); if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_S) && (UE->frame_parms.frame_type == TDD)) - if (UE->mode != loop_through_memory) - phy_procedures_UE_S_TX(UE,0,0); + phy_procedures_UE_S_TX(UE,0,0); proc->instance_cnt_rxtx--; @@ -895,8 +885,7 @@ static void *UE_thread_rxn_txnp4(void *arg) unsigned int emulator_absSF; void ue_stub_rx_handler(unsigned int num_bytes, - char *rx_buffer) -{ + char *rx_buffer) { PHY_VARS_UE *UE; UE = PHY_vars_UE_g[0][0]; UE_tport_t *pdu = (UE_tport_t *)rx_buffer; @@ -951,14 +940,14 @@ void ue_stub_rx_handler(unsigned int num_bytes, } } -uint64_t clock_usec(void) -{ - struct timespec t; - if (clock_gettime(CLOCK_MONOTONIC, &t) == -1) - { - abort(); - } - return (uint64_t)t.tv_sec * 1000000 + (t.tv_nsec / 1000); +uint64_t clock_usec(void) { + struct timespec t; + + if (clock_gettime(CLOCK_MONOTONIC, &t) == -1) { + abort(); + } + + return (uint64_t)t.tv_sec * 1000000 + (t.tv_nsec / 1000); } /*! * \brief This is the UE thread for RX subframe n and TX subframe n+4. @@ -968,23 +957,21 @@ uint64_t clock_usec(void) * \returns a pointer to an int. The storage is not on the heap and must not be freed. */ -static void *UE_phy_stub_standalone_pnf_task(void *arg) -{ +static void *UE_phy_stub_standalone_pnf_task(void *arg) { #if 1 { struct sched_param sparam = { .sched_priority = 79, }; - if (pthread_setschedparam(pthread_self(), SCHED_RR, &sparam) != 0) - { + + if (pthread_setschedparam(pthread_self(), SCHED_RR, &sparam) != 0) { LOG_E(PHY,"pthread_setschedparam: %s\n", strerror(errno)); } } #else thread_top_init("UE_phy_stub_thread_rxn_txnp4", 1, 870000L, 1000000L, 1000000L); #endif - // for multipule UE's L2-emulator //module_id_t Mod_id = 0; //int init_ra_UE = -1; // This counter is used to initiate the RA of each UE in different SFrames @@ -1004,9 +991,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) PHY_VARS_UE *UE = NULL; int ret; proc = &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0]; - UE = rtd->UE; - UL_INFO = (UL_IND_t *)calloc(1, sizeof(UL_IND_t)); UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = calloc(NFAPI_RX_IND_MAX_PDU, sizeof(nfapi_rx_indication_pdu_t)); UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0; @@ -1019,19 +1004,15 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = calloc(NFAPI_CQI_IND_MAX_PDU, sizeof(nfapi_cqi_indication_pdu_t)); UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = calloc(NFAPI_CQI_IND_MAX_PDU, sizeof(nfapi_cqi_indication_raw_pdu_t)); UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0; - proc->subframe_rx = proc->sub_frame_start; proc->subframe_tx = -1; proc->frame_rx = -1; proc->frame_tx = -1; // Initializations for nfapi-L2-emulator mode sync_var = 0; - //PANOS: CAREFUL HERE! wait_sync("UE_phy_stub_standalone_pnf_task"); - int last_sfn_sf = -1; - LOG_I(MAC, "Clearing Queues\n"); reset_queue(&dl_config_req_tx_req_queue); reset_queue(&ul_config_req_queue); @@ -1039,72 +1020,77 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) while (!oai_exit) { bool sent_any = false; + if (sem_wait(&sfn_semaphore) != 0) { LOG_E(MAC, "sem_wait() error\n"); abort(); } int sfn_sf = current_sfn_sf; - if (sfn_sf == last_sfn_sf) - { + + if (sfn_sf == last_sfn_sf) { LOG_W(MAC, "repeated sfn_sf = %d.%d\n", sfn_sf >> 4, sfn_sf & 15); continue; } - last_sfn_sf = sfn_sf; + last_sfn_sf = sfn_sf; nfapi_dl_config_req_tx_req_t *dl_config_req_tx_req = get_queue(&dl_config_req_tx_req_queue); nfapi_ul_config_request_t *ul_config_req = get_queue(&ul_config_req_queue); nfapi_hi_dci0_request_t *hi_dci0_req = get_queue(&hi_dci0_req_queue); - LOG_I(MAC, "received from proxy frame %d subframe %d\n", NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)); if (ul_config_req != NULL) { uint8_t ul_num_pdus = ul_config_req->ul_config_request_body.number_of_pdus; + if (ul_num_pdus > 0) { char *ul_str = nfapi_ul_config_req_to_string(ul_config_req); LOG_I(MAC, "ul_config_req: %s\n", ul_str); free(ul_str); } } + if (hi_dci0_req != NULL) { LOG_D(MAC, "hi_dci0_req pdus: %u Frame: %d Subframe: %d\n", - hi_dci0_req->hi_dci0_request_body.number_of_dci, - NFAPI_SFNSF2SFN(hi_dci0_req->sfn_sf), NFAPI_SFNSF2SF(hi_dci0_req->sfn_sf)); + hi_dci0_req->hi_dci0_request_body.number_of_dci, + NFAPI_SFNSF2SFN(hi_dci0_req->sfn_sf), NFAPI_SFNSF2SF(hi_dci0_req->sfn_sf)); } if (dl_config_req_tx_req != NULL) { - nfapi_tx_req_pdu_list_t *tx_req_pdu_list = dl_config_req_tx_req->tx_req_pdu_list; nfapi_dl_config_request_t *dl_config_req = dl_config_req_tx_req->dl_config_req; - uint16_t dl_num_pdus = dl_config_req->dl_config_request_body.number_pdu; LOG_I(MAC, "(OAI UE) Received dl_config_req from proxy at Frame: %d, Subframe: %d," " with number of PDUs: %u\n", NFAPI_SFNSF2SFN(dl_config_req->sfn_sf), NFAPI_SFNSF2SF(dl_config_req->sfn_sf), dl_num_pdus); + if (dl_num_pdus > 0) { char *dl_str = nfapi_dl_config_req_to_string(dl_config_req); LOG_I(MAC, "dl_config_req: %s\n", dl_str); free(dl_str); } - LOG_D(MAC, "tx_req pdus: %d\n", tx_req_pdu_list->num_pdus); + LOG_D(MAC, "tx_req pdus: %d\n", tx_req_pdu_list->num_pdus); // Handling dl_config_req and tx_req: nfapi_dl_config_request_body_t *dl_config_req_body = &dl_config_req->dl_config_request_body; + for (int i = 0; i < dl_config_req_body->number_pdu; ++i) { nfapi_dl_config_request_pdu_t *pdu = &dl_config_req_body->dl_config_pdu_list[i]; + if (pdu->pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE) { i += 1; AssertFatal(i < dl_config_req->dl_config_request_body.number_pdu, "Need PDU following DCI at index %d, but not found\n", i); nfapi_dl_config_request_pdu_t *dlsch = &dl_config_req_body->dl_config_pdu_list[i]; + if (dlsch->pdu_type != NFAPI_DL_CONFIG_DLSCH_PDU_TYPE) { LOG_E(MAC, "expected DLSCH PDU at index %d\n", i); continue; } + dl_config_req_UE_MAC_dci(NFAPI_SFNSF2SFN(dl_config_req->sfn_sf), NFAPI_SFNSF2SF(dl_config_req->sfn_sf), pdu, @@ -1125,8 +1111,10 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) } } } + if (hi_dci0_req) { nfapi_hi_dci0_request_body_t *hi_dci0_body = &hi_dci0_req->hi_dci0_request_body; + for (int i = 0; i < hi_dci0_body->number_of_dci + hi_dci0_body->number_of_hi; i++) { nfapi_hi_dci0_request_pdu_t *pdu = &hi_dci0_body->hi_dci0_pdu_list[i]; hi_dci0_req_UE_MAC(NFAPI_SFNSF2SFN(hi_dci0_req->sfn_sf), @@ -1139,13 +1127,13 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) for (ue_index = 0; ue_index < ue_num; ue_index++) { ue_Mod_id = ue_thread_id + NB_THREAD_INST * ue_index; // Always 0 in standalone pnf mode UE = PHY_vars_UE_g[ue_Mod_id][0]; - #if UE_TIMING_TRACE start_meas(&UE->generic_stat); #endif int rx_frame = NFAPI_SFNSF2SF(sfn_sf) < 4 ? (NFAPI_SFNSF2SFN(sfn_sf) + 1023) % 1024 : NFAPI_SFNSF2SFN(sfn_sf); // subtracting 4 from subframe_tx int rx_subframe = NFAPI_SFNSF2SF(sfn_sf) < 4 ? NFAPI_SFNSF2SF(sfn_sf) + 6 : NFAPI_SFNSF2SF(sfn_sf) - 4; LOG_D(MAC, "rx_frame %d rx_subframe %d\n", rx_frame, rx_subframe); + if (UE->mac_enabled == 1) { ret = ue_scheduler(ue_Mod_id, rx_frame, @@ -1168,178 +1156,171 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) // Prepare the future Tx data if ((subframe_select(&UE->frame_parms, NFAPI_SFNSF2SF(sfn_sf)) == SF_UL) || - (UE->frame_parms.frame_type == FDD)) - { - if (UE->mode != loop_through_memory) - { - // We make the start of RA between consecutive UEs differ by 20 frames - //if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && rx_frame >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) { - if (UE_mac_inst[ue_Mod_id].UE_mode[0] == RA_RESPONSE && - is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf))) - { - UE_mac_inst[ue_Mod_id].UE_mode[0] = PRACH; - } - LOG_D(MAC, "UE_mode: %d\n", UE_mac_inst[ue_Mod_id].UE_mode[0]); - if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH) - { //&& ue_Mod_id == next_Mod_id) { - next_ra_frame++; - if (next_ra_frame > 500) - { - // check if we have PRACH opportunity - if (is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1) - { - // The one working strangely... - //if (is_prach_subframe(&UE->frame_parms,NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf) && Mod_id == (module_id_t) init_ra_UE) ) { - PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0, NFAPI_SFNSF2SF(sfn_sf)); - if (prach_resources != NULL) - { - LOG_I(MAC, "preamble_received_tar_power: %d\n", - prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER); - UE_mac_inst[ue_Mod_id].ra_frame = NFAPI_SFNSF2SFN(sfn_sf); - LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)); - fill_rach_indication_UE_MAC(ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI); - sent_any = true; - Msg1_transmitted(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0); - UE_mac_inst[ue_Mod_id].UE_mode[0] = RA_RESPONSE; - next_Mod_id = ue_Mod_id + 1; - //next_ra_frame = (rx_frame + 20)%1000; - next_ra_frame = 0; - } - //ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode); + (UE->frame_parms.frame_type == FDD)) { + // We make the start of RA between consecutive UEs differ by 20 frames + //if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && rx_frame >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) { + if (UE_mac_inst[ue_Mod_id].UE_mode[0] == RA_RESPONSE && + is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf))) { + UE_mac_inst[ue_Mod_id].UE_mode[0] = PRACH; + } + + LOG_D(MAC, "UE_mode: %d\n", UE_mac_inst[ue_Mod_id].UE_mode[0]); + + if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH) { + //&& ue_Mod_id == next_Mod_id) { + next_ra_frame++; + + if (next_ra_frame > 500) { + // check if we have PRACH opportunity + if (is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1) { + // The one working strangely... + //if (is_prach_subframe(&UE->frame_parms,NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf) && Mod_id == (module_id_t) init_ra_UE) ) { + PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0, NFAPI_SFNSF2SF(sfn_sf)); + + if (prach_resources != NULL) { + LOG_I(MAC, "preamble_received_tar_power: %d\n", + prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER); + UE_mac_inst[ue_Mod_id].ra_frame = NFAPI_SFNSF2SFN(sfn_sf); + LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)); + fill_rach_indication_UE_MAC(ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI); + sent_any = true; + Msg1_transmitted(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0); + UE_mac_inst[ue_Mod_id].UE_mode[0] = RA_RESPONSE; + next_Mod_id = ue_Mod_id + 1; + //next_ra_frame = (rx_frame + 20)%1000; + next_ra_frame = 0; } + + //ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode); } - } // mode is PRACH - - // Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger - // UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB). - // Generate UL_indications which correspond to UL traffic. - if (ul_config_req != NULL) - { //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){ - ul_config_req_UE_MAC(ul_config_req, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), ue_Mod_id); } - } + } // mode is PRACH - phy_procedures_UE_SL_RX(UE, proc); - } - else - { - LOG_I(MAC, "Skipping subframe select statement proxy SFN.SF: %d.%d\n", - NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)); - if (ul_config_req != NULL) - { - LOG_I(MAC, "Skipping subframe select statement ul_config_req SFN.SF: %d.%d\n", - NFAPI_SFNSF2SFN(ul_config_req->sfn_sf), NFAPI_SFNSF2SF(ul_config_req->sfn_sf)); + // Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger + // UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB). + // Generate UL_indications which correspond to UL traffic. + if (ul_config_req != NULL) { + //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){ + ul_config_req_UE_MAC(ul_config_req, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), ue_Mod_id); } } - } //for (Mod_id=0; Mod_idcrc_ind.crc_indication_body.number_of_crcs > 0) { - //LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf)); - //LOG_I(MAC, "ul_config_req_UE_MAC 2.2, SFN/SF of PNF counter:%d.%d, number_of_crcs: %d \n", timer_frame, timer_subframe, UL_INFO->crc_ind.crc_indication_body.number_of_crcs); - send_standalone_msg(UL_INFO, UL_INFO->crc_ind.header.message_id); - sent_any = true; - //LOG_I(MAC, "ul_config_req_UE_MAC 2.21 \n"); - UL_INFO->crc_ind.crc_indication_body.number_of_crcs = 0; - } + phy_procedures_UE_SL_RX(UE, proc); + } else { + LOG_I(MAC, "Skipping subframe select statement proxy SFN.SF: %d.%d\n", + NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)); - if (UL_INFO->rx_ind.rx_indication_body.number_of_pdus > 0) { - - //LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf)); - //LOG_I(MAC, "ul_config_req_UE_MAC 2.3, SFN/SF of PNF counter:%d.%d, number_of_pdus: %d \n", timer_frame, timer_subframe, UL_INFO->rx_ind.rx_indication_body.number_of_pdus); - send_standalone_msg(UL_INFO, UL_INFO->rx_ind.header.message_id); - sent_any = true; - - //LOG_I(MAC, "ul_config_req_UE_MAC 2.31 \n"); - UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0; - } - - if (UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis > 0) { - send_standalone_msg(UL_INFO, UL_INFO->cqi_ind.header.message_id); - sent_any = true; - UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0; - } - - if (UL_INFO->harq_ind.harq_indication_body.number_of_harqs > 0) { - //LOG_D(MAC, "ul_config_req_UE_MAC 2.4, SFN/SF of PNF counter:%d.%d, number_of_harqs: %d \n", timer_frame, timer_subframe, UL_INFO->harq_ind.harq_indication_body.number_of_harqs); - send_standalone_msg(UL_INFO, UL_INFO->harq_ind.header.message_id); - sent_any = true; - //LOG_I(MAC, "ul_config_req_UE_MAC 2.41 \n"); - UL_INFO->harq_ind.harq_indication_body.number_of_harqs = 0; - } - - if (UL_INFO->sr_ind.sr_indication_body.number_of_srs > 0) { - //LOG_I(MAC, "ul_config_req_UE_MAC 2.5, SFN/SF of PNF counter:%d.%d, number_of_srs: %d \n", timer_frame, timer_subframe, UL_INFO->sr_ind.sr_indication_body.number_of_srs); - send_standalone_msg(UL_INFO, UL_INFO->sr_ind.header.message_id); - sent_any = true; - //LOG_I(MAC, "ul_config_req_UE_MAC 2.51 \n"); - UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0; - } - - // De-allocate memory of nfapi requests copies before next subframe round - if (dl_config_req_tx_req != NULL) { - if (dl_config_req_tx_req->dl_config_req->vendor_extension != NULL) { - free(dl_config_req_tx_req->dl_config_req->vendor_extension); - dl_config_req_tx_req->dl_config_req->vendor_extension = NULL; + if (ul_config_req != NULL) { + LOG_I(MAC, "Skipping subframe select statement ul_config_req SFN.SF: %d.%d\n", + NFAPI_SFNSF2SFN(ul_config_req->sfn_sf), NFAPI_SFNSF2SF(ul_config_req->sfn_sf)); } - - if (dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list != NULL) { - free(dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list); - dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list = NULL; - } - nfapi_free_tx_req_pdu_list(dl_config_req_tx_req->tx_req_pdu_list); - dl_config_req_tx_req->tx_req_pdu_list = NULL; - - free(dl_config_req_tx_req->dl_config_req); - dl_config_req_tx_req->dl_config_req = NULL; - - free(dl_config_req_tx_req); - dl_config_req_tx_req = NULL; } + } //for (Mod_id=0; Mod_idul_config_request_body.ul_config_pdu_list != NULL) { - free(ul_config_req->ul_config_request_body.ul_config_pdu_list); - ul_config_req->ul_config_request_body.ul_config_pdu_list = NULL; - } - - free(ul_config_req); - ul_config_req = NULL; - } - - if (hi_dci0_req != NULL) { - if (hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list != NULL) { - free(hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list); - hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list = NULL; - } - - free(hi_dci0_req); - hi_dci0_req = NULL; - } - if (!sent_any) - { - send_standalone_dummy(); - } + if (UL_INFO->crc_ind.crc_indication_body.number_of_crcs > 0) { + //LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf)); + //LOG_I(MAC, "ul_config_req_UE_MAC 2.2, SFN/SF of PNF counter:%d.%d, number_of_crcs: %d \n", timer_frame, timer_subframe, UL_INFO->crc_ind.crc_indication_body.number_of_crcs); + send_standalone_msg(UL_INFO, UL_INFO->crc_ind.header.message_id); + sent_any = true; + //LOG_I(MAC, "ul_config_req_UE_MAC 2.21 \n"); + UL_INFO->crc_ind.crc_indication_body.number_of_crcs = 0; } - // Free UL_INFO messages - free(UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list); - UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = NULL; - free(UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list); - UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = NULL; - free(UL_INFO->sr_ind.sr_indication_body.sr_pdu_list); - UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = NULL; - free(UL_INFO->harq_ind.harq_indication_body.harq_pdu_list); - UL_INFO->harq_ind.harq_indication_body.harq_pdu_list = NULL; - free(UL_INFO->crc_ind.crc_indication_body.crc_pdu_list); - UL_INFO->crc_ind.crc_indication_body.crc_pdu_list = NULL; - free(UL_INFO->rx_ind.rx_indication_body.rx_pdu_list); - UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = NULL; - free(UL_INFO); - UL_INFO = NULL; + if (UL_INFO->rx_ind.rx_indication_body.number_of_pdus > 0) { + //LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf)); + //LOG_I(MAC, "ul_config_req_UE_MAC 2.3, SFN/SF of PNF counter:%d.%d, number_of_pdus: %d \n", timer_frame, timer_subframe, UL_INFO->rx_ind.rx_indication_body.number_of_pdus); + send_standalone_msg(UL_INFO, UL_INFO->rx_ind.header.message_id); + sent_any = true; + //LOG_I(MAC, "ul_config_req_UE_MAC 2.31 \n"); + UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0; + } - // thread finished - free(arg); - return NULL; + if (UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis > 0) { + send_standalone_msg(UL_INFO, UL_INFO->cqi_ind.header.message_id); + sent_any = true; + UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0; + } + + if (UL_INFO->harq_ind.harq_indication_body.number_of_harqs > 0) { + //LOG_D(MAC, "ul_config_req_UE_MAC 2.4, SFN/SF of PNF counter:%d.%d, number_of_harqs: %d \n", timer_frame, timer_subframe, UL_INFO->harq_ind.harq_indication_body.number_of_harqs); + send_standalone_msg(UL_INFO, UL_INFO->harq_ind.header.message_id); + sent_any = true; + //LOG_I(MAC, "ul_config_req_UE_MAC 2.41 \n"); + UL_INFO->harq_ind.harq_indication_body.number_of_harqs = 0; + } + + if (UL_INFO->sr_ind.sr_indication_body.number_of_srs > 0) { + //LOG_I(MAC, "ul_config_req_UE_MAC 2.5, SFN/SF of PNF counter:%d.%d, number_of_srs: %d \n", timer_frame, timer_subframe, UL_INFO->sr_ind.sr_indication_body.number_of_srs); + send_standalone_msg(UL_INFO, UL_INFO->sr_ind.header.message_id); + sent_any = true; + //LOG_I(MAC, "ul_config_req_UE_MAC 2.51 \n"); + UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0; + } + + // De-allocate memory of nfapi requests copies before next subframe round + if (dl_config_req_tx_req != NULL) { + if (dl_config_req_tx_req->dl_config_req->vendor_extension != NULL) { + free(dl_config_req_tx_req->dl_config_req->vendor_extension); + dl_config_req_tx_req->dl_config_req->vendor_extension = NULL; + } + + if (dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list != NULL) { + free(dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list); + dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list = NULL; + } + + nfapi_free_tx_req_pdu_list(dl_config_req_tx_req->tx_req_pdu_list); + dl_config_req_tx_req->tx_req_pdu_list = NULL; + free(dl_config_req_tx_req->dl_config_req); + dl_config_req_tx_req->dl_config_req = NULL; + free(dl_config_req_tx_req); + dl_config_req_tx_req = NULL; + } + + if (ul_config_req != NULL) { + if (ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL) { + free(ul_config_req->ul_config_request_body.ul_config_pdu_list); + ul_config_req->ul_config_request_body.ul_config_pdu_list = NULL; + } + + free(ul_config_req); + ul_config_req = NULL; + } + + if (hi_dci0_req != NULL) { + if (hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list != NULL) { + free(hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list); + hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list = NULL; + } + + free(hi_dci0_req); + hi_dci0_req = NULL; + } + + if (!sent_any) { + send_standalone_dummy(); + } +} + +// Free UL_INFO messages +free(UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list); +UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = NULL; +free(UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list); +UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = NULL; +free(UL_INFO->sr_ind.sr_indication_body.sr_pdu_list); +UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = NULL; +free(UL_INFO->harq_ind.harq_indication_body.harq_pdu_list); +UL_INFO->harq_ind.harq_indication_body.harq_pdu_list = NULL; +free(UL_INFO->crc_ind.crc_indication_body.crc_pdu_list); +UL_INFO->crc_ind.crc_indication_body.crc_pdu_list = NULL; +free(UL_INFO->rx_ind.rx_indication_body.rx_pdu_list); +UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = NULL; +free(UL_INFO); +UL_INFO = NULL; + +// thread finished +free(arg); +return NULL; } /*! @@ -1350,8 +1331,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) * \returns a pointer to an int. The storage is not on the heap and must not be freed. */ -static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) -{ +static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { #if 0 // TODO: doesn't currently compile, obviated by multi-ue proxy thread_top_init("UE_phy_stub_thread_rxn_txnp4",1,870000L,1000000L,1000000L); // for multipule UE's L2-emulator @@ -1377,7 +1357,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) proc = &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0]; phy_stub_ticking->num_single_thread[ue_thread_id] = -1; UE = rtd->UE; - UL_INFO = (UL_IND_t *)malloc(sizeof(UL_IND_t)); UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_rx_indication_pdu_t)); UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0; @@ -1489,19 +1468,23 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) } if (dl_config_req && tx_req_pdu_list) { - nfapi_dl_config_request_body_t* dl_config_req_body = &dl_config_req->dl_config_request_body; + nfapi_dl_config_request_body_t *dl_config_req_body = &dl_config_req->dl_config_request_body; + for (int i = 0; i < dl_config_req_body->number_pdu; ++i) { - nfapi_dl_config_request_pdu_t* pdu = &dl_config_req_body->dl_config_pdu_list[i]; + nfapi_dl_config_request_pdu_t *pdu = &dl_config_req_body->dl_config_pdu_list[i]; + if (pdu->pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE) { i += 1; AssertFatal(i < dl_config_req->dl_config_request_body.number_pdu, "Need PDU following DCI at index %d, but not found\n", i); nfapi_dl_config_request_pdu_t *dlsch = &dl_config_req_body->dl_config_pdu_list[i]; + if (dlsch->pdu_type != NFAPI_DL_CONFIG_DLSCH_PDU_TYPE) { LOG_E(MAC, "expected DLSCH PDU at index %d\n", i); continue; } + dl_config_req_UE_MAC_dci(NFAPI_SFNSF2SFN(dl_config_req->sfn_sf), NFAPI_SFNSF2SF(dl_config_req->sfn_sf), pdu, @@ -1523,8 +1506,9 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) if (hi_dci0_req) { nfapi_hi_dci0_request_body_t *hi_dci0_body = &hi_dci0_req->hi_dci0_request_body; + for (int i = 0; i < hi_dci0_body->number_of_dci + hi_dci0_body->number_of_hi; i++) { - nfapi_hi_dci0_request_pdu_t* pdu = &hi_dci0_body->hi_dci0_pdu_list[i]; + nfapi_hi_dci0_request_pdu_t *pdu = &hi_dci0_body->hi_dci0_pdu_list[i]; hi_dci0_req_UE_MAC(NFAPI_SFNSF2SFN(hi_dci0_req->sfn_sf), NFAPI_SFNSF2SF(hi_dci0_req->sfn_sf), pdu, @@ -1592,44 +1576,41 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_UL) || (UE->frame_parms.frame_type == FDD) ) - if (UE->mode != loop_through_memory) { - // We make the start of RA between consecutive UEs differ by 20 frames - //if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && proc->frame_rx >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) { - if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH && ue_Mod_id == next_Mod_id) { - next_ra_frame++; - if(next_ra_frame > 500) { - // check if we have PRACH opportunity - if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1) { - // The one working strangely... - //if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx && Mod_id == (module_id_t) init_ra_UE) ) { - PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, proc->frame_tx, 0, proc->subframe_tx); + // We make the start of RA between consecutive UEs differ by 20 frames + //if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && proc->frame_rx >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) { + if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH && ue_Mod_id == next_Mod_id) { + next_ra_frame++; - if(prach_resources!=NULL ) { - UE_mac_inst[ue_Mod_id].ra_frame = proc->frame_rx; - LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", ue_Mod_id,proc->frame_tx, proc->subframe_tx); - fill_rach_indication_UE_MAC(ue_Mod_id, proc->frame_tx,proc->subframe_tx, UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI); - Msg1_transmitted(ue_Mod_id, 0, proc->frame_tx, 0); - UE_mac_inst[ue_Mod_id].UE_mode[0] = RA_RESPONSE; - next_Mod_id = ue_Mod_id + 1; - //next_ra_frame = (proc->frame_rx + 20)%1000; - next_ra_frame = 0; - } + if(next_ra_frame > 500) { + // check if we have PRACH opportunity + if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1) { + // The one working strangely... + //if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx && Mod_id == (module_id_t) init_ra_UE) ) { + PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, proc->frame_tx, 0, proc->subframe_tx); - //ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode); + if(prach_resources!=NULL ) { + UE_mac_inst[ue_Mod_id].ra_frame = proc->frame_rx; + LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", ue_Mod_id,proc->frame_tx, proc->subframe_tx); + fill_rach_indication_UE_MAC(ue_Mod_id, proc->frame_tx,proc->subframe_tx, UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI); + Msg1_transmitted(ue_Mod_id, 0, proc->frame_tx, 0); + UE_mac_inst[ue_Mod_id].UE_mode[0] = RA_RESPONSE; + next_Mod_id = ue_Mod_id + 1; + //next_ra_frame = (proc->frame_rx + 20)%1000; + next_ra_frame = 0; } + + //ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode); } - } // mode is PRACH - - // Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger - // UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB). - // Generate UL_indications which correspond to UL traffic. - if(ul_config_req!=NULL) { //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){ - ul_config_req_UE_MAC(ul_config_req, timer_frame, timer_subframe, ue_Mod_id); } - } + } // mode is PRACH - phy_procedures_UE_SL_RX(UE,proc); + // Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger + // UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB). + // Generate UL_indications which correspond to UL traffic. + if(ul_config_req!=NULL) { //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){ + ul_config_req_UE_MAC(ul_config_req, timer_frame, timer_subframe, ue_Mod_id); + } } //for (Mod_id=0; Mod_idnum_single_thread[ue_thread_id] = -1; @@ -1709,6 +1690,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) tx_req_pdu_list[i].segments[j].segment_data = NULL; } } + tx_req_num_elems = 0; free(tx_req_pdu_list); tx_req_pdu_list = NULL; @@ -1752,7 +1734,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) free(UL_INFO); UL_INFO = NULL; #endif // disabled UE_phy_stub_single_thread_rxn_txnp4 - // thread finished free(arg); return NULL; @@ -1767,9 +1748,8 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) * \returns a pointer to an int. The storage is not on the heap and must not be freed. */ -static void *UE_phy_stub_thread_rxn_txnp4(void *arg) -{ - #if 0 +static void *UE_phy_stub_thread_rxn_txnp4(void *arg) { +#if 0 thread_top_init("UE_phy_stub_thread_rxn_txnp4",1,870000L,1000000L,1000000L); module_id_t Mod_id = 0; static __thread int UE_thread_rxtx_retval; @@ -1880,45 +1860,42 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_UL) || (UE->frame_parms.frame_type == FDD) ) - if (UE->mode != loop_through_memory) { - if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH) ) { - // check if we have PRACH opportunity - if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx)) { - PRACH_RESOURCES_t *prach_resources = ue_get_rach(Mod_id, 0, proc->frame_tx, 0, proc->subframe_tx); + if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH) ) { + // check if we have PRACH opportunity + if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx)) { + PRACH_RESOURCES_t *prach_resources = ue_get_rach(Mod_id, 0, proc->frame_tx, 0, proc->subframe_tx); - if(prach_resources!=NULL) { - fill_rach_indication_UE_MAC(Mod_id, proc->frame_tx,proc->subframe_tx, UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI); - Msg1_transmitted(Mod_id, 0, proc->frame_tx, 0); - UE_mac_inst[Mod_id].UE_mode[0] = RA_RESPONSE; - } - - //ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode); - } - } // mode is PRACH - - // Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger - // UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB). - // Generate UL_indications which correspond to UL traffic. - if(ul_config_req!= NULL && ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL) { - //LOG_I(MAC, "UE_phy_stub_thread_rxn_txnp4 ul_config_req is not NULL \n"); - ul_config_req_UE_MAC(ul_config_req, timer_frame, timer_subframe, Mod_id); - - if(ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL) { - free(ul_config_req->ul_config_request_body.ul_config_pdu_list); - ul_config_req->ul_config_request_body.ul_config_pdu_list = NULL; + if(prach_resources!=NULL) { + fill_rach_indication_UE_MAC(Mod_id, proc->frame_tx,proc->subframe_tx, UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI); + Msg1_transmitted(Mod_id, 0, proc->frame_tx, 0); + UE_mac_inst[Mod_id].UE_mode[0] = RA_RESPONSE; } - free(ul_config_req); - ul_config_req = NULL; - } else if(ul_config_req!=NULL) { - free(ul_config_req); - ul_config_req = NULL; + //ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode); } + } // mode is PRACH + + // Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger + // UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB). + // Generate UL_indications which correspond to UL traffic. + if(ul_config_req!= NULL && ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL) { + //LOG_I(MAC, "UE_phy_stub_thread_rxn_txnp4 ul_config_req is not NULL \n"); + ul_config_req_UE_MAC(ul_config_req, timer_frame, timer_subframe, Mod_id); + + if(ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL) { + free(ul_config_req->ul_config_request_body.ul_config_pdu_list); + ul_config_req->ul_config_request_body.ul_config_pdu_list = NULL; } - phy_procedures_UE_SL_RX(UE,proc); + free(ul_config_req); + ul_config_req = NULL; + } else if(ul_config_req!=NULL) { + free(ul_config_req); + ul_config_req = NULL; + } } - #endif // disabled + +#endif // disabled // thread finished free(arg); return NULL; //return &UE_thread_rxtx_retval; @@ -1940,20 +1917,19 @@ void write_dummy(PHY_VARS_UE *UE, openair0_timestamp timestamp) { // struct complex16 v= {0}; void *samplesVoid[UE->frame_parms.nb_antennas_tx]; - + for ( int i=0; i < UE->frame_parms.nb_antennas_tx; i++) samplesVoid[i]=(void *)&v; - + AssertFatal( 1 == UE->rfdevice.trx_write_func(&UE->rfdevice, - timestamp+2*UE->frame_parms.samples_per_tti, - samplesVoid, - 1, - UE->frame_parms.nb_antennas_tx, - 1),""); + timestamp+2*UE->frame_parms.samples_per_tti, + samplesVoid, + 1, + UE->frame_parms.nb_antennas_tx, + 1),""); } -void *UE_thread(void *arg) -{ +void *UE_thread(void *arg) { PHY_VARS_UE *UE = (PHY_VARS_UE *) arg; // int tx_enabled = 0; int dummy_rx[UE->frame_parms.nb_antennas_rx][UE->frame_parms.samples_per_tti] __attribute__((aligned(32))); @@ -1966,10 +1942,11 @@ void *UE_thread(void *arg) int ret; cpu_set_t cpuset; CPU_ZERO(&cpuset); + if ( threads.main != -1 ) CPU_SET(threads.main, &cpuset); - init_thread(100000, 500000, FIFO_PRIORITY, &cpuset, "UHD Threads"); + init_thread(100000, 500000, FIFO_PRIORITY, &cpuset, "UHD Threads"); /* while (sync_var<0) pthread_cond_wait(&sync_cond, &sync_mutex); @@ -1996,46 +1973,45 @@ void *UE_thread(void *arg) int instance_cnt_synch = UE->proc.instance_cnt_synch; int is_synchronized = UE->is_synchronized; AssertFatal ( 0== pthread_mutex_unlock(&UE->proc.mutex_synch), ""); - + if (is_synchronized == 0) { if (instance_cnt_synch < 0) { // we can invoke the synch - // we shift in time flow because the UE doesn't detect sync when frame alignment is not easy - for (int i=0; iframe_parms.nb_antennas_rx; i++) - rxp[i] = (void *)&dummy_rx[i][0]; - UE->rfdevice.trx_read_func(&UE->rfdevice, - ×tamp, - rxp, - UE->frame_parms.samples_per_tti/2, - UE->frame_parms.nb_antennas_rx); - + // we shift in time flow because the UE doesn't detect sync when frame alignment is not easy + for (int i=0; iframe_parms.nb_antennas_rx; i++) + rxp[i] = (void *)&dummy_rx[i][0]; + + UE->rfdevice.trx_read_func(&UE->rfdevice, + ×tamp, + rxp, + UE->frame_parms.samples_per_tti/2, + UE->frame_parms.nb_antennas_rx); + // grab 10 ms of signal and wakeup synch thread - - if (UE->mode != loop_through_memory) { - if (IS_SOFTMODEM_RFSIM ) { - for(int sf=0; sf<10; sf++) { - for (int i=0; iframe_parms.nb_antennas_rx; i++) - rxp[i] = (void *)&UE->common_vars.rxdata[i][UE->frame_parms.samples_per_tti*sf]; - - AssertFatal(UE->frame_parms.samples_per_tti == UE->rfdevice.trx_read_func(&UE->rfdevice, - ×tamp, - rxp, - UE->frame_parms.samples_per_tti, - UE->frame_parms.nb_antennas_rx), ""); - write_dummy(UE, timestamp); - } - } else { - for (int i=0; iframe_parms.nb_antennas_rx; i++) - rxp[i] = (void *)&UE->common_vars.rxdata[i][0]; - - AssertFatal( UE->frame_parms.samples_per_tti*10 == - UE->rfdevice.trx_read_func(&UE->rfdevice, - ×tamp, - rxp, - UE->frame_parms.samples_per_tti*10, - UE->frame_parms.nb_antennas_rx), ""); - } - } + + if (IS_SOFTMODEM_RFSIM ) { + for(int sf=0; sf<10; sf++) { + for (int i=0; iframe_parms.nb_antennas_rx; i++) + rxp[i] = (void *)&UE->common_vars.rxdata[i][UE->frame_parms.samples_per_tti*sf]; + + AssertFatal(UE->frame_parms.samples_per_tti == UE->rfdevice.trx_read_func(&UE->rfdevice, + ×tamp, + rxp, + UE->frame_parms.samples_per_tti, + UE->frame_parms.nb_antennas_rx), ""); + write_dummy(UE, timestamp); + } + } else { + for (int i=0; iframe_parms.nb_antennas_rx; i++) + rxp[i] = (void *)&UE->common_vars.rxdata[i][0]; + + AssertFatal( UE->frame_parms.samples_per_tti*10 == + UE->rfdevice.trx_read_func(&UE->rfdevice, + ×tamp, + rxp, + UE->frame_parms.samples_per_tti*10, + UE->frame_parms.nb_antennas_rx), ""); + } AssertFatal ( 0== pthread_mutex_lock(&UE->proc.mutex_synch), ""); instance_cnt_synch = ++UE->proc.instance_cnt_synch; @@ -2049,69 +2025,62 @@ void *UE_thread(void *arg) AssertFatal ( 0== pthread_mutex_unlock(&UE->proc.mutex_synch), ""); } else { -#if OAISIM - (void)dummy_rx; /* avoid gcc warnings */ - usleep(500); -#else // grab 10 ms of signal into dummy buffer - if (UE->mode != loop_through_memory) { - for (int i=0; iframe_parms.nb_antennas_rx; i++) - rxp[i] = (void *)&dummy_rx[i][0]; + for (int i=0; iframe_parms.nb_antennas_rx; i++) + rxp[i] = (void *)&dummy_rx[i][0]; - for (int sf=0; sf<10; sf++) { - // printf("Reading dummy sf %d\n",sf); - UE->rfdevice.trx_read_func(&UE->rfdevice, - ×tamp, - rxp, - UE->frame_parms.samples_per_tti, - UE->frame_parms.nb_antennas_rx); - if (IS_SOFTMODEM_RFSIM ) - write_dummy(UE, timestamp); - } - } -#endif + for (int sf=0; sf<10; sf++) { + // printf("Reading dummy sf %d\n",sf); + UE->rfdevice.trx_read_func(&UE->rfdevice, + ×tamp, + rxp, + UE->frame_parms.samples_per_tti, + UE->frame_parms.nb_antennas_rx); + + if (IS_SOFTMODEM_RFSIM ) + write_dummy(UE, timestamp); + } } } // UE->is_synchronized==0 else { if (start_rx_stream==0) { start_rx_stream=1; - if (UE->mode != loop_through_memory) { - if (UE->no_timing_correction==0) { - LOG_I(PHY,"Resynchronizing RX by %d samples (mode = %d)\n",UE->rx_offset,UE->mode); - while ( UE->rx_offset ) { - size_t s=min(UE->rx_offset,UE->frame_parms.samples_per_tti); - AssertFatal(s == UE->rfdevice.trx_read_func(&UE->rfdevice, - ×tamp, - (void **)UE->common_vars.rxdata, - s, - UE->frame_parms.nb_antennas_rx),""); - if (IS_SOFTMODEM_RFSIM ) - write_dummy(UE, timestamp); - UE->rx_offset-=s; - } + if (UE->no_timing_correction==0) { + LOG_I(PHY,"Resynchronizing RX by %d samples (mode = %d)\n",UE->rx_offset,UE->mode); + + while ( UE->rx_offset ) { + size_t s=min(UE->rx_offset,UE->frame_parms.samples_per_tti); + AssertFatal(s == UE->rfdevice.trx_read_func(&UE->rfdevice, + ×tamp, + (void **)UE->common_vars.rxdata, + s, + UE->frame_parms.nb_antennas_rx),""); + + if (IS_SOFTMODEM_RFSIM ) + write_dummy(UE, timestamp); + + UE->rx_offset-=s; } + } - UE->rx_offset=0; - UE->time_sync_cell=0; + UE->rx_offset=0; + UE->time_sync_cell=0; - //UE->proc.proc_rxtx[0].frame_rx++; - //UE->proc.proc_rxtx[1].frame_rx++; - for (th_id=0; th_id < RX_NB_TH; th_id++) { - UE->proc.proc_rxtx[th_id].frame_rx++; - } + //UE->proc.proc_rxtx[0].frame_rx++; + //UE->proc.proc_rxtx[1].frame_rx++; + for (th_id=0; th_id < RX_NB_TH; th_id++) { + UE->proc.proc_rxtx[th_id].frame_rx++; + } - // read in first symbol - AssertFatal (UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0 == - UE->rfdevice.trx_read_func(&UE->rfdevice, - ×tamp, - (void **)UE->common_vars.rxdata, - UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0, - UE->frame_parms.nb_antennas_rx),""); - slot_fep(UE,0, 0, 0, 0, 0); - } //UE->mode != loop_through_memory - else - rt_sleep_ns(1000*1000); + // read in first symbol + AssertFatal (UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0 == + UE->rfdevice.trx_read_func(&UE->rfdevice, + ×tamp, + (void **)UE->common_vars.rxdata, + UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0, + UE->frame_parms.nb_antennas_rx),""); + slot_fep(UE,0, 0, 0, 0, 0); } else { sub_frame++; sub_frame%=10; @@ -2130,7 +2099,8 @@ void *UE_thread(void *arg) pthread_mutex_unlock(&proc->mutex_rxtx); } - usleep(300); + + usleep(300); } LOG_D(PHY,"Process Subframe %d thread Idx %d \n", sub_frame, UE->current_thread_id[sub_frame]); @@ -2139,130 +2109,129 @@ void *UE_thread(void *arg) if(thread_idx>=RX_NB_TH) thread_idx = 0; - if (UE->mode != loop_through_memory) { - for (i=0; iframe_parms.nb_antennas_rx; i++) - rxp[i] = (void *)&UE->common_vars.rxdata[i][UE->frame_parms.ofdm_symbol_size+ - UE->frame_parms.nb_prefix_samples0+ - sub_frame*UE->frame_parms.samples_per_tti]; + for (i=0; iframe_parms.nb_antennas_rx; i++) + rxp[i] = (void *)&UE->common_vars.rxdata[i][UE->frame_parms.ofdm_symbol_size+ + UE->frame_parms.nb_prefix_samples0+ + sub_frame*UE->frame_parms.samples_per_tti]; - for (i=0; iframe_parms.nb_antennas_tx; i++) - txp[i] = (void *)&UE->common_vars.txdata[i][((sub_frame+2)%10)*UE->frame_parms.samples_per_tti]; + for (i=0; iframe_parms.nb_antennas_tx; i++) + txp[i] = (void *)&UE->common_vars.txdata[i][((sub_frame+2)%10)*UE->frame_parms.samples_per_tti]; - int readBlockSize, writeBlockSize; + int readBlockSize, writeBlockSize; - if (sub_frame<9) { - readBlockSize=UE->frame_parms.samples_per_tti; - writeBlockSize=UE->frame_parms.samples_per_tti; - } else { - // set TO compensation to zero - UE->rx_offset_diff = 0; - - // compute TO compensation that should be applied for this frame - - if (UE->no_timing_correction == 0) { - if ( UE->rx_offset < 5*UE->frame_parms.samples_per_tti && - UE->rx_offset > 0 ) - UE->rx_offset_diff = -1 ; - - if ( UE->rx_offset > 5*UE->frame_parms.samples_per_tti && - UE->rx_offset < 10*UE->frame_parms.samples_per_tti ) - UE->rx_offset_diff = 1; - } - - LOG_D(PHY,"AbsSubframe %d.%d SET rx_off_diff to %d rx_offset %d \n",proc->frame_rx,sub_frame,UE->rx_offset_diff,UE->rx_offset); - readBlockSize=UE->frame_parms.samples_per_tti - - UE->frame_parms.ofdm_symbol_size - - UE->frame_parms.nb_prefix_samples0 - - UE->rx_offset_diff; - writeBlockSize=UE->frame_parms.samples_per_tti - - UE->rx_offset_diff; - } - - AssertFatal(readBlockSize == - UE->rfdevice.trx_read_func(&UE->rfdevice, - ×tamp, - rxp, - readBlockSize, - UE->frame_parms.nb_antennas_rx),""); - AssertFatal( writeBlockSize == - UE->rfdevice.trx_write_func(&UE->rfdevice, - timestamp+ - (2*UE->frame_parms.samples_per_tti) - - UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0 - - openair0_cfg[0].tx_sample_advance, - txp, - writeBlockSize, - UE->frame_parms.nb_antennas_tx, - 1),""); - - if( sub_frame==9) { - // read in first symbol of next frame and adjust for timing drift - int first_symbols=writeBlockSize-readBlockSize; - - if ( first_symbols > 0 ) - AssertFatal(first_symbols == - UE->rfdevice.trx_read_func(&UE->rfdevice, - ×tamp1, - (void **)UE->common_vars.rxdata, - first_symbols, - UE->frame_parms.nb_antennas_rx),""); - - if ( first_symbols <0 ) - LOG_E(PHY,"can't compensate: diff =%d\n", first_symbols); - } - - /* no timeout in IS_SOFTMODEM_RFSIM mode */ - if (IS_SOFTMODEM_RFSIM) { - ret = pthread_mutex_lock(&proc->mutex_rxtx); - } else { - struct timespec tv; - if (clock_gettime(CLOCK_REALTIME, &tv) != 0) { - perror("clock_gettime"); - exit(1); - } - tv.tv_nsec += 10*1000; - if (tv.tv_nsec >= 1000 * 1000 * 1000) { - tv.tv_sec++; - tv.tv_nsec -= 1000 * 1000 * 1000; - } - ret = pthread_mutex_timedlock(&proc->mutex_rxtx, &tv); - } - - // operate on thread sf mod 2 - if (ret != 0) { - if (ret == ETIMEDOUT) { - LOG_E(PHY,"Missed real time\n"); - continue; - } else { - LOG_E(PHY,"System error %s (%d)\n",strerror(errno),errno); - abort(); - } - } - - // usleep(3000); - if(sub_frame == 0) { - //UE->proc.proc_rxtx[0].frame_rx++; - //UE->proc.proc_rxtx[1].frame_rx++; - for (th_id=0; th_id < RX_NB_TH; th_id++) { - UE->proc.proc_rxtx[th_id].frame_rx++; - } - } - - proc->subframe_rx=sub_frame; - proc->subframe_tx=(sub_frame+4)%10; - proc->frame_tx = proc->frame_rx + (proc->subframe_rx>5?1:0); - proc->timestamp_tx = timestamp+ - (4*UE->frame_parms.samples_per_tti)- - UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0; - proc->instance_cnt_rxtx++; - LOG_D( PHY, "[SCHED][UE %d] UE RX instance_cnt_rxtx %d subframe %d !!\n", UE->Mod_id, proc->instance_cnt_rxtx,proc->subframe_rx); - T(T_UE_MASTER_TICK, T_INT(0), T_INT(proc->frame_rx%1024), T_INT(proc->subframe_rx)); - AssertFatal (pthread_cond_signal(&proc->cond_rxtx) ==0,""); - AssertFatal(pthread_mutex_unlock(&proc->mutex_rxtx) ==0,""); + if (sub_frame<9) { + readBlockSize=UE->frame_parms.samples_per_tti; + writeBlockSize=UE->frame_parms.samples_per_tti; } else { - printf("Processing subframe %d",proc->subframe_rx); - getchar(); + // set TO compensation to zero + UE->rx_offset_diff = 0; + + // compute TO compensation that should be applied for this frame + + if (UE->no_timing_correction == 0) { + if ( UE->rx_offset < 5*UE->frame_parms.samples_per_tti && + UE->rx_offset > 0 ) + UE->rx_offset_diff = -1 ; + + if ( UE->rx_offset > 5*UE->frame_parms.samples_per_tti && + UE->rx_offset < 10*UE->frame_parms.samples_per_tti ) + UE->rx_offset_diff = 1; + } + + LOG_D(PHY,"AbsSubframe %d.%d SET rx_off_diff to %d rx_offset %d \n",proc->frame_rx,sub_frame,UE->rx_offset_diff,UE->rx_offset); + readBlockSize=UE->frame_parms.samples_per_tti - + UE->frame_parms.ofdm_symbol_size - + UE->frame_parms.nb_prefix_samples0 - + UE->rx_offset_diff; + writeBlockSize=UE->frame_parms.samples_per_tti - + UE->rx_offset_diff; } + + AssertFatal(readBlockSize == + UE->rfdevice.trx_read_func(&UE->rfdevice, + ×tamp, + rxp, + readBlockSize, + UE->frame_parms.nb_antennas_rx),""); + AssertFatal( writeBlockSize == + UE->rfdevice.trx_write_func(&UE->rfdevice, + timestamp+ + (2*UE->frame_parms.samples_per_tti) - + UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0 - + openair0_cfg[0].tx_sample_advance, + txp, + writeBlockSize, + UE->frame_parms.nb_antennas_tx, + 1),""); + + if( sub_frame==9) { + // read in first symbol of next frame and adjust for timing drift + int first_symbols=writeBlockSize-readBlockSize; + + if ( first_symbols > 0 ) + AssertFatal(first_symbols == + UE->rfdevice.trx_read_func(&UE->rfdevice, + ×tamp1, + (void **)UE->common_vars.rxdata, + first_symbols, + UE->frame_parms.nb_antennas_rx),""); + + if ( first_symbols <0 ) + LOG_E(PHY,"can't compensate: diff =%d\n", first_symbols); + } + + /* no timeout in IS_SOFTMODEM_RFSIM mode */ + if (IS_SOFTMODEM_RFSIM) { + ret = pthread_mutex_lock(&proc->mutex_rxtx); + } else { + struct timespec tv; + + if (clock_gettime(CLOCK_REALTIME, &tv) != 0) { + perror("clock_gettime"); + exit(1); + } + + tv.tv_nsec += 10*1000; + + if (tv.tv_nsec >= 1000 * 1000 * 1000) { + tv.tv_sec++; + tv.tv_nsec -= 1000 * 1000 * 1000; + } + + ret = pthread_mutex_timedlock(&proc->mutex_rxtx, &tv); + } + + // operate on thread sf mod 2 + if (ret != 0) { + if (ret == ETIMEDOUT) { + LOG_E(PHY,"Missed real time\n"); + continue; + } else { + LOG_E(PHY,"System error %s (%d)\n",strerror(errno),errno); + abort(); + } + } + + // usleep(3000); + if(sub_frame == 0) { + //UE->proc.proc_rxtx[0].frame_rx++; + //UE->proc.proc_rxtx[1].frame_rx++; + for (th_id=0; th_id < RX_NB_TH; th_id++) { + UE->proc.proc_rxtx[th_id].frame_rx++; + } + } + + proc->subframe_rx=sub_frame; + proc->subframe_tx=(sub_frame+4)%10; + proc->frame_tx = proc->frame_rx + (proc->subframe_rx>5?1:0); + proc->timestamp_tx = timestamp+ + (4*UE->frame_parms.samples_per_tti)- + UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0; + proc->instance_cnt_rxtx++; + LOG_D( PHY, "[SCHED][UE %d] UE RX instance_cnt_rxtx %d subframe %d !!\n", UE->Mod_id, proc->instance_cnt_rxtx,proc->subframe_rx); + T(T_UE_MASTER_TICK, T_INT(0), T_INT(proc->frame_rx%1024), T_INT(proc->subframe_rx)); + AssertFatal (pthread_cond_signal(&proc->cond_rxtx) ==0,""); + AssertFatal(pthread_mutex_unlock(&proc->mutex_rxtx) ==0,""); } // start_rx_stream==1 } // UE->is_synchronized==1 } // while !oai_exit @@ -2283,8 +2252,7 @@ void *UE_thread(void *arg) * - UE_thread_dlsch_proc_slot1 * and the locking between them. */ -void init_UE_threads(int inst) -{ +void init_UE_threads(int inst) { struct rx_tx_thread_data *rtd; PHY_VARS_UE *UE; AssertFatal(PHY_vars_UE_g!=NULL,"PHY_vars_UE_g is NULL\n"); @@ -2339,8 +2307,7 @@ void init_UE_threads(int inst) * - UE_thread_dlsch_proc_slot1 * and the locking between them. */ -void init_UE_single_thread_stub(int nb_inst) -{ +void init_UE_single_thread_stub(int nb_inst) { struct rx_tx_thread_data *rtd; PHY_VARS_UE *UE; @@ -2368,8 +2335,8 @@ void init_UE_single_thread_stub(int nb_inst) // In phy_stub_UE mode due to less heavy processing operations we don't need two threads //int nb_threads=RX_NB_TH; int nb_threads=1; + void *(*task_func)(void *); - void* (*task_func)(void*); if (NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) { task_func = UE_phy_stub_standalone_pnf_task; } else { @@ -2413,8 +2380,7 @@ void init_UE_single_thread_stub(int nb_inst) * - UE_thread_dlsch_proc_slot1 * and the locking between them. */ -void init_UE_threads_stub(int inst) -{ +void init_UE_threads_stub(int inst) { struct rx_tx_thread_data *rtd; PHY_VARS_UE *UE; AssertFatal(PHY_vars_UE_g!=NULL,"PHY_vars_UE_g is NULL\n"); @@ -2451,8 +2417,7 @@ void init_UE_threads_stub(int inst) } -void fill_ue_band_info(void) -{ +void fill_ue_band_info(void) { LTE_UE_EUTRA_Capability_t *UE_EUTRA_Capability = UE_rrc_inst[0].UECap->UE_EUTRA_Capability; int i,j; bands_to_scan.nbands = UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.count; @@ -2477,8 +2442,7 @@ void fill_ue_band_info(void) } int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, - openair0_config_t *openair0_cfg) -{ + openair0_config_t *openair0_cfg) { int i, CC_id; LTE_DL_FRAME_PARMS *frame_parms; @@ -2520,8 +2484,7 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, // playing the role of nfapi-pnf. //02/02/2018 -static void *timer_thread( void *param ) -{ +static void *timer_thread( void *param ) { thread_top_init("timer_thread",1,870000L,1000000L,1000000L); timer_subframe =9; timer_frame =1023; @@ -2647,8 +2610,7 @@ static void *timer_thread( void *param ) } -int init_timer_thread(void) -{ +int init_timer_thread(void) { //PHY_VARS_UE *UE=PHY_vars_UE_g[0]; PHY_VARS_UE *UE=PHY_vars_UE_g[0][0]; phy_stub_ticking = (SF_ticking *)malloc(sizeof(SF_ticking)); @@ -2670,8 +2632,7 @@ int init_timer_thread(void) */ int8_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB, - find_type_t type) -{ + find_type_t type) { printf("you cannot read this\n"); abort(); } From 421603534c7db096fd7b4c21da302bfb28b712a2 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Mon, 11 Apr 2022 10:52:53 +0200 Subject: [PATCH 050/114] fix regression --- targets/RT/USER/lte-ue.c | 204 +++++++++++++++++++-------------------- 1 file changed, 100 insertions(+), 104 deletions(-) diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 8565e36e87..2b3a680713 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -1203,124 +1203,120 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) { //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){ ul_config_req_UE_MAC(ul_config_req, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), ue_Mod_id); } + } else { + LOG_I(MAC, "Skipping subframe select statement proxy SFN.SF: %d.%d\n", + NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)); + + if (ul_config_req != NULL) { + LOG_I(MAC, "Skipping subframe select statement ul_config_req SFN.SF: %d.%d\n", + NFAPI_SFNSF2SFN(ul_config_req->sfn_sf), NFAPI_SFNSF2SF(ul_config_req->sfn_sf)); + } + } + } //for (Mod_id=0; Mod_idcrc_ind.crc_indication_body.number_of_crcs > 0) { + //LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf)); + //LOG_I(MAC, "ul_config_req_UE_MAC 2.2, SFN/SF of PNF counter:%d.%d, number_of_crcs: %d \n", timer_frame, timer_subframe, UL_INFO->crc_ind.crc_indication_body.number_of_crcs); + send_standalone_msg(UL_INFO, UL_INFO->crc_ind.header.message_id); + sent_any = true; + //LOG_I(MAC, "ul_config_req_UE_MAC 2.21 \n"); + UL_INFO->crc_ind.crc_indication_body.number_of_crcs = 0; + } + + if (UL_INFO->rx_ind.rx_indication_body.number_of_pdus > 0) { + //LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf)); + //LOG_I(MAC, "ul_config_req_UE_MAC 2.3, SFN/SF of PNF counter:%d.%d, number_of_pdus: %d \n", timer_frame, timer_subframe, UL_INFO->rx_ind.rx_indication_body.number_of_pdus); + send_standalone_msg(UL_INFO, UL_INFO->rx_ind.header.message_id); + sent_any = true; + //LOG_I(MAC, "ul_config_req_UE_MAC 2.31 \n"); + UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0; + } + + if (UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis > 0) { + send_standalone_msg(UL_INFO, UL_INFO->cqi_ind.header.message_id); + sent_any = true; + UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0; + } + + if (UL_INFO->harq_ind.harq_indication_body.number_of_harqs > 0) { + //LOG_D(MAC, "ul_config_req_UE_MAC 2.4, SFN/SF of PNF counter:%d.%d, number_of_harqs: %d \n", timer_frame, timer_subframe, UL_INFO->harq_ind.harq_indication_body.number_of_harqs); + send_standalone_msg(UL_INFO, UL_INFO->harq_ind.header.message_id); + sent_any = true; + //LOG_I(MAC, "ul_config_req_UE_MAC 2.41 \n"); + UL_INFO->harq_ind.harq_indication_body.number_of_harqs = 0; + } + + if (UL_INFO->sr_ind.sr_indication_body.number_of_srs > 0) { + //LOG_I(MAC, "ul_config_req_UE_MAC 2.5, SFN/SF of PNF counter:%d.%d, number_of_srs: %d \n", timer_frame, timer_subframe, UL_INFO->sr_ind.sr_indication_body.number_of_srs); + send_standalone_msg(UL_INFO, UL_INFO->sr_ind.header.message_id); + sent_any = true; + //LOG_I(MAC, "ul_config_req_UE_MAC 2.51 \n"); + UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0; + } + + // De-allocate memory of nfapi requests copies before next subframe round + if (dl_config_req_tx_req != NULL) { + if (dl_config_req_tx_req->dl_config_req->vendor_extension != NULL) { + free(dl_config_req_tx_req->dl_config_req->vendor_extension); + dl_config_req_tx_req->dl_config_req->vendor_extension = NULL; } - phy_procedures_UE_SL_RX(UE, proc); - } else { - LOG_I(MAC, "Skipping subframe select statement proxy SFN.SF: %d.%d\n", - NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)); - - if (ul_config_req != NULL) { - LOG_I(MAC, "Skipping subframe select statement ul_config_req SFN.SF: %d.%d\n", - NFAPI_SFNSF2SFN(ul_config_req->sfn_sf), NFAPI_SFNSF2SF(ul_config_req->sfn_sf)); + if (dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list != NULL) { + free(dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list); + dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list = NULL; } - } - } //for (Mod_id=0; Mod_idcrc_ind.crc_indication_body.number_of_crcs > 0) { - //LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf)); - //LOG_I(MAC, "ul_config_req_UE_MAC 2.2, SFN/SF of PNF counter:%d.%d, number_of_crcs: %d \n", timer_frame, timer_subframe, UL_INFO->crc_ind.crc_indication_body.number_of_crcs); - send_standalone_msg(UL_INFO, UL_INFO->crc_ind.header.message_id); - sent_any = true; - //LOG_I(MAC, "ul_config_req_UE_MAC 2.21 \n"); - UL_INFO->crc_ind.crc_indication_body.number_of_crcs = 0; - } - - if (UL_INFO->rx_ind.rx_indication_body.number_of_pdus > 0) { - //LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf)); - //LOG_I(MAC, "ul_config_req_UE_MAC 2.3, SFN/SF of PNF counter:%d.%d, number_of_pdus: %d \n", timer_frame, timer_subframe, UL_INFO->rx_ind.rx_indication_body.number_of_pdus); - send_standalone_msg(UL_INFO, UL_INFO->rx_ind.header.message_id); - sent_any = true; - //LOG_I(MAC, "ul_config_req_UE_MAC 2.31 \n"); - UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0; - } - - if (UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis > 0) { - send_standalone_msg(UL_INFO, UL_INFO->cqi_ind.header.message_id); - sent_any = true; - UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0; - } - - if (UL_INFO->harq_ind.harq_indication_body.number_of_harqs > 0) { - //LOG_D(MAC, "ul_config_req_UE_MAC 2.4, SFN/SF of PNF counter:%d.%d, number_of_harqs: %d \n", timer_frame, timer_subframe, UL_INFO->harq_ind.harq_indication_body.number_of_harqs); - send_standalone_msg(UL_INFO, UL_INFO->harq_ind.header.message_id); - sent_any = true; - //LOG_I(MAC, "ul_config_req_UE_MAC 2.41 \n"); - UL_INFO->harq_ind.harq_indication_body.number_of_harqs = 0; - } - - if (UL_INFO->sr_ind.sr_indication_body.number_of_srs > 0) { - //LOG_I(MAC, "ul_config_req_UE_MAC 2.5, SFN/SF of PNF counter:%d.%d, number_of_srs: %d \n", timer_frame, timer_subframe, UL_INFO->sr_ind.sr_indication_body.number_of_srs); - send_standalone_msg(UL_INFO, UL_INFO->sr_ind.header.message_id); - sent_any = true; - //LOG_I(MAC, "ul_config_req_UE_MAC 2.51 \n"); - UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0; - } - - // De-allocate memory of nfapi requests copies before next subframe round - if (dl_config_req_tx_req != NULL) { - if (dl_config_req_tx_req->dl_config_req->vendor_extension != NULL) { - free(dl_config_req_tx_req->dl_config_req->vendor_extension); - dl_config_req_tx_req->dl_config_req->vendor_extension = NULL; + nfapi_free_tx_req_pdu_list(dl_config_req_tx_req->tx_req_pdu_list); + dl_config_req_tx_req->tx_req_pdu_list = NULL; + free(dl_config_req_tx_req->dl_config_req); + dl_config_req_tx_req->dl_config_req = NULL; + free(dl_config_req_tx_req); + dl_config_req_tx_req = NULL; } - if (dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list != NULL) { - free(dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list); - dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list = NULL; + if (ul_config_req != NULL) { + if (ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL) { + free(ul_config_req->ul_config_request_body.ul_config_pdu_list); + ul_config_req->ul_config_request_body.ul_config_pdu_list = NULL; + } + + free(ul_config_req); + ul_config_req = NULL; } - nfapi_free_tx_req_pdu_list(dl_config_req_tx_req->tx_req_pdu_list); - dl_config_req_tx_req->tx_req_pdu_list = NULL; - free(dl_config_req_tx_req->dl_config_req); - dl_config_req_tx_req->dl_config_req = NULL; - free(dl_config_req_tx_req); - dl_config_req_tx_req = NULL; - } + if (hi_dci0_req != NULL) { + if (hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list != NULL) { + free(hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list); + hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list = NULL; + } - if (ul_config_req != NULL) { - if (ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL) { - free(ul_config_req->ul_config_request_body.ul_config_pdu_list); - ul_config_req->ul_config_request_body.ul_config_pdu_list = NULL; + free(hi_dci0_req); + hi_dci0_req = NULL; } - free(ul_config_req); - ul_config_req = NULL; - } - - if (hi_dci0_req != NULL) { - if (hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list != NULL) { - free(hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list); - hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list = NULL; + if (!sent_any) { + send_standalone_dummy(); } - - free(hi_dci0_req); - hi_dci0_req = NULL; } - if (!sent_any) { - send_standalone_dummy(); - } -} - -// Free UL_INFO messages -free(UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list); -UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = NULL; -free(UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list); -UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = NULL; -free(UL_INFO->sr_ind.sr_indication_body.sr_pdu_list); -UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = NULL; -free(UL_INFO->harq_ind.harq_indication_body.harq_pdu_list); -UL_INFO->harq_ind.harq_indication_body.harq_pdu_list = NULL; -free(UL_INFO->crc_ind.crc_indication_body.crc_pdu_list); -UL_INFO->crc_ind.crc_indication_body.crc_pdu_list = NULL; -free(UL_INFO->rx_ind.rx_indication_body.rx_pdu_list); -UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = NULL; -free(UL_INFO); -UL_INFO = NULL; - -// thread finished -free(arg); -return NULL; + // Free UL_INFO messages + free(UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list); + UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = NULL; + free(UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list); + UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = NULL; + free(UL_INFO->sr_ind.sr_indication_body.sr_pdu_list); + UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = NULL; + free(UL_INFO->harq_ind.harq_indication_body.harq_pdu_list); + UL_INFO->harq_ind.harq_indication_body.harq_pdu_list = NULL; + free(UL_INFO->crc_ind.crc_indication_body.crc_pdu_list); + UL_INFO->crc_ind.crc_indication_body.crc_pdu_list = NULL; + free(UL_INFO->rx_ind.rx_indication_body.rx_pdu_list); + UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = NULL; + free(UL_INFO); + UL_INFO = NULL; + // thread finished + free(arg); + return NULL; } /*! From b738f8a6a98976c04c01b8f7a230193523a341fd Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Mon, 11 Apr 2022 17:27:11 +0200 Subject: [PATCH 051/114] tackle code review remarks --- executables/nr-softmodem-common.h | 1 - executables/nr-ue.c | 14 ++------------ executables/softmodem-common.h | 1 - targets/RT/USER/lte-ru.c | 5 ++--- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/executables/nr-softmodem-common.h b/executables/nr-softmodem-common.h index 47fd816db5..6e36dcf6c7 100644 --- a/executables/nr-softmodem-common.h +++ b/executables/nr-softmodem-common.h @@ -51,7 +51,6 @@ #define CONFIG_HLP_UEFO "set UE to enable estimation and compensation of frequency offset\n" #define CONFIG_HLP_DUMPFRAME "dump UE received frame to rxsig_frame0.dat and exit\n" #define CONFIG_HLP_DLSHIFT "dynamic shift for LLR compuation for TM3/4 (default 0)\n" -#define CONFIG_HLP_UELOOP "get softmodem (UE) to loop through memory instead of acquiring from HW\n" #define CONFIG_HLP_PHYTST "test UE phy layer, mac disabled\n" #define CONFIG_HLP_DORA "test gNB and UE with RA procedures\n" #define CONFIG_HLP_DMAMAP "sets flag for improved EXMIMO UE performance\n" diff --git a/executables/nr-ue.c b/executables/nr-ue.c index aef0370e53..02e92cbe0b 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -655,14 +655,6 @@ static void UE_synch(void *arg) { openair0_cfg[UE->rf_map.card].tx_freq[0]); UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0); - //UE->rfdevice.trx_set_gains_func(&openair0,&openair0_cfg[0]); - //UE->rfdevice.trx_stop_func(&UE->rfdevice); - // sleep(1); - /*if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) { - LOG_E(HW,"Could not start the device\n"); - oai_exit=1; - }*/ - if (UE->UE_scan_carrier == 1) { UE->UE_scan_carrier = 0; } else { @@ -815,9 +807,9 @@ void processSlotRX(void *arg) { void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockSize) { void *dummy_tx[UE->frame_parms.nb_antennas_tx]; - + int16_t dummy_tx_data[UE->frame_parms.nb_antennas_tx][2*writeBlockSize]; // 2 because the function we call use pairs of int16_t implicitly as complex numbers for (int i=0; iframe_parms.nb_antennas_tx; i++) - dummy_tx[i]=malloc16_clear(writeBlockSize*4); + dummy_tx[i]=dummy_tx_data[i]; AssertFatal( writeBlockSize == UE->rfdevice.trx_write_func(&UE->rfdevice, @@ -827,8 +819,6 @@ void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockS UE->frame_parms.nb_antennas_tx, 4),""); - for (int i=0; iframe_parms.nb_antennas_tx; i++) - free(dummy_tx[i]); } void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp, bool toTrash) { diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index 48ce73149f..eb0c1a54f7 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -53,7 +53,6 @@ extern "C" #define CONFIG_HLP_DUMPFRAME "dump UE received frame to rxsig_frame0.dat and exit\n" -#define CONFIG_HLP_UELOOP "get softmodem (UE) to loop through memory instead of acquiring from HW\n" #define CONFIG_HLP_PHYTST "test UE phy layer, mac disabled\n" #define CONFIG_HLP_DORA "test gNB and UE with RA procedures\n" #define CONFIG_HLP_SA "run gNB in standalone mode\n" diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index f6cf51f101..c1ffd7a292 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -835,8 +835,9 @@ void tx_rf(RU_t *ru, // in case of rfsim, we always enable tx because we need to feed rx of the opposite side // we write 1 single I/Q sample to trigger Rx (rfsim will fill gaps with 0 I/Q) void *dummy_tx[ru->frame_parms->nb_antennas_tx]; + int16_t dummy_tx_data[ru->frame_parms->nb_antennas_tx][2]; // 2 because the function we call use pairs of int16_t implicitly as complex numbers for (int i=0; iframe_parms->nb_antennas_tx; i++) - dummy_tx[i]=malloc16_clear(4); + dummy_tx[i]= dummy_tx_data[i]; AssertFatal( 1 == ru->rfdevice.trx_write_func(&ru->rfdevice, @@ -846,8 +847,6 @@ void tx_rf(RU_t *ru, ru->frame_parms->nb_antennas_tx, 4),""); - for (int i=0; iframe_parms->nb_antennas_tx; i++) - free(dummy_tx[i]); } } From 4ad71064b8a51176ec4c9536c2173ffda71df708 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Mon, 11 Apr 2022 19:29:45 +0200 Subject: [PATCH 052/114] review comments --- openair1/PHY/CODING/nr_rate_matching.c | 8 +-- .../PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 2 +- openair2/LAYER2/NR_MAC_COMMON/nr_mac.h | 7 +- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 13 ++-- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 2 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 66 ++++--------------- targets/ARCH/rfsimulator/apply_channelmod.c | 3 +- targets/ARCH/rfsimulator/rfsimulator.h | 2 +- 8 files changed, 31 insertions(+), 72 deletions(-) diff --git a/openair1/PHY/CODING/nr_rate_matching.c b/openair1/PHY/CODING/nr_rate_matching.c index fbad79cad7..8c105c37e6 100644 --- a/openair1/PHY/CODING/nr_rate_matching.c +++ b/openair1/PHY/CODING/nr_rate_matching.c @@ -313,14 +313,12 @@ void nr_deinterleaving_ldpc(uint32_t E, uint8_t Qm, int16_t *e,int16_t *f) switch(Qm) { case 2: { - AssertFatal(E%4==0,""); + AssertFatal(E%2==0,""); int16_t *e1=e+(E/2); - int16_t *end=f+E-3; + int16_t *end=f+E-1; while( fF && pdu_len < sizeof(NR_MAC_SUBHEADER_LONG)) + return false; if (s->F) { *mac_subheader_len = sizeof(*l); *mac_ce_len = ntohs(l->L); @@ -128,6 +132,7 @@ static inline void getMacLen(uint8_t* pdu, uint16_t *mac_ce_len, uint16_t *mac_s *mac_subheader_len = sizeof(*s); *mac_ce_len = s->L; } + return true; } // BSR MAC CEs diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 47a6682f63..ab63303629 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -3364,13 +3364,14 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, uint8_t rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID; LOG_D(MAC, "[UE] LCID %d, PDU length %d\n", rx_lcid, pdu_len); + bool ret; switch(rx_lcid){ // MAC CE case DL_SCH_LCID_CCCH: // MSG4 RRC Setup 38.331 // variable length - getMacLen(pduP, &mac_len, &mac_subheader_len); - AssertFatal(pdu_len > mac_len, "The mac_len (%d) has an invalid size. PDU len = %d! \n", + ret=get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len); + AssertFatal(ret, "The mac_len (%d) has an invalid size. PDU len = %d! \n", mac_len, pdu_len); // Check if it is a valid CCCH message, we get all 00's messages very often @@ -3404,7 +3405,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, // 38.321 Ch6.1.3.14 // varialbe length - getMacLen(pduP, &mac_len, &mac_subheader_len); + get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len); break; case DL_SCH_LCID_RECOMMENDED_BITRATE: @@ -3508,10 +3509,8 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, // check if LCID is valid at current time. default: { - // check if LCID is valid at current time. - if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT)) - return; - getMacLen(pduP, &mac_len, &mac_subheader_len); + if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len)) + return; LOG_D(NR_MAC, "[UE %d] %4d.%2d : DLSCH -> DL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, slot, rx_lcid, gNB_index, mac_len); #if defined(ENABLE_MAC_PAYLOAD_DEBUG) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 422e40af7e..7e3f6c857a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -1426,7 +1426,7 @@ void nr_schedule_ue_spec(module_id_t module_id, /* limit requested number of bytes to what preprocessor specified, or * such that TBS is full */ const rlc_buffer_occupancy_t ndata = min(sched_ctrl->rlc_status[lcid].bytes_in_buffer, - bufEnd-buf-+sizeof(NR_MAC_SUBHEADER_LONG)); + bufEnd-buf-sizeof(NR_MAC_SUBHEADER_LONG)); tbs_size_t len = mac_rlc_data_req(module_id, rnti, module_id, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 67ab8aacc5..1955d91af6 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -213,6 +213,7 @@ int nr_process_mac_pdu(module_id_t module_idP, int pdu_len) { + uint8_t done = 0; NR_UE_info_t *UE_info = &RC.nrmac[module_idP]->UE_info; @@ -279,16 +280,8 @@ int nr_process_mac_pdu(module_id_t module_idP, to be a partial PDU at the end of this buffer, so here we gracefully ignore that by returning 0. See: https://gitlab.eurecom.fr/oai/openairinterface5g/-/issues/534 */ - if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT)) - return 0; - mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ - if (pdu_len < sizeof(NR_MAC_SUBHEADER_LONG)) - return 0; - mac_ce_len= ntohs((NR_MAC_SUBHEADER_LONG *)pduP)->L); - mac_subheader_len = 3; - } + if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len)) + return 0; /* Extract long BSR value */ ce_ptr = &pduP[mac_subheader_len]; NR_BSR_LONG *bsr_l = (NR_BSR_LONG *) ce_ptr; @@ -362,32 +355,16 @@ int nr_process_mac_pdu(module_id_t module_idP, case UL_SCH_LCID_MULTI_ENTRY_PHR_1_OCT: //38.321 section 6.1.3.9 // varialbe length - if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT)) - return 0; - mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ - if (pdu_len < sizeof(NR_MAC_SUBHEADER_LONG)) - return 0; - mac_ce_len = ntohs((NR_MAC_SUBHEADER_LONG *)pduP)->L); - mac_subheader_len = 3; - } + if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len)) + return 0; /* Extract MULTI ENTRY PHR elements from single octet bitmap for PHR calculation */ break; case UL_SCH_LCID_MULTI_ENTRY_PHR_4_OCT: //38.321 section 6.1.3.9 // varialbe length - if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT)) - return 0; - mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ - if (pdu_len < sizeof(NR_MAC_SUBHEADER_LONG)) - return 0; - mac_ce_len = ntohs((NR_MAC_SUBHEADER_LONG *)pduP)->L); - mac_subheader_len = 3; - } + if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len)) + return 0; /* Extract MULTI ENTRY PHR elements from four octets bitmap for PHR calculation */ break; @@ -398,18 +375,8 @@ int nr_process_mac_pdu(module_id_t module_idP, case UL_SCH_LCID_SRB1: case UL_SCH_LCID_SRB2: - if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT)) - return 0; - if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ - //mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8; - if (pdu_len < sizeof(NR_MAC_SUBHEADER_LONG)) - return 0; - mac_subheader_len = 3; - mac_sdu_len = ntohs(NR_MAC_SUBHEADER_LONG *) pduP)->L); - } else { - mac_sdu_len = (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - } + if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len)) + return 0; rnti_t crnti = UE_info->rnti[UE_id]; int UE_idx = UE_id; @@ -486,19 +453,8 @@ int nr_process_mac_pdu(module_id_t module_idP, case UL_SCH_LCID_DTCH: // check if LCID is valid at current time. - if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT)) - return 0; - if (((NR_MAC_SUBHEADER_SHORT *)pduP)->F) { - // mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8; - if (pdu_len < sizeof(NR_MAC_SUBHEADER_LONG)) - return 0; - mac_subheader_len = 3; - mac_sdu_len = ntohs((NR_MAC_SUBHEADER_LONG *)pduP)->L); - - } else { - mac_sdu_len = (NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - } + if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len)) + return 0; LOG_D(NR_MAC, "In %s: [UE %d] %d.%d : ULSCH -> UL-%s %d (gNB %d, %d bytes)\n", __func__, diff --git a/targets/ARCH/rfsimulator/apply_channelmod.c b/targets/ARCH/rfsimulator/apply_channelmod.c index 6e26120e29..4ff5321e4d 100644 --- a/targets/ARCH/rfsimulator/apply_channelmod.c +++ b/targets/ARCH/rfsimulator/apply_channelmod.c @@ -52,7 +52,8 @@ either we regenerate the channel (call again random_channel(desc,0)), or we keep it over subframes legacy: we regenerate each sub frame in UL, and each frame only in DL */ -void rxAddInput( c16_t *input_sig, c16_t *after_channel_sig, +void rxAddInput( const c16_t *input_sig, + c16_t *after_channel_sig, int rxAnt, channel_desc_t *channelDesc, int nbSamples, diff --git a/targets/ARCH/rfsimulator/rfsimulator.h b/targets/ARCH/rfsimulator/rfsimulator.h index 33583f2d32..e69d41fa6c 100644 --- a/targets/ARCH/rfsimulator/rfsimulator.h +++ b/targets/ARCH/rfsimulator/rfsimulator.h @@ -25,7 +25,7 @@ #define __RFSIMULATOR_H double gaussZiggurat(double mean, double variance); void tableNor(unsigned long seed); -void rxAddInput( c16_t *input_sig, +void rxAddInput( const c16_t *input_sig, c16_t *after_channel_sig, int rxAnt, channel_desc_t *channelDesc, From d642c74b66325b8d655c40044cbe081b4da7179a Mon Sep 17 00:00:00 2001 From: francescomani Date: Tue, 12 Apr 2022 11:26:20 +0200 Subject: [PATCH 053/114] reintroducing RA logs to avoid CI test failure --- .../gnb.band78.sa.fr1.106PRB.ddsuu.2x2.usrpn310.conf | 1 - openair1/SCHED_NR/nr_prach_procedures.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 10 +++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.ddsuu.2x2.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.ddsuu.2x2.usrpn310.conf index 6fd04bf569..7b0e3eea22 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.ddsuu.2x2.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.ddsuu.2x2.usrpn310.conf @@ -38,7 +38,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; pusch_AntennaPorts = 2; ul_prbblacklist = "51,52,53,54" do_SRS = 1; diff --git a/openair1/SCHED_NR/nr_prach_procedures.c b/openair1/SCHED_NR/nr_prach_procedures.c index 7b5b6d22ff..b0f59d5f47 100644 --- a/openair1/SCHED_NR/nr_prach_procedures.c +++ b/openair1/SCHED_NR/nr_prach_procedures.c @@ -173,7 +173,7 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) { if ((gNB->prach_energy_counter == 100) && (max_preamble_energy[0] > gNB->measurements.prach_I0+gNB->prach_thres)) { - LOG_D(NR_PHY,"[gNB %d][RAPROC] Frame %d, slot %d Initiating RA procedure with preamble %d, energy %d.%d dB (I0 %d, thres %d), delay %d start symbol %u freq index %u\n", + LOG_I(NR_PHY,"[gNB %d][RAPROC] Frame %d, slot %d Initiating RA procedure with preamble %d, energy %d.%d dB (I0 %d, thres %d), delay %d start symbol %u freq index %u\n", gNB->Mod_id, frame, slot, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index f297af27bb..7c8c8d12d7 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -678,7 +678,7 @@ void nr_initiate_ra_proc(module_id_t module_idP, ra->preamble_index = preamble_index; ra->beam_id = beam_index; - LOG_D(NR_MAC, + LOG_I(NR_MAC, "[gNB %d][RAPROC] CC_id %d Frame %d Activating Msg2 generation in frame %d, slot %d using RA rnti %x SSB " "index %u RA index %d\n", module_idP, @@ -795,7 +795,7 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t return; } - LOG_D(NR_MAC, "[gNB %d][RAPROC] Frame %d, Slot %d : CC_id %d Scheduling retransmission of Msg3 in (%d,%d)\n", + LOG_I(NR_MAC, "[gNB %d][RAPROC] Frame %d, Slot %d : CC_id %d Scheduling retransmission of Msg3 in (%d,%d)\n", module_idP, frame, slot, CC_id, sched_frame, sched_slot); nfapi_nr_ul_tti_request_t *future_ul_tti_req = &RC.nrmac[module_idP]->UL_tti_req_ahead[CC_id][sched_slot]; @@ -1920,7 +1920,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra if(ra->msg3_dcch_dtch) { // If the UE used MSG3 to transfer a DCCH or DTCH message, then contention resolution is successful upon transmission of PDCCH - LOG_D(NR_MAC, "(ue %i, rnti 0x%04x) CBRA procedure succeeded!\n", UE_id, ra->rnti); + LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) CBRA procedure succeeded!\n", UE_id, ra->rnti); nr_clear_ra_proc(module_idP, CC_id, frameP, ra); UE_info->active[UE_id] = true; UE_info->Msg4_ACKed[UE_id] = true; @@ -1953,12 +1953,12 @@ void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_fram if (harq->is_waiting == 0) { if (harq->round == 0) { if (stats->dlsch_errors == 0) { - LOG_D(NR_MAC, "(ue %i, rnti 0x%04x) Received Ack of RA-Msg4. CBRA procedure succeeded!\n", UE_id, ra->rnti); + LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) Received Ack of RA-Msg4. CBRA procedure succeeded!\n", UE_id, ra->rnti); UE_info->active[UE_id] = true; UE_info->Msg4_ACKed[UE_id] = true; } else { - LOG_D(NR_MAC, "(ue %i, rnti 0x%04x) RA Procedure failed at Msg4!\n", UE_id, ra->rnti); + LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) RA Procedure failed at Msg4!\n", UE_id, ra->rnti); } nr_clear_ra_proc(module_id, CC_id, frame, ra); From 2373b0215011357aa853bb9d53804a536977d226 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Tue, 12 Apr 2022 20:52:40 +0200 Subject: [PATCH 054/114] review remarks --- executables/nr-ue.c | 1 + targets/RT/USER/lte-ru.c | 1 + 2 files changed, 2 insertions(+) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 02e92cbe0b..aff56f583a 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -808,6 +808,7 @@ void processSlotRX(void *arg) { void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockSize) { void *dummy_tx[UE->frame_parms.nb_antennas_tx]; int16_t dummy_tx_data[UE->frame_parms.nb_antennas_tx][2*writeBlockSize]; // 2 because the function we call use pairs of int16_t implicitly as complex numbers + memset(dummy_tx_data, 0, sizeof(dummy_tx_data)); for (int i=0; iframe_parms.nb_antennas_tx; i++) dummy_tx[i]=dummy_tx_data[i]; diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index c1ffd7a292..cee15ef48b 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -836,6 +836,7 @@ void tx_rf(RU_t *ru, // we write 1 single I/Q sample to trigger Rx (rfsim will fill gaps with 0 I/Q) void *dummy_tx[ru->frame_parms->nb_antennas_tx]; int16_t dummy_tx_data[ru->frame_parms->nb_antennas_tx][2]; // 2 because the function we call use pairs of int16_t implicitly as complex numbers + memset(dummy_tx_data,0,sizeof(dummy_tx_data)); for (int i=0; iframe_parms->nb_antennas_tx; i++) dummy_tx[i]= dummy_tx_data[i]; From 31319e80635065fe789560b88cee54a269a98f2f Mon Sep 17 00:00:00 2001 From: rmagueta Date: Wed, 13 Apr 2022 16:54:09 +0100 Subject: [PATCH 055/114] Fix pdcch_est_size --- openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c index a1e2b1ee7c..3e710c7c33 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c @@ -539,8 +539,8 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, int coreset_start_rb=0; // Hold the channel estimates in frequency domain. - int32_t pdcch_est_size = fp->symbols_per_slot*(fp->ofdm_symbol_size+LTE_CE_FILTER_LENGTH); - int32_t pdcch_dl_ch_estimates[4*fp->nb_antennas_rx][pdcch_est_size]; + int32_t pdcch_est_size = ((((fp->symbols_per_slot*(fp->ofdm_symbol_size+LTE_CE_FILTER_LENGTH))+15)/16)*16); + __attribute__ ((aligned(16))) int32_t pdcch_dl_ch_estimates[4*fp->nb_antennas_rx][pdcch_est_size]; for(int n_ss = 0; n_ss Date: Thu, 14 Apr 2022 17:43:02 +0200 Subject: [PATCH 056/114] fixes for SR in pucch0 --- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 20 ++++++++++++++------ openair1/PHY/defs_gNB.h | 2 -- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index 50c3b62f50..d1f7ff7c6c 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -298,7 +298,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, xr[aa][l][n2+1]+=(int16_t)(((int32_t)x_re[l][n]*r[n2+1]-(int32_t)x_im[l][n]*r[n2])>>15); #ifdef DEBUG_NR_PUCCH_RX printf("x (%d,%d), r%d.%d (%d,%d), xr (%d,%d)\n", - x_re[l][n],x_im[l][n],l2,re_offset[l],r[n2],r[n2+1],xr[aa][l][n2],xr[aa][l][n2+1]); + x_re[l][n],x_im[l][n],l2,re_offset[l],r[n2],r[n2+1],xr[aa][l][n2],xr[aa][l][n2+1]); #endif } } @@ -390,7 +390,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, index=maxpos; uci_stats->pucch0_n00 = gNB->measurements.n0_subband_power_tot_dB[prb_offset[0]]; uci_stats->pucch0_n01 = gNB->measurements.n0_subband_power_tot_dB[prb_offset[1]]; - LOG_D(PHY,"n00[%d] = %d, n01[%d] = %d\n",prb_offset[0],uci_stats->pucch0_n00,prb_offset[1],uci_stats->pucch0_n01); + LOG_I(PHY,"n00[%d] = %d, n01[%d] = %d\n",prb_offset[0],uci_stats->pucch0_n00,prb_offset[1],uci_stats->pucch0_n01); // estimate CQI for MAC (from antenna port 0 only) int max_n0 = uci_stats->pucch0_n00>uci_stats->pucch0_n01 ? uci_stats->pucch0_n00:uci_stats->pucch0_n01; int SNRtimes10,sigenergy=0; @@ -422,11 +422,12 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, if (pucch_pdu->bit_len_harq==0) { uci_pdu->harq = NULL; uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); - uci_pdu->sr->sr_confidence_level = no_conf ? 1 : 0; + uci_pdu->sr->sr_confidence_level = (SNRtimes10 > uci_stats->pucch0_thres) ? 1 : 0; uci_stats->pucch0_sr_trials++; - if (xrtmag_dBtimes10>(10*gNB->measurements.n0_power_tot_dB)) { + if (xrtmag_dBtimes10>10*max_n0) { uci_pdu->sr->sr_indication = 1; uci_stats->pucch0_positive_SR++; + LOG_D(PHY,"PUCCH0 got positive SR. Cumulative number of positive SR %d\n", uci_stats->pucch0_positive_SR); } else { uci_pdu->sr->sr_indication = 0; } @@ -445,7 +446,10 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); uci_pdu->sr->sr_indication = (index>1) ? 1 : 0; uci_pdu->sr->sr_confidence_level = no_conf ? 1 : 0; - uci_stats->pucch0_positive_SR++; + if(uci_pdu->sr->sr_indication == 1 && uci_pdu->sr->sr_confidence_level == 0) { + uci_stats->pucch0_positive_SR++; + LOG_D(PHY,"PUCCH0 got positive SR. Cumulative number of positive SR %d\n", uci_stats->pucch0_positive_SR); + } } uci_stats->pucch01_trials++; } @@ -463,6 +467,10 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); uci_pdu->sr->sr_indication = (index>3) ? 1 : 0; uci_pdu->sr->sr_confidence_level = (no_conf) ? 1 : 0; + if(uci_pdu->sr->sr_indication == 1 && uci_pdu->sr->sr_confidence_level == 0) { + uci_stats->pucch0_positive_SR++; + LOG_D(PHY,"PUCCH0 got positive SR. Cumulative number of positive SR %d\n", uci_stats->pucch0_positive_SR); + } } } } @@ -1671,7 +1679,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, LOG_D(PHY,"metric %d dB\n",corr_dB); } - // estimate CQI for MAC (from antenna port 0 only) + // estimate CQI for MAC (from antenna port 0 only) int SNRtimes10 = dB_fixed_times10(signal_energy_nodc(&rxdataF[0][soffset+(l2*frame_parms->ofdm_symbol_size)+re_offset[0]], 12*pucch_pdu->prb_size)) - (10*gNB->measurements.n0_power_tot_dB); diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 7b655c023a..f382de73aa 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -661,8 +661,6 @@ typedef struct { unsigned int n0_power_tot; //! estimated avg noise power (dB) unsigned int n0_power_tot_dB; - //! estimated avg noise power (dB) - int n0_power_tot_dBm; //! estimated avg noise power per RB per RX ant (lin) unsigned int n0_subband_power[MAX_NUM_RU_PER_gNB][275]; //! estimated avg noise power per RB per RX ant (dB) From ca51ba7d3f860df32b256df2a4b5c2b55d14b929 Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 14 Apr 2022 19:30:22 +0200 Subject: [PATCH 057/114] ignoring PUCCH2 TPC for now --- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 3 ++- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index d1f7ff7c6c..bcf743b560 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -390,7 +390,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, index=maxpos; uci_stats->pucch0_n00 = gNB->measurements.n0_subband_power_tot_dB[prb_offset[0]]; uci_stats->pucch0_n01 = gNB->measurements.n0_subband_power_tot_dB[prb_offset[1]]; - LOG_I(PHY,"n00[%d] = %d, n01[%d] = %d\n",prb_offset[0],uci_stats->pucch0_n00,prb_offset[1],uci_stats->pucch0_n01); + LOG_D(PHY,"n00[%d] = %d, n01[%d] = %d\n",prb_offset[0],uci_stats->pucch0_n00,prb_offset[1],uci_stats->pucch0_n01); // estimate CQI for MAC (from antenna port 0 only) int max_n0 = uci_stats->pucch0_n00>uci_stats->pucch0_n01 ? uci_stats->pucch0_n00:uci_stats->pucch0_n01; int SNRtimes10,sigenergy=0; @@ -1680,6 +1680,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, } // estimate CQI for MAC (from antenna port 0 only) + // TODO this computation is wrong -> to be ignored at MAC for now int SNRtimes10 = dB_fixed_times10(signal_energy_nodc(&rxdataF[0][soffset+(l2*frame_parms->ofdm_symbol_size)+re_offset[0]], 12*pucch_pdu->prb_size)) - (10*gNB->measurements.n0_power_tot_dB); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index e21d1e50f7..3eda061959 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -1493,10 +1493,11 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; // tpc (power control) - sched_ctrl->tpc1 = nr_get_tpc(RC.nrmac[mod_id]->pucch_target_snrx10, - uci_234->ul_cqi, - 30); - sched_ctrl->pucch_snrx10 = uci_234->ul_cqi * 5 - 640; + // TODO PUCCH2 SNR computation is not correct -> ignore the following + //sched_ctrl->tpc1 = nr_get_tpc(RC.nrmac[mod_id]->pucch_target_snrx10, + // uci_234->ul_cqi, + // 30); + //sched_ctrl->pucch_snrx10 = uci_234->ul_cqi * 5 - 640; if ((uci_234->pduBitmap >> 1) & 0x01) { // iterate over received harq bits From 8b0be9cf87708f9f5976ff239daa8d719d17dae4 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Thu, 20 Jan 2022 15:45:43 +0100 Subject: [PATCH 058/114] nr rlc: speedup ack/nack reception The code completely changed, expect problems. --- openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c | 850 +++++++++++---------- openair2/LAYER2/nr_rlc/nr_rlc_entity_am.h | 3 - openair2/LAYER2/nr_rlc/nr_rlc_sdu.c | 11 +- openair2/LAYER2/nr_rlc/nr_rlc_sdu.h | 7 +- openair2/LAYER2/nr_rlc/tests/test14.txt.gz | Bin 792 -> 799 bytes openair2/LAYER2/nr_rlc/tests/test15.txt.gz | Bin 546 -> 554 bytes 6 files changed, 441 insertions(+), 430 deletions(-) diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c index af8cb5715a..e86e7c7d05 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c @@ -103,36 +103,6 @@ static int segment_already_received(nr_rlc_entity_am_t *entity, return size <= 0; } -static void consider_retransmission(nr_rlc_entity_am_t *entity, - nr_rlc_sdu_segment_t *cur, int update_retx) -{ - if (update_retx) - cur->sdu->retx_count++; - - /* let's report max RETX reached for all retx_count >= max_retx_threshold - * (specs say to report if retx_count == max_retx_threshold). - * Upper layers should react (radio link failure), so no big deal actually. - */ - if (update_retx && cur->sdu->retx_count >= entity->max_retx_threshold) { - entity->common.max_retx_reached(entity->common.max_retx_reached_data, - (nr_rlc_entity_t *)entity); - } - - /* let's put in retransmit list even if we are over max_retx_threshold. - * upper layers should deal with this condition, internally it's better - * for the RLC code to keep going with this segment (we only remove - * a segment that was ACKed) - */ - LOG_D(RLC, "RLC segment to be added at the ReTx list \n"); - nr_rlc_sdu_segment_list_append(&entity->retransmit_list, - &entity->retransmit_end, - cur); - - /* update buffer status */ - entity->common.bstatus.retx_size += compute_pdu_header_size(entity, cur) - + cur->size; -} - /* checks that all the bytes of the SDU sn have been received (but SDU * has not been already processed) */ @@ -315,81 +285,6 @@ static void reception_actions(nr_rlc_entity_am_t *entity, nr_rlc_pdu_t *pdu) } } -static void process_received_ack(nr_rlc_entity_am_t *entity, int ack_sn) -{ - nr_rlc_sdu_segment_t head; - nr_rlc_sdu_segment_t *cur; - nr_rlc_sdu_segment_t *prev; - unsigned char sn_set[32768]; /* used to dec retx_count only once per sdu */ - - memset(sn_set, 0, 32768); - -#define IS_SN_SET(b) (sn_set[(b)/8] & (1 << ((b) % 8))) -#define SET_SN(b) do { sn_set[(b)/8] |= (1 << ((b) % 8)); } while (0) - - /* put SDUs from wait and retransmit lists with SN < 'ack_sn' to ack_list */ - - /* process wait list */ - head.next = entity->wait_list; - prev = &head; - cur = entity->wait_list; - while (cur != NULL) { - if (sn_compare_tx(entity, cur->sdu->sn, ack_sn) < 0) { - /* remove from wait list */ - prev->next = cur->next; - /* put the PDU in the ack list */ - entity->ack_list = nr_rlc_sdu_segment_list_add(sn_compare_tx, entity, - entity->ack_list, cur); - entity->wait_end = prev; - cur = prev->next; - } else { - entity->wait_end = cur; - prev = cur; - cur = cur->next; - } - } - entity->wait_list = head.next; - if (entity->wait_list == NULL) - entity->wait_end = NULL; - - /* process retransmit list */ - head.next = entity->retransmit_list; - prev = &head; - cur = entity->retransmit_list; - while (cur != NULL) { - if (sn_compare_tx(entity, cur->sdu->sn, ack_sn) < 0) { - /* dec. retx_count in case we put this segment back in retransmit list - * in 'process_received_nack' - * do it only once per SDU - */ - if (!IS_SN_SET(cur->sdu->sn)) { - cur->sdu->retx_count--; - SET_SN(cur->sdu->sn); - } - /* remove from retransmit list */ - prev->next = cur->next; - /* update buffer status */ - entity->common.bstatus.retx_size -= compute_pdu_header_size(entity, cur) - + cur->size; - /* put the PDU in the ack list */ - entity->ack_list = nr_rlc_sdu_segment_list_add(sn_compare_tx, entity, - entity->ack_list, cur); - entity->retransmit_end = prev; - cur = prev->next; - } else { - entity->retransmit_end = cur; - prev = cur; - cur = cur->next; - } - } - entity->retransmit_list = head.next; - if (entity->retransmit_list == NULL) - entity->retransmit_end = NULL; - -#undef IS_BIT_SET -#undef SET_BIT -} - static int so_overlap(int s1, int e1, int s2, int e2) { if (s1 < s2) { @@ -402,136 +297,375 @@ static int so_overlap(int s1, int e1, int s2, int e2) return 0; } -static void process_nack_sn(nr_rlc_entity_am_t *entity, int nack_sn, - int so_start, int so_end, unsigned char *sn_set) -{ - /* put all SDU segments with SN == 'sn' and with an overlapping so start/end - * to the retransmit list - * source lists are ack list and wait list. - * Not sure if we should consider wait list, isn't the other end supposed - * to only NACK SNs lower than the ACK SN sent in the status PDU, in which - * case all potential SDU segments should all be in ack list when calling - * the current function? in doubt let's accept anything and thus process - * also wait list. - */ - nr_rlc_sdu_segment_t head; - nr_rlc_sdu_segment_t *cur; - nr_rlc_sdu_segment_t *prev; - -#define IS_SN_SET(b) (sn_set[(b)/8] & (1 << ((b) % 8))) -#define SET_SN(b) do { sn_set[(b)/8] |= (1 << ((b) % 8)); } while (0) - - /* check that tx_next_ack <= sn < tx_next */ - if (!(sn_compare_tx(entity, entity->tx_next_ack, nack_sn) <= 0 && - sn_compare_tx(entity, nack_sn, entity->tx_next) < 0)) - return; - - /* process wait list */ - head.next = entity->wait_list; - prev = &head; - cur = entity->wait_list; - while (cur != NULL) { - if (cur->sdu->sn == nack_sn && - so_overlap(so_start, so_end, cur->so, cur->so + cur->size - 1)) { - /* remove from wait list */ - prev->next = cur->next; - cur->next = NULL; - /* consider the SDU segment for retransmission */ - consider_retransmission(entity, cur, !IS_SN_SET(cur->sdu->sn)); - SET_SN(cur->sdu->sn); - entity->wait_end = prev; - cur = prev->next; - } else { - entity->wait_end = cur; - prev = cur; - cur = cur->next; - } - } - entity->wait_list = head.next; - if (entity->wait_list == NULL) - entity->wait_end = NULL; - - /* process ack list */ - head.next = entity->ack_list; - prev = &head; - cur = entity->ack_list; - while (cur != NULL) { - if (cur->sdu->sn == nack_sn && - so_overlap(so_start, so_end, cur->so, cur->so + cur->size - 1)) { - /* remove from ack list */ - prev->next = cur->next; - cur->next = NULL; - /* consider the SDU segment for retransmission */ - consider_retransmission(entity, cur, !IS_SN_SET(cur->sdu->sn)); - SET_SN(cur->sdu->sn); - cur = prev->next; - } else { - prev = cur; - cur = cur->next; - } - } - entity->ack_list = head.next; - -#undef IS_BIT_SET -#undef SET_BIT -} - -static void process_received_nack(nr_rlc_entity_am_t *entity, int nack_sn, - int so_start, int so_end, int range, - unsigned char *sn_set) +static void process_control_pdu(nr_rlc_entity_am_t *entity, + char *buffer, int size) { +#define R(d) do { if (nr_rlc_pdu_decoder_in_error(&d)) goto err; } while (0) + nr_rlc_pdu_decoder_t decoder; int i; + int cpt; + int ack_sn; + int nack_sn; + int e1; + int e2; + int e3; + int so_start; + int so_end; + int range; + int prev_nack_sn = -1; + int prev_so_start; + int prev_so_end; + int tx_next_ack; + nr_rlc_sdu_segment_t *cur_wait_list; + nr_rlc_sdu_segment_t *prev_wait_list; + nr_rlc_sdu_segment_t *end_wait_list = NULL; + nr_rlc_sdu_segment_t head_wait_list; + nr_rlc_sdu_segment_t *cur_retransmit_list; + nr_rlc_sdu_segment_t *new_retransmit_list; + nr_rlc_sdu_segment_t head_retransmit_list; - for (i = 0; i < range; i++) - process_nack_sn(entity, (nack_sn + i) % entity->sn_modulus, - i == 0 ? so_start : 0, - i == range - 1 ? so_end : -1, - sn_set); -} + head_wait_list.next = entity->wait_list; + cur_wait_list = entity->wait_list; + prev_wait_list = &head_wait_list; -static int sdu_segment_in_ack_list_full(nr_rlc_sdu_segment_t *sdu) -{ - int target_count = sdu->sdu->ref_count; - int actual_count = 0; - int sn = sdu->sdu->sn; + head_retransmit_list.next = NULL; + cur_retransmit_list = entity->retransmit_list; + new_retransmit_list = &head_retransmit_list; - while (sdu != NULL && sdu->sdu->sn == sn) { - actual_count++; - sdu = sdu->next; + nr_rlc_pdu_decoder_init(&decoder, buffer, size); + nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); /* dc */ + + cpt = nr_rlc_pdu_decoder_get_bits(&decoder, 3); R(decoder); + if (cpt != 0) { + LOG_E(RLC, "%s:%d:%s: warning: discard PDU, CPT not 0 (%d)\n", + __FILE__, __LINE__, __FUNCTION__, cpt); + goto err; + } + ack_sn = nr_rlc_pdu_decoder_get_bits(&decoder, entity->sn_field_length); R(decoder); + e1 = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); + /* r bits */ + if (entity->sn_field_length == 18) { + nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); + } else { + nr_rlc_pdu_decoder_get_bits(&decoder, 7); R(decoder); } - return actual_count == target_count; -} - -static void finalize_ack_nack_processing(nr_rlc_entity_am_t *entity) -{ - nr_rlc_sdu_segment_t *cur = entity->ack_list; - int sn; - - /* - send indication of successful delivery for all consecutive acked SDUs - * starting from tx_next_ack. Also free them. - * - update tx_next_ack to the next SN not acked yet + /* 38.322 5.3.3.3 says to stop t_poll_retransmit if a ACK or NACK is + * received for the SN 'poll_sn' - check ACK case (NACK done below) */ - /* todo: send indication of successful delivery as soon as possible as - * the specs say (38.322 5.2.3.1.1). As the code is, if we receive - * ack for SN+2 we won't indicate successful delivery before - * SN+1 has been indicated. + if (sn_compare_tx(entity, entity->poll_sn, ack_sn) < 0) + entity->t_poll_retransmit_start = 0; + + while (e1) { + nack_sn = nr_rlc_pdu_decoder_get_bits(&decoder, entity->sn_field_length); R(decoder); + e1 = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); + e2 = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); + e3 = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); + /* r bits */ + if (entity->sn_field_length == 18) { + nr_rlc_pdu_decoder_get_bits(&decoder, 3); R(decoder); + } else { + nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); + } + if (e2) { + so_start = nr_rlc_pdu_decoder_get_bits(&decoder, 16); R(decoder); + so_end = nr_rlc_pdu_decoder_get_bits(&decoder, 16); R(decoder); + } else { + so_start = 0; + so_end = 0xffff; + } + if (e3) { + range = nr_rlc_pdu_decoder_get_bits(&decoder, 8); R(decoder); + } else { + range = 1; + } + /* special value 0xffff indicates 'all bytes to the end' */ + if (so_end == 0xffff) + so_end = -1; + + /* process nacks */ + for (i = 0; i < range; i++) { + int cur_nack_sn = (nack_sn + i) % entity->sn_modulus; + int cur_so_start = i == 0 ? so_start : 0; + int cur_so_end = i == range - 1 ? so_end : -1; + + /* check that current nack is > previous nack and <= ack + * if not then skip it and all following nacks, and + * do not touch t_poll_retransmit + */ + if (prev_nack_sn != -1) { + int cmp = sn_compare_tx(entity, cur_nack_sn, prev_nack_sn); + if (cmp < 0 + || (cmp == 0 + && (prev_so_end == -1 + || cur_so_start <= prev_so_end))) { + LOG_E(RLC, "%s:%d:%s: bad NACK (nack sn %d so start/end %d/%d, previous nack sn %d so start/end %d/%d), skip it and all following NACKs\n", + __FILE__, __LINE__, __FUNCTION__, + cur_nack_sn, cur_so_start, cur_so_end, + prev_nack_sn, prev_so_start, prev_so_end); + goto nacks_done; + } + } + if (sn_compare_tx(entity, cur_nack_sn, ack_sn) > 0) { + LOG_E(RLC, "%s:%d:%s: bad NACK (nack %d ack %d), skip it and all following NACKs\n", + __FILE__, __LINE__, __FUNCTION__, + cur_nack_sn, ack_sn); + goto nacks_done; + } + +process_next_pdu: + /* process smallest SN either from wait_list or retransmit list */ + if (cur_wait_list == NULL && cur_retransmit_list == NULL) + goto lists_over; + if (cur_wait_list == NULL) + goto process_retransmit_list_head; + if (cur_retransmit_list == NULL) + goto process_wait_list_head; + if (cur_wait_list->sdu->sn < cur_retransmit_list->sdu->sn + || (cur_wait_list->sdu->sn == cur_retransmit_list->sdu->sn && + cur_wait_list->so < cur_retransmit_list->so)) + goto process_wait_list_head; + goto process_retransmit_list_head; + +process_wait_list_head: + /* if nack overlaps with current segment, put it in retransmit list */ + if (cur_wait_list->sdu->sn == cur_nack_sn + && so_overlap(cur_so_start, cur_so_end, + cur_wait_list->so, + cur_wait_list->so + cur_wait_list->size - 1)) { + prev_wait_list->next = cur_wait_list->next; + if (cur_wait_list == entity->wait_end) + end_wait_list = prev_wait_list; + cur_wait_list->next = NULL; + new_retransmit_list->next = cur_wait_list; + new_retransmit_list = cur_wait_list; + /* increase retx count. Don't care about segmentation, so maybe we + * increase too much. + */ + cur_wait_list->sdu->retx_count++; + /* report max RETX reached for all retx_count >= max_retx_threshold + * (specs say to report if retx_count == max_retx_threshold). + * Upper layers should react (radio link failure), so no big deal. + * We deal with segmentation by requiring + * retx_count >= max_retx_threshold * number of segments. + * We may report max RETX reached too late/early. To be refined if + * this is a problem. + */ + if (cur_wait_list->sdu->retx_count + >= entity->max_retx_threshold * cur_wait_list->sdu->ref_count) + entity->common.max_retx_reached(entity->common.max_retx_reached_data, + (nr_rlc_entity_t *)entity); + /* update buffer status */ + entity->common.bstatus.retx_size += compute_pdu_header_size(entity, cur_wait_list) + + cur_wait_list->size; + /* and go process the next pdu, still for the current nack */ + cur_wait_list = prev_wait_list->next; + goto process_next_pdu; + } + + /* if current segment SN > current NACK, we can't classify it yet */ + if (sn_compare_tx(entity, cur_wait_list->sdu->sn, cur_nack_sn) > 0 + || (cur_wait_list->sdu->sn == cur_nack_sn + && cur_wait_list->so > cur_so_start)) + goto done_nack; + + /* if current segment is acked, free it, indicate successful delivery + * if fully acked + */ + if (sn_compare_tx(entity, cur_wait_list->sdu->sn, ack_sn) < 0) { + nr_rlc_sdu_segment_t *cur = cur_wait_list; + int upper_layer_id = cur->sdu->upper_layer_id; + int sdu_size = cur->sdu->size; + cur_wait_list = cur_wait_list->next; + prev_wait_list->next = cur_wait_list; + if (cur_wait_list == entity->wait_end) + end_wait_list = prev_wait_list; + if (nr_rlc_free_sdu_segment(cur)) { + entity->tx_size -= sdu_size; + entity->common.sdu_successful_delivery( + entity->common.sdu_successful_delivery_data, + (nr_rlc_entity_t *)entity, upper_layer_id); + } + goto process_next_pdu; + } + + /* if current segment SN > ack_sn, we're done with this list */ + if (sn_compare_tx(entity, cur_wait_list->sdu->sn, ack_sn) > 0) { + cur_wait_list = NULL; + goto process_next_pdu; + } + + /* current segment SN == ack_sn, skip this segment and move to the next. + * Not sure if correct, can we get a nack_sn == ack_sn? 38.322 5.3.4 says + * "set the ACK_SN to the SN of the next not received RLC SDU which is + * not indicated as missing in the resulting STATUS PDU." Is it okay to + * receive some NACK for a given SN and an ACK == this SN? I can see a + * case where it's possible (only parts of an SN were received and the + * TB is too small to report the several NACKs for this SN, then we + * can't set ACK = SN+1 but in this case, shouldn't we skip sending + * NACKs for this SN and only send ACK = SN? our current implementation + * does send both NACKs and ACK, see function generate_status()). + */ + prev_wait_list = cur_wait_list; + cur_wait_list = cur_wait_list->next; + goto process_next_pdu; + +process_retransmit_list_head: + /* if nack overlaps with current segment, leave it in retransmit list */ + if (cur_retransmit_list->sdu->sn == cur_nack_sn + && so_overlap(cur_so_start, cur_so_end, + cur_retransmit_list->so, + cur_retransmit_list->so + cur_retransmit_list->size - 1)) { + new_retransmit_list->next = cur_retransmit_list; + cur_retransmit_list = cur_retransmit_list->next; + new_retransmit_list = new_retransmit_list->next; + new_retransmit_list->next = NULL; + /* go process the next pdu, still for the current nack */ + goto process_next_pdu; + } + + /* if current segment SN > current NACK, we can't classify it yet */ + if (sn_compare_tx(entity, cur_retransmit_list->sdu->sn, cur_nack_sn) > 0 + || (cur_retransmit_list->sdu->sn == cur_nack_sn + && cur_retransmit_list->so > cur_so_start)) + goto done_nack; + + /* if current segment is acked, free it, indicate successful delivery + * if fully acked + */ + if (sn_compare_tx(entity, cur_retransmit_list->sdu->sn, ack_sn) < 0) { + nr_rlc_sdu_segment_t *cur = cur_retransmit_list; + int upper_layer_id = cur->sdu->upper_layer_id; + int sdu_size = cur->sdu->size; + cur_retransmit_list = cur_retransmit_list->next; + /* update buffer status */ + entity->common.bstatus.retx_size -= compute_pdu_header_size(entity, cur) + + cur->size; + if (nr_rlc_free_sdu_segment(cur)) { + entity->tx_size -= sdu_size; + entity->common.sdu_successful_delivery( + entity->common.sdu_successful_delivery_data, + (nr_rlc_entity_t *)entity, upper_layer_id); + } + goto process_next_pdu; + } + + /* current segment SN >= ack_sn + * if the wait list is empty, then put the remaining retransmit list at + * the end of the new retransmit list (just a speedup) + * if not, put only this segment + */ + if (cur_wait_list == NULL) { + new_retransmit_list->next = cur_retransmit_list; + cur_retransmit_list = NULL; + goto lists_over; + } + new_retransmit_list->next = cur_retransmit_list; + cur_retransmit_list = cur_retransmit_list->next; + new_retransmit_list = new_retransmit_list->next; + new_retransmit_list->next = NULL; + goto process_next_pdu; + +done_nack: + prev_nack_sn = cur_nack_sn; + prev_so_start = cur_so_start; + prev_so_end = cur_so_end; + } /* for (i = 0; i < range; i++) */ + +lists_over: + /* 38.322 5.3.3.3 says to stop t_poll_retransmit if a ACK or NACK is + * received for the SN 'poll_sn' - check NACK case (ACK done above) + */ + if (sn_compare_tx(entity, nack_sn, entity->poll_sn) <= 0 && + sn_compare_tx(entity, entity->poll_sn, (nack_sn + range) % entity->sn_modulus) < 0) + entity->t_poll_retransmit_start = 0; + } /* while (e1) */ + +nacks_done: + /* nacks done, finish with ack */ + /* we may report successful delivery out of order, if it's a problem + * then we can have a single loop and deal with the smallest sn of + * the current head of wait list and the current head of retransmit list. + * (It's simpler to process those two lists the one after the other.) */ - while (cur != NULL && cur->sdu->sn == entity->tx_next_ack && - sdu_segment_in_ack_list_full(cur)) { - entity->tx_size -= cur->sdu->size; - sn = cur->sdu->sn; - entity->common.sdu_successful_delivery( - entity->common.sdu_successful_delivery_data, - (nr_rlc_entity_t *)entity, cur->sdu->upper_layer_id); - while (cur != NULL && cur->sdu->sn == sn) { - nr_rlc_sdu_segment_t *s = cur; - cur = cur->next; - nr_rlc_free_sdu_segment(s); + /* deal with wait list */ + while (cur_wait_list != NULL + && sn_compare_tx(entity, cur_wait_list->sdu->sn, ack_sn) < 0) { + /* current segment is acked, free it, indicate successful delivery + * if fully acked + */ + nr_rlc_sdu_segment_t *cur = cur_wait_list; + int upper_layer_id = cur->sdu->upper_layer_id; + int sdu_size = cur->sdu->size; + prev_wait_list->next = cur_wait_list->next; + if (cur_wait_list == entity->wait_end) + end_wait_list = prev_wait_list; + cur_wait_list = cur_wait_list->next; + if (nr_rlc_free_sdu_segment(cur)) { + entity->tx_size -= sdu_size; + entity->common.sdu_successful_delivery( + entity->common.sdu_successful_delivery_data, + (nr_rlc_entity_t *)entity, upper_layer_id); } - entity->ack_list = cur; - entity->tx_next_ack = (entity->tx_next_ack + 1) % entity->sn_modulus; } + /* deal with retransmit list */ + while (cur_retransmit_list != NULL + && sn_compare_tx(entity, cur_retransmit_list->sdu->sn, ack_sn) < 0) { + /* current segment is acked, free it, indicate successful delivery + * if fully acked + */ + nr_rlc_sdu_segment_t *cur = cur_retransmit_list; + int upper_layer_id = cur->sdu->upper_layer_id; + int sdu_size = cur->sdu->size; + cur_retransmit_list = cur_retransmit_list->next; + /* update buffer status */ + entity->common.bstatus.retx_size -= compute_pdu_header_size(entity, cur) + + cur->size; + if (nr_rlc_free_sdu_segment(cur)) { + entity->tx_size -= sdu_size; + entity->common.sdu_successful_delivery( + entity->common.sdu_successful_delivery_data, + (nr_rlc_entity_t *)entity, upper_layer_id); + } + } + + new_retransmit_list->next = cur_retransmit_list; + + entity->wait_list = head_wait_list.next; + entity->retransmit_list = head_retransmit_list.next; + + if (end_wait_list != NULL) { + if (end_wait_list == &head_wait_list) + entity->wait_end = NULL; + else + entity->wait_end = end_wait_list; + } + + /* update tx_next_ack */ + /* 38.322 5.2.3.1.1 says "set TX_Next_Ack equal to the SN of the RLC SDU + * with the smallest SN, whose SN falls within the range + * TX_Next_Ack <= SN <= TX_Next and for which a positive acknowledgment + * has not been received yet. + */ + /* let's start from highest possible value and go down as needed */ + tx_next_ack = entity->tx_next; + if (entity->wait_list != NULL + && sn_compare_tx(entity, entity->wait_list->sdu->sn, tx_next_ack) < 0) + tx_next_ack = entity->wait_list->sdu->sn; + if (entity->retransmit_list != NULL + && sn_compare_tx(entity, entity->retransmit_list->sdu->sn, tx_next_ack) < 0) + tx_next_ack = entity->retransmit_list->sdu->sn; + if (sn_compare_tx(entity, ack_sn, tx_next_ack) < 0) + tx_next_ack = ack_sn; + entity->tx_next_ack = tx_next_ack; + + return; + +err: + LOG_E(RLC, "%s:%d:%s: error decoding PDU, NR RLC entity in inconsistent state\n", + __FILE__, __LINE__, __FUNCTION__); + +#undef R } void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity, @@ -540,7 +674,6 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity, #define R(d) do { if (nr_rlc_pdu_decoder_in_error(&d)) goto err; } while (0) nr_rlc_entity_am_t *entity = (nr_rlc_entity_am_t *)_entity; nr_rlc_pdu_decoder_t decoder; - nr_rlc_pdu_decoder_t control_decoder; nr_rlc_pdu_t *pdu; int dc; int p = 0; @@ -551,23 +684,11 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity, int is_first; int is_last; - int cpt; - int e1; - int e2; - int e3; - int ack_sn; - int nack_sn; - int so_start; - int so_end; - int range; - int control_e1; - int control_e2; - int control_e3; - unsigned char sn_set[32768]; /* used to dec retx_count only once per sdu */ - nr_rlc_pdu_decoder_init(&decoder, buffer, size); dc = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); - if (dc == 0) goto control; + + if (dc == 0) + return process_control_pdu(entity, buffer, size); /* data PDU */ p = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); @@ -596,20 +717,20 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity, /* dicard PDU if no data */ if (data_size <= 0) { - LOG_W(RLC, "%s:%d:%s: warning: discard PDU, no data\n", + LOG_D(RLC, "%s:%d:%s: warning: discard PDU, no data\n", __FILE__, __LINE__, __FUNCTION__); goto discard; } /* dicard PDU if rx buffer is full */ if (entity->rx_size + data_size > entity->rx_maxsize) { - LOG_W(RLC, "%s:%d:%s: warning: discard PDU, RX buffer full\n", + LOG_D(RLC, "%s:%d:%s: warning: discard PDU, RX buffer full\n", __FILE__, __LINE__, __FUNCTION__); goto discard; } if (!sn_in_recv_window(entity, sn)) { - LOG_W(RLC, "%s:%d:%s: warning: discard PDU, sn out of window (sn %d rx_next %d)\n", + LOG_D(RLC, "%s:%d:%s: warning: discard PDU, sn out of window (sn %d rx_next %d)\n", __FILE__, __LINE__, __FUNCTION__, sn, entity->rx_next); goto discard; @@ -617,7 +738,7 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity, /* discard segment if all the bytes of the segment are already there */ if (segment_already_received(entity, sn, so, data_size)) { - LOG_W(RLC, "%s:%d:%s: warning: discard PDU, already received\n", + LOG_D(RLC, "%s:%d:%s: warning: discard PDU, already received\n", __FILE__, __LINE__, __FUNCTION__); goto discard; } @@ -650,118 +771,6 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity, return; -control: - cpt = nr_rlc_pdu_decoder_get_bits(&decoder, 3); R(decoder); - if (cpt != 0) { - LOG_W(RLC, "%s:%d:%s: warning: discard PDU, CPT not 0 (%d)\n", - __FILE__, __LINE__, __FUNCTION__, cpt); - goto discard; - } - ack_sn = nr_rlc_pdu_decoder_get_bits(&decoder, entity->sn_field_length); R(decoder); - e1 = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); - /* r bits */ - if (entity->sn_field_length == 18) { - nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); - } else { - nr_rlc_pdu_decoder_get_bits(&decoder, 7); R(decoder); - } - - /* let's try to parse the control PDU once to check consistency */ - control_decoder = decoder; - control_e1 = e1; - while (control_e1) { - nack_sn = nr_rlc_pdu_decoder_get_bits(&control_decoder, entity->sn_field_length); R(control_decoder); - control_e1 = nr_rlc_pdu_decoder_get_bits(&control_decoder, 1); R(control_decoder); - control_e2 = nr_rlc_pdu_decoder_get_bits(&control_decoder, 1); R(control_decoder); - control_e3 = nr_rlc_pdu_decoder_get_bits(&control_decoder, 1); R(control_decoder); - /* r bits */ - if (entity->sn_field_length == 18) { - nr_rlc_pdu_decoder_get_bits(&control_decoder, 3); R(control_decoder); - } else { - nr_rlc_pdu_decoder_get_bits(&control_decoder, 1); R(control_decoder); - } - /* check range and so_start/so_end consistency */ - if (control_e2) { - so_start = nr_rlc_pdu_decoder_get_bits(&control_decoder, 16); R(control_decoder); - so_end = nr_rlc_pdu_decoder_get_bits(&control_decoder, 16); R(control_decoder); - } else { - so_start = 0; - so_end = 0xffff; - } - if (control_e3) { - range = nr_rlc_pdu_decoder_get_bits(&control_decoder, 8); R(control_decoder); - } else { - range = 1; - } - if (range < 1) { - LOG_E(RLC, "%s:%d:%s: error, bad 'range' in RLC NACK (sn %d)\n", - __FILE__, __LINE__, __FUNCTION__, nack_sn); - goto err; - } - /* so_start can be > so_end if more than one range; they don't refer - * to the same PDU then - */ - if (range == 1 && so_end < so_start) { - LOG_E(RLC, "%s:%d:%s: error, bad so start/end (sn %d)\n", - __FILE__, __LINE__, __FUNCTION__, nack_sn); - goto err; - } - } - - /* 38.322 5.3.3.3 says to stop t_poll_retransmit if a ACK or NACK is - * received for the SN 'poll_sn' - check ACK case (NACK done below) - */ - if (sn_compare_tx(entity, entity->poll_sn, ack_sn) < 0) - entity->t_poll_retransmit_start = 0; - - /* at this point, accept the PDU even if the actual values - * may be incorrect (eg. if so_start > so_end) - */ - process_received_ack(entity, ack_sn); - - if (e1) - memset(sn_set, 0, 32768); - - while (e1) { - nack_sn = nr_rlc_pdu_decoder_get_bits(&decoder, entity->sn_field_length); R(decoder); - e1 = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); - e2 = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); - e3 = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); - /* r bits */ - if (entity->sn_field_length == 18) { - nr_rlc_pdu_decoder_get_bits(&decoder, 3); R(decoder); - } else { - nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); - } - if (e2) { - so_start = nr_rlc_pdu_decoder_get_bits(&decoder, 16); R(decoder); - so_end = nr_rlc_pdu_decoder_get_bits(&decoder, 16); R(decoder); - } else { - so_start = 0; - so_end = 0xffff; - } - if (e3) { - range = nr_rlc_pdu_decoder_get_bits(&decoder, 8); R(decoder); - } else { - range = 1; - } - /* special value 0xffff indicates 'all bytes to the end' */ - if (so_end == 0xffff) - so_end = -1; - process_received_nack(entity, nack_sn, so_start, so_end, range, sn_set); - - /* 38.322 5.3.3.3 says to stop t_poll_retransmit if a ACK or NACK is - * received for the SN 'poll_sn' - check NACK case (ACK done above) - */ - if (sn_compare_tx(entity, nack_sn, entity->poll_sn) <= 0 && - sn_compare_tx(entity, entity->poll_sn, (nack_sn + range) % entity->sn_modulus) < 0) - entity->t_poll_retransmit_start = 0; - } - - finalize_ack_nack_processing(entity); - - return; - err: LOG_W(RLC, "%s:%d:%s: error decoding PDU, discarding\n", __FILE__, __LINE__, __FUNCTION__); goto discard; @@ -1225,7 +1234,7 @@ static int generate_missing(nr_rlc_entity_am_t *entity, static int generate_status(nr_rlc_entity_am_t *entity, char *buffer, int size) { int ack_sn = entity->rx_next; - missing_data_t m; + missing_data_t m; nr_rlc_pdu_t *cur; int nack_count = 0; nr_rlc_pdu_encoder_t encoder; @@ -1427,8 +1436,6 @@ static int generate_retx_pdu(nr_rlc_entity_am_t *entity, char *buffer, return 0; entity->retransmit_list = entity->retransmit_list->next; - if (entity->retransmit_list == NULL) - entity->retransmit_end = NULL; sdu->next = NULL; @@ -1444,15 +1451,24 @@ static int generate_retx_pdu(nr_rlc_entity_am_t *entity, char *buffer, /* put the second SDU back at the head of the retransmit list */ next_sdu->next = entity->retransmit_list; entity->retransmit_list = next_sdu; - if (entity->retransmit_end == NULL) - entity->retransmit_end = entity->retransmit_list; /* update buffer status */ entity->common.bstatus.retx_size += compute_pdu_header_size(entity, next_sdu) + next_sdu->size; } /* put SDU/SDU segment in the wait list */ - nr_rlc_sdu_segment_list_append(&entity->wait_list, &entity->wait_end, sdu); + /* speedup: check end of wait list, maybe the new sdu comes after */ + if (entity->wait_end == NULL + || sn_compare_tx(entity, sdu->sdu->sn, entity->wait_end->sdu->sn) > 0 + || (sn_compare_tx(entity, sdu->sdu->sn, entity->wait_end->sdu->sn) == 0 + && sdu->so > entity->wait_end->so)) + nr_rlc_sdu_segment_list_append(&entity->wait_list, &entity->wait_end, sdu); + else { + entity->wait_list = nr_rlc_sdu_segment_list_add(sn_compare_tx, entity, + entity->wait_list, sdu); + if (entity->wait_list->next == NULL) + entity->wait_end = entity->wait_list; + } p = check_poll_after_pdu_assembly(entity); @@ -1519,7 +1535,18 @@ static int generate_tx_pdu(nr_rlc_entity_am_t *entity, char *buffer, int size) entity->tx_next = (entity->tx_next + 1) % entity->sn_modulus; /* put SDU/SDU segment in the wait list */ - nr_rlc_sdu_segment_list_append(&entity->wait_list, &entity->wait_end, sdu); + /* speedup: check end of wait list, probably the new sdu comes after */ + if (entity->wait_end == NULL + || sn_compare_tx(entity, sdu->sdu->sn, entity->wait_end->sdu->sn) > 0 + || (sn_compare_tx(entity, sdu->sdu->sn, entity->wait_end->sdu->sn) == 0 + && sdu->so > entity->wait_end->so)) + nr_rlc_sdu_segment_list_append(&entity->wait_list, &entity->wait_end, sdu); + else { + entity->wait_list = nr_rlc_sdu_segment_list_add(sn_compare_tx, entity, + entity->wait_list, sdu); + if (entity->wait_list->next == NULL) + entity->wait_end = entity->wait_list; + } /* polling actions for a new PDU */ entity->pdu_without_poll++; @@ -1629,11 +1656,7 @@ void nr_rlc_entity_am_recv_sdu(nr_rlc_entity_t *_entity, static void check_t_poll_retransmit(nr_rlc_entity_am_t *entity) { - nr_rlc_sdu_segment_t head; nr_rlc_sdu_segment_t *cur; - nr_rlc_sdu_segment_t *prev; - int sn; - int old_retx_count; /* 38.322 5.3.3.4 */ /* did t_poll_retransmit expire? */ @@ -1659,74 +1682,58 @@ static void check_t_poll_retransmit(nr_rlc_entity_am_t *entity) */ entity->force_poll = 1; - LOG_W(RLC, "%s:%d:%s: warning: t_poll_retransmit expired\n", + LOG_D(RLC, "%s:%d:%s: warning: t_poll_retransmit expired\n", __FILE__, __LINE__, __FUNCTION__); /* do we meet conditions of 38.322 5.3.3.4? */ if (!check_poll_after_pdu_assembly(entity)) return; - /* search wait list for SDU with highest SN */ - /* this code may be incorrect: in LTE we had to look for PDU - * with SN = VT(S) - 1, but for NR the specs say "highest SN among the - * ones submitted to lower layers" not 'tx_next - 1'. So we should look - * for the highest SN in the wait list. But that's no big deal. If the - * program runs this code, then the connection is in a bad state and we - * can retransmit whatever we want. At some point we will receive a status - * report and retransmit what we really have to. Actually we could just - * retransmit the head of wait list (the specs have this 'or'). - * (Actually, maybe this interpretation is not correct and what the code - * does is correct. The specs are confusing.) + /* retransmit the head of wait list, this is the case + * "consider any RLC SDU which has not been positively acknowledged for + * retransmission" of 36.322 5.3.3.4. + * We don't search for the highest SN, it's simpler to just take the head + * of wait list. This can be changed if needed. */ - sn = (entity->tx_next - 1 + entity->sn_modulus) % entity->sn_modulus; - - head.next = entity->wait_list; cur = entity->wait_list; - prev = &head; - - while (cur != NULL) { - if (cur->sdu->sn == sn) - break; - prev = cur; - cur = cur->next; - } - - /* SDU with highest SN not found? take the head of wait list */ - if (cur == NULL) { - cur = entity->wait_list; - prev = &head; - sn = cur->sdu->sn; - } /* todo: do we need to for check cur == NULL? * It seems that no, the wait list should not be empty here, but not sure. */ - old_retx_count = cur->sdu->retx_count; + entity->wait_list = cur->next; + if (entity->wait_list == NULL) + entity->wait_end = NULL; - /* 38.322 says "SDU", not "SDU segment", so let's retransmit all - * SDU segments with this SN + /* 38.322 says "SDU", not "SDU segment", but let's retransmit only + * the 'cur' SDU segment. To be changed if needed. (Maybe we have + * to retransmit all SDU segments with the same SN that are in the + * wait list.) */ - /* todo: maybe we could simply retransmit the current SDU segment, - * so that we don't have to run through the full wait list. + + /* increase retx count. Don't care about segmentation, so maybe we + * increase too much. */ - while (cur != NULL) { - if (cur->sdu->sn == sn) { - prev->next = cur->next; - cur->next = NULL; - /* put in retransmit list */ - consider_retransmission(entity, cur, - old_retx_count == cur->sdu->retx_count); - } else { - prev = cur; - } - cur = prev->next; - } - entity->wait_list = head.next; - /* reset wait_end (todo: optimize?) */ - entity->wait_end = entity->wait_list; - while (entity->wait_end != NULL && entity->wait_end->next != NULL) - entity->wait_end = entity->wait_end->next; + cur->sdu->retx_count++; + /* report max RETX reached for all retx_count >= max_retx_threshold + * (specs say to report if retx_count == max_retx_threshold). + * Upper layers should react (radio link failure), so no big deal. + * We deal with segmentation by requiring + * retx_count >= max_retx_threshold * number of segments. + * We may report max RETX reached too late/early. To be refined if + * this is a problem. + */ + if (cur->sdu->retx_count + >= entity->max_retx_threshold * cur->sdu->ref_count) + entity->common.max_retx_reached(entity->common.max_retx_reached_data, + (nr_rlc_entity_t *)entity); + /* update buffer status */ + entity->common.bstatus.retx_size += compute_pdu_header_size(entity, cur) + + cur->size; + + /* put in retransmit list */ + entity->retransmit_list = nr_rlc_sdu_segment_list_add(sn_compare_tx, entity, + entity->retransmit_list, cur); } static void check_t_reassembly(nr_rlc_entity_am_t *entity) @@ -1815,6 +1822,7 @@ void nr_rlc_entity_am_discard_sdu(nr_rlc_entity_t *_entity, int sdu_id) entity->common.bstatus.tx_size -= compute_pdu_header_size(entity, cur) + cur->size; + entity->tx_size -= cur->sdu->size; nr_rlc_free_sdu_segment(cur); } @@ -1857,7 +1865,6 @@ static void clear_entity(nr_rlc_entity_am_t *entity) nr_rlc_free_sdu_segment_list(entity->tx_list); nr_rlc_free_sdu_segment_list(entity->wait_list); nr_rlc_free_sdu_segment_list(entity->retransmit_list); - nr_rlc_free_sdu_segment_list(entity->ack_list); entity->tx_list = NULL; entity->tx_end = NULL; @@ -1867,9 +1874,6 @@ static void clear_entity(nr_rlc_entity_am_t *entity) entity->wait_end = NULL; entity->retransmit_list = NULL; - entity->retransmit_end = NULL; - - entity->ack_list = NULL; entity->common.bstatus.tx_size = 0; entity->common.bstatus.retx_size = 0; diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.h b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.h index 453fe87026..57ae1a3485 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.h +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.h @@ -84,9 +84,6 @@ typedef struct { nr_rlc_sdu_segment_t *wait_end; nr_rlc_sdu_segment_t *retransmit_list; - nr_rlc_sdu_segment_t *retransmit_end; - - nr_rlc_sdu_segment_t *ack_list; } nr_rlc_entity_am_t; void nr_rlc_entity_am_recv_sdu(nr_rlc_entity_t *entity, diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_sdu.c b/openair2/LAYER2/nr_rlc/nr_rlc_sdu.c index ef0d52558a..ef64389ac5 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_sdu.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_sdu.c @@ -58,14 +58,19 @@ oom: exit(1); } -void nr_rlc_free_sdu_segment(nr_rlc_sdu_segment_t *sdu) +int nr_rlc_free_sdu_segment(nr_rlc_sdu_segment_t *sdu) { - sdu->sdu->ref_count--; - if (sdu->sdu->ref_count == 0) { + int ret = 0; + + sdu->sdu->free_count++; + if (sdu->sdu->free_count == sdu->sdu->ref_count) { free(sdu->sdu->data); free(sdu->sdu); + ret = 1; } free(sdu); + + return ret; } void nr_rlc_sdu_segment_list_append(nr_rlc_sdu_segment_t **list, diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_sdu.h b/openair2/LAYER2/nr_rlc/nr_rlc_sdu.h index f4585fb7d6..20cc90f185 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_sdu.h +++ b/openair2/LAYER2/nr_rlc/nr_rlc_sdu.h @@ -30,6 +30,10 @@ typedef struct nr_rlc_sdu_t { int retx_count; int ref_count; /* incremented each time the SDU is segmented */ + int free_count; /* incremented each time a segment is freed + * when it equals ref_count we can free the SDU + * completely + */ } nr_rlc_sdu_t; typedef struct nr_rlc_sdu_segment_t { @@ -44,7 +48,8 @@ typedef struct nr_rlc_sdu_segment_t { nr_rlc_sdu_segment_t *nr_rlc_new_sdu( char *buffer, int size, int upper_layer_id); -void nr_rlc_free_sdu_segment(nr_rlc_sdu_segment_t *sdu); +/* return 1 if the SDU has been freed too, 0 if not (more segments to free) */ +int nr_rlc_free_sdu_segment(nr_rlc_sdu_segment_t *sdu); void nr_rlc_sdu_segment_list_append(nr_rlc_sdu_segment_t **list, nr_rlc_sdu_segment_t **end, nr_rlc_sdu_segment_t *sdu); diff --git a/openair2/LAYER2/nr_rlc/tests/test14.txt.gz b/openair2/LAYER2/nr_rlc/tests/test14.txt.gz index 53616dae3d10b71375cea41ca9061d4304f64dcf..45e54651eb317c3b7695cfcab7428fe43172227b 100644 GIT binary patch delta 727 zcmV;|0x12M2A>9hABzYGOnK#D0t0kqb96B@E_8Tw0Ns{LYhyM4NCCm^MOEKZ=bSpax9>mP-mu=3)#kg~ z{rThj8|)3M(LUX+`va@j9?Uh<1qmfF$t3~1yeB%vosFO z#2T!{I;>z7>#+eFu?d^81zWKV+pz;XaRz5`4ktLpd0fCnT*75s!Bt$tb=<&B#31&! zL;SywKgOzT#@(NN`vhKg;G5awH34cl-io5)8o-96^ro zpHsnJ_7p$=^5cGtJ|6BrjTIk$`uLMT0at$vP`7iA)!mX%o9%j^RLk>jKZUUQ`|)I! zIsZ8yU2wvJ@)Tmb-w|Qw9P6%ww$qNiXy`iu^vJPt=-3>{k(|hxT*#H&$eldMlVT{A z;wVBZySmsfn7Yg<7eN+Npy&cMfQl=4gLH zQ<|p*T0Ed$-|AR>on!U9W92$%JMGxZhwk61xPQ6g`}*+g3(d1H+*#%={g3gIP9hHf zB3?d{PR8rfxRclNS6Q>(wl>!5xqW!}{G|Tq?@rXaSJulb>i-AdiJFg6Qx8+KC0eEx zTBS8wrw!Vq8@i=Cy3m#G>46^UiJpJygt< zMrRDhWE!SrI;Jp{>6w8UnTeT?2RNsLUiKJ|DVDz#W0#M8XO(ASA-o{R%-L87Cu3pP zxT8y7xVC4Yo=z|?M>kyg;_oR>{y$RwjmE1a;Pl2_0rqh2kKgKnX5n#7%(Dw?@)b>e JEYZ;s0009vZy5jp delta 720 zcmV;>0x$ia2ABqaABzYG$u*{70t0kqb96B@E_8Tw0Ns{5ZyZMugmeFjFSHY5X1eFa zP>|rviKxghhZ@~X5=8Fzp5?Gt#}fp2Dy-&}qd?nniDsDd~|5Jfx^kccECBL%5QLpm~$i5k?R z4i!{Uj|MbCq6y7tK`YwOjt+D#=i@EjEsWt6@9_a2@d=;t1z+(E-|-8WNiYOUa0EHR ze@+E^*zjQWeLUQM9xL9z{qU1O0at%CP`7iA)!mX%o9%j^RLlEr--WRG>v3h4 zKL1%C9dN>e@)Tmb=ZLU#j&;{T+iAyMH1wSSdgNF+bZidfNKWKTF62sXuXU`x%&~gjv2q=>op$WyL-(&$+<(8~`}*+gh344{cb0k0{>OMpClQB# z5idVUC*w8!FaFCkAElHYrc_I`Oe?fXYqU-qv`IH~OLugkE8WurJ<=0B(+j=Q8@(^H zK%Wf5unfl#hB7=OFd`!{GNUjmqcMLvV=yMuFfG$Dg{e%>49v((%zWIyIUV$}+jvZk z{H@ryeC#``JTr#jJ95LE9m8;P49{GBIsv>Kop9xYyr(ev|489CHeMwGrzhwNu!nOW zPOAr+E%mz|4S$w3>uqaey`I~Lhc8bQjQ;b9di%n9_riL4VZA?BT%gc&;HC?*=-Ux2N2b{wRPH`S*xPXhegv+>s>u^18z)gh>HzE!ZL=le| z5|D@_BqIgskRBP3iZo=W>c_jtnx ze8eYw#ut2t@9_h^;v0U%9444z9y2Up5ldLc3f5sgHeeNN*f{kk2tf&+V1z)3gha@M zLg)xRVIWk(1ZE^Uq7aqn4-(LQ0?~+p7>S9PiG|n^d*VQ>#6}!RjwB={d6JO=DUuQ? zlM1OL^`wDRNsTm;9a+dq_GBXmawI2mCKqx??#TnWk{fxXIEqk|;weT6zY_S=KDT9e z-7db=^%lKt&`*`_=XyFL?cvjV@kyTXb$9U1=6k&V{Bid3#4g;!XUEygmi=FtHymfL zPi)~meDMJLw!?SJ{&CJfKiM>|?dtNTEjfLAz6;&{nH)eRcJ1CuOUz_X^}+rFTP29vb2E|M*M~ sWUv0;muI7`KBVol{*!mmkK|+cZ5A^}_s6#07RbSZA0L&&0<;ML09iH+!vFvP literal 546 zcmV+-0^R)|iwFqSHKt(#19W9`bTKt9ba-?C&6P`QlR*@Q_x_4!sT-MdnOl}(ap$J( zN~C<3`J_-plBS}+-Xu+=(U?%dS{Q~|%o(2d%=^w85xL?J5Ch)#^eM9joOti+Dk z69?i*T)|AFKoXLY?5F_U7m%D3Nr{w6g;Yr$sV5Djk<>^NIgo{{WFtE{k`pmKl}&G&f!*=hCi#4g<9^V8~OtNt&{8&9j(C${h& zUpk_`?fCB1KhF7=XPd*vc5{8#=A6I1+=ceJXLd_|pe?q0@z>+w_Vs-pYNI?TXxqgq zp!fY;&#R#8z8mFVg>l0vf4Y(9|BtyIiPHFgACgUP^-sNh)?e%n{e<0z-|k|qG4Qop kuviX5TP&vK&CR!63)=YlP=P$QK#vyu0JKzLn6wE10El1~J^%m! From 33663e68b093ffdb28ff5e31f9dd3f360eb9dbf7 Mon Sep 17 00:00:00 2001 From: francescomani Date: Tue, 19 Apr 2022 18:37:14 +0200 Subject: [PATCH 059/114] rename frame_type --- common/utils/nr/nr_common.c | 4 ++-- common/utils/nr/nr_common.h | 2 +- openair1/PHY/LTE_TRANSPORT/prach.c | 2 +- openair1/PHY/LTE_TRANSPORT/prach_common.c | 2 +- openair1/PHY/LTE_TRANSPORT/prach_extern.h | 2 +- openair1/PHY/LTE_TRANSPORT/transport_common_proto.h | 4 ++-- openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c | 10 +++++----- openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c | 2 +- openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h | 4 ++-- openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h | 4 ++-- openair1/PHY/defs_common.h | 4 ++-- openair1/PHY/defs_nr_common.h | 2 +- openair1/SCHED/phy_procedures_lte_common.c | 2 +- openair1/SCHED/sched_common.h | 2 +- openair1/SCHED/sched_eNB.h | 2 +- openair1/SCHED_UE/phy_procedures_lte_ue.c | 2 +- openair1/SCHED_UE/sched_UE.h | 2 +- openair1/SIMULATION/LTE_PHY/pdcchsim.c | 2 +- openair2/COMMON/m2ap_messages_types.h | 4 ++-- openair2/COMMON/m3ap_messages_types.h | 2 +- openair2/COMMON/phy_messages_types.h | 2 +- openair2/COMMON/rrc_messages_types.h | 4 ++-- openair2/COMMON/x2ap_messages_types.h | 2 +- openair2/ENB_APP/RRC_config_tools.h | 2 +- openair2/ENB_APP/flexran_agent_ran_api.c | 2 +- openair2/ENB_APP/flexran_agent_ran_api.h | 2 +- openair2/GNB_APP/gnb_config.c | 2 +- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 2 +- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h | 2 +- openair2/LAYER2/NR_MAC_UE/config_ue.c | 2 +- openair2/LAYER2/NR_MAC_UE/mac_defs.h | 2 +- openair2/LAYER2/NR_MAC_gNB/config.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 6 +++--- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 2 +- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 2 +- openair2/M2AP/m2ap_MCE_defs.h | 2 +- openair2/M2AP/m2ap_eNB_defs.h | 2 +- openair2/RRC/LTE/rrc_eNB_S1AP.c | 2 +- openair2/RRC/NR/nr_rrc_config.c | 4 ++-- openair2/UTIL/OCG/OCG.h | 2 +- openair2/X2AP/x2ap_eNB_defs.h | 2 +- openair3/M3AP/m3ap_MCE_defs.h | 2 +- openair3/M3AP/m3ap_MME_defs.h | 2 +- targets/RT/USER/lte-ue.c | 2 +- 45 files changed, 59 insertions(+), 59 deletions(-) diff --git a/common/utils/nr/nr_common.c b/common/utils/nr/nr_common.c index 49743b3bdc..0aeeaf3afd 100644 --- a/common/utils/nr/nr_common.c +++ b/common/utils/nr/nr_common.c @@ -336,9 +336,9 @@ int get_dmrs_port(int nl, uint16_t dmrs_ports) { return p; } -lte_frame_type_t get_frame_type(uint16_t current_band, uint8_t scs_index) +frame_type_t get_frame_type(uint16_t current_band, uint8_t scs_index) { - lte_frame_type_t current_type; + frame_type_t current_type; int32_t delta_duplex = get_delta_duplex(current_band, scs_index); if (delta_duplex == 0) diff --git a/common/utils/nr/nr_common.h b/common/utils/nr/nr_common.h index 0150cf59f8..a09532a565 100644 --- a/common/utils/nr/nr_common.h +++ b/common/utils/nr/nr_common.h @@ -63,7 +63,7 @@ void get_coreset_rballoc(uint8_t *FreqDomainResource,int *n_rb,int *rb_offset); uint16_t config_bandwidth(int mu, int nb_rb, int nr_band); int get_nr_table_idx(int nr_bandP, uint8_t scs_index); int32_t get_delta_duplex(int nr_bandP, uint8_t scs_index); -lte_frame_type_t get_frame_type(uint16_t nr_bandP, uint8_t scs_index); +frame_type_t get_frame_type(uint16_t nr_bandP, uint8_t scs_index); uint16_t get_band(uint64_t downlink_frequency, int32_t delta_duplex); int NRRIV2BW(int locationAndBandwidth,int N_RB); int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB); diff --git a/openair1/PHY/LTE_TRANSPORT/prach.c b/openair1/PHY/LTE_TRANSPORT/prach.c index eb46a8d663..91c419ebe3 100644 --- a/openair1/PHY/LTE_TRANSPORT/prach.c +++ b/openair1/PHY/LTE_TRANSPORT/prach.c @@ -56,7 +56,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, uint8_t ce_level ) { int i; - lte_frame_type_t frame_type; + frame_type_t frame_type; uint16_t rootSequenceIndex; uint8_t prach_ConfigIndex; uint8_t Ncs_config; diff --git a/openair1/PHY/LTE_TRANSPORT/prach_common.c b/openair1/PHY/LTE_TRANSPORT/prach_common.c index e366e8edbc..f3409a90e3 100644 --- a/openair1/PHY/LTE_TRANSPORT/prach_common.c +++ b/openair1/PHY/LTE_TRANSPORT/prach_common.c @@ -399,7 +399,7 @@ void compute_prach_seq(uint16_t rootSequenceIndex, uint8_t prach_ConfigIndex, uint8_t zeroCorrelationZoneConfig, uint8_t highSpeedFlag, - lte_frame_type_t frame_type, + frame_type_t frame_type, uint32_t X_u[64][839]) { // Compute DFT of x_u => X_u[k] = x_u(inv(u)*k)^* X_u[k] = exp(j\pi u*inv(u)*k*(inv(u)*k+1)/N_ZC) unsigned int k,inv_u,i,NCS=0,num_preambles; diff --git a/openair1/PHY/LTE_TRANSPORT/prach_extern.h b/openair1/PHY/LTE_TRANSPORT/prach_extern.h index 3404646923..3403861011 100644 --- a/openair1/PHY/LTE_TRANSPORT/prach_extern.h +++ b/openair1/PHY/LTE_TRANSPORT/prach_extern.h @@ -81,7 +81,7 @@ void compute_prach_seq(uint16_t rootSequenceIndex, uint8_t prach_ConfigIndex, uint8_t zeroCorrelationZoneConfig, uint8_t highSpeedFlag, - lte_frame_type_t frame_type, + frame_type_t frame_type, uint32_t X_u[64][839]); #endif diff --git a/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h b/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h index af8e63c3ed..74a38e58db 100644 --- a/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h +++ b/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h @@ -224,7 +224,7 @@ uint8_t get_num_prach_tdd(module_id_t Mod_id); @returns 0-1 accordingly */ /* -uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type); +uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,frame_type_t frame_type); */ /*! @@ -247,7 +247,7 @@ void compute_prach_seq(uint16_t rootSequenceIndex, uint8_t prach_ConfigIndex, uint8_t zeroCorrelationZoneConfig, uint8_t highSpeedFlag, - lte_frame_type_t frame_type, + frame_type_t frame_type, uint32_t X_u[64][839]); diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c index efde277203..088e2c0a5e 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c @@ -64,7 +64,7 @@ extern uint16_t beta_cqi[16]; extern uint16_t beta_ri[16]; extern uint16_t beta_ack[16]; -void extract_dci1A_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted) +void extract_dci1A_info(uint8_t N_RB_DL, frame_type_t frame_type, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted) { uint8_t harq_pid=0; uint32_t rballoc=0; @@ -182,7 +182,7 @@ void extract_dci1A_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, void *dci_ pdci_info_extarcted->dai = dai; } -void extract_dci1C_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted) +void extract_dci1C_info(uint8_t N_RB_DL, frame_type_t frame_type, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted) { uint32_t rballoc=0; @@ -222,7 +222,7 @@ void extract_dci1C_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, void *dci_ pdci_info_extarcted->Ngap = Ngap; } -void extract_dci1_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted) +void extract_dci1_info(uint8_t N_RB_DL, frame_type_t frame_type, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted) { uint32_t rballoc=0; @@ -329,7 +329,7 @@ void extract_dci1_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, void *dci_p } -void extract_dci2_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, uint8_t nb_antenna_ports_eNB, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted) +void extract_dci2_info(uint8_t N_RB_DL, frame_type_t frame_type, uint8_t nb_antenna_ports_eNB, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted) { uint32_t rballoc=0; @@ -615,7 +615,7 @@ void extract_dci2_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, uint8_t nb_ } -void extract_dci2A_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, uint8_t nb_antenna_ports_eNB, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted) +void extract_dci2A_info(uint8_t N_RB_DL, frame_type_t frame_type, uint8_t nb_antenna_ports_eNB, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted) { uint32_t rballoc=0; diff --git a/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c index 82120dc3c3..4faa8367c3 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c @@ -46,7 +46,7 @@ //#define PRACH_DEBUG 1 int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint16_t Nf ) { - lte_frame_type_t frame_type = ue->frame_parms.frame_type; + frame_type_t frame_type = ue->frame_parms.frame_type; //uint8_t tdd_config = ue->frame_parms.tdd_config; uint16_t rootSequenceIndex = ue->frame_parms.prach_config_common.rootSequenceIndex; uint8_t prach_ConfigIndex = ue->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex; diff --git a/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h index c5d096ceb7..05a5904971 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h +++ b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h @@ -1669,7 +1669,7 @@ uint8_t get_num_prach_tdd(module_id_t Mod_id); @param frame_type 0-FDD, 1-TDD @returns 0-1 accordingly */ -uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type); +uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,frame_type_t frame_type); /*! \brief Helper for MAC, returns frequency index of PRACH resource in TDD for a particular configuration index @@ -1691,7 +1691,7 @@ void compute_prach_seq(uint16_t rootSequenceIndex, uint8_t prach_ConfigIndex, uint8_t zeroCorrelationZoneConfig, uint8_t highSpeedFlag, - lte_frame_type_t frame_type, + frame_type_t frame_type, uint32_t X_u[64][839]); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h index dc0f38f096..65c0ec9381 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h @@ -1567,7 +1567,7 @@ uint8_t get_num_prach_tdd(module_id_t Mod_id); @param frame_type 0-FDD, 1-TDD @returns 0-1 accordingly */ -uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type); +uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,frame_type_t frame_type); /*! \brief Helper for MAC, returns frequency index of PRACH resource in TDD for a particular configuration index @@ -1589,7 +1589,7 @@ void compute_prach_seq(uint16_t rootSequenceIndex, uint8_t prach_ConfigIndex, uint8_t zeroCorrelationZoneConfig, uint8_t highSpeedFlag, - lte_frame_type_t frame_type, + frame_type_t frame_type, uint32_t X_u[64][839]); diff --git a/openair1/PHY/defs_common.h b/openair1/PHY/defs_common.h index 86df85db5c..d13fe260de 100644 --- a/openair1/PHY/defs_common.h +++ b/openair1/PHY/defs_common.h @@ -99,7 +99,7 @@ #define NB_RX_ANTENNAS_MAX 64 -typedef enum {TDD=1,FDD=0} lte_frame_type_t; +typedef enum {TDD=1,FDD=0} frame_type_t; typedef enum {EXTENDED=1,NORMAL=0} lte_prefix_type_t; @@ -597,7 +597,7 @@ typedef struct LTE_DL_FRAME_PARMS { /// shift of pilot position in one RB uint8_t nushift; /// Frame type (0 FDD, 1 TDD) - lte_frame_type_t frame_type; + frame_type_t frame_type; /// TDD subframe assignment (0-7) (default = 3) (254=RX only, 255=TX only) uint8_t tdd_config; /// TDD S-subframe configuration (0-9) diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h index 7c78d20ae5..756e6b7210 100644 --- a/openair1/PHY/defs_nr_common.h +++ b/openair1/PHY/defs_nr_common.h @@ -280,7 +280,7 @@ struct NR_DL_FRAME_PARMS { uint32_t att_rx; /// total Number of Resource Block Groups: this is ceil(N_PRB/P) /// Frame type (0 FDD, 1 TDD) - lte_frame_type_t frame_type; + frame_type_t frame_type; uint8_t tdd_config; /// Cell ID uint16_t Nid_cell; diff --git a/openair1/SCHED/phy_procedures_lte_common.c b/openair1/SCHED/phy_procedures_lte_common.c index 7033c52701..9de453da94 100644 --- a/openair1/SCHED/phy_procedures_lte_common.c +++ b/openair1/SCHED/phy_procedures_lte_common.c @@ -994,7 +994,7 @@ int is_srs_occasion_common(LTE_DL_FRAME_PARMS *frame_parms,int frame_tx,int subf return(isSubframeSRS); } -void compute_srs_pos(lte_frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset) +void compute_srs_pos(frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset) { if(TDD == frameType) { diff --git a/openair1/SCHED/sched_common.h b/openair1/SCHED/sched_common.h index c9fc338686..9f3e6695b6 100644 --- a/openair1/SCHED/sched_common.h +++ b/openair1/SCHED/sched_common.h @@ -339,7 +339,7 @@ void dump_dlsch2(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe, unsig int is_srs_occasion_common(LTE_DL_FRAME_PARMS *frame_parms,int frame_tx,int subframe_tx); -void compute_srs_pos(lte_frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset); +void compute_srs_pos(frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset); /* from here: prototype added to remove compilation warnings, doc to be written by the author of the function */ diff --git a/openair1/SCHED/sched_eNB.h b/openair1/SCHED/sched_eNB.h index de987b0ac7..efdb1bd199 100644 --- a/openair1/SCHED/sched_eNB.h +++ b/openair1/SCHED/sched_eNB.h @@ -215,7 +215,7 @@ int16_t get_target_pucch_rx_power(module_id_t module_idP, uint8_t CC_id); int is_srs_occasion_common(LTE_DL_FRAME_PARMS *frame_parms,int frame_tx,int subframe_tx); -void compute_srs_pos(lte_frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset); +void compute_srs_pos(frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset); void release_rnti_of_phy(module_id_t mod_id); /*@}*/ diff --git a/openair1/SCHED_UE/phy_procedures_lte_ue.c b/openair1/SCHED_UE/phy_procedures_lte_ue.c index b02f24e04e..67513b9c59 100644 --- a/openair1/SCHED_UE/phy_procedures_lte_ue.c +++ b/openair1/SCHED_UE/phy_procedures_lte_ue.c @@ -574,7 +574,7 @@ void get_cqipmiri_params(PHY_VARS_UE *ue, } } -PUCCH_FMT_t get_pucch_format(lte_frame_type_t frame_type, +PUCCH_FMT_t get_pucch_format(frame_type_t frame_type, lte_prefix_type_t cyclic_prefix_type, uint8_t SR_payload, uint8_t nb_cw, diff --git a/openair1/SCHED_UE/sched_UE.h b/openair1/SCHED_UE/sched_UE.h index 32702b1148..0dbb779630 100644 --- a/openair1/SCHED_UE/sched_UE.h +++ b/openair1/SCHED_UE/sched_UE.h @@ -278,7 +278,7 @@ void dump_dlsch2(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe, unsig int is_srs_occasion_common(LTE_DL_FRAME_PARMS *frame_parms,int frame_tx,int subframe_tx); -void compute_srs_pos(lte_frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset); +void compute_srs_pos(frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset); /*@}*/ diff --git a/openair1/SIMULATION/LTE_PHY/pdcchsim.c b/openair1/SIMULATION/LTE_PHY/pdcchsim.c index bd2c2d66b9..50910290c3 100644 --- a/openair1/SIMULATION/LTE_PHY/pdcchsim.c +++ b/openair1/SIMULATION/LTE_PHY/pdcchsim.c @@ -415,7 +415,7 @@ int main(int argc, char **argv) { uint8_t harq_pid; uint8_t phich_ACK; uint8_t num_phich_interf = 0; - lte_frame_type_t frame_type=TDD; + frame_type_t frame_type=TDD; // int re_offset; // uint32_t *txptr; int aarx; diff --git a/openair2/COMMON/m2ap_messages_types.h b/openair2/COMMON/m2ap_messages_types.h index c70c50fc64..460dbfc4bb 100644 --- a/openair2/COMMON/m2ap_messages_types.h +++ b/openair2/COMMON/m2ap_messages_types.h @@ -354,7 +354,7 @@ typedef struct m2ap_register_mce_req_s { int32_t uplink_frequency_offset[MAX_NUM_CCs]; uint32_t Nid_cell[MAX_NUM_CCs]; int16_t N_RB_DL[MAX_NUM_CCs]; - lte_frame_type_t frame_type[MAX_NUM_CCs]; + frame_type_t frame_type[MAX_NUM_CCs]; uint32_t fdd_earfcn_DL[MAX_NUM_CCs]; uint32_t fdd_earfcn_UL[MAX_NUM_CCs]; int num_cc; @@ -427,7 +427,7 @@ typedef struct m2ap_register_enb_req_s { int32_t uplink_frequency_offset[MAX_NUM_CCs]; uint32_t Nid_cell[MAX_NUM_CCs]; int16_t N_RB_DL[MAX_NUM_CCs]; - lte_frame_type_t frame_type[MAX_NUM_CCs]; + frame_type_t frame_type[MAX_NUM_CCs]; uint32_t fdd_earfcn_DL[MAX_NUM_CCs]; uint32_t fdd_earfcn_UL[MAX_NUM_CCs]; int num_cc; diff --git a/openair2/COMMON/m3ap_messages_types.h b/openair2/COMMON/m3ap_messages_types.h index 21e24dd449..36ac8fcc9a 100644 --- a/openair2/COMMON/m3ap_messages_types.h +++ b/openair2/COMMON/m3ap_messages_types.h @@ -123,7 +123,7 @@ typedef struct m3ap_register_mce_req_s { int32_t uplink_frequency_offset[MAX_NUM_CCs]; uint32_t Nid_cell[MAX_NUM_CCs]; int16_t N_RB_DL[MAX_NUM_CCs]; - lte_frame_type_t frame_type[MAX_NUM_CCs]; + frame_type_t frame_type[MAX_NUM_CCs]; uint32_t fdd_earfcn_DL[MAX_NUM_CCs]; uint32_t fdd_earfcn_UL[MAX_NUM_CCs]; int num_cc; diff --git a/openair2/COMMON/phy_messages_types.h b/openair2/COMMON/phy_messages_types.h index 1f040a0a77..40e4678228 100644 --- a/openair2/COMMON/phy_messages_types.h +++ b/openair2/COMMON/phy_messages_types.h @@ -70,7 +70,7 @@ typedef struct CellInfo_s { //-------------------------------------------------------------------------------------------// // eNB: ENB_APP -> PHY messages typedef struct PhyConfigurationReq_s { - lte_frame_type_t frame_type[MAX_NUM_CCs]; + frame_type_t frame_type[MAX_NUM_CCs]; lte_prefix_type_t prefix_type[MAX_NUM_CCs]; uint32_t downlink_frequency[MAX_NUM_CCs]; int32_t uplink_frequency_offset[MAX_NUM_CCs]; diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index ac70dee092..5b214cf95a 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -188,7 +188,7 @@ typedef struct RrcConfigurationReq_s { uint32_t rrc_inactivity_timer_thres; // for testing, maybe change later paging_drx_t default_drx; int16_t nb_cc; - lte_frame_type_t frame_type[MAX_NUM_CCs]; + frame_type_t frame_type[MAX_NUM_CCs]; uint8_t tdd_config[MAX_NUM_CCs]; uint8_t tdd_config_s[MAX_NUM_CCs]; lte_prefix_type_t prefix_type[MAX_NUM_CCs]; @@ -339,7 +339,7 @@ typedef struct NbIoTRrcConfigurationReq_s { uint16_t mcc; uint16_t mnc; uint8_t mnc_digit_length; - lte_frame_type_t frame_type; + frame_type_t frame_type; uint8_t tdd_config; uint8_t tdd_config_s; lte_prefix_type_t prefix_type; diff --git a/openair2/COMMON/x2ap_messages_types.h b/openair2/COMMON/x2ap_messages_types.h index 9339ab12f3..cd092b6ca8 100644 --- a/openair2/COMMON/x2ap_messages_types.h +++ b/openair2/COMMON/x2ap_messages_types.h @@ -138,7 +138,7 @@ typedef struct x2ap_register_enb_req_s { int32_t uplink_frequency_offset[MAX_NUM_CCs]; uint32_t Nid_cell[MAX_NUM_CCs]; int16_t N_RB_DL[MAX_NUM_CCs]; - lte_frame_type_t frame_type[MAX_NUM_CCs]; + frame_type_t frame_type[MAX_NUM_CCs]; uint32_t fdd_earfcn_DL[MAX_NUM_CCs]; uint32_t fdd_earfcn_UL[MAX_NUM_CCs]; uint32_t subframeAssignment[MAX_NUM_CCs]; diff --git a/openair2/ENB_APP/RRC_config_tools.h b/openair2/ENB_APP/RRC_config_tools.h index 488441ff59..89cefeaa1f 100644 --- a/openair2/ENB_APP/RRC_config_tools.h +++ b/openair2/ENB_APP/RRC_config_tools.h @@ -38,7 +38,7 @@ typedef struct eutra_band_s { uint32_t ul_max; uint32_t dl_min; uint32_t dl_max; - lte_frame_type_t frame_type; + frame_type_t frame_type; } eutra_band_t; diff --git a/openair2/ENB_APP/flexran_agent_ran_api.c b/openair2/ENB_APP/flexran_agent_ran_api.c index 68d1f3311f..9926ec9e20 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.c +++ b/openair2/ENB_APP/flexran_agent_ran_api.c @@ -1352,7 +1352,7 @@ void flexran_agent_set_operating_bandwidth(mid_t mod_id, uint8_t cc_id, uint8_t } } -void flexran_agent_set_operating_frame_type(mid_t mod_id, uint8_t cc_id, lte_frame_type_t frame_type) { +void flexran_agent_set_operating_frame_type(mid_t mod_id, uint8_t cc_id, frame_type_t frame_type) { if (phy_is_present(mod_id, cc_id)) { RC.eNB[mod_id][cc_id]->frame_parms.frame_type = frame_type; } else { diff --git a/openair2/ENB_APP/flexran_agent_ran_api.h b/openair2/ENB_APP/flexran_agent_ran_api.h index 79115b0a16..c15865ccfd 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.h +++ b/openair2/ENB_APP/flexran_agent_ran_api.h @@ -433,7 +433,7 @@ void flexran_agent_set_operating_eutra_band(mid_t mod_id, uint8_t cc_id, uint8_t void flexran_agent_set_operating_bandwidth(mid_t mod_id, uint8_t cc_id, uint8_t N_RB); /*set frame type*/ -void flexran_agent_set_operating_frame_type(mid_t mod_id, uint8_t cc_id, lte_frame_type_t frame_type); +void flexran_agent_set_operating_frame_type(mid_t mod_id, uint8_t cc_id, frame_type_t frame_type); /*RRC status flexRAN*/ uint8_t flexran_get_rrc_status(mid_t mod_id, rnti_t rnti); diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 434a2896de..2c486ec832 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -346,7 +346,7 @@ void fix_scc(NR_ServingCellConfigCommon_t *scc,uint64_t ssbmap) { // prepare DL Allocation lists nr_rrc_config_dl_tda(scc); - lte_frame_type_t frame_type = get_frame_type((int)*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); + frame_type_t frame_type = get_frame_type((int)*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); if (frame_type == FDD) { ASN_STRUCT_FREE(asn_DEF_NR_TDD_UL_DL_ConfigCommon, scc->tdd_UL_DL_ConfigurationCommon); scc->tdd_UL_DL_ConfigurationCommon = NULL; diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index b25efbb5d8..581930b83d 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -3092,7 +3092,7 @@ int is_nr_DL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon,slo else return(slot_in_period <= slots1+tdd_UL_DL_ConfigurationCommon->pattern2->nrofDownlinkSlots ? 1 : 0); } -int is_nr_UL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, slot_t slot, lte_frame_type_t frame_type) { +int is_nr_UL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, slot_t slot, frame_type_t frame_type) { int period,period1,period2=0; diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index 0f2cb42b88..e8a3af2498 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -45,7 +45,7 @@ int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,i int is_nr_DL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon,slot_t slotP); -int is_nr_UL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, slot_t slotP, lte_frame_type_t frame_type); +int is_nr_UL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, slot_t slotP, frame_type_t frame_type); uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDLBWP, const NR_BWP_UplinkCommon_t *initialULBWP, diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 3b10167e03..bd693e4d88 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -323,7 +323,7 @@ void config_common_ue(NR_UE_MAC_INST_t *mac, uint32_t band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; mac->frequency_range = band<100?FR1:FR2; - lte_frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); + frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); // cell config diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index fc2c2d2c8b..99cbdf3292 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -369,7 +369,7 @@ typedef struct { NR_ControlResourceSet_t *coreset[MAX_NUM_BWP][FAPI_NR_MAX_CORESET_PER_BWP]; NR_SearchSpace_t *SSpace[MAX_NUM_BWP][FAPI_NR_MAX_SS]; - lte_frame_type_t frame_type; + frame_type_t frame_type; /*BWP*/ // dedicated active DL BWP diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 6ba8629718..a2cbd4807f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -233,7 +233,7 @@ void config_common(int Mod_idP, int ssb_SubcarrierOffset, rrc_pdsch_AntennaPorts uint32_t band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; frequency_range_t frequency_range = band<100?FR1:FR2; - lte_frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); + frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); RC.nrmac[Mod_idP]->common_channels[0].frame_type = frame_type; // Cell configuration diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index ca197b224d..3d17e966a9 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -399,7 +399,7 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP void nr_schedule_msg2(uint16_t rach_frame, uint16_t rach_slot, uint16_t *msg2_frame, uint16_t *msg2_slot, NR_ServingCellConfigCommon_t *scc, - lte_frame_type_t frame_type, + frame_type_t frame_type, uint16_t monitoring_slot_period, uint16_t monitoring_offset,uint8_t beam_index, uint8_t num_active_ssb, @@ -525,7 +525,7 @@ void nr_initiate_ra_proc(module_id_t module_idP, gNB_MAC_INST *nr_mac = RC.nrmac[module_idP]; NR_COMMON_channels_t *cc = &nr_mac->common_channels[CC_id]; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; - lte_frame_type_t frame_type = cc->frame_type; + frame_type_t frame_type = cc->frame_type; uint8_t total_RApreambles = MAX_NUM_NR_PRACH_PREAMBLES; uint8_t num_ssb_per_RO = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present; @@ -933,7 +933,7 @@ void nr_get_Msg3alloc(module_id_t module_id, uint16_t msg3_nb_rb = 8; // sdu has 6 or 8 bytes - lte_frame_type_t frame_type = RC.nrmac[module_id]->common_channels->frame_type; + frame_type_t frame_type = RC.nrmac[module_id]->common_channels->frame_type; int mu = ubwp ? ubwp->bwp_Common->genericParameters.subcarrierSpacing : diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 5aace1d0dc..7806d6011d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -62,7 +62,7 @@ void calculate_preferred_dl_tda(module_id_t module_id, const NR_BWP_Downlink_t * /* there is a mixed slot only when in TDD */ NR_ServingCellConfigCommon_t *scc = nrmac->common_channels->ServingCellConfigCommon; - lte_frame_type_t frame_type = nrmac->common_channels->frame_type; + frame_type_t frame_type = nrmac->common_channels->frame_type; const int n = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; const NR_TDD_UL_DL_Pattern_t *tdd = scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 9273c38de3..7342864763 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -55,7 +55,7 @@ void calculate_preferred_ul_tda(module_id_t module_id, const NR_BWP_Uplink_t *ub /* there is a mixed slot only when in TDD */ NR_ServingCellConfigCommon_t *scc = nrmac->common_channels->ServingCellConfigCommon; - lte_frame_type_t frame_type = nrmac->common_channels->frame_type; + frame_type_t frame_type = nrmac->common_channels->frame_type; const int n = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; NR_ServingCellConfigCommonSIB_t *scc_sib1 = get_softmodem_params()->sa ? diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 0f538131dd..0ed70444b1 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -202,7 +202,7 @@ typedef struct { int p_gNB; int Ncp; int nr_band; - lte_frame_type_t frame_type; + frame_type_t frame_type; uint64_t dl_CarrierFreq; NR_BCCH_BCH_Message_t *mib; NR_BCCH_DL_SCH_Message_t *sib1; diff --git a/openair2/M2AP/m2ap_MCE_defs.h b/openair2/M2AP/m2ap_MCE_defs.h index 5267232d69..73183e89c2 100644 --- a/openair2/M2AP/m2ap_MCE_defs.h +++ b/openair2/M2AP/m2ap_MCE_defs.h @@ -170,7 +170,7 @@ typedef struct m2ap_MCE_instance_s { int32_t uplink_frequency_offset[MAX_NUM_CCs]; uint32_t Nid_cell[MAX_NUM_CCs]; int16_t N_RB_DL[MAX_NUM_CCs]; - lte_frame_type_t frame_type[MAX_NUM_CCs]; + frame_type_t frame_type[MAX_NUM_CCs]; uint32_t fdd_earfcn_DL[MAX_NUM_CCs]; uint32_t fdd_earfcn_UL[MAX_NUM_CCs]; int num_cc; diff --git a/openair2/M2AP/m2ap_eNB_defs.h b/openair2/M2AP/m2ap_eNB_defs.h index b8f7e4b3c6..0b30c33d80 100644 --- a/openair2/M2AP/m2ap_eNB_defs.h +++ b/openair2/M2AP/m2ap_eNB_defs.h @@ -181,7 +181,7 @@ typedef struct m2ap_eNB_instance_s { int32_t uplink_frequency_offset[MAX_NUM_CCs]; uint32_t Nid_cell[MAX_NUM_CCs]; int16_t N_RB_DL[MAX_NUM_CCs]; - lte_frame_type_t frame_type[MAX_NUM_CCs]; + frame_type_t frame_type[MAX_NUM_CCs]; uint32_t fdd_earfcn_DL[MAX_NUM_CCs]; uint32_t fdd_earfcn_UL[MAX_NUM_CCs]; int num_cc; diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c index 9b9e267828..f24c9ab1b6 100644 --- a/openair2/RRC/LTE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c @@ -1757,7 +1757,7 @@ int rrc_eNB_process_PAGING_IND(MessageDef *msg_p, const char *msg_name, instance && RC.rrc[instance]->configuration.mnc[j] == S1AP_PAGING_IND(msg_p).plmn_identity[tai_size].mnc && RC.rrc[instance]->configuration.tac == S1AP_PAGING_IND(msg_p).tac[tai_size]) { for (uint8_t CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - lte_frame_type_t frame_type = RC.eNB[instance][CC_id]->frame_parms.frame_type; + frame_type_t frame_type = RC.eNB[instance][CC_id]->frame_parms.frame_type; /* get nB from configuration */ /* get default DRX cycle from configuration */ Tc = (uint8_t)RC.rrc[instance]->configuration.radioresourceconfig[CC_id].pcch_defaultPagingCycle; diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index bb2a180146..54fb5a168b 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -216,7 +216,7 @@ void prepare_sim_uecap(NR_UE_NR_Capability_t *cap, void nr_rrc_config_dl_tda(NR_ServingCellConfigCommon_t *scc){ - lte_frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); + frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); int curr_bwp = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; // coreset duration setting to be improved in the framework of RRC harmonization, potentially using a common function int len_coreset = 1; @@ -253,7 +253,7 @@ void nr_rrc_config_ul_tda(NR_ServingCellConfigCommon_t *scc, int min_fb_delay){ uint8_t DELTA[4]= {2,3,4,6}; // Delta parameter for Msg3 int mu = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing; - lte_frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); + frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); struct NR_PUSCH_TimeDomainResourceAllocation *pusch_timedomainresourceallocation = CALLOC(1,sizeof(struct NR_PUSCH_TimeDomainResourceAllocation)); pusch_timedomainresourceallocation->k2 = CALLOC(1,sizeof(long)); diff --git a/openair2/UTIL/OCG/OCG.h b/openair2/UTIL/OCG/OCG.h index 58cc7184e7..452581bb17 100644 --- a/openair2/UTIL/OCG/OCG.h +++ b/openair2/UTIL/OCG/OCG.h @@ -700,7 +700,7 @@ typedef struct { unsigned int n_frames_flag; // if set, then let the emulation goes to infinity node_function_t node_function[MAX_NUM_CCs]; node_timing_t node_timing[MAX_NUM_CCs]; - unsigned char frame_type[MAX_NUM_CCs]; //! LTE frame type (TDD=1, FDD=0). \note this should be converted to \ref lte_frame_type_t (header file reorganization needed) + unsigned char frame_type[MAX_NUM_CCs]; //! LTE frame type (TDD=1, FDD=0). \note this should be converted to \ref frame_type_t (header file reorganization needed) char *frame_type_name[MAX_NUM_CCs]; unsigned char tdd_config[MAX_NUM_CCs]; unsigned char tdd_config_S[MAX_NUM_CCs]; diff --git a/openair2/X2AP/x2ap_eNB_defs.h b/openair2/X2AP/x2ap_eNB_defs.h index 063302d03a..bd6092e0cb 100644 --- a/openair2/X2AP/x2ap_eNB_defs.h +++ b/openair2/X2AP/x2ap_eNB_defs.h @@ -172,7 +172,7 @@ typedef struct x2ap_eNB_instance_s { int32_t uplink_frequency_offset[MAX_NUM_CCs]; uint32_t Nid_cell[MAX_NUM_CCs]; int16_t N_RB_DL[MAX_NUM_CCs]; - lte_frame_type_t frame_type[MAX_NUM_CCs]; + frame_type_t frame_type[MAX_NUM_CCs]; uint32_t fdd_earfcn_DL[MAX_NUM_CCs]; uint32_t fdd_earfcn_UL[MAX_NUM_CCs]; uint32_t subframeAssignment[MAX_NUM_CCs]; diff --git a/openair3/M3AP/m3ap_MCE_defs.h b/openair3/M3AP/m3ap_MCE_defs.h index 18ad70a408..4dcb2b4db0 100644 --- a/openair3/M3AP/m3ap_MCE_defs.h +++ b/openair3/M3AP/m3ap_MCE_defs.h @@ -170,7 +170,7 @@ typedef struct m3ap_MCE_instance_s { int32_t uplink_frequency_offset[MAX_NUM_CCs]; uint32_t Nid_cell[MAX_NUM_CCs]; int16_t N_RB_DL[MAX_NUM_CCs]; - lte_frame_type_t frame_type[MAX_NUM_CCs]; + frame_type_t frame_type[MAX_NUM_CCs]; uint32_t fdd_earfcn_DL[MAX_NUM_CCs]; uint32_t fdd_earfcn_UL[MAX_NUM_CCs]; int num_cc; diff --git a/openair3/M3AP/m3ap_MME_defs.h b/openair3/M3AP/m3ap_MME_defs.h index 3b5725655d..6608587cc3 100644 --- a/openair3/M3AP/m3ap_MME_defs.h +++ b/openair3/M3AP/m3ap_MME_defs.h @@ -170,7 +170,7 @@ typedef struct m3ap_MME_instance_s { int32_t uplink_frequency_offset[MAX_NUM_CCs]; uint32_t Nid_cell[MAX_NUM_CCs]; int16_t N_RB_DL[MAX_NUM_CCs]; - lte_frame_type_t frame_type[MAX_NUM_CCs]; + frame_type_t frame_type[MAX_NUM_CCs]; uint32_t fdd_earfcn_DL[MAX_NUM_CCs]; uint32_t fdd_earfcn_UL[MAX_NUM_CCs]; int num_cc; diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 9010a40bf9..eaeb22d096 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -111,7 +111,7 @@ typedef struct eutra_band_s { uint32_t ul_max; uint32_t dl_min; uint32_t dl_max; - lte_frame_type_t frame_type; + frame_type_t frame_type; } eutra_band_t; typedef struct band_info_s { From 32b2f76c578ae6f2443d6cb9f3aac6f63a9a6625 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Wed, 20 Apr 2022 14:30:13 +0200 Subject: [PATCH 060/114] fix(ci): first port to the new Eurecom infrastructure: * Proxy no longer required for git cloning * Most of the IP addresses have been changed - Remaining --> 192.168.18.89 for amariue Signed-off-by: Raphael Defosseux --- ci-scripts/build_fr1_template.yaml | 2 +- ci-scripts/ci_ueinfra.yaml | 6 +-- ci-scripts/cls_containerize.py | 46 +++++++++---------- .../enb.band38.lte_2x2.100PRB.usrpn310.conf | 2 +- ...nb.band38.lte_2x2_tm2.100PRB.usrpn310.conf | 2 +- .../enb.band38.nsa_2x2.100PRB.usrpn310.conf | 2 +- ...sci_gnb.band78.sa.fr1.106PRB.usrpn310.conf | 2 +- ...oxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf | 2 +- .../gNB_SA_n78_106PRB.2x2_usrpn310.conf | 6 +-- .../gNB_SA_n78_133PRB.2x2_usrpn310.conf | 6 +-- .../gnb.band78.nsa_2x2.106PRB.usrpn310.conf | 2 +- ...and78.sa.fr1.106PRB.2x2.usrpn310.asue.conf | 2 +- ...gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf | 2 +- .../gnb.band78.sa.fr1.106PRB.usrpn310.conf | 2 +- ...gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf | 2 +- ci-scripts/main.py | 14 +++--- ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml | 4 +- .../fr1_nsa_2x2_quectel_attach_detach.xml | 4 +- .../xml_files/fr1_sa_amarisoft_ue_1x.xml | 2 +- ci-scripts/xml_files/fr1_sa_oaiue_b200.xml | 2 +- ci-scripts/xml_files/fr1_sa_oaiue_n310.xml | 4 +- ci-scripts/xml_files/fr1_sa_oaiue_x300.xml | 2 +- ci-scripts/xml_files/fr1_sa_quectel.xml | 2 +- .../xml_files/fr1_sa_quectel_162prb.xml | 2 +- .../xml_files/fr1_sa_quectel_stages.xml | 2 +- .../fr1_sa_quectel_stages_162prb.xml | 2 +- ci-scripts/xml_files/lte_2x2_tm1_quectel.xml | 2 +- ci-scripts/xml_files/lte_2x2_tm2_quectel.xml | 2 +- .../4g_rfsimulator_fdd_05MHz/README.md | 2 +- .../docker-compose.yml | 2 +- .../docker-compose.yml | 2 +- .../docker-compose.yml | 2 +- .../docker-compose.yml | 2 +- .../5g_f1_rfsimulator/docker-compose.yaml | 2 +- .../5g_fdd_rfsimulator/docker-compose.yaml | 2 +- ci-scripts/yaml_files/5g_l2sim_tdd/README.md | 8 ++-- .../5g_l2sim_tdd/docker-compose.yaml | 6 +-- .../5g_rfsimulator/docker-compose.yaml | 2 +- .../fr1_epc_20897/docker-compose.yml | 2 +- .../magma_nsa_20897/docker-compose.yml | 2 +- .../nsa_b200_enb/docker-compose.yml | 4 +- .../nsa_b200_gnb/docker-compose.yml | 4 +- 42 files changed, 86 insertions(+), 86 deletions(-) diff --git a/ci-scripts/build_fr1_template.yaml b/ci-scripts/build_fr1_template.yaml index 02e49bc4b5..5c7b2fc6f4 100755 --- a/ci-scripts/build_fr1_template.yaml +++ b/ci-scripts/build_fr1_template.yaml @@ -14,7 +14,7 @@ steps: ADB: #on Caracal - ADBIPAddress : 192.168.18.196 + ADBIPAddress : 172.21.16.132 ADBUserName : oaici ADBPassword : KkexF6CErOi1fNuebCPsuIVK diff --git a/ci-scripts/ci_ueinfra.yaml b/ci-scripts/ci_ueinfra.yaml index 89bda5fa92..b58e14ff6a 100644 --- a/ci-scripts/ci_ueinfra.yaml +++ b/ci-scripts/ci_ueinfra.yaml @@ -12,7 +12,7 @@ idefix: LogStore : /media/usb-drive/ci_qlogs PLMN : 22201 UENetwork : wwan0 - HostIPAddress : 192.168.18.188 + HostIPAddress : 172.21.16.135 HostUsername : oaicicd HostPassword : oaicicd HostSourceCodePath : none @@ -32,7 +32,7 @@ nrmodule2_quectel: LogStore : /media/ci_qlogs PLMN : 20897 UENetwork : wwan0 - HostIPAddress : 192.168.18.189 + HostIPAddress : 172.21.16.139 HostUsername : nrmodule2 HostPassword : linux HostSourceCodePath : none @@ -97,7 +97,7 @@ dummy: DetachScript : '' PLMN : 22201 UENetwork : wwan0 - HostIPAddress : 192.168.18.188 + HostIPAddress : 172.21.16.135 HostUsername : oaicicd HostPassword : oaicicd HostSourceCodePath : none diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 8092febe39..89a3ac586d 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -243,7 +243,7 @@ class Containerize(): # Build the base image only on Push Events (not on Merge Requests) # On when the base image docker file is being modified. if forceBaseImageBuild: - mySSH.command(self.cli + ' build ' + self.cliBuildOptions + ' --target ' + baseImage + ' --tag ' + baseImage + ':' + baseTag + ' --file docker/Dockerfile.base' + self.dockerfileprefix + ' --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" . > cmake_targets/log/ran-base.log 2>&1', '\$', 1600) + mySSH.command(self.cli + ' build ' + self.cliBuildOptions + ' --target ' + baseImage + ' --tag ' + baseImage + ':' + baseTag + ' --file docker/Dockerfile.base' + self.dockerfileprefix + ' . > cmake_targets/log/ran-base.log 2>&1', '\$', 1600) # First verify if the base image was properly created. status = True mySSH.command(self.cli + ' image inspect --format=\'Size = {{.Size}} bytes\' ' + baseImage + ':' + baseTag, '\$', 5) @@ -1146,19 +1146,19 @@ class Containerize(): 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('192.168.18.194', mySSH.getBefore()) + 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 192.168.18.194 dev eno1', '\$', 10) + 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('192.168.18.193', mySSH.getBefore()) + 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 192.168.18.193 dev eno1', '\$', 10) + mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.128/26 via 172.21.16.128 dev eno1', '\$', 10) # Check if route to nepes gnb exists mySSH.command('ip route | grep --colour=never "192.168.68.192/26"', '\$', 10) - result = re.search('192.168.18.209', mySSH.getBefore()) + 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 192.168.18.209 dev eno1', '\$', 10) + 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()) @@ -1174,19 +1174,19 @@ class Containerize(): 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('192.168.18.210', mySSH.getBefore()) + 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 192.168.18.210 dev em1', '\$', 10) + 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('192.168.18.210', mySSH.getBefore()) + 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 192.168.18.210 dev em1', '\$', 10) + 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('192.168.18.193', mySSH.getBefore()) + 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 192.168.18.193 dev em1', '\$', 10) + 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()) @@ -1202,19 +1202,19 @@ class Containerize(): 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('192.168.18.210', mySSH.getBefore()) + 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 192.168.18.210 dev eno1', '\$', 10) + 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('192.168.18.194', mySSH.getBefore()) + 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 192.168.18.194 dev eno1', '\$', 10) + 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('192.168.18.209', mySSH.getBefore()) + 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 192.168.18.209 dev eno1', '\$', 10) + 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()) @@ -1230,14 +1230,14 @@ class Containerize(): 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('192.168.18.210', mySSH.getBefore()) + 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 192.168.18.210 dev enp0s31f6', '\$', 10) + mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.61.192/26 via 172.21.16.136 dev enp0s31f6', '\$', 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('192.168.18.193', mySSH.getBefore()) + 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 192.168.18.193 dev enp0s31f6', '\$', 10) + mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.128/26 via 172.21.16.128 dev enp0s31f6', '\$', 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()) diff --git a/ci-scripts/conf_files/enb.band38.lte_2x2.100PRB.usrpn310.conf b/ci-scripts/conf_files/enb.band38.lte_2x2.100PRB.usrpn310.conf index fe2e031acb..a7100a97e3 100644 --- a/ci-scripts/conf_files/enb.band38.lte_2x2.100PRB.usrpn310.conf +++ b/ci-scripts/conf_files/enb.band38.lte_2x2.100PRB.usrpn310.conf @@ -237,7 +237,7 @@ RUs = ( max_pdschReferenceSignalPower = -27; max_rxgain = 75; eNB_instances = [0]; - sdr_addrs = "mgmt_addr=192.168.18.241,addr=192.168.20.2,second_addr=192.168.10.2"; + sdr_addrs = "mgmt_addr=172.21.19.13,addr=192.168.20.2,second_addr=192.168.10.2"; } ); diff --git a/ci-scripts/conf_files/enb.band38.lte_2x2_tm2.100PRB.usrpn310.conf b/ci-scripts/conf_files/enb.band38.lte_2x2_tm2.100PRB.usrpn310.conf index a0742c57a6..1f358c1571 100644 --- a/ci-scripts/conf_files/enb.band38.lte_2x2_tm2.100PRB.usrpn310.conf +++ b/ci-scripts/conf_files/enb.band38.lte_2x2_tm2.100PRB.usrpn310.conf @@ -237,7 +237,7 @@ RUs = ( max_pdschReferenceSignalPower = -27; max_rxgain = 75; eNB_instances = [0]; - sdr_addrs = "mgmt_addr=192.168.18.241,addr=192.168.20.2,second_addr=192.168.10.2"; + sdr_addrs = "mgmt_addr=172.21.19.13,addr=192.168.20.2,second_addr=192.168.10.2"; } ); diff --git a/ci-scripts/conf_files/enb.band38.nsa_2x2.100PRB.usrpn310.conf b/ci-scripts/conf_files/enb.band38.nsa_2x2.100PRB.usrpn310.conf index dfc9beda71..f7088aee52 100644 --- a/ci-scripts/conf_files/enb.band38.nsa_2x2.100PRB.usrpn310.conf +++ b/ci-scripts/conf_files/enb.band38.nsa_2x2.100PRB.usrpn310.conf @@ -237,7 +237,7 @@ RUs = ( max_pdschReferenceSignalPower = -27; max_rxgain = 75; eNB_instances = [0]; - sdr_addrs = "mgmt_addr=192.168.18.241,addr=192.168.20.2,second_addr=192.168.10.2"; + sdr_addrs = "mgmt_addr=172.21.19.13,addr=192.168.20.2,second_addr=192.168.10.2"; } ); diff --git a/ci-scripts/conf_files/episci/episci_gnb.band78.sa.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/episci/episci_gnb.band78.sa.fr1.106PRB.usrpn310.conf index 40f6f911b1..51ffb1d5cd 100644 --- a/ci-scripts/conf_files/episci/episci_gnb.band78.sa.fr1.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/episci/episci_gnb.band78.sa.fr1.106PRB.usrpn310.conf @@ -239,7 +239,7 @@ RUs = ( #beamforming 1x4 matrix: bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000]; #clock_src = "external"; - sdr_addrs = "mgmt_addr=192.168.18.240,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" + sdr_addrs = "mgmt_addr=172.21.19.14,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/ci-scripts/conf_files/episci/proxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/episci/proxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf index edcd4f06ff..f80ce3751a 100644 --- a/ci-scripts/conf_files/episci/proxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/episci/proxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf @@ -240,7 +240,7 @@ RUs = ( #beamforming 1x4 matrix: bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000]; #clock_src = "external"; - sdr_addrs = "mgmt_addr=192.168.18.240,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" + sdr_addrs = "mgmt_addr=172.21.19.14,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/ci-scripts/conf_files/gNB_SA_n78_106PRB.2x2_usrpn310.conf b/ci-scripts/conf_files/gNB_SA_n78_106PRB.2x2_usrpn310.conf index 33ab30887f..d6edc09286 100644 --- a/ci-scripts/conf_files/gNB_SA_n78_106PRB.2x2_usrpn310.conf +++ b/ci-scripts/conf_files/gNB_SA_n78_106PRB.2x2_usrpn310.conf @@ -209,9 +209,9 @@ gNBs = { GNB_INTERFACE_NAME_FOR_NG_AMF = "em1"; - GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.18.194/24"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "172.21.16.127/24"; GNB_INTERFACE_NAME_FOR_NGU = "em1"; - GNB_IPV4_ADDRESS_FOR_NGU = "192.168.18.194/24"; + GNB_IPV4_ADDRESS_FOR_NGU = "172.21.16.127/24"; GNB_PORT_FOR_S1U = 2152; # Spec 2152 }; @@ -258,7 +258,7 @@ RUs = ( ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; - sdr_addrs = "mgmt_addr=192.168.18.252,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" + sdr_addrs = "mgmt_addr=172.21.19.14,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/ci-scripts/conf_files/gNB_SA_n78_133PRB.2x2_usrpn310.conf b/ci-scripts/conf_files/gNB_SA_n78_133PRB.2x2_usrpn310.conf index 4a5eaec89b..7f4b11c35d 100644 --- a/ci-scripts/conf_files/gNB_SA_n78_133PRB.2x2_usrpn310.conf +++ b/ci-scripts/conf_files/gNB_SA_n78_133PRB.2x2_usrpn310.conf @@ -206,9 +206,9 @@ gNBs = { GNB_INTERFACE_NAME_FOR_NG_AMF = "em1"; - GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.18.194/24"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "172.21.16.127/24"; GNB_INTERFACE_NAME_FOR_NGU = "em1"; - GNB_IPV4_ADDRESS_FOR_NGU = "192.168.18.194/24"; + GNB_IPV4_ADDRESS_FOR_NGU = "172.21.16.127/24"; GNB_PORT_FOR_S1U = 2152; # Spec 2152 }; @@ -254,7 +254,7 @@ RUs = ( ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; - sdr_addrs = "mgmt_addr=192.168.18.252,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" + sdr_addrs = "mgmt_addr=172.21.19.14,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf index 21863dcfc7..e3bd49e7fc 100644 --- a/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf @@ -230,7 +230,7 @@ RUs = ( bf_weights = [0x00007fff, 0x00007fff]; #clock_src = "external"; sf_extension = 0 - sdr_addrs = "mgmt_addr=192.168.18.252,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" + sdr_addrs = "mgmt_addr=172.21.19.14,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.asue.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.asue.conf index 60fb16318f..5e6b3fb217 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.asue.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.asue.conf @@ -264,7 +264,7 @@ RUs = ( ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; sf_extension = 0 - sdr_addrs = "mgmt_addr=192.168.18.252,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" + sdr_addrs = "mgmt_addr=172.21.19.14,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf index 1d7c4b57f0..8489008300 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf @@ -261,7 +261,7 @@ RUs = ( ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; sf_extension = 0 - sdr_addrs = "mgmt_addr=192.168.18.252,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" + sdr_addrs = "mgmt_addr=172.21.19.14,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf index e2b331939b..9e1f499f03 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf @@ -263,7 +263,7 @@ RUs = ( ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; sf_extension = 0 - sdr_addrs = "mgmt_addr=192.168.18.252,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" + sdr_addrs = "mgmt_addr=172.21.19.14,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf index 324b3d2ce1..ce63578dd3 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf @@ -262,7 +262,7 @@ RUs = ( ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; sf_extension = 0 - sdr_addrs = "mgmt_addr=192.168.18.252,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" + sdr_addrs = "mgmt_addr=172.21.19.14,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/ci-scripts/main.py b/ci-scripts/main.py index c838c3740d..65f9fbb0da 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -779,19 +779,19 @@ 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 == '192.168.18.210': + if EPC.IPAddress == '172.21.16.136': CONTAINERS.CheckAndAddRoute('porcepix', EPC.IPAddress, EPC.UserName, EPC.Password) - if CONTAINERS.eNBIPAddress == '192.168.18.194': + if CONTAINERS.eNBIPAddress == '172.21.16.127': CONTAINERS.CheckAndAddRoute('asterix', CONTAINERS.eNBIPAddress, CONTAINERS.eNBUserName, CONTAINERS.eNBPassword) - if CONTAINERS.eNB1IPAddress == '192.168.18.194': + if CONTAINERS.eNB1IPAddress == '172.21.16.127': CONTAINERS.CheckAndAddRoute('asterix', CONTAINERS.eNB1IPAddress, CONTAINERS.eNB1UserName, CONTAINERS.eNB1Password) - if CONTAINERS.eNBIPAddress == '192.168.18.193': + if CONTAINERS.eNBIPAddress == '172.21.16.128': CONTAINERS.CheckAndAddRoute('obelix', CONTAINERS.eNBIPAddress, CONTAINERS.eNBUserName, CONTAINERS.eNBPassword) - if CONTAINERS.eNB1IPAddress == '192.168.18.193': + if CONTAINERS.eNB1IPAddress == '172.21.16.128': CONTAINERS.CheckAndAddRoute('obelix', CONTAINERS.eNB1IPAddress, CONTAINERS.eNB1UserName, CONTAINERS.eNB1Password) - if CONTAINERS.eNBIPAddress == '192.168.18.209': + if CONTAINERS.eNBIPAddress == '172.21.16.137': CONTAINERS.CheckAndAddRoute('nepes', CONTAINERS.eNBIPAddress, CONTAINERS.eNBUserName, CONTAINERS.eNBPassword) - if CONTAINERS.eNB1IPAddress == '192.168.18.209': + if CONTAINERS.eNB1IPAddress == '172.21.16.137': CONTAINERS.CheckAndAddRoute('nepes', CONTAINERS.eNB1IPAddress, CONTAINERS.eNB1UserName, CONTAINERS.eNB1Password) CiTestObj.FailReportCnt = 0 diff --git a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml index 56694920ba..a4dcb58e8b 100644 --- a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml +++ b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml @@ -68,7 +68,7 @@ lte yes yes - 192.168.18.241 + 172.21.19.13 @@ -81,7 +81,7 @@ nr yes datalog_rt_stats.2x2.yaml - 192.168.18.252 + 172.21.19.14 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 840521481e..335fe873a1 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 @@ -87,7 +87,7 @@ lte yes yes - 192.168.18.241 + 172.21.19.13 @@ -100,7 +100,7 @@ nr yes datalog_rt_stats.2x2.yaml - 192.168.18.252 + 172.21.19.14 diff --git a/ci-scripts/xml_files/fr1_sa_amarisoft_ue_1x.xml b/ci-scripts/xml_files/fr1_sa_amarisoft_ue_1x.xml index 194ed4e453..ea031a0174 100644 --- a/ci-scripts/xml_files/fr1_sa_amarisoft_ue_1x.xml +++ b/ci-scripts/xml_files/fr1_sa_amarisoft_ue_1x.xml @@ -52,7 +52,7 @@ yes yes datalog_rt_stats.2x2.yaml - 192.168.18.252 + 172.21.19.14 diff --git a/ci-scripts/xml_files/fr1_sa_oaiue_b200.xml b/ci-scripts/xml_files/fr1_sa_oaiue_b200.xml index 55268b909d..5995f75a64 100644 --- a/ci-scripts/xml_files/fr1_sa_oaiue_b200.xml +++ b/ci-scripts/xml_files/fr1_sa_oaiue_b200.xml @@ -60,7 +60,7 @@ nr yes yes - 192.168.18.252 + 172.21.19.14 diff --git a/ci-scripts/xml_files/fr1_sa_oaiue_n310.xml b/ci-scripts/xml_files/fr1_sa_oaiue_n310.xml index 53b696c6eb..468005f54f 100644 --- a/ci-scripts/xml_files/fr1_sa_oaiue_n310.xml +++ b/ci-scripts/xml_files/fr1_sa_oaiue_n310.xml @@ -42,7 +42,7 @@ Initialize_OAI_UE Initialize OAI UE (N310) nr - --sa -O ../../../ci-scripts/conf_files/ue.sa.conf --usrp-args "mgmt_addr=192.168.18.241,addr=192.168.10.2" --numerology 1 -r 106 --band 78 -C 3319680000 --nokrnmod 1 --ue-txgain 0 --ue-rxgain 70 --ue-fo-compensation --log_config.global_log_options level,nocolor,time + --sa -O ../../../ci-scripts/conf_files/ue.sa.conf --usrp-args "mgmt_addr=172.21.19.13,addr=192.168.10.2" --numerology 1 -r 106 --band 78 -C 3319680000 --nokrnmod 1 --ue-txgain 0 --ue-rxgain 70 --ue-fo-compensation --log_config.global_log_options level,nocolor,time @@ -60,7 +60,7 @@ nr yes yes - 192.168.18.252 + 172.21.19.14 diff --git a/ci-scripts/xml_files/fr1_sa_oaiue_x300.xml b/ci-scripts/xml_files/fr1_sa_oaiue_x300.xml index 8c2f7052e4..ef001a7518 100644 --- a/ci-scripts/xml_files/fr1_sa_oaiue_x300.xml +++ b/ci-scripts/xml_files/fr1_sa_oaiue_x300.xml @@ -60,7 +60,7 @@ nr yes yes - 192.168.18.252 + 172.21.19.14 diff --git a/ci-scripts/xml_files/fr1_sa_quectel.xml b/ci-scripts/xml_files/fr1_sa_quectel.xml index 576456ebc9..4d4edab56b 100644 --- a/ci-scripts/xml_files/fr1_sa_quectel.xml +++ b/ci-scripts/xml_files/fr1_sa_quectel.xml @@ -70,7 +70,7 @@ yes yes datalog_rt_stats.2x2.yaml - 192.168.18.252 + 172.21.19.14 diff --git a/ci-scripts/xml_files/fr1_sa_quectel_162prb.xml b/ci-scripts/xml_files/fr1_sa_quectel_162prb.xml index c5f2ddad5f..23eaccfcfd 100644 --- a/ci-scripts/xml_files/fr1_sa_quectel_162prb.xml +++ b/ci-scripts/xml_files/fr1_sa_quectel_162prb.xml @@ -68,7 +68,7 @@ yes yes datalog_rt_stats.2x2.yaml - 192.168.18.252 + 172.21.19.14 diff --git a/ci-scripts/xml_files/fr1_sa_quectel_stages.xml b/ci-scripts/xml_files/fr1_sa_quectel_stages.xml index 2707fd4ebf..603f3f919b 100644 --- a/ci-scripts/xml_files/fr1_sa_quectel_stages.xml +++ b/ci-scripts/xml_files/fr1_sa_quectel_stages.xml @@ -74,7 +74,7 @@ yes yes datalog_rt_stats.2x2.yaml - 192.168.18.252 + 172.21.19.14 diff --git a/ci-scripts/xml_files/fr1_sa_quectel_stages_162prb.xml b/ci-scripts/xml_files/fr1_sa_quectel_stages_162prb.xml index 661bcb32fe..9371e46ec9 100644 --- a/ci-scripts/xml_files/fr1_sa_quectel_stages_162prb.xml +++ b/ci-scripts/xml_files/fr1_sa_quectel_stages_162prb.xml @@ -74,7 +74,7 @@ yes yes datalog_rt_stats.2x2.yaml - 192.168.18.252 + 172.21.19.14 diff --git a/ci-scripts/xml_files/lte_2x2_tm1_quectel.xml b/ci-scripts/xml_files/lte_2x2_tm1_quectel.xml index 11c4abce1b..6aa53200c8 100644 --- a/ci-scripts/xml_files/lte_2x2_tm1_quectel.xml +++ b/ci-scripts/xml_files/lte_2x2_tm1_quectel.xml @@ -65,7 +65,7 @@ lte yes yes - 192.168.18.241 + 172.21.19.13 diff --git a/ci-scripts/xml_files/lte_2x2_tm2_quectel.xml b/ci-scripts/xml_files/lte_2x2_tm2_quectel.xml index 714cf51a9b..84aa87aa23 100644 --- a/ci-scripts/xml_files/lte_2x2_tm2_quectel.xml +++ b/ci-scripts/xml_files/lte_2x2_tm2_quectel.xml @@ -65,7 +65,7 @@ lte yes yes - 192.168.18.241 + 172.21.19.13 diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/README.md b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/README.md index 400559d269..be0d63838b 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/README.md +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/README.md @@ -505,7 +505,7 @@ In my traffic test, I was able to ping outside of my local network. in SPGW-C config: ```yaml - DEFAULT_DNS_IPV4_ADDRESS: 192.168.18.129 + DEFAULT_DNS_IPV4_ADDRESS: 172.21.3.100 DEFAULT_DNS_SEC_IPV4_ADDRESS: 8.8.4.4 PUSH_PROTOCOL_OPTION: 'true' ``` diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml index b15e794c10..a260857a34 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml @@ -115,7 +115,7 @@ services: TZ: Europe/Paris SGW_INTERFACE_NAME_FOR_S11: eth0 PGW_INTERFACE_NAME_FOR_SX: eth0 - DEFAULT_DNS_IPV4_ADDRESS: 192.168.18.129 + DEFAULT_DNS_IPV4_ADDRESS: 172.21.3.100 DEFAULT_DNS_SEC_IPV4_ADDRESS: 8.8.4.4 PUSH_PROTOCOL_OPTION: 'true' APN_NI_1: oai.ipv4 diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml index e1e992c94c..3f63953b0e 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml @@ -115,7 +115,7 @@ services: TZ: Europe/Paris SGW_INTERFACE_NAME_FOR_S11: eth0 PGW_INTERFACE_NAME_FOR_SX: eth0 - DEFAULT_DNS_IPV4_ADDRESS: 192.168.18.129 + DEFAULT_DNS_IPV4_ADDRESS: 172.21.3.100 DEFAULT_DNS_SEC_IPV4_ADDRESS: 8.8.4.4 PUSH_PROTOCOL_OPTION: 'true' APN_NI_1: oai.ipv4 diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml index ad665813f2..1165400273 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml @@ -115,7 +115,7 @@ services: TZ: Europe/Paris SGW_INTERFACE_NAME_FOR_S11: eth0 PGW_INTERFACE_NAME_FOR_SX: eth0 - DEFAULT_DNS_IPV4_ADDRESS: 192.168.18.129 + DEFAULT_DNS_IPV4_ADDRESS: 172.21.3.100 DEFAULT_DNS_SEC_IPV4_ADDRESS: 8.8.4.4 PUSH_PROTOCOL_OPTION: 'true' APN_NI_1: oai.ipv4 diff --git a/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml index ffa92bac49..86f6c80b59 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml @@ -115,7 +115,7 @@ services: TZ: Europe/Paris SGW_INTERFACE_NAME_FOR_S11: eth0 PGW_INTERFACE_NAME_FOR_SX: eth0 - DEFAULT_DNS_IPV4_ADDRESS: 192.168.18.129 + DEFAULT_DNS_IPV4_ADDRESS: 172.21.3.100 DEFAULT_DNS_SEC_IPV4_ADDRESS: 8.8.4.4 PUSH_PROTOCOL_OPTION: 'true' APN_NI_1: oai.ipv4 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 74a23905f0..d52b228ec6 100644 --- a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml @@ -120,7 +120,7 @@ services: - SMF_INTERFACE_PORT_FOR_SBI=80 - SMF_INTERFACE_HTTP2_PORT_FOR_SBI=9090 - SMF_API_VERSION=v1 - - DEFAULT_DNS_IPV4_ADDRESS=192.168.18.129 + - DEFAULT_DNS_IPV4_ADDRESS=172.21.3.100 - DEFAULT_DNS_SEC_IPV4_ADDRESS=4.4.4.4 - AMF_IPV4_ADDRESS=0.0.0.0 - AMF_PORT=80 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 3e46adb9e7..7758c39592 100644 --- a/ci-scripts/yaml_files/5g_fdd_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_fdd_rfsimulator/docker-compose.yaml @@ -120,7 +120,7 @@ services: - SMF_INTERFACE_PORT_FOR_SBI=80 - SMF_INTERFACE_HTTP2_PORT_FOR_SBI=9090 - SMF_API_VERSION=v1 - - DEFAULT_DNS_IPV4_ADDRESS=192.168.18.129 + - DEFAULT_DNS_IPV4_ADDRESS=172.21.3.100 - DEFAULT_DNS_SEC_IPV4_ADDRESS=4.4.4.4 - AMF_IPV4_ADDRESS=0.0.0.0 - AMF_PORT=80 diff --git a/ci-scripts/yaml_files/5g_l2sim_tdd/README.md b/ci-scripts/yaml_files/5g_l2sim_tdd/README.md index 531f2406ef..f1e1287995 100644 --- a/ci-scripts/yaml_files/5g_l2sim_tdd/README.md +++ b/ci-scripts/yaml_files/5g_l2sim_tdd/README.md @@ -326,16 +326,16 @@ Removing network l2sim-oai-traffic-net In the `SMF` section, provide your own DNS IP address: ```yaml - DEFAULT_DNS_IPV4_ADDRESS=192.168.18.129 + DEFAULT_DNS_IPV4_ADDRESS=172.21.3.100 ``` -In the `gNB` section, provide your docker-host primary IP address and interface name: in our case `192.168.18.193` and `eno1`. +In the `gNB` section, provide your docker-host primary IP address and interface name: in our case `172.21.16.128` and `eno1`. ```yaml GNB_NGA_IF_NAME: eno1 - GNB_NGA_IP_ADDRESS: 192.168.18.193 + GNB_NGA_IP_ADDRESS: 172.21.16.128 GNB_NGU_IF_NAME: eno1 - GNB_NGU_IP_ADDRESS: 192.168.18.193 + GNB_NGU_IP_ADDRESS: 172.21.16.128 ``` Same thing in the `nr-ue` section: 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 c899f8cc7e..a28b640e1a 100644 --- a/ci-scripts/yaml_files/5g_l2sim_tdd/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_l2sim_tdd/docker-compose.yaml @@ -120,7 +120,7 @@ services: - SMF_INTERFACE_PORT_FOR_SBI=80 - SMF_INTERFACE_HTTP2_PORT_FOR_SBI=9090 - SMF_API_VERSION=v1 - - DEFAULT_DNS_IPV4_ADDRESS=192.168.18.129 + - DEFAULT_DNS_IPV4_ADDRESS=172.21.3.100 - DEFAULT_DNS_SEC_IPV4_ADDRESS=4.4.4.4 - AMF_IPV4_ADDRESS=0.0.0.0 - AMF_PORT=80 @@ -241,9 +241,9 @@ services: NSSAI_SD1: 112233 AMF_IP_ADDRESS: 192.168.71.132 GNB_NGA_IF_NAME: eno1 - GNB_NGA_IP_ADDRESS: 192.168.18.193 + GNB_NGA_IP_ADDRESS: 172.21.16.128 GNB_NGU_IF_NAME: eno1 - GNB_NGU_IP_ADDRESS: 192.168.18.193 + GNB_NGU_IP_ADDRESS: 172.21.16.128 LOCAL_S_IF_NAME: 'lo:' REMOTE_S_ADDRESS: 127.0.0.1 LOCAL_S_ADDRESS: 127.0.0.2 diff --git a/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml index f27ec3050d..696d8c6698 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml @@ -120,7 +120,7 @@ services: - SMF_INTERFACE_PORT_FOR_SBI=80 - SMF_INTERFACE_HTTP2_PORT_FOR_SBI=9090 - SMF_API_VERSION=v1 - - DEFAULT_DNS_IPV4_ADDRESS=192.168.18.129 + - DEFAULT_DNS_IPV4_ADDRESS=172.21.3.100 - DEFAULT_DNS_SEC_IPV4_ADDRESS=4.4.4.4 - AMF_IPV4_ADDRESS=0.0.0.0 - AMF_PORT=80 diff --git a/ci-scripts/yaml_files/fr1_epc_20897/docker-compose.yml b/ci-scripts/yaml_files/fr1_epc_20897/docker-compose.yml index a3675dc78e..91d15b5251 100644 --- a/ci-scripts/yaml_files/fr1_epc_20897/docker-compose.yml +++ b/ci-scripts/yaml_files/fr1_epc_20897/docker-compose.yml @@ -132,7 +132,7 @@ services: TZ: Europe/Paris SGW_INTERFACE_NAME_FOR_S11: eth0 PGW_INTERFACE_NAME_FOR_SX: eth0 - DEFAULT_DNS_IPV4_ADDRESS: 192.168.18.129 + DEFAULT_DNS_IPV4_ADDRESS: 172.21.3.100 DEFAULT_DNS_SEC_IPV4_ADDRESS: 8.8.4.4 PUSH_PROTOCOL_OPTION: 'true' APN_NI_1: oai.ipv4 diff --git a/ci-scripts/yaml_files/magma_nsa_20897/docker-compose.yml b/ci-scripts/yaml_files/magma_nsa_20897/docker-compose.yml index df14e900e7..f320e7e3df 100644 --- a/ci-scripts/yaml_files/magma_nsa_20897/docker-compose.yml +++ b/ci-scripts/yaml_files/magma_nsa_20897/docker-compose.yml @@ -116,7 +116,7 @@ services: TZ: Europe/Paris SGW_INTERFACE_NAME_FOR_S11: eth0 PGW_INTERFACE_NAME_FOR_SX: eth0 - DEFAULT_DNS_IPV4_ADDRESS: 192.168.18.129 + DEFAULT_DNS_IPV4_ADDRESS: 172.21.3.100 DEFAULT_DNS_SEC_IPV4_ADDRESS: 8.8.4.4 PUSH_PROTOCOL_OPTION: 'true' APN_NI_1: oai.ipv4 diff --git a/ci-scripts/yaml_files/nsa_b200_enb/docker-compose.yml b/ci-scripts/yaml_files/nsa_b200_enb/docker-compose.yml index 92ccdf8a0a..2df5eac61b 100644 --- a/ci-scripts/yaml_files/nsa_b200_enb/docker-compose.yml +++ b/ci-scripts/yaml_files/nsa_b200_enb/docker-compose.yml @@ -20,7 +20,7 @@ services: NB_PRB: 25 ENABLE_MEASUREMENT_REPORTS: 'yes' ENABLE_X2: 'yes' - MME_S1C_IP_ADDRESS: 192.168.18.210 + MME_S1C_IP_ADDRESS: 172.21.16.136 ENB_S1C_IF_NAME: eth0 ENB_S1C_IP_ADDRESS: 192.168.68.130 ENB_S1U_IF_NAME: eth0 @@ -29,7 +29,7 @@ services: RRC_INACTIVITY_THRESHOLD: 0 FLEXRAN_ENABLED: 'no' FLEXRAN_INTERFACE_NAME: eth0 - FLEXRAN_IPV4_ADDRESS: 192.168.18.210 + FLEXRAN_IPV4_ADDRESS: 172.21.16.136 THREAD_PARALLEL_CONFIG: PARALLEL_SINGLE_THREAD USE_ADDITIONAL_OPTIONS: --log_config.global_log_options level,nocolor,time,line_num,function volumes: 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 c6096956a8..61266aa2b1 100644 --- a/ci-scripts/yaml_files/nsa_b200_gnb/docker-compose.yml +++ b/ci-scripts/yaml_files/nsa_b200_gnb/docker-compose.yml @@ -15,7 +15,7 @@ services: TAC: 1 ENABLE_X2: 'yes' ENB_X2_IP_ADDRESS: 192.168.68.130 - MME_S1C_IP_ADDRESS: 192.168.18.210 + MME_S1C_IP_ADDRESS: 172.21.16.136 GNB_S1C_IF_NAME: eth0 GNB_S1C_IP_ADDRESS: 192.168.68.194 GNB_S1U_IF_NAME: eth0 @@ -24,7 +24,7 @@ services: RRC_INACTIVITY_THRESHOLD: 0 FLEXRAN_ENABLED: 'no' FLEXRAN_INTERFACE_NAME: eth0 - FLEXRAN_IPV4_ADDRESS: 192.168.18.210 + FLEXRAN_IPV4_ADDRESS: 172.21.16.136 THREAD_PARALLEL_CONFIG: PARALLEL_RU_L1_TRX_SPLIT USE_ADDITIONAL_OPTIONS: -E -q --RUs.[0].sdr_addrs serial=30C51D4 --log_config.global_log_options level,nocolor,time,line_num,function volumes: From d592b1ff5bcb8743129006bb43a5a2501b5a14ec Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Wed, 20 Apr 2022 17:56:25 +0200 Subject: [PATCH 061/114] fix(ci): dummy commit to re-trigger Signed-off-by: Raphael Defosseux --- ci-scripts/ci_ueinfra.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/ci-scripts/ci_ueinfra.yaml b/ci-scripts/ci_ueinfra.yaml index b58e14ff6a..b888f6bb59 100644 --- a/ci-scripts/ci_ueinfra.yaml +++ b/ci-scripts/ci_ueinfra.yaml @@ -40,6 +40,7 @@ nrmodule2_quectel: - sudo -S ip link set dev wwan1 mtu 1500 MTU : 1500 +# CAUTION: 192.168.18.89 address has to be changed when the server is moved #single UE single ping amarisoft_ue_1: ID: amarisoft_ue_1 From b8ac9d5db9a171424000ae9015abb500f89ae853 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Thu, 21 Apr 2022 12:30:08 +0200 Subject: [PATCH 062/114] fix(ci): fix helm charts for phy-sim testing on cluster new infra Signed-off-by: Raphael Defosseux --- charts/physims/charts/dlsim/values.yaml | 4 +-- charts/physims/charts/ldpctest/values.yaml | 4 +-- charts/physims/charts/nr-dlschsim/values.yaml | 4 +-- charts/physims/charts/nr-dlsim/values.yaml | 4 +-- charts/physims/charts/nr-pbchsim/values.yaml | 4 +-- charts/physims/charts/nr-prachsim/values.yaml | 4 +-- charts/physims/charts/nr-pucchsim/values.yaml | 4 +-- charts/physims/charts/nr-ulschsim/values.yaml | 4 +-- charts/physims/charts/nr-ulsim/values.yaml | 4 +-- charts/physims/charts/polartest/values.yaml | 4 +-- .../physims/charts/smallblocktest/values.yaml | 4 +-- charts/physims/charts/ulsim/values.yaml | 4 +-- charts/physims/templates/rbac.yaml | 30 ++++++++++++++----- charts/physims/values.yaml | 4 +-- ci-scripts/cls_physim1.py | 30 +++++++++++++------ 15 files changed, 69 insertions(+), 43 deletions(-) diff --git a/charts/physims/charts/dlsim/values.yaml b/charts/physims/charts/dlsim/values.yaml index d78fbb7409..7f45b42f72 100644 --- a/charts/physims/charts/dlsim/values.yaml +++ b/charts/physims/charts/dlsim/values.yaml @@ -4,11 +4,11 @@ replicaCount: 1 -namespace: "oaicicd-ran-tmp" +namespace: "OAICICD_PROJECT" image: registry: local - repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + repository: image-registry.openshift-image-registry.svc:5000/OAICICD_PROJECT/oai-physim version: temp # pullPolicy: IfNotPresent or Never or Always pullPolicy: Always diff --git a/charts/physims/charts/ldpctest/values.yaml b/charts/physims/charts/ldpctest/values.yaml index e2e6467923..b3cc476cf8 100644 --- a/charts/physims/charts/ldpctest/values.yaml +++ b/charts/physims/charts/ldpctest/values.yaml @@ -4,11 +4,11 @@ replicaCount: 1 -namespace: "oaicicd-ran-tmp" +namespace: "OAICICD_PROJECT" image: registry: local - repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + repository: image-registry.openshift-image-registry.svc:5000/OAICICD_PROJECT/oai-physim version: temp # pullPolicy: IfNotPresent or Never or Always pullPolicy: Always diff --git a/charts/physims/charts/nr-dlschsim/values.yaml b/charts/physims/charts/nr-dlschsim/values.yaml index 8944e7e724..b7ef28f47a 100644 --- a/charts/physims/charts/nr-dlschsim/values.yaml +++ b/charts/physims/charts/nr-dlschsim/values.yaml @@ -4,11 +4,11 @@ replicaCount: 1 -namespace: "oaicicd-ran-tmp" +namespace: "OAICICD_PROJECT" image: registry: local - repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + repository: image-registry.openshift-image-registry.svc:5000/OAICICD_PROJECT/oai-physim version: temp # pullPolicy: IfNotPresent or Never or Always pullPolicy: Always diff --git a/charts/physims/charts/nr-dlsim/values.yaml b/charts/physims/charts/nr-dlsim/values.yaml index 573e8630de..2a35912fee 100644 --- a/charts/physims/charts/nr-dlsim/values.yaml +++ b/charts/physims/charts/nr-dlsim/values.yaml @@ -4,11 +4,11 @@ replicaCount: 1 -namespace: "oaicicd-ran-tmp" +namespace: "OAICICD_PROJECT" image: registry: local - repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + repository: image-registry.openshift-image-registry.svc:5000/OAICICD_PROJECT/oai-physim version: temp # pullPolicy: IfNotPresent or Never or Always pullPolicy: Always diff --git a/charts/physims/charts/nr-pbchsim/values.yaml b/charts/physims/charts/nr-pbchsim/values.yaml index 28c4678334..9a25d2810d 100644 --- a/charts/physims/charts/nr-pbchsim/values.yaml +++ b/charts/physims/charts/nr-pbchsim/values.yaml @@ -4,11 +4,11 @@ replicaCount: 1 -namespace: "oaicicd-ran-tmp" +namespace: "OAICICD_PROJECT" image: registry: local - repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + repository: image-registry.openshift-image-registry.svc:5000/OAICICD_PROJECT/oai-physim version: temp # pullPolicy: IfNotPresent or Never or Always pullPolicy: Always diff --git a/charts/physims/charts/nr-prachsim/values.yaml b/charts/physims/charts/nr-prachsim/values.yaml index 9e3c68b54d..dba6cc16c0 100644 --- a/charts/physims/charts/nr-prachsim/values.yaml +++ b/charts/physims/charts/nr-prachsim/values.yaml @@ -4,11 +4,11 @@ replicaCount: 1 -namespace: "oaicicd-ran-tmp" +namespace: "OAICICD_PROJECT" image: registry: local - repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + repository: image-registry.openshift-image-registry.svc:5000/OAICICD_PROJECT/oai-physim version: temp # pullPolicy: IfNotPresent or Never or Always pullPolicy: Always diff --git a/charts/physims/charts/nr-pucchsim/values.yaml b/charts/physims/charts/nr-pucchsim/values.yaml index 449670f713..77fe0963ac 100644 --- a/charts/physims/charts/nr-pucchsim/values.yaml +++ b/charts/physims/charts/nr-pucchsim/values.yaml @@ -4,11 +4,11 @@ replicaCount: 1 -namespace: "oaicicd-ran-tmp" +namespace: "OAICICD_PROJECT" image: registry: local - repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + repository: image-registry.openshift-image-registry.svc:5000/OAICICD_PROJECT/oai-physim version: temp # pullPolicy: IfNotPresent or Never or Always pullPolicy: Always diff --git a/charts/physims/charts/nr-ulschsim/values.yaml b/charts/physims/charts/nr-ulschsim/values.yaml index a3afc090e8..efb011a7f6 100644 --- a/charts/physims/charts/nr-ulschsim/values.yaml +++ b/charts/physims/charts/nr-ulschsim/values.yaml @@ -4,11 +4,11 @@ replicaCount: 1 -namespace: "oaicicd-ran-tmp" +namespace: "OAICICD_PROJECT" image: registry: local - repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + repository: image-registry.openshift-image-registry.svc:5000/OAICICD_PROJECT/oai-physim version: temp # pullPolicy: IfNotPresent or Never or Always pullPolicy: Always diff --git a/charts/physims/charts/nr-ulsim/values.yaml b/charts/physims/charts/nr-ulsim/values.yaml index 2bf96498e8..71c455b69c 100644 --- a/charts/physims/charts/nr-ulsim/values.yaml +++ b/charts/physims/charts/nr-ulsim/values.yaml @@ -4,11 +4,11 @@ replicaCount: 1 -namespace: "oaicicd-ran-tmp" +namespace: "OAICICD_PROJECT" image: registry: local - repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + repository: image-registry.openshift-image-registry.svc:5000/OAICICD_PROJECT/oai-physim version: temp # pullPolicy: IfNotPresent or Never or Always pullPolicy: Always diff --git a/charts/physims/charts/polartest/values.yaml b/charts/physims/charts/polartest/values.yaml index e0a532fdd8..e0751e8ec4 100644 --- a/charts/physims/charts/polartest/values.yaml +++ b/charts/physims/charts/polartest/values.yaml @@ -4,11 +4,11 @@ replicaCount: 1 -namespace: "oaicicd-ran-tmp" +namespace: "OAICICD_PROJECT" image: registry: local - repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + repository: image-registry.openshift-image-registry.svc:5000/OAICICD_PROJECT/oai-physim version: temp # pullPolicy: IfNotPresent or Never or Always pullPolicy: Always diff --git a/charts/physims/charts/smallblocktest/values.yaml b/charts/physims/charts/smallblocktest/values.yaml index f2f113d9b6..f933a978fd 100644 --- a/charts/physims/charts/smallblocktest/values.yaml +++ b/charts/physims/charts/smallblocktest/values.yaml @@ -4,11 +4,11 @@ replicaCount: 1 -namespace: "oaicicd-ran-tmp" +namespace: "OAICICD_PROJECT" image: registry: local - repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + repository: image-registry.openshift-image-registry.svc:5000/OAICICD_PROJECT/oai-physim version: temp # pullPolicy: IfNotPresent or Never or Always pullPolicy: Always diff --git a/charts/physims/charts/ulsim/values.yaml b/charts/physims/charts/ulsim/values.yaml index 35dc14d596..d25b6fc2a5 100644 --- a/charts/physims/charts/ulsim/values.yaml +++ b/charts/physims/charts/ulsim/values.yaml @@ -4,11 +4,11 @@ replicaCount: 1 -namespace: "oaicicd-ran-tmp" +namespace: "OAICICD_PROJECT" image: registry: local - repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + repository: image-registry.openshift-image-registry.svc:5000/OAICICD_PROJECT/oai-physim version: temp # pullPolicy: IfNotPresent or Never or Always pullPolicy: Always diff --git a/charts/physims/templates/rbac.yaml b/charts/physims/templates/rbac.yaml index 35f956a203..b341744796 100644 --- a/charts/physims/templates/rbac.yaml +++ b/charts/physims/templates/rbac.yaml @@ -1,12 +1,26 @@ -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role metadata: - name: {{ .Chart.Name }}-{{ .Values.global.namespace }}-rbac -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: cluster-admin + name: {{ .Chart.Name }}-{{ .Release.Namespace }}-role +rules: +- apiGroups: + - security.openshift.io + resourceNames: + - privileged + resources: + - securitycontextconstraints + verbs: + - use +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: {{ .Chart.Name }}-{{ .Release.Namespace }}-binding subjects: - kind: ServiceAccount name: {{ .Values.global.serviceAccountName }} - namespace: {{ .Values.global.namespace }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: Role + name: {{ .Chart.Name }}-{{ .Release.Namespace }}-role + apiGroup: rbac.authorization.k8s.io diff --git a/charts/physims/values.yaml b/charts/physims/values.yaml index b348e822bb..d5253c7812 100644 --- a/charts/physims/values.yaml +++ b/charts/physims/values.yaml @@ -4,9 +4,9 @@ global: serviceAccountName: oai-physim-sa - namespace: "oaicicd-ran-tmp" + namespace: "OAICICD_PROJECT" image: - repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + repository: image-registry.openshift-image-registry.svc:5000/OAICICD_PROJECT/oai-physim version: TAG ## Declaring values specific to coressponding physim to overwrite diff --git a/ci-scripts/cls_physim1.py b/ci-scripts/cls_physim1.py index 83fb74b7cb..54329790cd 100644 --- a/ci-scripts/cls_physim1.py +++ b/ci-scripts/cls_physim1.py @@ -153,6 +153,7 @@ class PhySim: mySSH.command(f'oc project {ocProjectName}', '\$', 30) if mySSH.getBefore().count(f'Already on project "{ocProjectName}"') == 0 and mySSH.getBefore().count(f'Now using project "{self.OCProjectName}"') == 0: logging.error(f'\u001B[1m Unable to access OC project {ocProjectName}\u001B[0m') + mySSH.command('oc logout', '\$', 30) mySSH.close() HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_PROJECT_FAIL) RAN.prematureExit = True @@ -161,9 +162,10 @@ class PhySim: logging.debug(f'\u001B[1m Now using project {ocProjectName}\u001B[0m') # Tag the image and push to the OC cluster - mySSH.command('oc whoami -t | sudo podman login -u ' + ocUserName + ' --password-stdin https://default-route-openshift-image-registry.apps.5glab.nsa.eurecom.fr/ --tls-verify=false', '\$', 30) + mySSH.command('oc whoami -t | sudo podman login -u ' + ocUserName + ' --password-stdin https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/ --tls-verify=false', '\$', 30) if mySSH.getBefore().count('Login Succeeded!') == 0: logging.error('\u001B[1m Podman Login to OC Cluster Registry Failed\u001B[0m') + mySSH.command('oc logout', '\$', 30) mySSH.close() HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_LOGIN_FAIL) RAN.prematureExit = True @@ -171,9 +173,11 @@ class PhySim: else: logging.debug('\u001B[1m Podman Login to OC Cluster Registry Successfully\u001B[0m') time.sleep(2) - mySSH.command('oc create -f openshift/oai-physim-image-stream.yml', '\$', 30) + mySSH.command('oc create -f openshift/oai-physim-image-stream.yml || true', '\$', 30) if mySSH.getBefore().count('(AlreadyExists):') == 0 and mySSH.getBefore().count('created') == 0: logging.error(f'\u001B[1m Image Stream "oai-physim" Creation Failed on OC Cluster {ocProjectName}\u001B[0m') + mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) + mySSH.command('oc logout', '\$', 30) mySSH.close() HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_IS_FAIL) RAN.prematureExit = True @@ -181,11 +185,13 @@ class PhySim: else: logging.debug(f'\u001B[1m Image Stream "oai-physim" created on OC project {ocProjectName}\u001B[0m') time.sleep(2) - mySSH.command(f'sudo podman tag oai-physim:{imageTag} default-route-openshift-image-registry.apps.5glab.nsa.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 30) + mySSH.command(f'sudo podman tag oai-physim:{imageTag} default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 30) time.sleep(2) - mySSH.command(f'sudo podman push default-route-openshift-image-registry.apps.5glab.nsa.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag} --tls-verify=false', '\$', 180) + mySSH.command(f'sudo podman push default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag} --tls-verify=false', '\$', 180) if mySSH.getBefore().count('Storing signatures') == 0: logging.error('\u001B[1m Image "oai-physim" push to OC Cluster Registry Failed\u001B[0m') + mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) + mySSH.command('oc logout', '\$', 30) mySSH.close() HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_IS_FAIL) RAN.prematureExit = True @@ -195,8 +201,9 @@ class PhySim: # Using helm charts deployment time.sleep(5) + mySSH.command(f'grep -rl OAICICD_PROJECT ./charts/ | xargs sed -i -e "s#OAICICD_PROJECT#{ocProjectName}#"', '\$', 30) mySSH.command(f'sed -i -e "s#TAG#{imageTag}#g" ./charts/physims/values.yaml', '\$', 6) - mySSH.command('helm install physim ./charts/physims/ | tee -a cmake_targets/log/physim_helm_summary.txt 2>&1', '\$', 30) + mySSH.command('helm install physim ./charts/physims/ 2>&1 | tee -a cmake_targets/log/physim_helm_summary.txt', '\$', 30) if mySSH.getBefore().count('STATUS: deployed') == 0: logging.error('\u001B[1m Deploying PhySim Failed using helm chart on OC Cluster\u001B[0m') mySSH.command('helm uninstall physim >> cmake_targets/log/physim_helm_summary.txt 2>&1', '\$', 30) @@ -206,8 +213,10 @@ class PhySim: mySSH.command('oc get pods -l app.kubernetes.io/instance=physim', '\$', 6, resync=True) if re.search('No resources found', mySSH.getBefore()): isFinished1 = True - mySSH.command(f'sudo podman rmi default-route-openshift-image-registry.apps.5glab.nsa.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 30) + mySSH.command(f'sudo podman rmi default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 30) mySSH.command('oc delete is oai-physim', '\$', 30) + mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) + mySSH.command('oc logout', '\$', 30) mySSH.close() self.AnalyzeLogFile_phySim(HTML) RAN.prematureExit = True @@ -227,7 +236,7 @@ class PhySim: if isRunning == False: logging.error('\u001B[1m Some PODS Running FAILED \u001B[0m') mySSH.command('oc get pods -l app.kubernetes.io/instance=physim 2>&1 | tee -a cmake_targets/log/physim_pods_summary.txt', '\$', 6) - mySSH.command('helm uninstall physim >> cmake_targets/log/physim_helm_summary.txt 2>&1', '\$', 6) + mySSH.command('helm uninstall physim 2>&1 >> cmake_targets/log/physim_helm_summary.txt', '\$', 6) self.AnalyzeLogFile_phySim(HTML) isFinished1 = False while(isFinished1 == False): @@ -235,8 +244,10 @@ class PhySim: mySSH.command('oc get pods -l app.kubernetes.io/instance=physim', '\$', 6, resync=True) if re.search('No resources found', mySSH.getBefore()): isFinished1 = True - mySSH.command(f'sudo podman rmi default-route-openshift-image-registry.apps.5glab.nsa.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 6) + mySSH.command(f'sudo podman rmi default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 6) mySSH.command('oc delete is oai-physim', '\$', 6) + mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) + mySSH.command('oc logout', '\$', 30) HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_PHYSIM_DEPLOY_FAIL) HTML.CreateHtmlTestRowPhySimTestResult(self.testSummary,self.testResult) RAN.prematureExit = True @@ -293,9 +304,10 @@ class PhySim: isFinished1 = True if isFinished1 == True: logging.debug('\u001B[1m UnDeployed PhySim Successfully on OC Cluster\u001B[0m') - mySSH.command(f'sudo podman rmi default-route-openshift-image-registry.apps.5glab.nsa.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 6) + mySSH.command(f'sudo podman rmi default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 6) mySSH.command('oc delete is oai-physim', '\$', 6) logging.debug('\u001B[1m Deleted the Image and ImageStream\u001B[0m') + mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) mySSH.command('oc logout', '\$', 6) mySSH.close() self.AnalyzeLogFile_phySim(HTML) From 9327e9915210ee6480b66bcf88567b4bea501948 Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 21 Apr 2022 16:29:22 +0200 Subject: [PATCH 063/114] additional fixes for SR --- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index bcf743b560..5026354afd 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -422,9 +422,9 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, if (pucch_pdu->bit_len_harq==0) { uci_pdu->harq = NULL; uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); - uci_pdu->sr->sr_confidence_level = (SNRtimes10 > uci_stats->pucch0_thres) ? 1 : 0; + uci_pdu->sr->sr_confidence_level = (SNRtimes10 < uci_stats->pucch0_thres); uci_stats->pucch0_sr_trials++; - if (xrtmag_dBtimes10>10*max_n0) { + if (xrtmag_dBtimes10>(10*max_n0+100)) { uci_pdu->sr->sr_indication = 1; uci_stats->pucch0_positive_SR++; LOG_D(PHY,"PUCCH0 got positive SR. Cumulative number of positive SR %d\n", uci_stats->pucch0_positive_SR); From 4b4e419aba60c857ca4f9ecaee4eba87ef283c85 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Thu, 14 Apr 2022 16:42:38 +0200 Subject: [PATCH 064/114] nr rlc: fix NR RLC AM status generation Several problems were found and fixed. --- openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c | 107 +++++++++++++--------- 1 file changed, 63 insertions(+), 44 deletions(-) diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c index af8cb5715a..bfc8abbf73 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c @@ -908,8 +908,6 @@ typedef struct { int so_start; int sn_end; int so_end; - /* data for maximum ack */ - int ack_sn; /* -1 if not to be used */ /* pdu to use for next call to 'next_missing' */ nr_rlc_pdu_t *next; } missing_data_t; @@ -924,13 +922,12 @@ static missing_data_t next_missing(nr_rlc_entity_am_t *entity, int max_so = 0; int last_reached = 0; - ret.ack_sn = -1; - /* special case: missing part before the head of RX list */ if (check_head) { if (cur->sn != entity->rx_next || !cur->is_first) { /* don't report if out of reporting window */ - if (sn_compare_rx(entity, entity->rx_highest_status, cur->sn) <= 0) { + if (sn_compare_rx(entity, entity->rx_highest_status, + entity->rx_next) <= 0) { ret.sn_start = -1; return ret; } @@ -954,10 +951,6 @@ next_pdu: max_so = cur_max_so; last_reached = last_reached | cur->is_last; - /* if cur already processed, it can be the acked SDU */ - if (cur->data == NULL) - ret.ack_sn = (cur->sn + 1) % entity->sn_modulus; - /* no next? */ if (cur->next == NULL) { /* inform the caller that work is over */ @@ -1033,32 +1026,36 @@ next_pdu: } /* discontinuity between different SDUs */ - ret.sn_start = sn; + if (last_reached) { + ret.sn_start = (sn + 1) % entity->sn_modulus; + ret.so_start = 0; + } else { + ret.sn_start = sn; + ret.so_start = max_so + 1; + } /* don't report if out of reporting window */ if (sn_compare_rx(entity, entity->rx_highest_status, ret.sn_start) <= 0) { ret.sn_start = -1; return ret; } - ret.so_start = max_so + 1; set_end_different_sdu: - /* don't go more than rx_highest_status - 1 */ - if (sn_compare_rx(entity, entity->rx_highest_status, cur->sn) <= 0) { - ret.sn_end = (entity->rx_highest_status - 1 + entity->sn_modulus) % - entity->sn_modulus; - ret.so_end = 0xffff; - return ret; - } - /* if cur is the head of a SDU, then use cur-1 */ if (cur->is_first) { ret.sn_end = (cur->sn - 1 + entity->sn_modulus) % entity->sn_modulus; ret.so_end = 0xffff; - return ret; + } else { + ret.sn_end = cur->sn; + ret.so_end = cur->so - 1; + } + /* don't go more than rx_highest_status - 1 */ + if (sn_compare_rx(entity, entity->rx_highest_status, ret.sn_end) <= 0) { + ret.sn_end = (entity->rx_highest_status - 1 + entity->sn_modulus) % + entity->sn_modulus; + ret.so_end = 0xffff; + ret.next = NULL; } - ret.sn_end = cur->sn; - ret.so_end = cur->so - 1; return ret; } @@ -1098,21 +1095,20 @@ static void get_e1_position(nr_rlc_entity_am_t *entity, } } -/* returns the number of nacks serialized. - * In most cases it is 1, it can be more if the - * missing data consists of a range that is more - * than 255 SNs in which case it has to be cut in - * smaller ranges. +/* returns the last nack SN generated, -1 if nothing generated. * If there is no more room in the status buffer, * will set m->next = NULL (and may serialize - * less nacks than required by 'm'). + * less nacks than required by 'm'), also + * sets *generation_truncated to 1. */ static int generate_missing(nr_rlc_entity_am_t *entity, nr_rlc_pdu_encoder_t *encoder, - missing_data_t *m, int *e1_byte, int *e1_bit) + missing_data_t *m, int *e1_byte, int *e1_bit, + int *generation_truncated, + unsigned char **so_end_address) { int r_bits = entity->sn_field_length == 18 ? 3 : 1; - int range_count = 0; + int last_nack_generated = -1; int sn_start; int so_start; int sn_end; @@ -1164,6 +1160,7 @@ static int generate_missing(nr_rlc_entity_am_t *entity, m_nack.so_end = so_end; if (encoder->byte + nack_size(entity, &m_nack) > encoder->size) { m->next = NULL; + *generation_truncated = 1; break; } @@ -1197,6 +1194,7 @@ static int generate_missing(nr_rlc_entity_am_t *entity, /* nack_sn */ nr_rlc_pdu_encoder_put_bits(encoder, sn_start, entity->sn_field_length); + last_nack_generated = sn_start; /* e1 = 0 (set later if needed) */ nr_rlc_pdu_encoder_put_bits(encoder, 0, 1); /* e2 */ @@ -1208,34 +1206,44 @@ static int generate_missing(nr_rlc_entity_am_t *entity, /* so_start/so_end */ if (e2) { nr_rlc_pdu_encoder_put_bits(encoder, so_start, 16); + *so_end_address = (unsigned char *)encoder->buffer + encoder->byte; nr_rlc_pdu_encoder_put_bits(encoder, so_end, 16); - } + } else + *so_end_address = NULL; /* nack range */ - if (e3) + if (e3) { nr_rlc_pdu_encoder_put_bits(encoder, cur_sn_count, 8); + last_nack_generated += cur_sn_count - 1; + } sn_count -= cur_sn_count; sn_start = (sn_start + cur_sn_count) % entity->sn_modulus; - range_count++; } - return range_count; + return last_nack_generated; } static int generate_status(nr_rlc_entity_am_t *entity, char *buffer, int size) { - int ack_sn = entity->rx_next; - missing_data_t m; + int last_nack; + int ack_sn; + missing_data_t m; nr_rlc_pdu_t *cur; - int nack_count = 0; + int check_head = 1; nr_rlc_pdu_encoder_t encoder; int e1_byte; int e1_bit; + int generation_truncated; + int ln; + unsigned char *so_end_address = NULL; /* if not enough room, do nothing */ if (size < 3) return 0; + /* initial last_nack is rx_next - 1 */ + last_nack = (entity->rx_next - 1 + entity->sn_modulus) % entity->sn_modulus; + nr_rlc_pdu_encoder_init(&encoder, buffer, size); /* first 3 bytes, ack_sn and e1 will be set later */ @@ -1250,22 +1258,33 @@ static int generate_status(nr_rlc_entity_am_t *entity, char *buffer, int size) e1_bit = entity->sn_field_length == 18 ? 1 : 7; while (cur != NULL) { - m = next_missing(entity, cur, nack_count == 0); - - /* update ack_sn if the returned value is valid */ - if (m.ack_sn != -1) - ack_sn = m.ack_sn; + m = next_missing(entity, cur, check_head); + check_head = 0; /* stop here if no more nack to report */ if (m.sn_start == -1) break; - nack_count += generate_missing(entity, &encoder, &m, &e1_byte, &e1_bit); + generation_truncated = 0; + ln = generate_missing(entity, &encoder, &m, &e1_byte, &e1_bit, + &generation_truncated, &so_end_address); + /* remember the last nack put, if any */ + if (ln != -1) + last_nack = ln; + /* if generation was truncated and so_end was put, we force its value to + * 0xffff (end of SDU) because we don't know what missing nack information + * was supposed to be put, so we nack until the end of the PDU to be sure + */ + if (generation_truncated && so_end_address != NULL) { + so_end_address[0] = 0xff; + so_end_address[1] = 0xff; + } cur = m.next; } - /* put ack_sn */ + /* put ack_sn, which is last_nack + 1 */ + ack_sn = (last_nack + 1) % entity->sn_modulus; if (entity->sn_field_length == 12) { buffer[0] = ack_sn >> 8; buffer[1] = ack_sn & 255; From 4c4cbc963b99080682ea10c00c31cd7540e8ebd2 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Fri, 22 Apr 2022 12:28:04 +0200 Subject: [PATCH 065/114] fix(ci): little fixes after migration to new infra: - Better mechanism for qlog cleaning - Faster attachment check - html.py is confusing for some python3 installation -- renaming it Signed-off-by: Raphael Defosseux --- ci-scripts/cls_log_mgt.py | 23 ++++++++++++++--------- ci-scripts/cls_module_ue.py | 7 ++++--- ci-scripts/{html.py => cls_oai_html.py} | 0 ci-scripts/cls_oaicitest.py | 4 ++-- ci-scripts/cls_physim.py | 2 +- ci-scripts/cls_physim1.py | 2 +- ci-scripts/main.py | 4 ++-- 7 files changed, 24 insertions(+), 18 deletions(-) rename ci-scripts/{html.py => cls_oai_html.py} (100%) diff --git a/ci-scripts/cls_log_mgt.py b/ci-scripts/cls_log_mgt.py index 905a105512..e29e9168b7 100644 --- a/ci-scripts/cls_log_mgt.py +++ b/ci-scripts/cls_log_mgt.py @@ -64,10 +64,10 @@ class Log_Mgt: if m is not None: return int(m.group(1)) - def __RemoveOldest(self): + def __RemoveOldest(self, days): mySSH = sshconnection.SSHConnection() mySSH.open(self.IPAddress, self.Username, self.Password) - COMMAND='echo ' + self.Password + ' | sudo -S find ' + self.path + ' -type f -mtime +14 -delete' + COMMAND='echo ' + self.Password + ' | sudo -S find ' + self.path + ' -type f -mtime +' + str(days) + ' -delete' mySSH.command(COMMAND,'\$',20) mySSH.close() @@ -79,13 +79,18 @@ class Log_Mgt: def LogRotation(self): - used_space = self.__CheckUsedSpace() #avail space in target folder - if used_space > 80 : - logging.debug('\u001B[1;37;41m Used Disk > 80%, on ' + self.Username+'@'+self.IPAddress + '\u001B[0m') - logging.debug('\u001B[1;37;41m Removing Artifacts older than 14 days \u001B[0m') - self.__RemoveOldest() - else: - logging.debug('Used Disk < 80%, on ' + self.Username+'@'+self.IPAddress +', no cleaning required') + doLoop = True + nbDays = 14 + while doLoop and nbDays > 2: + used_space = self.__CheckUsedSpace() #avail space in target folder + if used_space > 80 : + logging.debug('\u001B[1;37;41m Used Disk (' + str(used_space) + '%) > 80%, on ' + self.Username+'@'+self.IPAddress + '\u001B[0m') + logging.debug('\u001B[1;37;41m Removing Artifacts older than ' + nbDays + ' days \u001B[0m') + self.__RemoveOldest(nbDays) + nbDays -= 1 + else: + logging.debug('Used Disk (' + str(used_space) + '%) < 80%, on ' + self.Username+'@'+self.IPAddress +', no cleaning required') + doLoop = False diff --git a/ci-scripts/cls_module_ue.py b/ci-scripts/cls_module_ue.py index fb10700798..dcf75a34fc 100644 --- a/ci-scripts/cls_module_ue.py +++ b/ci-scripts/cls_module_ue.py @@ -107,14 +107,15 @@ class Module_UE: def GetModuleIPAddress(self): HOST=self.HostUsername+'@'+self.HostIPAddress response= [] - tentative = 3 + tentative = 8 while (len(response)==0) and (tentative>0): COMMAND="ip a show dev " + self.UENetwork + " | grep --colour=never inet | grep " + self.UENetwork - logging.debug(COMMAND) + if tentative == 8: + logging.debug(COMMAND) ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE) response = ssh.stdout.readlines() tentative-=1 - time.sleep(10) + time.sleep(2) if (tentative==0) and (len(response)==0): logging.debug('\u001B[1;37;41m Module IP Address Not Found! Time expired \u001B[0m') return -1 diff --git a/ci-scripts/html.py b/ci-scripts/cls_oai_html.py similarity index 100% rename from ci-scripts/html.py rename to ci-scripts/cls_oai_html.py diff --git a/ci-scripts/cls_oaicitest.py b/ci-scripts/cls_oaicitest.py index 33910f1f9b..9d5ae84038 100644 --- a/ci-scripts/cls_oaicitest.py +++ b/ci-scripts/cls_oaicitest.py @@ -439,7 +439,7 @@ class OaiCiTest(): while cnt < 4: Module_UE.Command("wup") logging.debug("Waiting for IP address to be assigned") - time.sleep(20) + time.sleep(5) logging.debug("Retrieve IP address") status=Module_UE.GetModuleIPAddress() if status==0: @@ -1111,7 +1111,7 @@ class OaiCiTest(): while cnt < 4: Module_UE.Command("wup") logging.debug("Waiting for IP address to be assigned") - time.sleep(20) + time.sleep(5) logging.debug("Retrieve IP address") status=Module_UE.GetModuleIPAddress() if status==0: diff --git a/ci-scripts/cls_physim.py b/ci-scripts/cls_physim.py index 33792f6ca4..ecd8f63af1 100644 --- a/ci-scripts/cls_physim.py +++ b/ci-scripts/cls_physim.py @@ -32,7 +32,7 @@ import logging #to create a SSH object locally in the methods import sshconnection #to update the HTML object -import html +import cls_oai_html from multiprocessing import SimpleQueue #for log folder maintenance import os diff --git a/ci-scripts/cls_physim1.py b/ci-scripts/cls_physim1.py index 54329790cd..3907fc2a34 100644 --- a/ci-scripts/cls_physim1.py +++ b/ci-scripts/cls_physim1.py @@ -33,7 +33,7 @@ #----------------------------------------------------------- import logging import sshconnection as SSH -import html +import cls_oai_html import os import re import time diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 65f9fbb0da..03947bdfc9 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -49,7 +49,7 @@ import cls_physim1 #class PhySim for physical simulators deploy and run import sshconnection import epc import ran -import html +import cls_oai_html #----------------------------------------------------------- @@ -518,7 +518,7 @@ CiTestObj = cls_oaicitest.OaiCiTest() SSH = sshconnection.SSHConnection() EPC = epc.EPCManagement() RAN = ran.RANManagement() -HTML = html.HTMLManagement() +HTML = cls_oai_html.HTMLManagement() CONTAINERS = cls_containerize.Containerize() SCA = cls_static_code_analysis.StaticCodeAnalysis() PHYSIM = cls_physim1.PhySim() From 998452e679864ed8d50729736bd6639b6359fc90 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Fri, 22 Apr 2022 16:53:34 +0200 Subject: [PATCH 066/114] feat(ci): add script to properly flatten the target images Signed-off-by: Raphael Defosseux --- ci-scripts/cls_containerize.py | 3 + ci-scripts/flatten_image.py | 116 +++++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+) create mode 100644 ci-scripts/flatten_image.py diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 89a3ac586d..259db7bffe 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -294,6 +294,9 @@ class Containerize(): if image != 'ran-build': mySSH.command('sed -i -e "s#' + "ran-build" + ':latest#' + "ran-build" + ':' + imageTag + '#" docker/Dockerfile.' + pattern + self.dockerfileprefix, '\$', 5) mySSH.command(self.cli + ' build ' + self.cliBuildOptions + ' --target ' + image + ' --tag ' + image + ':' + imageTag + ' --file docker/Dockerfile.' + pattern + self.dockerfileprefix + ' . > cmake_targets/log/' + image + '.log 2>&1', '\$', 1200) + # Flatten Image + if image != 'ran-build': + mySSH.command('python3 ./ci-scripts/flatten_image.py --tag ' + image + ':' + imageTag, '\$', 300) # split the log mySSH.command('mkdir -p cmake_targets/log/' + image, '\$', 5) mySSH.command('python3 ci-scripts/docker_log_split.py --logfilename=cmake_targets/log/' + image + '.log', '\$', 5) diff --git a/ci-scripts/flatten_image.py b/ci-scripts/flatten_image.py new file mode 100644 index 0000000000..aef5bfccad --- /dev/null +++ b/ci-scripts/flatten_image.py @@ -0,0 +1,116 @@ +""" + 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 argparse +import re +import subprocess +import sys + +def main() -> None: + args = _parse_args() + status = perform_flattening(args.tag) + sys.exit(status) + +def _parse_args() -> argparse.Namespace: + parser = argparse.ArgumentParser(description='Flattening Image') + + parser.add_argument( + '--tag', '-t', + action='store', + required=True, + help='Image Tag in image-name:image tag format', + ) + return parser.parse_args() + +def perform_flattening(tag): + # First detect which docker/podman command to use + cli = '' + image_prefix = '' + cmd = 'which podman || true' + podman_check = subprocess.check_output(cmd, shell=True, universal_newlines=True) + if re.search('podman', podman_check.strip()): + cli = 'sudo podman' + image_prefix = 'localhost/' + if cli == '': + cmd = 'which docker || true' + docker_check = subprocess.check_output(cmd, shell=True, universal_newlines=True) + if re.search('docker', docker_check.strip()): + cli = 'docker' + image_prefix = '' + if cli == '': + print ('No docker / podman installed: quitting') + return -1 + print (f'Flattening {tag}') + + # Creating a container + cmd = cli + ' run --name test-flatten --entrypoint /bin/true -d ' + tag + print (cmd) + subprocess.check_output(cmd, shell=True, universal_newlines=True) + + # Export / Import trick + cmd = cli + ' export test-flatten | ' + cli + ' import ' + # Bizarro syntax issue with podman + if cli == 'docker': + cmd += ' --change "ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ' + else: + cmd += ' --change "ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ' + if re.search('oai-enb', tag): + cmd += ' --change "WORKDIR /opt/oai-enb" ' + cmd += ' --change "EXPOSE 2152/udp" ' + cmd += ' --change "EXPOSE 36412/udp" ' + cmd += ' --change "EXPOSE 36422/udp" ' + cmd += ' --change "CMD [\\"/opt/oai-enb/bin/lte-softmodem.Rel15\\", \\"-O\\", \\"/opt/oai-enb/etc/enb.conf\\"]" ' + cmd += ' --change "ENTRYPOINT [\\"/opt/oai-enb/bin/entrypoint.sh\\"]" ' + if re.search('oai-gnb', tag): + cmd += ' --change "WORKDIR /opt/oai-gnb" ' + cmd += ' --change "EXPOSE 2152/udp" ' + cmd += ' --change "EXPOSE 36422/udp" ' + cmd += ' --change "CMD [\\"/opt/oai-gnb/bin/nr-softmodem.Rel15\\", \\"-O\\", \\"/opt/oai-gnb/etc/gnb.conf\\"]" ' + cmd += ' --change "ENTRYPOINT [\\"/opt/oai-gnb/bin/entrypoint.sh\\"]" ' + if re.search('oai-lte-ue', tag): + cmd += ' --change "WORKDIR /opt/oai-lte-ue" ' + cmd += ' --change "CMD [\\"/opt/oai-lte-ue/bin/lte-uesoftmodem.Rel15\\"]" ' + cmd += ' --change "ENTRYPOINT [\\"/opt/oai-lte-ue/bin/entrypoint.sh\\"]" ' + if re.search('oai-nr-ue', tag): + cmd += ' --change "WORKDIR /opt/oai-nr-ue" ' + cmd += ' --change "CMD [\\"/opt/oai-nr-ue/bin/nr-uesoftmodem.Rel15\\", \\"-O\\", \\"/opt/oai-nr-ue/etc/nr-ue.conf\\"]" ' + cmd += ' --change "ENTRYPOINT [\\"/opt/oai-nr-ue/bin/entrypoint.sh\\"]" ' + if re.search('oai-lte-ru', tag): + cmd += ' --change "WORKDIR /opt/oai-lte-ru" ' + cmd += ' --change "CMD [\\"/opt/oai-lte-ru/bin/oairu.Rel15\\", \\"-O\\", \\"/opt/oai-lte-ru/etc/rru.conf\\"]" ' + cmd += ' --change "ENTRYPOINT [\\"/opt/oai-lte-ru/bin/entrypoint.sh\\"]" ' + if re.search('oai-physim', tag): + cmd += ' --change "WORKDIR /opt/oai-physim" ' + cmd += ' - ' + image_prefix + tag + print (cmd) + subprocess.check_output(cmd, shell=True, universal_newlines=True) + + # Remove container + cmd = cli + ' rm -f test-flatten' + print (cmd) + subprocess.check_output(cmd, shell=True, universal_newlines=True) + + # At this point the original image is a dangling image. + # CI pipeline will clean up (`image prune --force`) + return 0 + +if __name__ == '__main__': + main() From 532bb0da965417617e4e7ed2612b1208814bae3c Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 22 Apr 2022 17:54:41 +0200 Subject: [PATCH 067/114] Remove useless comments --- openair2/LAYER2/NR_MAC_COMMON/nr_mac.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h index 63f21ec382..9123afd324 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h @@ -107,10 +107,10 @@ typedef struct { } __attribute__ ((__packed__)) NR_MAC_SUBHEADER_SHORT; typedef struct { - uint8_t LCID: 6; // octet 1 [5:0] - uint8_t F: 1; // octet 1 [6] - uint8_t R: 1; // octet 1 [7] - uint16_t L: 16; // octet 2 [7:0] + uint8_t LCID: 6; + uint8_t F: 1; + uint8_t R: 1; + uint16_t L: 16; } __attribute__ ((__packed__)) NR_MAC_SUBHEADER_LONG; typedef struct { From 3c6a628b747cd6e78ae2b30072f19b9fbabbe202 Mon Sep 17 00:00:00 2001 From: Laurent Thomas Date: Mon, 25 Apr 2022 23:34:48 +0200 Subject: [PATCH 068/114] fix 2 bugs: one new introduced by merge develop, one introduced by extra change asked in code review --- openair1/PHY/CODING/nr_segmentation.c | 2 +- openair1/SCHED_NR_UE/harq_nr.c | 4 +++- openair1/SIMULATION/NR_PHY/dlschsim.c | 7 +------ 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/openair1/PHY/CODING/nr_segmentation.c b/openair1/PHY/CODING/nr_segmentation.c index 281e61cda5..f43813a6ca 100644 --- a/openair1/PHY/CODING/nr_segmentation.c +++ b/openair1/PHY/CODING/nr_segmentation.c @@ -87,7 +87,7 @@ if ((Kprime%Kb) > 0) else Z = (Kprime/Kb); - LOG_D(PHY,"nr segmetation B %u Bprime %u Kprime %u z %u \n", B, Bprime, Kprime, Z); + LOG_D(PHY,"nr segmentation B %u Bprime %u Kprime %u z %u \n", B, Bprime, Kprime, Z); if (Z <= 2) { *K = 2; diff --git a/openair1/SCHED_NR_UE/harq_nr.c b/openair1/SCHED_NR_UE/harq_nr.c index c0f7c08771..a9ff01d78a 100644 --- a/openair1/SCHED_NR_UE/harq_nr.c +++ b/openair1/SCHED_NR_UE/harq_nr.c @@ -357,8 +357,10 @@ void downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int ndi, int if (ndi!=dl_harq->DCINdi) { dl_harq->first_rx = true; dl_harq->DLround = 0; - } else + } else { + dl_harq->first_rx = false; dl_harq->DLround++; + } dl_harq->status = ACTIVE; diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c index 64e377b896..6f747b36a6 100644 --- a/openair1/SIMULATION/NR_PHY/dlschsim.c +++ b/openair1/SIMULATION/NR_PHY/dlschsim.c @@ -478,13 +478,10 @@ int main(int argc, char **argv) harq_process->n_dmrs_cdm_groups = 1; printf("harq process ue mcs = %d Qm = %d, symb %d\n", harq_process->mcs, harq_process->Qm, nb_symb_sch); - unsigned char *test_input; - test_input = (unsigned char *) malloc16(sizeof(unsigned char) * TBS / 8); + unsigned char *test_input=dlsch->harq_process.pdu; //unsigned char test_input[TBS / 8] __attribute__ ((aligned(16))); for (i = 0; i < TBS / 8; i++) test_input[i] = (unsigned char) rand(); - dlsch->harq_process.pdu=test_input; - //estimated_output = harq_process->b; #ifdef DEBUG_NR_DLSCHSIM for (i = 0; i < TBS / 8; i++) printf("test_input[i]=%hhu \n",test_input[i]); @@ -618,8 +615,6 @@ int main(int argc, char **argv) } }*/ - //free(test_input); it must not be free as it is in DLSCH_struct -> free_gNB_dlsch () -> free(harq->pdu) with no checks or control - free_channel_desc_scm(gNB2UE); reset_DLSCH_struct(gNB, &msgDataTx); From 05567b59f17e650d372c6e4c973d02f51a9e2ffa Mon Sep 17 00:00:00 2001 From: Vijay Chadachan Date: Tue, 26 Apr 2022 10:59:42 +0200 Subject: [PATCH 069/114] Fix for OAI UE AUTH_REQ processing additional check for RAND value It was observed in simulation test the OAI UE always sends the sucessful AUTH_RES when the AUTH_REQ has the RAND value "0". This opens a back door in the authentication process. The code is modified to fix this issue in OAI UE. --- openair3/NAS/UE/EMM/Authentication.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/openair3/NAS/UE/EMM/Authentication.c b/openair3/NAS/UE/EMM/Authentication.c index 850f97150a..97c7082be0 100644 --- a/openair3/NAS/UE/EMM/Authentication.c +++ b/openair3/NAS/UE/EMM/Authentication.c @@ -149,7 +149,8 @@ int emm_proc_authentication_request(nas_user_t *user, int native_ksi, int ksi, int rc = RETURNerror; authentication_data_t *authentication_data = user->authentication_data; emm_timers_t *emm_timers = user->emm_data->emm_timers; - + uint8_t nullRand[AUTH_CK_SIZE]; + memset(nullRand, 0, AUTH_CK_SIZE); LOG_TRACE(INFO, "EMM-PROC - Authentication requested ksi type = %s, ksi = %d", native_ksi ? "native" : "mapped", ksi); /* 3GPP TS 24.301, section 5.4.2.1 @@ -178,11 +179,13 @@ int emm_proc_authentication_request(nas_user_t *user, int native_ksi, int ksi, OctetString ik = {AUTH_IK_SIZE, authentication_data->ik}; OctetString res = {AUTH_RES_SIZE, authentication_data->res}; - if (memcmp(authentication_data->rand, rand->value, AUTH_CK_SIZE) != 0) { + if ((memcmp(authentication_data->rand, rand->value, AUTH_CK_SIZE) != 0) || + (memcmp(nullRand,authentication_data->rand, AUTH_CK_SIZE) == 0)) { /* * There is no valid stored RAND in the ME or the stored RAND is * different from the new received value in the AUTHENTICATION - * REQUEST message + * REQUEST message OR the received RAND is all "0" or "NULL" + * process the new received AUTHENTICATIOn REQUEST message */ OctetString auts; auts.length = 0; From b805e6db47bbb42dd97a735984e75860ddd8274e Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 26 Apr 2022 17:40:42 +0200 Subject: [PATCH 070/114] Use --continuous-tx for B210-based gNB (TDD) --- ci-scripts/xml_files/fr1_nsa_quectel.xml | 2 +- ci-scripts/yaml_files/nsa_b200_gnb/docker-compose.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ci-scripts/xml_files/fr1_nsa_quectel.xml b/ci-scripts/xml_files/fr1_nsa_quectel.xml index 55f6f4376e..44aab6e892 100644 --- a/ci-scripts/xml_files/fr1_nsa_quectel.xml +++ b/ci-scripts/xml_files/fr1_nsa_quectel.xml @@ -74,7 +74,7 @@ Initialize_eNB Initialize gNB - -O ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf -E -q --RUs.[0].sdr_addrs "serial=30C51D4" --log_config.global_log_options level,nocolor,time,line_num,function + -O ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf -E -q --RUs.[0].sdr_addrs "serial=30C51D4" --continuous-tx --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 61266aa2b1..208e1564cd 100644 --- a/ci-scripts/yaml_files/nsa_b200_gnb/docker-compose.yml +++ b/ci-scripts/yaml_files/nsa_b200_gnb/docker-compose.yml @@ -26,7 +26,7 @@ services: FLEXRAN_INTERFACE_NAME: eth0 FLEXRAN_IPV4_ADDRESS: 172.21.16.136 THREAD_PARALLEL_CONFIG: PARALLEL_RU_L1_TRX_SPLIT - USE_ADDITIONAL_OPTIONS: -E -q --RUs.[0].sdr_addrs serial=30C51D4 --log_config.global_log_options level,nocolor,time,line_num,function + USE_ADDITIONAL_OPTIONS: -E -q --RUs.[0].sdr_addrs serial=30C51D4 --continuous-tx --log_config.global_log_options level,nocolor,time,line_num,function volumes: - /dev:/dev networks: From 57d1b22ca4296ba3e92a990ad41432e895f83ceb Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 26 Apr 2022 17:48:23 +0200 Subject: [PATCH 071/114] Improve B210 gNB configuration --- .../conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf index af58145322..f2bf69d2f7 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf @@ -203,7 +203,7 @@ MACRLCs = ( tr_n_preference = "local_RRC"; pusch_TargetSNRx10 = 200; pucch_TargetSNRx10 = 200; - ulsch_max_frame_inactivity = 1; + ulsch_max_frame_inactivity = 0; } ); @@ -221,11 +221,11 @@ RUs = ( local_rf = "yes" nb_tx = 1 nb_rx = 1 - att_tx = 3 - att_rx = 0; + att_tx = 16 + att_rx = 16; bands = [7]; max_pdschReferenceSignalPower = -27; - max_rxgain = 111; + max_rxgain = 114; eNB_instances = [0]; # sdr_addrs = "serial=30C51D4"; # clock_src = "external"; From 4389fdea4ef82dba502271235ab65d5b446d5432 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 26 Apr 2022 18:16:19 +0200 Subject: [PATCH 072/114] Harmonize NSA DMRS AdditionalPosition with SA --- openair2/RRC/NR/rrc_gNB_reconfig.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 36113fb7ee..4e9245cf46 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -223,7 +223,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS=NULL; secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition)); - *secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0; + *secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1; secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList)); @@ -572,7 +572,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS=NULL; } bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition)); - *bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0; + *bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1; bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList=calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList)); From 89e7923652c0f28ce1dd2538c3cb562ffc6dc962 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 26 Apr 2022 17:56:50 +0200 Subject: [PATCH 073/114] Increase NSA B210 throughput requirements --- .../xml_files/container_nsa_b200_quectel.xml | 8 ++++---- ci-scripts/xml_files/fr1_nsa_quectel.xml | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ci-scripts/xml_files/container_nsa_b200_quectel.xml b/ci-scripts/xml_files/container_nsa_b200_quectel.xml index 610f0b019a..80ed3f5cfc 100644 --- a/ci-scripts/xml_files/container_nsa_b200_quectel.xml +++ b/ci-scripts/xml_files/container_nsa_b200_quectel.xml @@ -138,12 +138,12 @@ Iperf - iperf (DL/40Mbps/UDP)(60 sec)(single-ue profile) - -u -b 40M -t 60 -i 1 -fm + iperf (DL/125Mbps/UDP)(60 sec)(single-ue profile) + -u -b 125M -t 60 -i 1 -fm DL idefix - 20 - 85 + 1 + 95 single-ue diff --git a/ci-scripts/xml_files/fr1_nsa_quectel.xml b/ci-scripts/xml_files/fr1_nsa_quectel.xml index 44aab6e892..f8ecaae0fd 100644 --- a/ci-scripts/xml_files/fr1_nsa_quectel.xml +++ b/ci-scripts/xml_files/fr1_nsa_quectel.xml @@ -117,29 +117,29 @@ -u -b 30M -t 30 DL idefix - 5 + 1 95 single-ue Iperf - iperf (DL/40Mbps/UDP)(30 sec)(single-ue profile) - -u -b 40M -t 30 + iperf (DL/90Mbps/UDP)(30 sec)(single-ue profile) + -u -b 90M -t 30 DL idefix - 5 + 1 95 single-ue Iperf - iperf (DL/60Mbps/UDP)(60 sec)(single-ue profile) - -u -b 60M -t 60 + iperf (DL/125Mbps/UDP)(60 sec)(single-ue profile) + -u -b 125M -t 60 DL idefix - 5 + 1 95 single-ue From a4f3d431f5a52e876c26f61ea7159c039250b145 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 27 Apr 2022 16:31:35 +0200 Subject: [PATCH 074/114] Further improve B210/NSA gNB configuration file --- ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf index f2bf69d2f7..f3515d3882 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf @@ -221,8 +221,8 @@ RUs = ( local_rf = "yes" nb_tx = 1 nb_rx = 1 - att_tx = 16 - att_rx = 16; + att_tx = 12 + att_rx = 12; bands = [7]; max_pdschReferenceSignalPower = -27; max_rxgain = 114; From c265cbda8a272dd245dd7635cce12a70f62409e0 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 27 Apr 2022 16:36:16 +0200 Subject: [PATCH 075/114] NSA-B200(-Container) test: increase UL traffic requirements --- ci-scripts/xml_files/container_nsa_b200_quectel.xml | 4 ++-- ci-scripts/xml_files/fr1_nsa_quectel.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ci-scripts/xml_files/container_nsa_b200_quectel.xml b/ci-scripts/xml_files/container_nsa_b200_quectel.xml index 80ed3f5cfc..47a939f63c 100644 --- a/ci-scripts/xml_files/container_nsa_b200_quectel.xml +++ b/ci-scripts/xml_files/container_nsa_b200_quectel.xml @@ -149,8 +149,8 @@ Iperf - iperf (UL/3Mbps/UDP)(60 sec)(single-ue profile) - -u -b 3M -t 60 -i 1 -fm + iperf (UL/8Mbps/UDP)(60 sec)(single-ue profile) + -u -b 8M -t 60 -i 1 -fm UL idefix 1 diff --git a/ci-scripts/xml_files/fr1_nsa_quectel.xml b/ci-scripts/xml_files/fr1_nsa_quectel.xml index f8ecaae0fd..0f8c90abdf 100644 --- a/ci-scripts/xml_files/fr1_nsa_quectel.xml +++ b/ci-scripts/xml_files/fr1_nsa_quectel.xml @@ -146,8 +146,8 @@ Iperf - iperf (UL/3Mbps/UDP)(60 sec)(single-ue profile) - -u -b 3M -t 60 + iperf (UL/8Mbps/UDP)(60 sec)(single-ue profile) + -u -b 8M -t 60 UL idefix 1 From 629b04dc80800af8ec7351a88e88547a126488ba Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Wed, 27 Apr 2022 15:25:43 +0200 Subject: [PATCH 076/114] fix(ci): typo when printing Signed-off-by: Raphael Defosseux --- ci-scripts/cls_log_mgt.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci-scripts/cls_log_mgt.py b/ci-scripts/cls_log_mgt.py index e29e9168b7..f1dbf6b8ec 100644 --- a/ci-scripts/cls_log_mgt.py +++ b/ci-scripts/cls_log_mgt.py @@ -81,11 +81,11 @@ class Log_Mgt: def LogRotation(self): doLoop = True nbDays = 14 - while doLoop and nbDays > 2: + while doLoop and nbDays > 1: used_space = self.__CheckUsedSpace() #avail space in target folder if used_space > 80 : logging.debug('\u001B[1;37;41m Used Disk (' + str(used_space) + '%) > 80%, on ' + self.Username+'@'+self.IPAddress + '\u001B[0m') - logging.debug('\u001B[1;37;41m Removing Artifacts older than ' + nbDays + ' days \u001B[0m') + logging.debug('\u001B[1;37;41m Removing Artifacts older than ' + str(nbDays) + ' days \u001B[0m') self.__RemoveOldest(nbDays) nbDays -= 1 else: From e98afec56753f15427c29866626dbeb3c6e7a914 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 27 Apr 2022 17:40:53 +0200 Subject: [PATCH 077/114] NSA-2x2 test: improve gNB configuration --- .../gnb.band78.nsa_2x2.106PRB.usrpn310.conf | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf index e3bd49e7fc..fa7c190538 100644 --- a/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf @@ -199,12 +199,12 @@ gNBs = ); MACRLCs = ( - { - num_cc = 1; - tr_s_preference = "local_L1"; - tr_n_preference = "local_RRC"; - ulsch_max_frame_inactivity = 1; - } +{ + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + ulsch_max_frame_inactivity = 0; +} ); L1s = ( @@ -213,6 +213,7 @@ L1s = ( tr_n_preference = "local_mac"; thread_pool_size = 8; prach_dtx_threshold = 120; + pucch0_dtx_threshold = 80; } ); From 730fa472ae361b5e3e7ab973c5c763b0cd74c046 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 27 Apr 2022 17:46:17 +0200 Subject: [PATCH 078/114] NSA-2x2 test: increase DL traffic requirements --- ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml | 6 +++--- 1 file 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 a4dcb58e8b..332af80d22 100644 --- a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml +++ b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml @@ -115,11 +115,11 @@ Iperf - iperf (DL/60Mbps/UDP)(60 sec)(single-ue profile) - -u -b 60M -t 60 + iperf (DL/125Mbps/UDP)(60 sec)(single-ue profile) + -u -b 125M -t 60 DL nrmodule2_quectel - 5 + 15 single-ue From b089469935673c3101db6eb26edc74290a2491d3 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 27 Apr 2022 18:15:46 +0200 Subject: [PATCH 079/114] Reduce nr_dlsim 256QAM MCS 27 test case to MCS 26, see #543 --- cmake_targets/autotests/test_case_list.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index ce1b9dcdf4..b55228bdc9 100755 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -1093,7 +1093,7 @@ (Test8: 217 PRB 100 PDSCH-PRBs 110 PDSCH-Offset), (Test9: 106 PRBs 50 PDSCH-PRBs MCS Index 27), (Test10: 106 PRBs 50 PDSCH-PRBs MCS Index 16), - (Test11: 106 MCS-TABLE 256 QAM MCS Index 27), + (Test11: 106 MCS-TABLE 256 QAM MCS Index 26), (Test12: HARQ test 25% TP 4 rounds), (Test13: HARQ test 33% TP 3 rounds), (Test14: HARQ test 50% TP 2 rounds), @@ -1121,7 +1121,7 @@ -n100 -R217 -a110 -s5 -b100 -n100 -e27 -s30 -n100 -e16 -s10 - -n100 -q1 -e27 -s30 + -n100 -q1 -e26 -s30 -n100 -s1 -t25 -n100 -s1 -t33 -n100 -s1 -t50 From ced2a66f6e57e3afd77a7d547f0fc32e96fb2eaf Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Wed, 27 Apr 2022 18:36:01 +0200 Subject: [PATCH 080/114] fix(ci): changing the Docker Hub account to push to Signed-off-by: Raphael Defosseux --- ci-scripts/Jenkinsfile-push-registry | 13 +++++--- ci-scripts/provideUniqueImageTag.py | 6 ++-- .../4g_rfsimulator_fdd_05MHz/README.md | 28 ++++++++-------- ci-scripts/yaml_files/5g_l2sim_tdd/README.md | 32 +++++++++---------- .../yaml_files/5g_rfsimulator/README.md | 28 ++++++++-------- 5 files changed, 52 insertions(+), 55 deletions(-) diff --git a/ci-scripts/Jenkinsfile-push-registry b/ci-scripts/Jenkinsfile-push-registry index f5847ff0aa..bc1a80ba61 100644 --- a/ci-scripts/Jenkinsfile-push-registry +++ b/ci-scripts/Jenkinsfile-push-registry @@ -26,6 +26,9 @@ def nodeExecutor = params.nodeExecutor // Name of the phone resource def ciServerResource = params.serverResource +// Docker Hub account to push to +def DH_Account = "oaisoftwarealliance" + pipeline { agent { label nodeExecutor @@ -66,11 +69,11 @@ pipeline { def listOfImages = ["oai-enb", "oai-gnb", "oai-lte-ue", "oai-nr-ue"] sh "docker login -u ${DH_Username} -p ${DH_Password} > /dev/null 2>&1" listOfImages.eachWithIndex { item, iindex -> - sh "docker image tag ${item}:develop ${DH_Username}/${item}:develop" - sh "docker image tag ${item}:develop ${DH_Username}/${item}:${WEEK_TAG}" - sh "docker push --quiet ${DH_Username}/${item}:${WEEK_TAG}" - sh "docker push --quiet ${DH_Username}/${item}:develop" - sh "docker rmi ${DH_Username}/${item}:${WEEK_TAG} ${DH_Username}/${item}:develop" + sh "docker image tag ${item}:develop ${DH_Account}/${item}:develop" + sh "docker image tag ${item}:develop ${DH_Account}/${item}:${WEEK_TAG}" + sh "docker push --quiet ${DH_Account}/${item}:${WEEK_TAG}" + sh "docker push --quiet ${DH_Account}/${item}:develop" + sh "docker rmi ${DH_Account}/${item}:${WEEK_TAG} ${DH_Account}/${item}:develop" } sh "docker logout > /dev/null 2>&1" } diff --git a/ci-scripts/provideUniqueImageTag.py b/ci-scripts/provideUniqueImageTag.py index ee8306402f..88d51ca6f8 100644 --- a/ci-scripts/provideUniqueImageTag.py +++ b/ci-scripts/provideUniqueImageTag.py @@ -5,15 +5,15 @@ import subprocess import sys AUTH_SERVICE = 'registry.docker.io' -AUTH_SCOPE = 'repository:rdefosseoai/oai-enb:pull' +AUTH_SCOPE = 'repository:oaisoftwarealliance/oai-enb:pull' def main() -> None: args = _parse_args() - cmd = 'curl -fsSL "https://auth.docker.io/token?service=' + AUTH_SERVICE + '&scope=' + AUTH_SCOPE + '" | jq --raw-output ".token"' + cmd = 'curl -fsSL "https://auth.docker.io/token?service=' + AUTH_SERVICE + '&scope=' + AUTH_SCOPE + '" 2>/dev/null | jq --raw-output ".token"' token = subprocess.check_output(cmd, shell=True, universal_newlines=True) token = str(token).strip() - cmd = 'curl -fsSL -H "Authorization: Bearer ' + token + '" "https://index.docker.io/v2/rdefosseoai/oai-enb/tags/list" | jq .' + cmd = 'curl -fsSL -H "Authorization: Bearer ' + token + '" "https://index.docker.io/v2/oaisoftwarealliance/oai-enb/tags/list" 2>/dev/null | jq .' listOfTags = subprocess.check_output(cmd, shell=True, universal_newlines=True) foundTag = False diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/README.md b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/README.md index be0d63838b..1a947d0389 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/README.md +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/README.md @@ -31,9 +31,7 @@ This page is only valid for an `Ubuntu18` host. # 1. Retrieving the images on Docker-Hub # -Currently the images are hosted under the user account `rdefosseoai`. - -This may change in the future. +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`. @@ -49,13 +47,13 @@ Now pull images. ```bash $ docker pull cassandra:2.1 $ docker pull redis:6.0.5 -$ docker pull rdefosseoai/oai-hss:latest -$ docker pull rdefosseoai/magma-mme:latest -$ docker pull rdefosseoai/oai-spgwc:latest -$ docker pull rdefosseoai/oai-spgwu-tiny:latest +$ docker pull oaisoftwarealliance/oai-hss:latest +$ docker pull oaisoftwarealliance/magma-mme:latest +$ docker pull oaisoftwarealliance/oai-spgwc:latest +$ docker pull oaisoftwarealliance/oai-spgwu-tiny:latest -$ docker pull rdefosseoai/oai-enb:develop -$ docker pull rdefosseoai/oai-lte-ue:develop +$ docker pull oaisoftwarealliance/oai-enb:develop +$ docker pull oaisoftwarealliance/oai-lte-ue:develop ``` If the `redis` tag is not available, pick the newest available `6.0.x` tag at [Docker Hub Redis Tags](https://hub.docker.com/_/redis?tab=tags). @@ -63,13 +61,13 @@ If the `redis` tag is not available, pick the newest available `6.0.x` tag at [D And **re-tag** them for tutorials' docker-compose file to work. ```bash -$ docker image tag rdefosseoai/oai-spgwc:latest oai-spgwc:latest -$ docker image tag rdefosseoai/oai-hss:latest oai-hss:latest -$ docker image tag rdefosseoai/oai-spgwu-tiny:latest oai-spgwu-tiny:latest -$ docker image tag rdefosseoai/magma-mme:latest magma-mme:latest +$ docker image tag oaisoftwarealliance/oai-spgwc:latest oai-spgwc:latest +$ docker image tag oaisoftwarealliance/oai-hss:latest oai-hss:latest +$ docker image tag oaisoftwarealliance/oai-spgwu-tiny:latest oai-spgwu-tiny:latest +$ docker image tag oaisoftwarealliance/magma-mme:latest magma-mme:latest -$ docker image tag rdefosseoai/oai-enb:develop oai-enb:develop -$ docker image tag rdefosseoai/oai-lte-ue:develop oai-lte-ue:develop +$ docker image tag oaisoftwarealliance/oai-enb:develop oai-enb:develop +$ docker image tag oaisoftwarealliance/oai-lte-ue:develop oai-lte-ue:develop ``` ```bash diff --git a/ci-scripts/yaml_files/5g_l2sim_tdd/README.md b/ci-scripts/yaml_files/5g_l2sim_tdd/README.md index f1e1287995..c3f631cf76 100644 --- a/ci-scripts/yaml_files/5g_l2sim_tdd/README.md +++ b/ci-scripts/yaml_files/5g_l2sim_tdd/README.md @@ -18,9 +18,7 @@ This tutorial is only valid once this file is merged into the `develop` branch. # 1. Retrieving the images on Docker-Hub # -Currently the images are hosted under the user account `rdefosseoai`. - -This may change in the future. +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`. @@ -35,27 +33,27 @@ Now pull images. ```bash $ docker pull mysql:5.7 -$ docker pull rdefosseoai/oai-amf:latest -$ docker pull rdefosseoai/oai-nrf:latest -$ docker pull rdefosseoai/oai-smf:latest -$ docker pull rdefosseoai/oai-spgwu-tiny:latest +$ docker pull oaisoftwarealliance/oai-amf:latest +$ docker pull oaisoftwarealliance/oai-nrf:latest +$ docker pull oaisoftwarealliance/oai-smf:latest +$ docker pull oaisoftwarealliance/oai-spgwu-tiny:latest -$ docker pull rdefosseoai/oai-gnb:develop -$ docker pull rdefosseoai/oai-nr-ue:develop -$ docker pull rdefosseoai/proxy:latest +$ docker pull oaisoftwarealliance/oai-gnb:develop +$ docker pull oaisoftwarealliance/oai-nr-ue:develop +$ docker pull oaisoftwarealliance/proxy:latest ``` And **re-tag** them for tutorials' docker-compose file to work. ```bash -$ docker image tag rdefosseoai/oai-amf:latest oai-amf:latest -$ docker image tag rdefosseoai/oai-nrf:latest oai-nrf:latest -$ docker image tag rdefosseoai/oai-smf:latest oai-smf:latest -$ docker image tag rdefosseoai/oai-spgwu-tiny:latest oai-spgwu-tiny:latest +$ docker image tag oaisoftwarealliance/oai-amf:latest oai-amf:latest +$ docker image tag oaisoftwarealliance/oai-nrf:latest oai-nrf:latest +$ docker image tag oaisoftwarealliance/oai-smf:latest oai-smf:latest +$ docker image tag oaisoftwarealliance/oai-spgwu-tiny:latest oai-spgwu-tiny:latest -$ docker image tag rdefosseoai/oai-gnb:develop oai-gnb:develop -$ docker image tag rdefosseoai/oai-nr-ue:develop oai-nr-ue:develop -$ docker image tag rdefosseoai/proxy:latest oai-lte-multi-ue-proxy:latest +$ docker image tag oaisoftwarealliance/oai-gnb:develop oai-gnb:develop +$ docker image tag oaisoftwarealliance/oai-nr-ue:develop oai-nr-ue:develop +$ docker image tag oaisoftwarealliance/proxy:latest oai-lte-multi-ue-proxy:latest ``` ```bash diff --git a/ci-scripts/yaml_files/5g_rfsimulator/README.md b/ci-scripts/yaml_files/5g_rfsimulator/README.md index 64c9084500..aa18571776 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/README.md +++ b/ci-scripts/yaml_files/5g_rfsimulator/README.md @@ -35,9 +35,7 @@ This page is only valid for an `Ubuntu18` host. # 1. Retrieving the images on Docker-Hub # -Currently the images are hosted under the user account `rdefosseoai`. - -This may change in the future. +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`. @@ -52,25 +50,25 @@ Now pull images. ```bash $ docker pull mysql:5.7 -$ docker pull rdefosseoai/oai-amf:latest -$ docker pull rdefosseoai/oai-nrf:latest -$ docker pull rdefosseoai/oai-smf:latest -$ docker pull rdefosseoai/oai-spgwu-tiny:latest +$ docker pull oaisoftwarealliance/oai-amf:latest +$ docker pull oaisoftwarealliance/oai-nrf:latest +$ docker pull oaisoftwarealliance/oai-smf:latest +$ docker pull oaisoftwarealliance/oai-spgwu-tiny:latest -$ docker pull rdefosseoai/oai-gnb:develop -$ docker pull rdefosseoai/oai-nr-ue:develop +$ docker pull oaisoftwarealliance/oai-gnb:develop +$ docker pull oaisoftwarealliance/oai-nr-ue:develop ``` And **re-tag** them for tutorials' docker-compose file to work. ```bash -$ docker image tag rdefosseoai/oai-amf:latest oai-amf:latest -$ docker image tag rdefosseoai/oai-nrf:latest oai-nrf:latest -$ docker image tag rdefosseoai/oai-smf:latest oai-smf:latest -$ docker image tag rdefosseoai/oai-spgwu-tiny:latest oai-spgwu-tiny:latest +$ docker image tag oaisoftwarealliance/oai-amf:latest oai-amf:latest +$ docker image tag oaisoftwarealliance/oai-nrf:latest oai-nrf:latest +$ docker image tag oaisoftwarealliance/oai-smf:latest oai-smf:latest +$ docker image tag oaisoftwarealliance/oai-spgwu-tiny:latest oai-spgwu-tiny:latest -$ docker image tag rdefosseoai/oai-gnb:develop oai-gnb:develop -$ docker image tag rdefosseoai/oai-nr-ue:develop oai-nr-ue:develop +$ docker image tag oaisoftwarealliance/oai-gnb:develop oai-gnb:develop +$ docker image tag oaisoftwarealliance/oai-nr-ue:develop oai-nr-ue:develop ``` ```bash From e946ddbe47e4f1a22fbcfda5604e5fda3a00fbdc Mon Sep 17 00:00:00 2001 From: Eurecom Date: Wed, 27 Apr 2022 21:34:06 +0200 Subject: [PATCH 081/114] bugfix in if5_tools.c --- openair1/PHY/LTE_TRANSPORT/if5_tools.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openair1/PHY/LTE_TRANSPORT/if5_tools.c b/openair1/PHY/LTE_TRANSPORT/if5_tools.c index e71b1e31f6..76d62f34a2 100644 --- a/openair1/PHY/LTE_TRANSPORT/if5_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/if5_tools.c @@ -1052,7 +1052,7 @@ static inline int64_t clock_difftime_ns(struct timespec start, struct timespec e void send_IF5(RU_t *ru, openair0_timestamp proc_timestamp, int tti, uint8_t *seqno, uint16_t packet_type) { LTE_DL_FRAME_PARMS *fp=ru->frame_parms; - int32_t *txp[fp->nb_antennas_tx], *rxp[fp->nb_antennas_rx]; + int32_t *txp[ru->nb_tx], *rxp[ru->nb_rx]; int32_t *tx_buffer=NULL; uint16_t packet_id=0, i=0; @@ -1131,6 +1131,7 @@ void send_IF5(RU_t *ru, openair0_timestamp proc_timestamp, int tti, uint8_t *seq //VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SEND_IF5_PKT_ID, packet_id ); //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_IF0, 1 ); clock_gettime( CLOCK_MONOTONIC, &start_comp); + ru->ifdevice.trx_write_func2(&ru->ifdevice, (proc_timestamp + packet_id*spp_eth-600)*factor, (void*)txp[aid], From 8d43b9c4770b64b47f9f1fc89bf923e630c4741c Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 28 Apr 2022 09:47:05 +0200 Subject: [PATCH 082/114] NSA 2x2: Set bitrate threshold to mark test green (setup problem) --- ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml index 332af80d22..2ef2b7d7ce 100644 --- a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml +++ b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml @@ -120,6 +120,7 @@ DL nrmodule2_quectel 15 + 85 single-ue From 4df04fc48ca599901bd54e43478cc555955c37ef Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Mon, 11 Apr 2022 12:55:34 +0100 Subject: [PATCH 083/114] Avoid gNB to exit when UE release or becomes out of coverage --- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 1 - 1 file changed, 1 deletion(-) diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index baae1fa436..0a8e03fc1e 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -385,7 +385,6 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP, rb->recv_sdu(rb, (char *)sdu_pP->data, sdu_sizeP, muiP); } else { LOG_E(RLC, "%s:%d:%s: fatal: SDU sent to unknown RB\n", __FILE__, __LINE__, __FUNCTION__); - exit(1); } nr_rlc_manager_unlock(nr_rlc_ue_manager); From dda9077708ef7197d71c15e993ad976d71098b3c Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Tue, 26 Apr 2022 09:46:11 +0100 Subject: [PATCH 084/114] Remove all GTPU tunnels for a specific RNTI after UEContextRelease --- openair2/RRC/NR/rrc_gNB.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 1715677c6d..35c7b487d3 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -3481,6 +3481,7 @@ void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) { mac_remove_nr_ue(ctxt_pP->module_id, ctxt_pP->rnti); rrc_rlc_remove_ue(ctxt_pP); pdcp_remove_UE(ctxt_pP); + newGtpuDeleteAllTunnels(ctxt_pP->instance, ctxt_pP->rnti); /* remove RRC UE Context */ ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[ctxt_pP->module_id], ctxt_pP->rnti); From 3bdc709243142929545d334d3253b089aefbdde2 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Tue, 26 Apr 2022 18:37:25 +0100 Subject: [PATCH 085/114] Fix build of phy_simulators --- openair1/SIMULATION/NR_PHY/dlsim.c | 4 ++++ openair1/SIMULATION/NR_PHY/prachsim.c | 4 ++++ openair1/SIMULATION/NR_PHY/ulsim.c | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 00262149c9..eff65fa606 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -105,6 +105,10 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer return 0; } +int newGtpuDeleteAllTunnels(instance_t instance, rnti_t rnti) { + return 0; +} + // dummy functions int dummy_nr_ue_ul_indication(nr_uplink_indication_t *ul_info) { return(0); } diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index f255ab5337..325cbb1ecc 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -97,6 +97,10 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer return 0; } +int newGtpuDeleteAllTunnels(instance_t instance, rnti_t rnti) { + return 0; +} + void rrc_data_ind( const protocol_ctxt_t *const ctxt_pP, diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 09499248b2..e70d08bdb3 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -100,6 +100,11 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer transport_layer_addr_t remoteAddr, int port, gtpCallback callBack) { return 0; } + +int newGtpuDeleteAllTunnels(instance_t instance, rnti_t rnti) { + return 0; +} + extern void fix_scd(NR_ServingCellConfig_t *scd);// forward declaration int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, From 3571769bef1384596e8dd446e5bd851abf84c7c0 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 11 Apr 2022 18:22:10 +0200 Subject: [PATCH 086/114] Correctly initialize RLC when using phy-test mode When using phy-test mode, the RNTI for PDCP/RLC initialization would be 0, incorrectly initializing these layers, fixed in this commit. Additionally, in this commit, we only trigger the initialization in cases where the UE context is initialized (before, the RNTI might be 0 in other cases as well). --- openair2/RRC/NR/rrc_gNB_nsa.c | 47 +++++++++++++++++------------------ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index bb66d1513b..3f41c69d72 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -339,8 +339,6 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ sizeof(X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).rrc_buffer)); X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).rrc_buffer_size = (enc_rval.encoded+7)>>3; itti_send_msg_to_task(TASK_X2AP, ENB_MODULE_ID_TO_INSTANCE(0), msg); //Check right id instead of hardcoding - } else if (get_softmodem_params()->do_ra || get_softmodem_params()->sa) { - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, rrc->module_id, GNB_FLAG_YES, ue_context_p->ue_id_rnti, 0, 0,rrc->module_id); } rrc->Nb_ue++; @@ -374,36 +372,37 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ } if(m == NULL){ + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, rrc->module_id, GNB_FLAG_YES, ue_context_p->ue_id_rnti, 0, 0, rrc->module_id); LOG_W(RRC, "Calling RRC PDCP/RLC ASN1 request functions for protocol context %p with module_id %d, rnti %x, frame %d, subframe %d eNB_index %d \n", &ctxt, ctxt.module_id, ctxt.rnti, ctxt.frame, ctxt.subframe, ctxt.eNB_index); + + nr_rrc_pdcp_config_asn1_req(&ctxt, + get_softmodem_params()->sa ? ue_context_p->ue_context.rb_config->srb_ToAddModList : (NR_SRB_ToAddModList_t *) NULL, + ue_context_p->ue_context.rb_config->drb_ToAddModList , + ue_context_p->ue_context.rb_config->drb_ToReleaseList, + (ue_context_p->ue_context.integrity_algorithm << 4) | ue_context_p->ue_context.ciphering_algorithm, + NULL, /* kRRCenc - unused */ + NULL, /* kRRCint - unused */ + kUPenc, /* kUPenc */ + kUPint, /* kUPint */ + NULL, + NULL, + ue_context_p->ue_context.secondaryCellGroup->rlc_BearerToAddModList); + + nr_rrc_rlc_config_asn1_req (&ctxt, + get_softmodem_params()->sa ? ue_context_p->ue_context.rb_config->srb_ToAddModList : (NR_SRB_ToAddModList_t *) NULL, + ue_context_p->ue_context.rb_config->drb_ToAddModList, + ue_context_p->ue_context.rb_config->drb_ToReleaseList, + (LTE_PMCH_InfoList_r9_t *) NULL, + ue_context_p->ue_context.secondaryCellGroup->rlc_BearerToAddModList); + + LOG_D(RRC, "%s:%d: done RRC PDCP/RLC ASN1 request for UE rnti %x\n", __FUNCTION__, __LINE__, ctxt.rnti); } - nr_rrc_pdcp_config_asn1_req(&ctxt, - get_softmodem_params()->sa ? ue_context_p->ue_context.rb_config->srb_ToAddModList : (NR_SRB_ToAddModList_t *) NULL, - ue_context_p->ue_context.rb_config->drb_ToAddModList , - ue_context_p->ue_context.rb_config->drb_ToReleaseList, - (ue_context_p->ue_context.integrity_algorithm << 4) | ue_context_p->ue_context.ciphering_algorithm, - NULL, /* kRRCenc - unused */ - NULL, /* kRRCint - unused */ - kUPenc, /* kUPenc */ - kUPint, /* kUPint */ - NULL, - NULL, - ue_context_p->ue_context.secondaryCellGroup->rlc_BearerToAddModList); - - nr_rrc_rlc_config_asn1_req (&ctxt, - get_softmodem_params()->sa ? ue_context_p->ue_context.rb_config->srb_ToAddModList : (NR_SRB_ToAddModList_t *) NULL, - ue_context_p->ue_context.rb_config->drb_ToAddModList, - ue_context_p->ue_context.rb_config->drb_ToReleaseList, - (LTE_PMCH_InfoList_r9_t *) NULL, - ue_context_p->ue_context.secondaryCellGroup->rlc_BearerToAddModList); - - LOG_D(RRC, "%s:%d: done RRC PDCP/RLC ASN1 request for UE rnti %x\n", __FUNCTION__, __LINE__, ctxt.rnti); - } void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti) { From e4e08925ecb621af0a85ec24f039efdad8103a44 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 12 Apr 2022 18:25:41 +0200 Subject: [PATCH 087/114] Speed up random TB filling in phy-test mode --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 53485886c0..03b35a17a5 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -1478,6 +1478,10 @@ void nr_schedule_ue_spec(module_id_t module_id, header->L = htons(bufEnd-buf); dlsch_total_bytes += bufEnd-buf; + for (; buf < bufEnd - 3; buf += 4) { + uint32_t *buf32 = (uint32_t *)buf; + *buf32 = lrand48(); + } for (; buf < bufEnd; buf++) *buf = lrand48() & 0xff; } From 3054102200af4ad66589eccd8d568b66cbfbe2c2 Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 13 Apr 2022 17:51:05 +0200 Subject: [PATCH 088/114] targets config file cleanup --- targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf | 3 --- targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf | 1 - .../CONF/gnb.band78.tm1.106PRB.usrpn300.gtp-itti.conf | 2 +- .../GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf | 1 - .../GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.106PRB.usrpn300.conf | 1 - .../CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf | 1 - .../GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf | 1 - 7 files changed, 1 insertion(+), 9 deletions(-) diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf index c07a0db649..6aacd98c7f 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf @@ -45,10 +45,7 @@ gNBs = remote_s_portc = 500; remote_s_portd = 2152; ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; min_rxtxtime = 6; - sib1_tda = 0; pdcch_ConfigSIB1 = ( { diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf index 256d724f3f..f95bdf91ae 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf @@ -38,7 +38,6 @@ gNBs = ssb_SubcarrierOffset = 0; min_rxtxtime = 6; - sib1_tda = 0; pdcch_ConfigSIB1 = ( { diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.band78.tm1.106PRB.usrpn300.gtp-itti.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.band78.tm1.106PRB.usrpn300.gtp-itti.conf index 726e43d7ad..f91683897f 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.band78.tm1.106PRB.usrpn300.gtp-itti.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.band78.tm1.106PRB.usrpn300.gtp-itti.conf @@ -37,7 +37,7 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - sib1_tda = 0; + servingCellConfigCommon = ( { #spCellConfigCommon diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf index 7e2db64aaa..d124c5692f 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf @@ -34,7 +34,6 @@ gNBs = ssb_SubcarrierOffset = 0; min_rxtxtime = 6; - sib1_tda = 0; do_SRS = 1; pdcch_ConfigSIB1 = ( diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.106PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.106PRB.usrpn300.conf index cab801525b..ff64fe718a 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.106PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.106PRB.usrpn300.conf @@ -36,7 +36,6 @@ gNBs = pdsch_AntennaPorts = 1; pusch_AntennaPorts = 1; min_rxtxtime = 6; - sib1_tda = 0; pdcch_ConfigSIB1 = ( { diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf index 950e9c1d38..1bc6de3bfe 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf @@ -35,7 +35,6 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts_N1 = 2; pusch_AntennaPorts = 2; - sib1_tda = 0; do_SRS = 1; ul_prbblacklist = "51,52,53,54" diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf index 1dc903b811..a0cee6f9ca 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf @@ -34,7 +34,6 @@ gNBs = ssb_SubcarrierOffset = 0; min_rxtxtime = 6; - sib1_tda = 0; pdcch_ConfigSIB1 = ( { From 40b0ce997835a37e4a5f404689d201fa0b661580 Mon Sep 17 00:00:00 2001 From: francescomani Date: Tue, 19 Apr 2022 15:47:12 +0200 Subject: [PATCH 089/114] vrb map fixes --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 9a651293b2..ede66f4b38 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -391,7 +391,7 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP const int16_t N_RA_RB = get_N_RA_RB(cfg->prach_config.prach_sub_c_spacing.value, mu_pusch); uint16_t *vrb_map_UL = &cc->vrb_map_UL[slotP * MAX_BWP_SIZE]; for (int i = 0; i < N_RA_RB * fdm; ++i) - vrb_map_UL[bwp_start + rach_ConfigGeneric->msg1_FrequencyStart + i] = SL_to_bitmap(start_symbol, N_t_slot*N_dur); + vrb_map_UL[bwp_start + rach_ConfigGeneric->msg1_FrequencyStart + i] |= SL_to_bitmap(start_symbol, N_t_slot*N_dur); } } } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 4b654e2ad1..f631f9bfd5 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -426,7 +426,7 @@ uint32_t schedule_control_sib1(module_id_t module_id, gNB_mac->sched_ctrlCommon->cce_index, gNB_mac->sched_ctrlCommon->aggregation_level); for (int rb = 0; rb < gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize; rb++) { - vrb_map[rb + rbStart] = SL_to_bitmap(startSymbolIndex, nrOfSymbols); + vrb_map[rb + rbStart] |= SL_to_bitmap(startSymbolIndex, nrOfSymbols); } return TBS; } From 4be054b8ba201be69542a8b23ec191b3728cf4fa Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 19 Apr 2022 17:24:48 +0200 Subject: [PATCH 090/114] Fix band66 CI config file locationAndBandwidth --- .../conf_files/gnb.sa.band66.fr1.106PRB.usrpn300.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ci-scripts/conf_files/gnb.sa.band66.fr1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.sa.band66.fr1.106PRB.usrpn300.conf index e26fc3030d..b78ca916f3 100644 --- a/ci-scripts/conf_files/gnb.sa.band66.fr1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.sa.band66.fr1.106PRB.usrpn300.conf @@ -63,8 +63,8 @@ gNBs = dl_carrierBandwidth = 106; #initialDownlinkBWP #genericParameters - # this is RBstart=27,L=48 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 13475; # 6366 12925 12956 28875 12952 + # this is RBstart=0,L=106 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 28875; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; @@ -85,7 +85,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 13475; + initialULBWPlocationAndBandwidth = 28875; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; From 1060de4c323aa774060f62ae504925ea0f09be10 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 20 Apr 2022 12:29:16 +0200 Subject: [PATCH 091/114] Correct frame calculation in UL scheduler --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 72061bb9ba..0d61c639ed 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -1479,7 +1479,7 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t if (tda < 0) return false; int K2 = get_K2(scc, scc_sib1, sched_ctrl->active_ubwp, tda, mu); - const int sched_frame = frame + (slot + K2 >= nr_slots_per_frame[mu]); + const int sched_frame = (frame + (slot + K2 >= nr_slots_per_frame[mu])) % 1024; const int sched_slot = (slot + K2) % nr_slots_per_frame[mu]; if (!is_xlsch_in_slot(nr_mac->ulsch_slot_bitmap[sched_slot / 64], sched_slot)) From db0a9f60c1990d90e7bcfafc2bbd3abe2dd9d0d3 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 20 Apr 2022 12:32:24 +0200 Subject: [PATCH 092/114] Correct slot calculation in nr_acknack_scheduling() --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 43822d0cd0..0e87af56f5 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -1598,11 +1598,11 @@ int nr_acknack_scheduling(int mod_id, const NR_TDD_UL_DL_Pattern_t *tdd = scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL; // initializing the values for FDD int nr_slots_period = n_slots_frame; - int first_ul_slot_tdd = slot + minfbtime; + int next_ul_slot = slot + minfbtime; int first_ul_slot_period = 0; if(tdd){ nr_slots_period /= get_nb_periods_per_frame(tdd->dl_UL_TransmissionPeriodicity); - first_ul_slot_tdd = tdd->nrofDownlinkSlots + nr_slots_period * (slot / nr_slots_period); + next_ul_slot = tdd->nrofDownlinkSlots + nr_slots_period * (slot / nr_slots_period); first_ul_slot_period = tdd->nrofDownlinkSlots; } else @@ -1746,8 +1746,8 @@ int nr_acknack_scheduling(int mod_id, AssertFatal(pucch->sr_flag + pucch->dai_c == 0, "expected no SR/AckNack for UE %d in %4d.%2d, but has %d/%d for %4d.%2d\n", UE_id, frame, slot, pucch->sr_flag, pucch->dai_c, pucch->frame, pucch->ul_slot); - const int s = first_ul_slot_tdd; - pucch->frame = (s < n_slots_frame - 1) ? frame : (frame + 1) % 1024; + const int s = next_ul_slot; + pucch->frame = s < n_slots_frame ? frame : (frame + 1) % 1024; pucch->ul_slot = s % n_slots_frame; } From 9fcc94313c17f42fb0e87c2875e47750e4bfd5dc Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 21 Apr 2022 15:51:10 +0200 Subject: [PATCH 093/114] Make variables in nr_acknack_scheduling() const --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 0e87af56f5..bf9ca4d26d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -1596,18 +1596,10 @@ int nr_acknack_scheduling(int mod_id, const NR_ServingCellConfigCommon_t *scc = RC.nrmac[mod_id]->common_channels[CC_id].ServingCellConfigCommon; const int n_slots_frame = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; const NR_TDD_UL_DL_Pattern_t *tdd = scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL; - // initializing the values for FDD - int nr_slots_period = n_slots_frame; - int next_ul_slot = slot + minfbtime; - int first_ul_slot_period = 0; - if(tdd){ - nr_slots_period /= get_nb_periods_per_frame(tdd->dl_UL_TransmissionPeriodicity); - next_ul_slot = tdd->nrofDownlinkSlots + nr_slots_period * (slot / nr_slots_period); - first_ul_slot_period = tdd->nrofDownlinkSlots; - } - else - // if TDD configuration is not present and the band is not FDD, it means it is a dynamic TDD configuration - AssertFatal(RC.nrmac[mod_id]->common_channels[CC_id].frame_type == FDD,"Dynamic TDD not handled yet\n"); + AssertFatal(tdd || RC.nrmac[mod_id]->common_channels[CC_id].frame_type == FDD, "Dynamic TDD not handled yet\n"); + const int nr_slots_period = tdd ? n_slots_frame / get_nb_periods_per_frame(tdd->dl_UL_TransmissionPeriodicity) : n_slots_frame; + const int next_ul_slot = tdd ? tdd->nrofDownlinkSlots + nr_slots_period * (slot / nr_slots_period) : slot + minfbtime; + const int first_ul_slot_period = tdd ? tdd->nrofDownlinkSlots : 0; NR_sched_pucch_t *csi_pucch; From d5419a27f2ab14f3d93354bcd46ccb37fe05c333 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 21 Apr 2022 16:38:06 +0200 Subject: [PATCH 094/114] Correct check for free symbols for PUSCH/PDSCH allocation --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 19 ++++++-------- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 26 +++++++++---------- 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 03b35a17a5..4dd098162c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -571,8 +571,8 @@ bool allocate_dl_retransmission(module_id_t module_id, rbStart += rbSize; /* last iteration rbSize was not enough, skip it */ rbSize = 0; - while (rbStart < bwpSize && - !(rballoc_mask[rbStart]&SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols))) + const int slbitmap = SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols); + while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap) rbStart++; if (rbStart >= bwpSize) { @@ -581,7 +581,7 @@ bool allocate_dl_retransmission(module_id_t module_id, } while (rbStart + rbSize < bwpSize && - (rballoc_mask[rbStart + rbSize]&SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols)) && + (rballoc_mask[rbStart + rbSize] & slbitmap) == slbitmap && rbSize < retInfo->rbSize) rbSize++; } @@ -614,12 +614,11 @@ bool allocate_dl_retransmission(module_id_t module_id, ps->nrOfLayers, sched_ctrl, &temp_ps); - while (rbStart < bwpSize && - !(rballoc_mask[rbStart]&SL_to_bitmap(temp_ps.startSymbolIndex, temp_ps.nrOfSymbols))) + const uint16_t slbitmap = SL_to_bitmap(temp_ps.startSymbolIndex, temp_ps.nrOfSymbols); + while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap) rbStart++; - while (rbStart + rbSize < bwpSize && - (rballoc_mask[rbStart + rbSize]&SL_to_bitmap(temp_ps.startSymbolIndex, temp_ps.nrOfSymbols))) + while (rbStart + rbSize < bwpSize && (rballoc_mask[rbStart + rbSize] & slbitmap) == slbitmap) rbSize++; uint32_t new_tbs; @@ -929,14 +928,12 @@ void pf_dl(module_id_t module_id, const uint16_t slbitmap = SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols); // Freq-demain allocation - while (rbStart < bwpSize && - !(rballoc_mask[rbStart]&slbitmap)) + while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap) rbStart++; uint16_t max_rbSize = 1; - while (rbStart + max_rbSize < bwpSize && - (rballoc_mask[rbStart + max_rbSize]&slbitmap)) + while (rbStart + max_rbSize < bwpSize && (rballoc_mask[rbStart + max_rbSize] & slbitmap) == slbitmap) max_rbSize++; sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, ps->mcsTableIdx); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 0d61c639ed..e62ac993b4 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -1002,8 +1002,8 @@ bool allocate_ul_retransmission(module_id_t module_id, } /* Check the resource is enough for retransmission */ - while (rbStart < bwpSize && - !(rballoc_mask[rbStart]&SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols))) + const uint16_t slbitmap = SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols); + while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap) rbStart++; if (rbStart + retInfo->rbSize > bwpSize) { LOG_W(NR_MAC, "cannot allocate retransmission of UE %d/RNTI %04x: no resources (rbStart %d, retInfo->rbSize %d, bwpSize %d\n", UE_id, UE_info->rnti[UE_id], rbStart, retInfo->rbSize, bwpSize); @@ -1023,12 +1023,11 @@ bool allocate_ul_retransmission(module_id_t module_id, &temp_ps); /* the retransmission will use a different time domain allocation, check * that we have enough resources */ - while (rbStart < bwpSize && - !(rballoc_mask[rbStart]&SL_to_bitmap(temp_ps.startSymbolIndex, temp_ps.nrOfSymbols))) + const uint16_t slbitmap = SL_to_bitmap(temp_ps.startSymbolIndex, temp_ps.nrOfSymbols); + while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap) rbStart++; int rbSize = 0; - while (rbStart + rbSize < bwpSize && - (rballoc_mask[rbStart + rbSize]&SL_to_bitmap(temp_ps.startSymbolIndex, temp_ps.nrOfSymbols))) + while (rbStart + rbSize < bwpSize && (rballoc_mask[rbStart + rbSize] & slbitmap) == slbitmap) rbSize++; uint32_t new_tbs; uint16_t new_rbSize; @@ -1260,8 +1259,8 @@ void pf_ul(module_id_t module_id, } LOG_D(NR_MAC,"Looking for min_rb %d RBs, starting at %d\n", min_rb, rbStart); - while (rbStart < bwpSize && - !(rballoc_mask[rbStart]&SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols))) + const uint16_t slbitmap = SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols); + while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap) rbStart++; if (rbStart + min_rb >= bwpSize) { LOG_W(NR_MAC, "cannot allocate continuous UL data for UE %d/RNTI %04x: no resources (rbStart %d, min_rb %d, bwpSize %d\n", @@ -1294,7 +1293,7 @@ void pf_ul(module_id_t module_id, /* Mark the corresponding RBs as used */ n_rb_sched -= sched_pusch->rbSize; for (int rb = 0; rb < sched_ctrl->sched_pusch.rbSize; rb++) - rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] ^= SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols); + rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] ^= slbitmap; continue; } @@ -1398,13 +1397,12 @@ void pf_ul(module_id_t module_id, } update_ul_ue_R_Qm(sched_pusch, ps); - while (rbStart < bwpSize && - !(rballoc_mask[rbStart]&SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols))) + const uint16_t slbitmap = SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols); + while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap) rbStart++; sched_pusch->rbStart = rbStart; uint16_t max_rbSize = 1; - while (rbStart + max_rbSize < bwpSize && - (rballoc_mask[rbStart + max_rbSize]&&SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols))) + while (rbStart + max_rbSize < bwpSize && (rballoc_mask[rbStart + max_rbSize] & slbitmap) == slbitmap) max_rbSize++; if (rbStart + min_rb >= bwpSize) { @@ -1445,7 +1443,7 @@ void pf_ul(module_id_t module_id, n_rb_sched -= sched_pusch->rbSize; for (int rb = 0; rb < sched_ctrl->sched_pusch.rbSize; rb++) - rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] ^= SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols); + rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] ^= slbitmap; } } From 00609ed15a8f52332e78783b34f1fb16e73000a4 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 21 Apr 2022 17:11:02 +0200 Subject: [PATCH 095/114] Enable UDP traffic test in 5G FDD RFsim test --- ci-scripts/xml_files/container_5g_fdd_rfsim.xml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ci-scripts/xml_files/container_5g_fdd_rfsim.xml b/ci-scripts/xml_files/container_5g_fdd_rfsim.xml index 61a2af9e54..b41dafb767 100644 --- a/ci-scripts/xml_files/container_5g_fdd_rfsim.xml +++ b/ci-scripts/xml_files/container_5g_fdd_rfsim.xml @@ -33,12 +33,10 @@ 000013 020011 020012 - 100011 - - + 100011 + @@ -104,7 +102,7 @@ rfsim5g-oai-ext-dn rfsim5g-oai-nr-ue -u -i 1 -s - -B 12.1.1.2 -c 192.168.72.135 -u -i 1 -t 30 -b 1M + -B 12.1.1.2 -c 192.168.72.135 -u -i 1 -t 30 -b 3M From 85eb5926dd6d6c3446cf9a823ad71ddf9a85fc7f Mon Sep 17 00:00:00 2001 From: Laurent Thomas Date: Thu, 28 Apr 2022 14:36:03 +0200 Subject: [PATCH 096/114] x2 nsa bug --- ci-scripts/ran.py | 72 +++++++++++++++-------------------- openair2/X2AP/x2ap_eNB.c | 19 ++++----- openair3/SCTP/sctp_common.h | 2 +- openair3/SCTP/sctp_eNB_task.c | 18 ++++----- 4 files changed, 45 insertions(+), 66 deletions(-) diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py index 287a0a3c09..97c5b9696e 100644 --- a/ci-scripts/ran.py +++ b/ci-scripts/ran.py @@ -372,36 +372,28 @@ class RANManagement(): else: pcapfile_prefix="gnb_" mySSH.open(lIpAddr, lUserName, lPassWord) - mySSH.command('ip addr show | awk -f /tmp/active_net_interfaces.awk | egrep -v "lo|tun"', '\$', 5) - result = re.search('interfaceToUse=(?P[a-zA-Z0-9\-\_]+)done', mySSH.getBefore()) - if result is not None: - eth_interface = result.group('eth_interface') - fltr = 'port 38412 or port 36412 or port 36422' # NGAP, S1AP, X2AP - logging.debug('\u001B[1m Launching tshark on interface ' + eth_interface + ' with filter "' + fltr + '"\u001B[0m') - pcapfile = pcapfile_prefix + self.testCase_id + '_log.pcap' - mySSH.command('echo ' + lPassWord + ' | sudo -S rm -f /tmp/' + pcapfile , '\$', 5) - mySSH.command('echo $USER; nohup sudo -E tshark -i ' + eth_interface + ' -f "' + fltr + '" -w /tmp/' + pcapfile + ' > /dev/null 2>&1 &','\$', 5) + eth_interface = 'any' + fltr = 'sctp' + logging.debug('\u001B[1m Launching tshark on interface ' + eth_interface + ' with filter "' + fltr + '"\u001B[0m') + pcapfile = pcapfile_prefix + self.testCase_id + '_log.pcap' + mySSH.command('echo ' + lPassWord + ' | sudo -S rm -f /tmp/' + pcapfile , '\$', 5) + mySSH.command('echo $USER; nohup sudo -E tshark -i ' + eth_interface + ' -f "' + fltr + '" -w /tmp/' + pcapfile + ' > /dev/null 2>&1 &','\$', 5) mySSH.close() # If tracer options is on, running tshark on EPC side and capture traffic b/ EPC and eNB - result = re.search('T_stdout', str(self.Initialize_eNB_args)) - if (result is not None): - localEpcIpAddr = EPC.IPAddress - localEpcUserName = EPC.UserName - localEpcPassword = EPC.Password - mySSH.open(localEpcIpAddr, localEpcUserName, localEpcPassword) - mySSH.command('ip addr show | awk -f /tmp/active_net_interfaces.awk | egrep -v "lo|tun"', '\$', 5) - result = re.search('interfaceToUse=(?P[a-zA-Z0-9\-\_]+)done', mySSH.getBefore()) - if result is not None: - eth_interface = result.group('eth_interface') - fltr = 'port 38412 or port 36412 or port 36422' # NGAP, S1AP, X2AP - logging.debug('\u001B[1m Launching tshark on interface ' + eth_interface + ' with filter "' + fltr + '"\u001B[0m') - self.epcPcapFile = 'enb_' + self.testCase_id + '_s1log.pcap' - mySSH.command('echo ' + localEpcPassword + ' | sudo -S rm -f /tmp/' + self.epcPcapFile , '\$', 5) - mySSH.command('echo $USER; nohup sudo tshark -f "host ' + lIpAddr +'" -i ' + eth_interface + ' -f "' + fltr + '" -w /tmp/' + self.epcPcapFile + ' > /tmp/tshark.log 2>&1 &', localEpcUserName, 5) - mySSH.close() + localEpcIpAddr = EPC.IPAddress + localEpcUserName = EPC.UserName + localEpcPassword = EPC.Password + mySSH.open(localEpcIpAddr, localEpcUserName, localEpcPassword) + eth_interface = 'any' + fltr = 'sctp' + logging.debug('\u001B[1m Launching tshark on interface ' + eth_interface + ' with filter "' + fltr + '"\u001B[0m') + self.epcPcapFile = 'enb_' + self.testCase_id + '_s1log.pcap' + mySSH.command('echo ' + localEpcPassword + ' | sudo -S rm -f /tmp/' + self.epcPcapFile , '\$', 5) + mySSH.command('echo $USER; nohup sudo tshark -f "host ' + lIpAddr +'" -i ' + eth_interface + ' -f "' + fltr + '" -w /tmp/' + self.epcPcapFile + ' > /tmp/tshark.log 2>&1 &', localEpcUserName, 5) + mySSH.close() mySSH.open(lIpAddr, lUserName, lPassWord) mySSH.command('cd ' + lSourcePath, '\$', 5) # Initialize_eNB_args usually start with -O and followed by the location in repository @@ -519,23 +511,19 @@ class RANManagement(): logging.error('\u001B[1;37;41m eNB/gNB/ocp-eNB logging system did not show got sync! \u001B[0m') HTML.CreateHtmlTestRow(self.air_interface[self.eNB_instance] + ' -O ' + config_file + extra_options, 'KO', CONST.ALL_PROCESSES_OK) # In case of T tracer recording, we need to kill tshark on EPC side - result = re.search('T_stdout', str(self.Initialize_eNB_args)) - if (result is not None): - localEpcIpAddr = EPC.IPAddress - localEpcUserName = EPC.UserName - localEpcPassword = EPC.Password - mySSH.open(localEpcIpAddr, localEpcUserName, localEpcPassword) - logging.debug('\u001B[1m Stopping tshark \u001B[0m') - mySSH.command('echo ' + localEpcPassword + ' | sudo -S killall --signal SIGKILL tshark', '\$', 5) - if self.epcPcapFile != '': - time.sleep(0.5) - mySSH.command('echo ' + localEpcPassword + ' | sudo -S chmod 666 /tmp/' + self.epcPcapFile, '\$', 5) - mySSH.close() - time.sleep(1) - if self.epcPcapFile != '': - copyin_res = mySSH.copyin(localEpcIpAddr, localEpcUserName, localEpcPassword, '/tmp/' + self.epcPcapFile, '.') - if (copyin_res == 0): - mySSH.copyout(lIpAddr, lUserName, lPassWord, self.epcPcapFile, lSourcePath + '/cmake_targets/.') + localEpcIpAddr = EPC.IPAddress + localEpcUserName = EPC.UserName + localEpcPassword = EPC.Password + mySSH.open(localEpcIpAddr, localEpcUserName, localEpcPassword) + logging.debug('\u001B[1m Stopping tshark \u001B[0m') + mySSH.command('echo ' + localEpcPassword + ' | sudo -S killall --signal SIGKILL tshark', '\$', 5) + if self.epcPcapFile != '': + mySSH.command('echo ' + localEpcPassword + ' | sudo -S chmod 666 /tmp/' + self.epcPcapFile, '\$', 5) + mySSH.close() + if self.epcPcapFile != '': + copyin_res = mySSH.copyin(localEpcIpAddr, localEpcUserName, localEpcPassword, '/tmp/' + self.epcPcapFile, '.') + if (copyin_res == 0): + mySSH.copyout(lIpAddr, lUserName, lPassWord, self.epcPcapFile, lSourcePath + '/cmake_targets/.') self.prematureExit = True return else: diff --git a/openair2/X2AP/x2ap_eNB.c b/openair2/X2AP/x2ap_eNB.c index 2b1d19001a..a73bc0a640 100644 --- a/openair2/X2AP/x2ap_eNB.c +++ b/openair2/X2AP/x2ap_eNB.c @@ -70,8 +70,7 @@ void x2ap_eNB_register_eNB(x2ap_eNB_instance_t *instance_p, net_ip_address_t *local_ip_addr, uint16_t in_streams, uint16_t out_streams, - uint32_t enb_port_for_X2C, - int multi_sd); + uint32_t enb_port_for_X2C); static void x2ap_eNB_handle_handover_req(instance_t instance, @@ -249,20 +248,17 @@ static void x2ap_eNB_register_eNB(x2ap_eNB_instance_t *instance_p, net_ip_address_t *local_ip_addr, uint16_t in_streams, uint16_t out_streams, - uint32_t enb_port_for_X2C, - int multi_sd) { + uint32_t enb_port_for_X2C) { MessageDef *message = NULL; - sctp_new_association_req_multi_t *sctp_new_association_req = NULL; x2ap_eNB_data_t *x2ap_enb_data = NULL; DevAssert(instance_p != NULL); DevAssert(target_eNB_ip_address != NULL); - message = itti_alloc_new_message(TASK_X2AP, 0, SCTP_NEW_ASSOCIATION_REQ_MULTI); - sctp_new_association_req = &message->ittiMsg.sctp_new_association_req_multi; + message = itti_alloc_new_message(TASK_X2AP, 0, SCTP_NEW_ASSOCIATION_REQ); + sctp_new_association_req_t *sctp_new_association_req = &message->ittiMsg.sctp_new_association_req; sctp_new_association_req->port = enb_port_for_X2C; sctp_new_association_req->ppid = X2AP_SCTP_PPID; sctp_new_association_req->in_streams = in_streams; sctp_new_association_req->out_streams = out_streams; - sctp_new_association_req->multi_sd = multi_sd; memcpy(&sctp_new_association_req->remote_address, target_eNB_ip_address, sizeof(*target_eNB_ip_address)); @@ -399,8 +395,7 @@ void x2ap_eNB_handle_sctp_init_msg_multi_cnf( &instance->enb_x2_ip_address, instance->sctp_in_streams, instance->sctp_out_streams, - instance->enb_port_for_X2C, - instance->multi_sd); + instance->enb_port_for_X2C); } } @@ -645,7 +640,8 @@ void *x2ap_task(void *arg) { while (1) { itti_receive_msg(TASK_X2AP, &received_msg); - + LOG_D(X2AP, "Received message %d:%s\n", + ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); switch (ITTI_MSG_ID(received_msg)) { case TERMINATE_MESSAGE: X2AP_WARN(" *** Exiting X2AP thread\n"); @@ -684,7 +680,6 @@ void *x2ap_task(void *arg) { case X2AP_ENDC_SGNB_ADDITION_REQ_ACK: x2ap_gNB_trigger_sgNB_add_req_ack(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &X2AP_ENDC_SGNB_ADDITION_REQ_ACK(received_msg)); - LOG_I(X2AP, "Received elements for X2AP_ENDC_SGNB_ADDITION_REQ_ACK \n"); break; case X2AP_ENDC_SGNB_RECONF_COMPLETE: diff --git a/openair3/SCTP/sctp_common.h b/openair3/SCTP/sctp_common.h index ecaeebd090..024feb8b09 100644 --- a/openair3/SCTP/sctp_common.h +++ b/openair3/SCTP/sctp_common.h @@ -37,7 +37,7 @@ #if defined(ENB_MODE) # include "common/utils/LOG/log.h" # define SCTP_ERROR(x, args...) LOG_E(SCTP, x, ##args) -# define SCTP_DEBUG(x, args...) LOG_I(SCTP, x, ##args) +# define SCTP_DEBUG(x, args...) LOG_D(SCTP, x, ##args) # define SCTP_WARN(x, args...) LOG_W(SCTP, x, ##args) #else # define SCTP_ERROR(x, args...) do { fprintf(stderr, "[SCTP][E]"x, ##args); } while(0) diff --git a/openair3/SCTP/sctp_eNB_task.c b/openair3/SCTP/sctp_eNB_task.c index ab49125856..06e606e36b 100644 --- a/openair3/SCTP/sctp_eNB_task.c +++ b/openair3/SCTP/sctp_eNB_task.c @@ -318,7 +318,8 @@ sctp_handle_new_association_req_multi( assoc_id, used_address); } } else { - SCTP_DEBUG("sctp_connectx SUCCESS, used %d addresses assoc_id %d\n", + SCTP_DEBUG("sctp_connectx SUCCESS, socket %d used %d addresses assoc_id %d\n", + sd, used_address, assoc_id); } @@ -750,7 +751,7 @@ static int sctp_create_new_listener( } if (server_type) { - if ((sd = socket(PF_INET, SOCK_SEQPACKET, IPPROTO_SCTP)) < 0) { + if ((sd = socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP)) < 0) { SCTP_ERROR("socket: %s:%d\n", strerror(errno), errno); free(addr); return -1; @@ -822,7 +823,7 @@ static int sctp_create_new_listener( sctp_cnx = NULL; return -1; } - + SCTP_DEBUG("Created listen socket: %d\n", sd); /* Insert new element at end of list */ STAILQ_INSERT_TAIL(&sctp_cnx_list, sctp_cnx, entries); sctp_nb_cnx++; @@ -1110,11 +1111,10 @@ void *sctp_eNB_process_itti_msg(void *notUsed) /* Check if there is a packet to handle */ if (received_msg != NULL) { + LOG_D(SCTP,"Received message %d:%s\n", + ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); switch (ITTI_MSG_ID(received_msg)) { case SCTP_INIT_MSG: { - SCTP_DEBUG("Received SCTP_INIT_MSG\n"); - - /* We received a new connection request */ if (sctp_create_new_listener( ITTI_MSG_DESTINATION_INSTANCE(received_msg), ITTI_MSG_ORIGIN_ID(received_msg), @@ -1126,11 +1126,7 @@ void *sctp_eNB_process_itti_msg(void *notUsed) break; case SCTP_INIT_MSG_MULTI_REQ: { - int multi_sd; - - SCTP_DEBUG("Received SCTP_INIT_MSG_MULTI_REQ\n"); - - multi_sd = sctp_create_new_listener( + int multi_sd = sctp_create_new_listener( ITTI_MSG_DESTINATION_INSTANCE(received_msg), ITTI_MSG_ORIGIN_ID(received_msg), &received_msg->ittiMsg.sctp_init_multi,1); From 454dc0cfab3d378ee3e488b5b64f3e92232c4f55 Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Thu, 31 Mar 2022 12:19:00 +0530 Subject: [PATCH 097/114] Fixed memory leaks identified by address san There is still a leak that needs to be fixed in rrc_UE.c Should properly free NR_BCCH_BCH_Message_t *bcch_message after asn decoder using ASN_STRUCT_FREE() --- openair2/RRC/NR_UE/rrc_UE.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 6a678d0e18..7dca9b2774 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -359,7 +359,8 @@ void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message_type, return; } nr_rrc_ue_process_rrcReconfiguration(module_id,RRCReconfiguration); - } + ASN_STRUCT_FREE(asn_DEF_NR_RRCReconfiguration, RRCReconfiguration); + } break; case nr_RadioBearerConfigX_r15: @@ -392,6 +393,7 @@ void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message_type, else if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void *) RadioBearerConfig); } + ASN_STRUCT_FREE(asn_DEF_NR_RadioBearerConfig, RadioBearerConfig); } break; From a8f879ea128639048179ca34b98bcec763b55cd2 Mon Sep 17 00:00:00 2001 From: Vijay Chadachan Date: Thu, 28 Apr 2022 18:08:20 +0200 Subject: [PATCH 098/114] Update for the code review comment. Instead of NULL RAND value check, added the flag to indicate if the AUTH process started. The flag is used manage the timer handling for authentication process when stored RAND values is same as received RAND value in AUTH_REQ. --- openair3/NAS/UE/EMM/Authentication.c | 7 ++++--- openair3/NAS/UE/EMM/Authentication.h | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/openair3/NAS/UE/EMM/Authentication.c b/openair3/NAS/UE/EMM/Authentication.c index 97c7082be0..36c90c4ab0 100644 --- a/openair3/NAS/UE/EMM/Authentication.c +++ b/openair3/NAS/UE/EMM/Authentication.c @@ -180,13 +180,14 @@ int emm_proc_authentication_request(nas_user_t *user, int native_ksi, int ksi, OctetString res = {AUTH_RES_SIZE, authentication_data->res}; if ((memcmp(authentication_data->rand, rand->value, AUTH_CK_SIZE) != 0) || - (memcmp(nullRand,authentication_data->rand, AUTH_CK_SIZE) == 0)) { + (authentication_data->auth_process_started == FALSE)) { /* * There is no valid stored RAND in the ME or the stored RAND is * different from the new received value in the AUTHENTICATION - * REQUEST message OR the received RAND is all "0" or "NULL" - * process the new received AUTHENTICATIOn REQUEST message + * REQUEST message OR if this is first time UE starting the + * Authentication process */ + authentication_data->auth_process_started = TRUE; OctetString auts; auts.length = 0; auts.value = (uint8_t *)malloc(AUTH_AUTS_SIZE); diff --git a/openair3/NAS/UE/EMM/Authentication.h b/openair3/NAS/UE/EMM/Authentication.h index 50b2d990aa..466d3256f3 100644 --- a/openair3/NAS/UE/EMM/Authentication.h +++ b/openair3/NAS/UE/EMM/Authentication.h @@ -18,6 +18,8 @@ typedef struct { unsigned char mac_count:2; /* MAC failure counter (#20) */ unsigned char umts_count:2; /* UMTS challenge failure counter (#26) */ unsigned char sync_count:2; /* Sync failure counter (#21) */ + unsigned char auth_process_started:1; /* Authentication started */ + unsigned char reserve:1; /* For future use, byte aligned */ } authentication_data_t; #endif From ca0666868239ed0b5d2abe6f8c4abb728230ef99 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Mon, 21 Mar 2022 14:35:41 +0000 Subject: [PATCH 099/114] Handle RRC processing time at gNB --- openair2/GNB_APP/gnb_config.c | 3 +- openair2/LAYER2/NR_MAC_gNB/config.c | 23 ++++++++-- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 3 ++ openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 7 +++ .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 23 ++++++---- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 22 ++++++++++ .../LAYER2/NR_MAC_gNB/gNB_scheduler_srs.c | 2 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 4 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 3 +- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 9 ++++ openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 3 +- openair2/RRC/NR/nr_rrc_defs.h | 6 ++- openair2/RRC/NR/rrc_gNB.c | 43 +++++++++++++++++-- openair2/RRC/NR/rrc_gNB_nsa.c | 5 +-- 14 files changed, 130 insertions(+), 26 deletions(-) diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 2c486ec832..0648249122 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -2066,8 +2066,7 @@ void configure_gnb_du_mac(int inst) { NULL, 0, 0, // rnti - (NR_CellGroupConfig_t *)NULL - ); + NULL); } diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index a2cbd4807f..ca709666eb 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -449,6 +449,25 @@ void config_common(int Mod_idP, int ssb_SubcarrierOffset, rrc_pdsch_AntennaPorts } +int nr_mac_enable_ue_rrc_processing_timer(module_id_t Mod_idP, rnti_t rnti, NR_SubcarrierSpacing_t subcarrierSpacing, uint32_t rrc_reconfiguration_delay) { + if (rrc_reconfiguration_delay > 0) { + const int UE_id = find_nr_UE_id(Mod_idP,rnti); + if (UE_id >= 0) { + NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; + NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + if (sched_ctrl->rrc_processing_timer == 0) { + const uint16_t sf_ahead = (uint16_t) ceil(6.0/(float)(0x01<rrc_processing_timer = (rrc_reconfiguration_delay<rnti); UE_info->active[UE_id] = true; UE_info->Msg4_ACKed[UE_id] = true; + + const NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL; + NR_BWP_t *genericParameters = get_dl_bwp_genericParameters(sched_ctrl->active_bwp, + RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon, + sib1); + // 3GPP TS 38.331 Section 12 Table 12.1-1: UE performance requirements for RRC procedures for UEs + sched_ctrl->rrc_processing_timer = (NR_RRC_SETUP_DELAY_MS << genericParameters->subcarrierSpacing); // RRCSetup 10 ms } else { LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) RA Procedure failed at Msg4!\n", UE_id, ra->rnti); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 53485886c0..ef6dfef45b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -488,17 +488,22 @@ void nr_store_dlsch_buffer(module_id_t module_id, const int lcid = sched_ctrl->dl_lc_ids[i]; const uint16_t rnti = UE_info->rnti[UE_id]; LOG_D(NR_MAC, "In %s: UE %d/%x: LCID %d\n", __FUNCTION__, UE_id, rnti, lcid); + + if (lcid == DL_SCH_LCID_DTCH && sched_ctrl->rrc_processing_timer > 0) { + continue; + } + start_meas(&RC.nrmac[module_id]->rlc_status_ind); sched_ctrl->rlc_status[lcid] = mac_rlc_status_ind(module_id, - rnti, - module_id, - frame, - slot, - ENB_FLAG_YES, - MBMS_FLAG_NO, - lcid, - 0, - 0); + rnti, + module_id, + frame, + slot, + ENB_FLAG_YES, + MBMS_FLAG_NO, + lcid, + 0, + 0); stop_meas(&RC.nrmac[module_id]->rlc_status_ind); if (sched_ctrl->rlc_status[lcid].bytes_in_buffer == 0) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 6f17556c91..b58e3280c3 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2604,6 +2604,11 @@ void nr_csirs_scheduling(int Mod_idP, for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + + if (sched_ctrl->rrc_processing_timer > 0) { + continue; + } + NR_CellGroupConfig_t *CellGroup = UE_info->CellGroup[UE_id]; if (!CellGroup || !CellGroup->spCellConfig || !CellGroup->spCellConfig->spCellConfigDedicated || @@ -2791,6 +2796,23 @@ void nr_csirs_scheduling(int Mod_idP, } } +void nr_mac_update_timers(module_id_t module_id, + frame_t frame, + sub_frame_t slot) { + NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info; + const NR_list_t *UE_list = &UE_info->list; + for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { + NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + if (sched_ctrl->rrc_processing_timer > 0) { + sched_ctrl->rrc_processing_timer--; + if (sched_ctrl->rrc_processing_timer == 0) { + LOG_I(NR_MAC, "(%d.%d) De-activating RRC processing timer for UE %d\n", frame, slot, UE_id); + sched_ctrl->update_pdsch_ps = true; + sched_ctrl->update_pusch_ps = true; + } + } + } +} /*void fill_nfapi_coresets_and_searchspaces(NR_CellGroupConfig_t *cg, nfapi_nr_coreset_t *coreset, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_srs.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_srs.c index bf2af3b388..8680cc25d1 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_srs.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_srs.c @@ -125,7 +125,7 @@ void nr_schedule_srs(int module_id, frame_t frame) { sched_ctrl->sched_srs.slot = -1; sched_ctrl->sched_srs.srs_scheduled = false; - if(!UE_info->Msg4_ACKed[UE_id]) { + if(!UE_info->Msg4_ACKed[UE_id] || sched_ctrl->rrc_processing_timer > 0) { continue; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 43822d0cd0..ae9c2d97a3 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -702,7 +702,9 @@ void nr_csi_meas_reporting(int Mod_idP, for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { const NR_CellGroupConfig_t *CellGroup = UE_info->CellGroup[UE_id]; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; - if (sched_ctrl->ul_failure==1 && get_softmodem_params()->phy_test==0) continue; + if ((sched_ctrl->rrc_processing_timer > 0) || (sched_ctrl->ul_failure==1 && get_softmodem_params()->phy_test==0)) { + continue; + } if (!CellGroup || !CellGroup->spCellConfig || !CellGroup->spCellConfig->spCellConfigDedicated || !CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig) continue; const NR_CSI_MeasConfig_t *csi_measconfig = CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 72061bb9ba..bbe135413b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -1201,8 +1201,9 @@ void pf_ul(module_id_t module_id, const bool do_sched = nr_UE_is_to_be_scheduled(module_id, 0, UE_id, sched_pusch->frame, sched_pusch->slot); LOG_D(NR_MAC,"pf_ul: do_sched UE %d => %s\n",UE_id,do_sched ? "yes" : "no"); - if (B == 0 && !do_sched) + if ((B == 0 && !do_sched) || (sched_ctrl->rrc_processing_timer > 0)) { continue; + } /* Schedule UE on SR or UL inactivity and no data (otherwise, will be scheduled * based on data to transmit) */ diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 399033abd0..54abee888b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -46,6 +46,11 @@ void config_common(int Mod_idP, int pusch_AntennaPorts, NR_ServingCellConfigCommon_t *scc); +int nr_mac_enable_ue_rrc_processing_timer(module_id_t Mod_idP, + rnti_t rnti, + NR_SubcarrierSpacing_t subcarrierSpacing, + uint32_t rrc_reconfiguration_delay); + int rrc_mac_config_req_gNB(module_id_t Mod_idP, int ssb_SubcarrierOffset, rrc_pdsch_AntennaPorts_t pdsch_AntennaPorts, @@ -64,6 +69,10 @@ void clear_nr_nfapi_information(gNB_MAC_INST * gNB, frame_t frameP, sub_frame_t subframeP); +void nr_mac_update_timers(module_id_t module_id, + frame_t frame, + sub_frame_t slot); + void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame_rxP, sub_frame_t slot_rxP); diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index e32e63a778..31cdd96af0 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -646,12 +646,13 @@ typedef struct { /// UL HARQ processes that await retransmission NR_list_t retrans_ul_harq; NR_UE_mac_ce_ctrl_t UE_mac_ce_ctrl;// MAC CE related information - /// number of active DL LCs uint8_t dl_lc_num; /// order in which DLSCH scheduler should allocate LCs uint8_t dl_lc_ids[NR_MAX_NUM_LCID]; + /// Timer for RRC processing procedures + uint32_t rrc_processing_timer; } NR_UE_sched_ctrl_t; typedef struct { diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index b26f8243a0..5cc3157bce 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -96,6 +96,10 @@ typedef struct nr_uid_linear_allocator_s { #define PROTOCOL_NR_RRC_CTXT_FMT PROTOCOL_CTXT_FMT #define PROTOCOL_NR_RRC_CTXT_ARGS(CTXT_Pp) PROTOCOL_NR_CTXT_ARGS(CTXT_Pp) +// 3GPP TS 38.331 Section 12 Table 12.1-1: UE performance requirements for RRC procedures for UEs +#define NR_RRC_SETUP_DELAY_MS 10 +#define NR_RRC_RECONFIGURATION_DELAY_MS 10 +#define NR_RRC_BWP_SWITCHING_DELAY_MS 6 #define NR_UE_MODULE_INVALID ((module_id_t) ~0) // FIXME attention! depends on type uint8_t!!! #define NR_UE_INDEX_INVALID ((module_id_t) ~0) // FIXME attention! depends on type uint8_t!!! used to be -1 @@ -372,7 +376,7 @@ typedef struct gNB_RRC_UE_s { rb_id_t gnb_gtp_ebi[S1AP_MAX_E_RAB]; rb_id_t gnb_gtp_psi[S1AP_MAX_E_RAB]; //GTPV1 F1-U TUNNELS - uint32_t incoming_teid[S1AP_MAX_E_RAB]; + uint32_t incoming_teid[S1AP_MAX_E_RAB]; uint32_t ul_failure_timer; uint32_t ue_release_timer; diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 1715677c6d..4be59273c1 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -729,6 +729,13 @@ rrc_gNB_generate_defaultRRCReconfiguration( LOG_DUMPMSG(NR_RRC, DEBUG_RRC,(char *)buffer, size, "[MSG] RRC Reconfiguration\n"); + if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) { + nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, + ue_context_pP->ue_context.rnti, + *rrc->carrier.servingcellconfigcommon->ssbSubcarrierSpacing, + NR_RRC_RECONFIGURATION_DELAY_MS); + } + /* Free all NAS PDUs */ for (int i = 0; i < ue_context_pP->ue_context.nb_of_pdusessions; i++) { if (ue_context_pP->ue_context.pduSession[i].param.nas_pdu.buffer != NULL) { @@ -995,6 +1002,13 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( cellGroupConfig); LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size,"[MSG] RRC Reconfiguration\n"); + if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) { + nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, + ue_context_pP->ue_context.rnti, + *rrc->carrier.servingcellconfigcommon->ssbSubcarrierSpacing, + NR_RRC_RECONFIGURATION_DELAY_MS); + } + /* Free all NAS PDUs */ for (i = 0; i < ue_context_pP->ue_context.nb_of_pdusessions; i++) { if (ue_context_pP->ue_context.pduSession[i].param.nas_pdu.buffer != NULL) { @@ -1168,6 +1182,13 @@ rrc_gNB_modify_dedicatedRRCReconfiguration( NULL); LOG_DUMPMSG(NR_RRC, DEBUG_RRC, (char *)buffer, size, "[MSG] RRC Reconfiguration\n"); + if (NODE_IS_DU(RC.nrrrc[ctxt_pP->module_id]->node_type) || NODE_IS_MONOLITHIC(RC.nrrrc[ctxt_pP->module_id]->node_type)) { + nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, + ue_context_pP->ue_context.rnti, + *RC.nrrrc[ctxt_pP->module_id]->carrier.servingcellconfigcommon->ssbSubcarrierSpacing, + NR_RRC_RECONFIGURATION_DELAY_MS); + } + /* Free all NAS PDUs */ for (i = 0; i < ue_context_pP->ue_context.nb_of_modify_pdusessions; i++) { if (ue_context_pP->ue_context.modify_pdusession[i].param.nas_pdu.buffer != NULL) { @@ -1269,8 +1290,15 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release( NULL); ue_context_pP->ue_context.pdu_session_release_command_flag = 1; - LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size, - "[MSG] RRC Reconfiguration\n"); + + LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size, "[MSG] RRC Reconfiguration\n"); + + if (NODE_IS_DU(RC.nrrrc[ctxt_pP->module_id]->node_type) || NODE_IS_MONOLITHIC(RC.nrrrc[ctxt_pP->module_id]->node_type)) { + nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, + ue_context_pP->ue_context.rnti, + *RC.nrrrc[ctxt_pP->module_id]->carrier.servingcellconfigcommon->ssbSubcarrierSpacing, + NR_RRC_RECONFIGURATION_DELAY_MS); + } /* Free all NAS PDUs */ if (nas_length > 0) { @@ -1819,8 +1847,15 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete( NULL, NULL, NULL); - LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size, - "[MSG] RRC Reconfiguration\n"); + + LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size, "[MSG] RRC Reconfiguration\n"); + + if (NODE_IS_DU(RC.nrrrc[ctxt_pP->module_id]->node_type) || NODE_IS_MONOLITHIC(RC.nrrrc[ctxt_pP->module_id]->node_type)) { + nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, + ue_context_pP->ue_context.rnti, + *RC.nrrrc[ctxt_pP->module_id]->carrier.servingcellconfigcommon->ssbSubcarrierSpacing, + NR_RRC_RECONFIGURATION_DELAY_MS); + } /* Free all NAS PDUs */ for (i = 0; i < ue_context_pP->ue_context.nb_of_pdusessions; i++) { diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index bb66d1513b..fb8de46953 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -241,9 +241,8 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ cipher_algo, NR_SecurityConfig__keyToUse_secondary); } - NR_ServingCellConfig_t *scc = ue_context_p->ue_context.spCellConfig - ? ue_context_p->ue_context.spCellConfig->spCellConfigDedicated - : NULL; + NR_ServingCellConfig_t *scc = ue_context_p->ue_context.spCellConfig ? + ue_context_p->ue_context.spCellConfig->spCellConfigDedicated : NULL; fill_default_reconfig(carrier->servingcellconfigcommon, scc, reconfig_ies, From d8a127810c0a0a34f938b45414b5b7d7a08f006c Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Mon, 2 May 2022 11:35:36 +0100 Subject: [PATCH 100/114] Fix mcs table update during RRCReconfiguration --- openair2/LAYER2/NR_MAC_gNB/config.c | 2 -- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 4 +--- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 23 +++++++++++-------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index ca709666eb..b12454735d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -676,8 +676,6 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, LOG_I(NR_MAC,"Modified UE_id %d/%x with CellGroup\n",UE_id,rnti); process_CellGroup(CellGroup,&UE_info->UE_sched_ctrl[UE_id]); NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; - sched_ctrl->update_pdsch_ps = true; - sched_ctrl->update_pusch_ps = true; const NR_PDSCH_ServingCellConfig_t *pdsch = servingCellConfig ? servingCellConfig->pdsch_ServingCellConfig->choice.setup : NULL; if (get_softmodem_params()->sa) { // add all available DL HARQ processes for this UE in SA diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index ef6dfef45b..7250bf4fcc 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -593,7 +593,7 @@ bool allocate_dl_retransmission(module_id_t module_id, /* check whether we need to switch the TDA allocation since the last * (re-)transmission */ - if (ps->time_domain_allocation != tda || sched_ctrl->update_pdsch_ps) { + if (ps->time_domain_allocation != tda) { nr_set_pdsch_semi_static(sib1, scc, cg, @@ -603,7 +603,6 @@ bool allocate_dl_retransmission(module_id_t module_id, ps->nrOfLayers, sched_ctrl, ps); - sched_ctrl->update_pdsch_ps = false; } } else { /* the retransmission will use a different time domain allocation, check @@ -928,7 +927,6 @@ void pf_dl(module_id_t module_id, layers[UE_id], sched_ctrl, ps); - sched_ctrl->update_pdsch_ps = false; } const uint16_t slbitmap = SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index b58e3280c3..d7478474b1 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -579,16 +579,21 @@ void nr_set_pdsch_semi_static(const NR_SIB1_t *sib1, bwpd = (NR_BWP_DownlinkDedicated_t*)bwpd0; } - if (bwpd && - bwpd->pdsch_Config && - bwpd->pdsch_Config->choice.setup && - bwpd->pdsch_Config->choice.setup->mcs_Table) { - if (*bwpd->pdsch_Config->choice.setup->mcs_Table == 0) - ps->mcsTableIdx = 1; - else - ps->mcsTableIdx = 2; + if (sched_ctrl->update_pdsch_ps == true) { + if (bwpd && + bwpd->pdsch_Config && + bwpd->pdsch_Config->choice.setup && + bwpd->pdsch_Config->choice.setup->mcs_Table) { + if (*bwpd->pdsch_Config->choice.setup->mcs_Table == 0) { + ps->mcsTableIdx = 1; + } else { + ps->mcsTableIdx = 2; + } + } else { + ps->mcsTableIdx = 0; + } + sched_ctrl->update_pdsch_ps = false; } - else ps->mcsTableIdx = 0; LOG_D(NR_MAC,"MCS Table Index: %d\n",ps->mcsTableIdx); NR_PDSCH_Config_t *pdsch_Config; From 8569a47bc62bda9a9b21815f6ea5a7750813fba3 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Mon, 2 May 2022 11:37:19 +0100 Subject: [PATCH 101/114] Remove sib1_tda from configuration files to use default value --- targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf | 1 - targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf | 1 - .../CONF/gnb.band78.tm1.106PRB.usrpn300.gtp-itti.conf | 1 - .../GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf | 1 - .../GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.106PRB.usrpn300.conf | 1 - .../CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf | 1 - .../GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf | 1 - 7 files changed, 7 deletions(-) diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf index c07a0db649..92d1ce432c 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf @@ -48,7 +48,6 @@ gNBs = pdsch_AntennaPorts = 1; pusch_AntennaPorts = 1; min_rxtxtime = 6; - sib1_tda = 0; pdcch_ConfigSIB1 = ( { diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf index 256d724f3f..f95bdf91ae 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf @@ -38,7 +38,6 @@ gNBs = ssb_SubcarrierOffset = 0; min_rxtxtime = 6; - sib1_tda = 0; pdcch_ConfigSIB1 = ( { diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.band78.tm1.106PRB.usrpn300.gtp-itti.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.band78.tm1.106PRB.usrpn300.gtp-itti.conf index 726e43d7ad..74f6c34f57 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.band78.tm1.106PRB.usrpn300.gtp-itti.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.band78.tm1.106PRB.usrpn300.gtp-itti.conf @@ -37,7 +37,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - sib1_tda = 0; servingCellConfigCommon = ( { #spCellConfigCommon diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf index 7e2db64aaa..d124c5692f 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf @@ -34,7 +34,6 @@ gNBs = ssb_SubcarrierOffset = 0; min_rxtxtime = 6; - sib1_tda = 0; do_SRS = 1; pdcch_ConfigSIB1 = ( diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.106PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.106PRB.usrpn300.conf index cab801525b..ff64fe718a 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.106PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.106PRB.usrpn300.conf @@ -36,7 +36,6 @@ gNBs = pdsch_AntennaPorts = 1; pusch_AntennaPorts = 1; min_rxtxtime = 6; - sib1_tda = 0; pdcch_ConfigSIB1 = ( { diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf index 950e9c1d38..1bc6de3bfe 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf @@ -35,7 +35,6 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts_N1 = 2; pusch_AntennaPorts = 2; - sib1_tda = 0; do_SRS = 1; ul_prbblacklist = "51,52,53,54" diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf index 1dc903b811..a0cee6f9ca 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf @@ -34,7 +34,6 @@ gNBs = ssb_SubcarrierOffset = 0; min_rxtxtime = 6; - sib1_tda = 0; pdcch_ConfigSIB1 = ( { From 4b7b621f00bc9c31e7fe35914df06f542d848659 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Mon, 2 May 2022 11:43:03 +0100 Subject: [PATCH 102/114] Minor improvements and cleanup in 5G NR SA configuration files --- .../CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf | 13 ++++--------- .../CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf | 7 +------ .../CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf | 13 ++++--------- .../CONF/gnb.sa.band78.fr1.162PRB.2x2.usrpn300.conf | 13 ++++--------- 4 files changed, 13 insertions(+), 33 deletions(-) diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf index d124c5692f..e645094e8b 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf @@ -19,10 +19,6 @@ gNBs = { sst = 1; sd = 0x1; // 0 false, else true - }, - { - sst = 1; - sd = 0x112233; // 0 false, else true } ); @@ -33,7 +29,7 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - min_rxtxtime = 6; + min_rxtxtime = 2; do_SRS = 1; pdcch_ConfigSIB1 = ( @@ -218,7 +214,7 @@ L1s = ( num_cc = 1; tr_n_preference = "local_mac"; prach_dtx_threshold = 120; - pucch0_dtx_threshold = 150; + pucch0_dtx_threshold = 100; ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 } ); @@ -228,12 +224,11 @@ RUs = ( local_rf = "yes" nb_tx = 1 nb_rx = 1 - att_tx = 0 - att_rx = 0; + att_tx = 6; + att_rx = 6; bands = [41]; max_pdschReferenceSignalPower = -27; max_rxgain = 114; - sf_extension = 0; eNB_instances = [0]; #beamforming 1x4 matrix: bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000]; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf index 1bc6de3bfe..2881a77d48 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf @@ -19,10 +19,6 @@ gNBs = { sst = 1; sd = 0x1; // 0 false, else true - }, - { - sst = 1; - sd = 0x112233; // 0 false, else true } ); @@ -40,7 +36,7 @@ gNBs = pdcch_ConfigSIB1 = ( { - controlResourceSetZero = 11; + controlResourceSetZero = 12; searchSpaceZero = 0; } ); @@ -234,7 +230,6 @@ RUs = ( bands = [78]; max_pdschReferenceSignalPower = -27; max_rxgain = 75; - sf_extension = 0; eNB_instances = [0]; ##beamforming 1x2 matrix: 1 layer x 2 antennas bf_weights = [0x00007fff, 0x0000]; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf index a0cee6f9ca..e3024737ee 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf @@ -19,10 +19,6 @@ gNBs = { sst = 1; sd = 0x1; // 0 false, else true - }, - { - sst = 1; - sd = 0x112233; // 0 false, else true } ); @@ -33,7 +29,7 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - min_rxtxtime = 6; + min_rxtxtime = 2; pdcch_ConfigSIB1 = ( { @@ -217,7 +213,7 @@ L1s = ( num_cc = 1; tr_n_preference = "local_mac"; prach_dtx_threshold = 120; - pucch0_dtx_threshold = 150; + pucch0_dtx_threshold = 100; ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 } ); @@ -227,12 +223,11 @@ RUs = ( local_rf = "yes" nb_tx = 1 nb_rx = 1 - att_tx = 0 - att_rx = 0; + att_tx = 6; + att_rx = 6; bands = [78]; max_pdschReferenceSignalPower = -27; max_rxgain = 114; - sf_extension = 0; eNB_instances = [0]; #beamforming 1x4 matrix: bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000]; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.162PRB.2x2.usrpn300.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.162PRB.2x2.usrpn300.conf index 74f8f2cb3b..b8d71015c1 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.162PRB.2x2.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.162PRB.2x2.usrpn300.conf @@ -19,10 +19,6 @@ gNBs = { sst = 1; sd = 0x1; // 0 false, else true - }, - { - sst = 1; - sd = 0x112233; // 0 false, else true } ); @@ -33,12 +29,12 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts_N1 = 2; + pdsch_AntennaPorts_N1 = 1; pusch_AntennaPorts = 2; ul_prbblacklist = "79,80,81,82" pdcch_ConfigSIB1 = ( { - controlResourceSetZero = 11; + controlResourceSetZero = 12; searchSpaceZero = 10; } ); @@ -236,7 +232,7 @@ MACRLCs = ( num_cc = 1; tr_s_preference = "local_L1"; tr_n_preference = "local_RRC"; - pusch_TargetSNRx10 = 200; + pusch_TargetSNRx10 = 150; pucch_TargetSNRx10 = 200; ulsch_max_frame_inactivity = 0; } @@ -247,7 +243,7 @@ L1s = ( num_cc = 1; tr_n_preference = "local_mac"; prach_dtx_threshold = 120; - pucch0_dtx_threshold = 120; + pucch0_dtx_threshold = 100; } ); @@ -261,7 +257,6 @@ RUs = ( bands = [78]; max_pdschReferenceSignalPower = -27; max_rxgain = 75; - sf_extension = 0; eNB_instances = [0]; ##beamforming 1x2 matrix: 1 layer x 2 antennas bf_weights = [0x00007fff, 0x0000]; From 79d9c2e8dc266ac61af188182f43f3a5af46cb38 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Mon, 2 May 2022 11:50:08 +0100 Subject: [PATCH 103/114] Address review comments --- openair2/RRC/NR/rrc_gNB.c | 78 +++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 4be59273c1..74e7997fba 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -729,13 +729,6 @@ rrc_gNB_generate_defaultRRCReconfiguration( LOG_DUMPMSG(NR_RRC, DEBUG_RRC,(char *)buffer, size, "[MSG] RRC Reconfiguration\n"); - if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) { - nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, - ue_context_pP->ue_context.rnti, - *rrc->carrier.servingcellconfigcommon->ssbSubcarrierSpacing, - NR_RRC_RECONFIGURATION_DELAY_MS); - } - /* Free all NAS PDUs */ for (int i = 0; i < ue_context_pP->ue_context.nb_of_pdusessions; i++) { if (ue_context_pP->ue_context.pduSession[i].param.nas_pdu.buffer != NULL) { @@ -804,6 +797,13 @@ rrc_gNB_generate_defaultRRCReconfiguration( default : LOG_W(NR_RRC, "Unknown node type %d\n", RC.nrrrc[ctxt_pP->module_id]->node_type); } + + if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) { + nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, + ue_context_pP->ue_context.rnti, + *rrc->carrier.servingcellconfigcommon->ssbSubcarrierSpacing, + NR_RRC_RECONFIGURATION_DELAY_MS); + } } //----------------------------------------------------------------------------- @@ -1002,13 +1002,6 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( cellGroupConfig); LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size,"[MSG] RRC Reconfiguration\n"); - if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) { - nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, - ue_context_pP->ue_context.rnti, - *rrc->carrier.servingcellconfigcommon->ssbSubcarrierSpacing, - NR_RRC_RECONFIGURATION_DELAY_MS); - } - /* Free all NAS PDUs */ for (i = 0; i < ue_context_pP->ue_context.nb_of_pdusessions; i++) { if (ue_context_pP->ue_context.pduSession[i].param.nas_pdu.buffer != NULL) { @@ -1045,6 +1038,13 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( buffer, PDCP_TRANSMISSION_MODE_CONTROL); #endif + + if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) { + nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, + ue_context_pP->ue_context.rnti, + *rrc->carrier.servingcellconfigcommon->ssbSubcarrierSpacing, + NR_RRC_RECONFIGURATION_DELAY_MS); + } } //----------------------------------------------------------------------------- @@ -1182,13 +1182,6 @@ rrc_gNB_modify_dedicatedRRCReconfiguration( NULL); LOG_DUMPMSG(NR_RRC, DEBUG_RRC, (char *)buffer, size, "[MSG] RRC Reconfiguration\n"); - if (NODE_IS_DU(RC.nrrrc[ctxt_pP->module_id]->node_type) || NODE_IS_MONOLITHIC(RC.nrrrc[ctxt_pP->module_id]->node_type)) { - nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, - ue_context_pP->ue_context.rnti, - *RC.nrrrc[ctxt_pP->module_id]->carrier.servingcellconfigcommon->ssbSubcarrierSpacing, - NR_RRC_RECONFIGURATION_DELAY_MS); - } - /* Free all NAS PDUs */ for (i = 0; i < ue_context_pP->ue_context.nb_of_modify_pdusessions; i++) { if (ue_context_pP->ue_context.modify_pdusession[i].param.nas_pdu.buffer != NULL) { @@ -1225,6 +1218,13 @@ rrc_gNB_modify_dedicatedRRCReconfiguration( buffer, PDCP_TRANSMISSION_MODE_CONTROL); #endif + + if (NODE_IS_DU(RC.nrrrc[ctxt_pP->module_id]->node_type) || NODE_IS_MONOLITHIC(RC.nrrrc[ctxt_pP->module_id]->node_type)) { + nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, + ue_context_pP->ue_context.rnti, + *RC.nrrrc[ctxt_pP->module_id]->carrier.servingcellconfigcommon->ssbSubcarrierSpacing, + NR_RRC_RECONFIGURATION_DELAY_MS); + } } //----------------------------------------------------------------------------- @@ -1290,15 +1290,8 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release( NULL); ue_context_pP->ue_context.pdu_session_release_command_flag = 1; - - LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size, "[MSG] RRC Reconfiguration\n"); - - if (NODE_IS_DU(RC.nrrrc[ctxt_pP->module_id]->node_type) || NODE_IS_MONOLITHIC(RC.nrrrc[ctxt_pP->module_id]->node_type)) { - nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, - ue_context_pP->ue_context.rnti, - *RC.nrrrc[ctxt_pP->module_id]->carrier.servingcellconfigcommon->ssbSubcarrierSpacing, - NR_RRC_RECONFIGURATION_DELAY_MS); - } + LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size, + "[MSG] RRC Reconfiguration\n"); /* Free all NAS PDUs */ if (nas_length > 0) { @@ -1332,6 +1325,13 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release( buffer, PDCP_TRANSMISSION_MODE_CONTROL); #endif + + if (NODE_IS_DU(RC.nrrrc[ctxt_pP->module_id]->node_type) || NODE_IS_MONOLITHIC(RC.nrrrc[ctxt_pP->module_id]->node_type)) { + nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, + ue_context_pP->ue_context.rnti, + *RC.nrrrc[ctxt_pP->module_id]->carrier.servingcellconfigcommon->ssbSubcarrierSpacing, + NR_RRC_RECONFIGURATION_DELAY_MS); + } } //----------------------------------------------------------------------------- @@ -1847,15 +1847,8 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete( NULL, NULL, NULL); - - LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size, "[MSG] RRC Reconfiguration\n"); - - if (NODE_IS_DU(RC.nrrrc[ctxt_pP->module_id]->node_type) || NODE_IS_MONOLITHIC(RC.nrrrc[ctxt_pP->module_id]->node_type)) { - nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, - ue_context_pP->ue_context.rnti, - *RC.nrrrc[ctxt_pP->module_id]->carrier.servingcellconfigcommon->ssbSubcarrierSpacing, - NR_RRC_RECONFIGURATION_DELAY_MS); - } + LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size, + "[MSG] RRC Reconfiguration\n"); /* Free all NAS PDUs */ for (i = 0; i < ue_context_pP->ue_context.nb_of_pdusessions; i++) { @@ -1897,6 +1890,13 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete( PDCP_TRANSMISSION_MODE_CONTROL); #endif } + + if (NODE_IS_DU(RC.nrrrc[ctxt_pP->module_id]->node_type) || NODE_IS_MONOLITHIC(RC.nrrrc[ctxt_pP->module_id]->node_type)) { + nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, + ue_context_pP->ue_context.rnti, + *RC.nrrrc[ctxt_pP->module_id]->carrier.servingcellconfigcommon->ssbSubcarrierSpacing, + NR_RRC_RECONFIGURATION_DELAY_MS); + } } //----------------------------------------------------------------------------- From 305347af9ae820c865968aa7683c3fcc5dc65591 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Mon, 2 May 2022 14:13:01 +0100 Subject: [PATCH 104/114] Fix indentation and improve function nr_mac_enable_ue_rrc_processing_timer --- openair2/LAYER2/NR_MAC_gNB/config.c | 31 ++++++++--------- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 33 +++++++++---------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index b12454735d..9f7493e581 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -450,22 +450,23 @@ void config_common(int Mod_idP, int ssb_SubcarrierOffset, rrc_pdsch_AntennaPorts } int nr_mac_enable_ue_rrc_processing_timer(module_id_t Mod_idP, rnti_t rnti, NR_SubcarrierSpacing_t subcarrierSpacing, uint32_t rrc_reconfiguration_delay) { - if (rrc_reconfiguration_delay > 0) { - const int UE_id = find_nr_UE_id(Mod_idP,rnti); - if (UE_id >= 0) { - NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; - NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; - if (sched_ctrl->rrc_processing_timer == 0) { - const uint16_t sf_ahead = (uint16_t) ceil(6.0/(float)(0x01<rrc_processing_timer = (rrc_reconfiguration_delay<UE_info; + NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + const uint16_t sf_ahead = 6/(0x01<0); + const uint16_t sl_ahead = sf_ahead * (0x01<rrc_processing_timer = (rrc_reconfiguration_delay<> 3; + R, + 1, /* rbSize */ + 10, /* hypothetical number of slots */ + 0, /* N_PRB_DMRS * N_DMRS_SLOT */ + 0 /* N_PRB_oh, 0 for initialBWP */, + 0 /* tb_scaling */, + 1 /* nrOfLayers */) >> 3; } } @@ -1274,15 +1273,15 @@ void nr_schedule_ue_spec(module_id_t module_id, if (phaseTrackingRS) { bool valid_ptrs_setup = set_dl_ptrs_values(phaseTrackingRS->choice.setup, - pdsch_pdu->rbSize, - pdsch_pdu->mcsIndex[0], - pdsch_pdu->mcsTable[0], - &pdsch_pdu->PTRSFreqDensity, - &pdsch_pdu->PTRSTimeDensity, - &pdsch_pdu->PTRSPortIndex, - &pdsch_pdu->nEpreRatioOfPDSCHToPTRS, - &pdsch_pdu->PTRSReOffset, - pdsch_pdu->NrOfSymbols); + pdsch_pdu->rbSize, + pdsch_pdu->mcsIndex[0], + pdsch_pdu->mcsTable[0], + &pdsch_pdu->PTRSFreqDensity, + &pdsch_pdu->PTRSTimeDensity, + &pdsch_pdu->PTRSPortIndex, + &pdsch_pdu->nEpreRatioOfPDSCHToPTRS, + &pdsch_pdu->PTRSReOffset, + pdsch_pdu->NrOfSymbols); if (valid_ptrs_setup) pdsch_pdu->pduBitmap |= 0x1; // Bit 0: pdschPtrs - Indicates PTRS included (FR2) From be3498ddd282c7b6ba6cc05d594040415f11874a Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Mon, 2 May 2022 14:26:17 +0100 Subject: [PATCH 105/114] Update documentation to be able to run OAI gNB with OAI UE and COTS UE with the same configuration file --- doc/RUNMODEM.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/RUNMODEM.md b/doc/RUNMODEM.md index 919bbc2dc0..119027f169 100644 --- a/doc/RUNMODEM.md +++ b/doc/RUNMODEM.md @@ -165,7 +165,7 @@ From the `cmake_targets/ran_build/build` folder: gNB on machine 1: -`sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --sa` +`sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --gNBs.[0].min_rxtxtime 6 --sa` UE on machine 2: @@ -173,7 +173,7 @@ UE on machine 2: With the RF simulator (on the same machine): -`sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --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 --sa` `sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 -s 516 --rfsim --sa` From 299642344ad98273f6622c729550a852ff152ee8 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 2 May 2022 19:08:10 +0200 Subject: [PATCH 106/114] fix for ssb offset scaling issue --- openair1/PHY/INIT/nr_parms.c | 6 ++++-- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 6 ++++-- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 7 ++++++- openair2/LAYER2/NR_MAC_gNB/config.c | 13 ++++++++----- .../LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 2 +- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 2 +- openair2/RRC/NR/MESSAGES/asn1_msg.c | 11 +++++++++-- 7 files changed, 33 insertions(+), 14 deletions(-) diff --git a/openair1/PHY/INIT/nr_parms.c b/openair1/PHY/INIT/nr_parms.c index 757a8d965f..458c8b3403 100644 --- a/openair1/PHY/INIT/nr_parms.c +++ b/openair1/PHY/INIT/nr_parms.c @@ -366,8 +366,10 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp, uint8_t sco = 0; if (((fp->freq_range == nr_FR1) && (config->ssb_table.ssb_subcarrier_offset<24)) || - ((fp->freq_range == nr_FR2) && (config->ssb_table.ssb_subcarrier_offset<12)) ) - sco = config->ssb_table.ssb_subcarrier_offset; + ((fp->freq_range == nr_FR2) && (config->ssb_table.ssb_subcarrier_offset<12)) ) { + if (fp->freq_range == nr_FR1) + sco = config->ssb_table.ssb_subcarrier_offset>>config->ssb_config.scs_common; + } fp->ssb_start_subcarrier = (12 * config->ssb_table.ssb_offset_point_a + sco); set_Lmax(fp); diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 22db636966..dca97bddf0 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -54,8 +54,10 @@ void nr_set_ssb_first_subcarrier(nfapi_nr_config_request_scf_t *cfg, NR_DL_FRAME uint8_t sco = 0; if (((fp->freq_range == nr_FR1) && (cfg->ssb_table.ssb_subcarrier_offset.value<24)) || - ((fp->freq_range == nr_FR2) && (cfg->ssb_table.ssb_subcarrier_offset.value<12)) ) - sco = cfg->ssb_table.ssb_subcarrier_offset.value; + ((fp->freq_range == nr_FR2) && (cfg->ssb_table.ssb_subcarrier_offset.value<12)) ) { + if (fp->freq_range == nr_FR1) + sco = cfg->ssb_table.ssb_subcarrier_offset.value>>cfg->ssb_config.scs_common.value; + } fp->ssb_start_subcarrier = (12 * cfg->ssb_table.ssb_offset_point_a.value + sco); LOG_D(PHY, "SSB first subcarrier %d (%d,%d)\n", fp->ssb_start_subcarrier,cfg->ssb_table.ssb_offset_point_a.value,sco); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 79ebaea70a..8e9442d00c 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -354,13 +354,18 @@ int8_t nr_ue_decode_mib(module_id_t module_id, scs_ssb = get_softmodem_params()->numerology; band = mac->nr_band; ssb_start_symbol = get_ssb_start_symbol(band,scs_ssb,ssb_index); + int ssb_sc_offset_norm; + if (ssb_subcarrier_offset<24 && mac->frequency_range == FR1) + ssb_sc_offset_norm = ssb_subcarrier_offset>>scs_ssb; + else + ssb_sc_offset_norm = ssb_subcarrier_offset; if (mac->common_configuration_complete == 0) nr_ue_sib1_scheduler(module_id, cc_id, ssb_start_symbol, frame, - ssb_subcarrier_offset, + ssb_sc_offset_norm, ssb_index, ssb_start_subcarrier, mac->frequency_range, diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 5e99c2d0e1..ff4ec396e7 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -344,21 +344,24 @@ void config_common(int Mod_idP, int ssb_SubcarrierOffset, rrc_pdsch_AntennaPorts uint32_t absolute_diff = (*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA); uint16_t sco = absolute_diff%(12*scs_scaling); // values of subcarrier offset larger than the limit only indicates CORESET for Type0-PDCCH CSS set is not present - uint8_t ssb_SubcarrierOffset_limit = 0; + int ssb_SubcarrierOffset_limit = 0; + int offset_scaling = 0; //15kHz if(frequency_range == FR1) { ssb_SubcarrierOffset_limit = 24; - } else { + if (ssb_SubcarrierOffsetssb_config.scs_common.value; + } else ssb_SubcarrierOffset_limit = 12; - } if (ssb_SubcarrierOffset>(cfg->ssb_config.scs_common.value))),"absoluteFrequencySSB has a subcarrier offset of %d while it should be %d\n",sco/scs_scaling,ssb_SubcarrierOffset); + AssertFatal(sco==(scs_scaling * ssb_SubcarrierOffset), + "absoluteFrequencySSB has a subcarrier offset of %d while it should be %d\n",sco/scs_scaling,ssb_SubcarrierOffset); cfg->ssb_table.ssb_offset_point_a.value = absolute_diff/(12*scs_scaling) - 10; //absoluteFrequencySSB is the central frequency of SSB which is made by 20RBs in total cfg->ssb_table.ssb_offset_point_a.tl.tag = NFAPI_NR_CONFIG_SSB_OFFSET_POINT_A_TAG; cfg->num_tlv++; cfg->ssb_table.ssb_period.value = *scc->ssb_periodicityServingCell; cfg->ssb_table.ssb_period.tl.tag = NFAPI_NR_CONFIG_SSB_PERIOD_TAG; cfg->num_tlv++; - cfg->ssb_table.ssb_subcarrier_offset.value = ssb_SubcarrierOffset>>(cfg->ssb_config.scs_common.value); + cfg->ssb_table.ssb_subcarrier_offset.value = ssb_SubcarrierOffset<ssb_table.ssb_subcarrier_offset.tl.tag = NFAPI_NR_CONFIG_SSB_SUBCARRIER_OFFSET_TAG; cfg->num_tlv++; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index be33e4f688..44cdcef9fa 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -737,7 +737,7 @@ void nr_set_pusch_semi_static(const NR_SIB1_t *sib1, void nr_configure_css_dci_initial(nfapi_nr_dl_tti_pdcch_pdu_rel15_t* pdcch_pdu, nr_scs_e scs_common, nr_scs_e pdcch_scs, - nr_frequency_range_e freq_range, + frequency_range_t freq_range, uint8_t rmsi_pdcch_config, uint8_t ssb_idx, uint8_t k_ssb, diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 399033abd0..27527edbcd 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -222,7 +222,7 @@ void get_pdsch_to_harq_feedback(int Mod_idP, void nr_configure_css_dci_initial(nfapi_nr_dl_tti_pdcch_pdu_rel15_t* pdcch_pdu, nr_scs_e scs_common, nr_scs_e pdcch_scs, - nr_frequency_range_e freq_range, + frequency_range_t freq_range, uint8_t rmsi_pdcch_config, uint8_t ssb_idx, uint8_t k_ssb, diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index f516fc2219..8e8959c597 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -222,7 +222,15 @@ uint8_t do_MIB_NR(gNB_RRC_INST *rrc,uint32_t frame) { mib->message.choice.mib->spare.size = 1; mib->message.choice.mib->spare.bits_unused = 7; // This makes a spare of 1 bits - mib->message.choice.mib->ssb_SubcarrierOffset = (configuration->ssb_SubcarrierOffset)&15; + AssertFatal(scc->ssbSubcarrierSpacing != NULL, "scc->ssbSubcarrierSpacing is null\n"); + int band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; + frequency_range_t frequency_range = band<100?FR1:FR2; + int ssb_subcarrier_offset; + if(frequency_range == FR1) + ssb_subcarrier_offset = (configuration->ssb_SubcarrierOffset<24) ? (configuration->ssb_SubcarrierOffset<<*scc->ssbSubcarrierSpacing) : configuration->ssb_SubcarrierOffset; + else + ssb_subcarrier_offset = configuration->ssb_SubcarrierOffset; + mib->message.choice.mib->ssb_SubcarrierOffset = ssb_subcarrier_offset&15; /* * The SIB1 will be sent in this allocation (Type0-PDCCH) : 38.213, 13-4 Table and 38.213 13-11 to 13-14 tables @@ -236,7 +244,6 @@ uint8_t do_MIB_NR(gNB_RRC_INST *rrc,uint32_t frame) { mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceZero; } - AssertFatal(scc->ssbSubcarrierSpacing != NULL, "scc->ssbSubcarrierSpacing is null\n"); switch (*scc->ssbSubcarrierSpacing) { case NR_SubcarrierSpacing_kHz15: mib->message.choice.mib->subCarrierSpacingCommon = NR_MIB__subCarrierSpacingCommon_scs15or60; From 6db761692d56e56a137bb3ca9341b8130e84e8e0 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Tue, 3 May 2022 08:55:25 +0100 Subject: [PATCH 107/114] Remove update_pdsch_ps and update_pusch_ps flags to use_rrc_processing_timer instead --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 2 +- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 48 +++++++++++++++++-- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 12 ++--- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 1 + openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 2 - 5 files changed, 49 insertions(+), 16 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 271d7c7f2a..e8230bc344 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -917,7 +917,7 @@ void pf_dl(module_id_t module_id, NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch; NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static; - if (ps->nrOfLayers != layers[UE_id] || ps->time_domain_allocation != tda || sched_ctrl->update_pdsch_ps) { + if (ps->nrOfLayers != layers[UE_id] || ps->time_domain_allocation != tda) { nr_set_pdsch_semi_static(sib1, scc, UE_info->CellGroup[UE_id], diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index d7478474b1..764c97e66f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -579,7 +579,11 @@ void nr_set_pdsch_semi_static(const NR_SIB1_t *sib1, bwpd = (NR_BWP_DownlinkDedicated_t*)bwpd0; } - if (sched_ctrl->update_pdsch_ps == true) { + // Prevent gNB to enable 256QAM table while the RRCProcessing timer is running. + // For example, after the RRC created RRC Reconfiguration message we need to prevent gNB to apply another MCS table + // before the RRC Reconfiguration being received by the UE, otherwise UE will not be able to decode PDSCH + // and the connection will drop. + if (sched_ctrl->rrc_processing_timer == 0) { if (bwpd && bwpd->pdsch_Config && bwpd->pdsch_Config->choice.setup && @@ -592,7 +596,6 @@ void nr_set_pdsch_semi_static(const NR_SIB1_t *sib1, } else { ps->mcsTableIdx = 0; } - sched_ctrl->update_pdsch_ps = false; } LOG_D(NR_MAC,"MCS Table Index: %d\n",ps->mcsTableIdx); @@ -2812,8 +2815,45 @@ void nr_mac_update_timers(module_id_t module_id, sched_ctrl->rrc_processing_timer--; if (sched_ctrl->rrc_processing_timer == 0) { LOG_I(NR_MAC, "(%d.%d) De-activating RRC processing timer for UE %d\n", frame, slot, UE_id); - sched_ctrl->update_pdsch_ps = true; - sched_ctrl->update_pusch_ps = true; + + const NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL; + NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon; + + NR_BWP_DownlinkDedicated_t *bwpd = UE_info->CellGroup[UE_id] && + UE_info->CellGroup[UE_id]->spCellConfig && + UE_info->CellGroup[UE_id]->spCellConfig->spCellConfigDedicated ? + UE_info->CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->initialDownlinkBWP : NULL; + + const uint8_t layers = set_dl_nrOfLayers(sched_ctrl); + const int tda = RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0][slot]; + nr_set_pdsch_semi_static(sib1, + scc, + UE_info->CellGroup[UE_id], + sched_ctrl->active_bwp, + bwpd, + tda >= 0 ? tda : sched_ctrl->pdsch_semi_static.time_domain_allocation, + layers, + sched_ctrl, + &sched_ctrl->pdsch_semi_static); + + NR_BWP_UplinkDedicated_t *ubwpd = UE_info->CellGroup[UE_id] && + UE_info->CellGroup[UE_id]->spCellConfig && + UE_info->CellGroup[UE_id]->spCellConfig->spCellConfigDedicated && + UE_info->CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig ? + UE_info->CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP : NULL; + + const uint8_t num_dmrs_cdm_grps_no_data = (sched_ctrl->active_ubwp || ubwpd) ? 1 : 2; + int dci_format = get_dci_format(sched_ctrl); + const int utda = sched_ctrl->active_ubwp ? RC.nrmac[module_id]->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot] : 0; + nr_set_pusch_semi_static(sib1, + scc, + sched_ctrl->active_ubwp, + ubwpd, + dci_format, + utda >= 0 ? utda : sched_ctrl->pusch_semi_static.time_domain_allocation, + num_dmrs_cdm_grps_no_data, + &sched_ctrl->pusch_semi_static); + } } } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index bbe135413b..5b2d9293f2 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -988,8 +988,7 @@ bool allocate_ul_retransmission(module_id_t module_id, if (ps->time_domain_allocation != tda || ps->dci_format != dci_format - || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data - || sched_ctrl->update_pusch_ps) { + || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data) { nr_set_pusch_semi_static(sib1, scc, sched_ctrl->active_ubwp, @@ -998,7 +997,6 @@ bool allocate_ul_retransmission(module_id_t module_id, tda, num_dmrs_cdm_grps_no_data, ps); - sched_ctrl->update_pusch_ps = false; } /* Check the resource is enough for retransmission */ @@ -1247,8 +1245,7 @@ void pf_ul(module_id_t module_id, const int tda = sched_ctrl->active_ubwp ? nrmac->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot] : 0; if (ps->time_domain_allocation != tda || ps->dci_format != dci_format - || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data - || sched_ctrl->update_pusch_ps) { + || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data) { nr_set_pusch_semi_static(sib1, scc, sched_ctrl->active_ubwp, @@ -1257,7 +1254,6 @@ void pf_ul(module_id_t module_id, tda, num_dmrs_cdm_grps_no_data, ps); - sched_ctrl->update_pusch_ps = false; } LOG_D(NR_MAC,"Looking for min_rb %d RBs, starting at %d\n", min_rb, rbStart); @@ -1385,8 +1381,7 @@ void pf_ul(module_id_t module_id, const int tda = sched_ctrl->active_ubwp ? nrmac->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot] : 0; if (ps->time_domain_allocation != tda || ps->dci_format != dci_format - || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data - || sched_ctrl->update_pusch_ps) { + || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data) { nr_set_pusch_semi_static(sib1, scc, sched_ctrl->active_ubwp, @@ -1395,7 +1390,6 @@ void pf_ul(module_id_t module_id, tda, num_dmrs_cdm_grps_no_data, ps); - sched_ctrl->update_pusch_ps = false; } update_ul_ue_R_Qm(sched_pusch, ps); diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 54abee888b..fcc1e4c789 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -509,6 +509,7 @@ void set_dl_mcs(NR_sched_pdsch_t *sched_pdsch, uint8_t set_dl_nrOfLayers(NR_UE_sched_ctrl_t *sched_ctrl); +int get_dci_format(NR_UE_sched_ctrl_t *sched_ctrl); void calculate_preferred_dl_tda(module_id_t module_id, const NR_BWP_Downlink_t *bwp); void calculate_preferred_ul_tda(module_id_t module_id, const NR_BWP_Uplink_t *ubwp); diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 31cdd96af0..f93090c3c1 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -626,8 +626,6 @@ typedef struct { int ul_failure; struct CSI_Report CSI_report; bool SR; - bool update_pdsch_ps; - bool update_pusch_ps; bool set_mcs; /// information about every HARQ process NR_UE_harq_t harq_processes[NR_MAX_NB_HARQ_PROCESSES]; From 114dcc6a084224333c24e26628ea4b7753d7d949 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Tue, 3 May 2022 08:57:02 +0100 Subject: [PATCH 108/114] Remove irrelevant comment --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 1 - 1 file changed, 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index ecc2ef0cff..7027e0336f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -346,7 +346,6 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, LOG_I(NR_MAC,"Frame.Slot %d.%d\n%s\n",frame,slot,stats_output); } - // This updates the timers running at MAC layer nr_mac_update_timers(module_idP, frame, slot); // This schedules MIB From 139d20a9ba68595338bc8ce353e3339c74aade50 Mon Sep 17 00:00:00 2001 From: Vijay Chadachan Date: Tue, 3 May 2022 11:58:15 +0200 Subject: [PATCH 109/114] Removing unused variables --- openair3/NAS/UE/EMM/Authentication.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openair3/NAS/UE/EMM/Authentication.c b/openair3/NAS/UE/EMM/Authentication.c index 36c90c4ab0..a2762d08e8 100644 --- a/openair3/NAS/UE/EMM/Authentication.c +++ b/openair3/NAS/UE/EMM/Authentication.c @@ -149,8 +149,7 @@ int emm_proc_authentication_request(nas_user_t *user, int native_ksi, int ksi, int rc = RETURNerror; authentication_data_t *authentication_data = user->authentication_data; emm_timers_t *emm_timers = user->emm_data->emm_timers; - uint8_t nullRand[AUTH_CK_SIZE]; - memset(nullRand, 0, AUTH_CK_SIZE); + LOG_TRACE(INFO, "EMM-PROC - Authentication requested ksi type = %s, ksi = %d", native_ksi ? "native" : "mapped", ksi); /* 3GPP TS 24.301, section 5.4.2.1 From cc6469c77d5766ac52c5116535cd6427fa3aa0e2 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 2 May 2022 11:02:50 +0200 Subject: [PATCH 110/114] Upgrade SA test USRP IP address after CI migration --- .../conf_files/gnb.band78.sa.fr1.106PRB.ddsuu.2x2.usrpn310.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.ddsuu.2x2.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.ddsuu.2x2.usrpn310.conf index 7b0e3eea22..18ca7b5d1e 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.ddsuu.2x2.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.ddsuu.2x2.usrpn310.conf @@ -260,7 +260,7 @@ RUs = ( ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; sf_extension = 0 - sdr_addrs = "mgmt_addr=192.168.18.252,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" + sdr_addrs = "mgmt_addr=172.21.19.14,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" sl_ahead = 5; } ); From 6d35883b2afca34e5b43743abfd922ab1855a960 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 4 May 2022 10:38:41 +0200 Subject: [PATCH 111/114] Add help strings for new config options --- openair2/ENB_APP/enb_paramdef.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/openair2/ENB_APP/enb_paramdef.h b/openair2/ENB_APP/enb_paramdef.h index 21e2e1b703..e6e97069fa 100644 --- a/openair2/ENB_APP/enb_paramdef.h +++ b/openair2/ENB_APP/enb_paramdef.h @@ -104,6 +104,11 @@ typedef enum { #define CONFIG_STRING_RU_NR_FLAG "nr_flag" #define CONFIG_STRING_RU_NR_SCS_FOR_RASTER "nr_scs_for_raster" +#define HLP_RU_SF_AHEAD "LTE TX processing advance" +#define HLP_RU_SL_AHEAD "NR TX processing advance" +#define HLP_RU_NR_FLAG "Use NR numerology (for AW2SORI)" +#define HLP_RU_NR_SCS_FOR_RASTER "NR SCS for raster (for AW2SORI)" + #define RU_LOCAL_IF_NAME_IDX 0 #define RU_LOCAL_ADDRESS_IDX 1 #define RU_REMOTE_ADDRESS_IDX 2 @@ -171,10 +176,10 @@ typedef enum { {CONFIG_STRING_RU_IF_FREQUENCY, NULL, 0, u64ptr:NULL, defuintval:0, TYPE_UINT64, 0}, \ {CONFIG_STRING_RU_IF_FREQ_OFFSET, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ {CONFIG_STRING_RU_DO_PRECODING, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ - {CONFIG_STRING_RU_SF_AHEAD, NULL, 0, iptr:NULL, defintval:4, TYPE_INT, 0}, \ - {CONFIG_STRING_RU_SL_AHEAD, NULL, 0, iptr:NULL, defintval:6, TYPE_INT, 0}, \ - {CONFIG_STRING_RU_NR_FLAG, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ - {CONFIG_STRING_RU_NR_SCS_FOR_RASTER, NULL, 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \ + {CONFIG_STRING_RU_SF_AHEAD, HLP_RU_SF_AHEAD, 0, iptr:NULL, defintval:4, TYPE_INT, 0}, \ + {CONFIG_STRING_RU_SL_AHEAD, HLP_RU_SL_AHEAD, 0, iptr:NULL, defintval:6, TYPE_INT, 0}, \ + {CONFIG_STRING_RU_NR_FLAG, HLP_RU_NR_FLAG, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ + {CONFIG_STRING_RU_NR_SCS_FOR_RASTER, HLP_RU_NR_SCS_FOR_RASTER, 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \ } /*---------------------------------------------------------------------------------------------------------------------------------------*/ From ada4be081caa14db2a9f83feea06324ac397ab67 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 4 May 2022 10:43:15 +0200 Subject: [PATCH 112/114] Remove clock_gettime() introduced in this branch --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 6 +----- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 8 ++------ openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 9 ++------- 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 7e4710ccda..f1eebfc026 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -456,14 +456,10 @@ int nr_process_mac_pdu(module_id_t module_idP, if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len)) return 0; - struct timespec time_request; - clock_gettime(CLOCK_REALTIME, &time_request); - LOG_D(NR_MAC, "[UE %04x] %d.%d : Time %lu.%lu ULSCH -> UL-%s %d (gNB %d, %d bytes)\n", + LOG_D(NR_MAC, "[UE %x] %d.%d: ULSCH -> UL-%s %d (gNB %d, %d bytes)\n", UE_info->rnti[UE_id], frameP, slot, - time_request.tv_sec, - time_request.tv_nsec, rx_lcid<4?"DCCH":"DTCH", rx_lcid, module_idP, diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index ac7da5412b..b5cea6bdb9 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -711,9 +711,7 @@ rb_found: memblock = get_free_mem_block(size, __FUNCTION__); memcpy(memblock->data, buf, size); - struct timespec time_request; - clock_gettime(CLOCK_REALTIME, &time_request); - LOG_D(PDCP, "%s(): (rb %d) calling enqueue_rlc_data_req size %d at time %lu.%lu\n", __func__, rb_id, size,time_request.tv_sec,time_request.tv_nsec); + LOG_D(PDCP, "%s(): (srb %d) calling rlc_data_req size %d\n", __func__, rb_id, size); //for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)memblock->data[i]); //printf("\n"); enqueue_rlc_data_req(&ctxt, 0, MBMS_FLAG_NO, rb_id, sdu_id, 0, size, memblock); @@ -1338,9 +1336,7 @@ static boolean_t pdcp_data_req_drb( const sdu_size_t sdu_buffer_size, unsigned char *const sdu_buffer) { - struct timespec time_request; - clock_gettime(CLOCK_REALTIME, &time_request); - LOG_D(PDCP, "%s() called at time %lu.%lu, size %d\n", __func__, time_request.tv_sec,time_request.tv_nsec,sdu_buffer_size); + LOG_D(PDCP, "%s() called, size %d\n", __func__, sdu_buffer_size); nr_pdcp_ue_t *ue; nr_pdcp_entity_t *rb; int rnti = ctxt_pP->rnti; diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 18ee7da8e2..baae1fa436 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -460,14 +460,9 @@ static void deliver_sdu(void *_ue, nr_rlc_entity_t *entity, char *buf, int size) exit(1); rb_found: - if (is_srb==0) { - struct timespec time_request; - clock_gettime(CLOCK_REALTIME, &time_request); + LOG_D(RLC, "%s:%d:%s: delivering SDU (rnti %d is_srb %d rb_id %d) size %d\n", + __FILE__, __LINE__, __FUNCTION__, ue->rnti, is_srb, rb_id, size); - LOG_D(RLC, "%s:%d:%s: delivering SDU Time %lu.%lu (rnti %d is_srb %d rb_id %d) size %d\n", - __FILE__, __LINE__, __FUNCTION__, time_request.tv_sec,time_request.tv_nsec, - ue->rnti, is_srb, rb_id, size); - } /* unused fields? */ ctx.instance = 0; ctx.frame = 0; From 602fb113392b98f98fccbb99ccc37998a592c9c2 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Thu, 5 May 2022 13:39:04 +0100 Subject: [PATCH 113/114] Avoid usage of preferred_dl_tda and preferred_ul_tda before their computation and improve code readability --- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 50 +++++++++++-------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 555c41a752..3f7a908395 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2829,42 +2829,52 @@ void nr_mac_update_timers(module_id_t module_id, const NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL; NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon; + NR_CellGroupConfig_t *cg = UE_info->CellGroup[UE_id]; - NR_BWP_DownlinkDedicated_t *bwpd = UE_info->CellGroup[UE_id] && - UE_info->CellGroup[UE_id]->spCellConfig && - UE_info->CellGroup[UE_id]->spCellConfig->spCellConfigDedicated ? - UE_info->CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->initialDownlinkBWP : NULL; + NR_BWP_Downlink_t *bwp = sched_ctrl->active_bwp; + NR_BWP_DownlinkDedicated_t *bwpd = cg && + cg->spCellConfig && + cg->spCellConfig->spCellConfigDedicated ? + cg->spCellConfig->spCellConfigDedicated->initialDownlinkBWP : NULL; + int **preferred_dl_tda = RC.nrmac[module_id]->preferred_dl_tda; + NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static; const uint8_t layers = set_dl_nrOfLayers(sched_ctrl); - const int tda = RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0][slot]; + const int tda = bwp && preferred_dl_tda[bwp->bwp_Id][slot] >= 0 ? + preferred_dl_tda[bwp->bwp_Id][slot] : (ps->time_domain_allocation >= 0 ? ps->time_domain_allocation : 0); + nr_set_pdsch_semi_static(sib1, scc, - UE_info->CellGroup[UE_id], - sched_ctrl->active_bwp, + cg, + bwp, bwpd, - tda >= 0 ? tda : sched_ctrl->pdsch_semi_static.time_domain_allocation, + tda, layers, sched_ctrl, - &sched_ctrl->pdsch_semi_static); + ps); - NR_BWP_UplinkDedicated_t *ubwpd = UE_info->CellGroup[UE_id] && - UE_info->CellGroup[UE_id]->spCellConfig && - UE_info->CellGroup[UE_id]->spCellConfig->spCellConfigDedicated && - UE_info->CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig ? - UE_info->CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP : NULL; + NR_BWP_Uplink_t *ubwp = sched_ctrl->active_ubwp; + NR_BWP_UplinkDedicated_t *ubwpd = cg && + cg->spCellConfig && + cg->spCellConfig->spCellConfigDedicated && + cg->spCellConfig->spCellConfigDedicated->uplinkConfig ? + cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP : NULL; + int **preferred_ul_tda = RC.nrmac[module_id]->preferred_ul_tda; + NR_pusch_semi_static_t *ups = &sched_ctrl->pusch_semi_static; - const uint8_t num_dmrs_cdm_grps_no_data = (sched_ctrl->active_ubwp || ubwpd) ? 1 : 2; int dci_format = get_dci_format(sched_ctrl); - const int utda = sched_ctrl->active_ubwp ? RC.nrmac[module_id]->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot] : 0; + const uint8_t num_dmrs_cdm_grps_no_data = (ubwp || ubwpd) ? 1 : 2; + const int utda = ubwp && preferred_ul_tda[ubwp->bwp_Id][slot] >= 0 ? + preferred_ul_tda[ubwp->bwp_Id][slot] : (ups->time_domain_allocation >= 0 ? ups->time_domain_allocation : 0); + nr_set_pusch_semi_static(sib1, scc, - sched_ctrl->active_ubwp, + ubwp, ubwpd, dci_format, - utda >= 0 ? utda : sched_ctrl->pusch_semi_static.time_domain_allocation, + utda, num_dmrs_cdm_grps_no_data, - &sched_ctrl->pusch_semi_static); - + ups); } } } From e1e8a49b763d313370a4499d92a100d540f81cce Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 5 May 2022 19:02:19 +0200 Subject: [PATCH 114/114] Fix UP traffic in NSA --- openair2/RRC/NR/rrc_gNB_nsa.c | 57 +++++++++++++++++------------------ 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index 00e11278a2..b482637dfd 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -370,38 +370,37 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ ue_context_p->ue_context.secondaryCellGroup); } - if(m == NULL){ - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, rrc->module_id, GNB_FLAG_YES, ue_context_p->ue_id_rnti, 0, 0, rrc->module_id); - LOG_W(RRC, "Calling RRC PDCP/RLC ASN1 request functions for protocol context %p with module_id %d, rnti %x, frame %d, subframe %d eNB_index %d \n", &ctxt, - ctxt.module_id, - ctxt.rnti, - ctxt.frame, - ctxt.subframe, - ctxt.eNB_index); + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, rrc->module_id, GNB_FLAG_YES, ue_context_p->ue_id_rnti, 0, 0, rrc->module_id); + LOG_W(RRC, + "Calling RRC PDCP/RLC ASN1 request functions for protocol context %p with module_id %d, rnti %x, frame %d, subframe %d eNB_index %d \n", + &ctxt, + ctxt.module_id, + ctxt.rnti, + ctxt.frame, + ctxt.subframe, + ctxt.eNB_index); - nr_rrc_pdcp_config_asn1_req(&ctxt, - get_softmodem_params()->sa ? ue_context_p->ue_context.rb_config->srb_ToAddModList : (NR_SRB_ToAddModList_t *) NULL, - ue_context_p->ue_context.rb_config->drb_ToAddModList , - ue_context_p->ue_context.rb_config->drb_ToReleaseList, - (ue_context_p->ue_context.integrity_algorithm << 4) | ue_context_p->ue_context.ciphering_algorithm, - NULL, /* kRRCenc - unused */ - NULL, /* kRRCint - unused */ - kUPenc, /* kUPenc */ - kUPint, /* kUPint */ - NULL, - NULL, - ue_context_p->ue_context.secondaryCellGroup->rlc_BearerToAddModList); + nr_rrc_pdcp_config_asn1_req(&ctxt, + get_softmodem_params()->sa ? ue_context_p->ue_context.rb_config->srb_ToAddModList : (NR_SRB_ToAddModList_t *) NULL, + ue_context_p->ue_context.rb_config->drb_ToAddModList , + ue_context_p->ue_context.rb_config->drb_ToReleaseList, + (ue_context_p->ue_context.integrity_algorithm << 4) | ue_context_p->ue_context.ciphering_algorithm, + NULL, /* kRRCenc - unused */ + NULL, /* kRRCint - unused */ + kUPenc, /* kUPenc */ + kUPint, /* kUPint */ + NULL, + NULL, + ue_context_p->ue_context.secondaryCellGroup->rlc_BearerToAddModList); - nr_rrc_rlc_config_asn1_req (&ctxt, - get_softmodem_params()->sa ? ue_context_p->ue_context.rb_config->srb_ToAddModList : (NR_SRB_ToAddModList_t *) NULL, - ue_context_p->ue_context.rb_config->drb_ToAddModList, - ue_context_p->ue_context.rb_config->drb_ToReleaseList, - (LTE_PMCH_InfoList_r9_t *) NULL, - ue_context_p->ue_context.secondaryCellGroup->rlc_BearerToAddModList); - - LOG_D(RRC, "%s:%d: done RRC PDCP/RLC ASN1 request for UE rnti %x\n", __FUNCTION__, __LINE__, ctxt.rnti); - } + nr_rrc_rlc_config_asn1_req(&ctxt, + get_softmodem_params()->sa ? ue_context_p->ue_context.rb_config->srb_ToAddModList : (NR_SRB_ToAddModList_t *) NULL, + ue_context_p->ue_context.rb_config->drb_ToAddModList, + ue_context_p->ue_context.rb_config->drb_ToReleaseList, + (LTE_PMCH_InfoList_r9_t *) NULL, + ue_context_p->ue_context.secondaryCellGroup->rlc_BearerToAddModList); + LOG_D(RRC, "%s:%d: done RRC PDCP/RLC ASN1 request for UE rnti %x\n", __FUNCTION__, __LINE__, ctxt.rnti); } void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti) {