From 0517b97382dd609e10d51946408d21932e10c653 Mon Sep 17 00:00:00 2001 From: sfn Date: Mon, 2 Aug 2021 15:38:46 +0200 Subject: [PATCH 01/67] Add codebook type I precoding matrices generation function --- executables/nr-gnb.c | 8 +- openair1/PHY/INIT/nr_init.c | 402 ++++++++++++++++++++++++- openair1/PHY/defs_gNB.h | 3 + openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 2 + openair2/RRC/NR/rrc_gNB_reconfig.c | 46 ++- 5 files changed, 445 insertions(+), 16 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index f83fac2737..e2385c45c0 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -74,7 +74,7 @@ #include "UTIL/OPT/opt.h" #include "enb_config.h" #include "gnb_paramdef.h" - +#include "LAYER2/NR_MAC_gNB/mac_proto.h" #include "s1ap_eNB.h" #include "SIMULATION/ETH_TRANSPORT/proto.h" @@ -497,14 +497,18 @@ void print_opp_meas(void) { void init_eNB_afterRU(void) { int inst,ru_id,i,aa; PHY_VARS_gNB *gNB; + gNB_MAC_INST *mac; LOG_I(PHY,"%s() RC.nb_nr_inst:%d\n", __FUNCTION__, RC.nb_nr_inst); if(NFAPI_MODE == NFAPI_MODE_PNF) RC.nb_nr_inst = 1; for (inst=0; instUL_INFO.module_id]; + phy_init_nr_gNB(gNB,0,0); + mac_init_codebook_gNB(gNB,mac); // map antennas and PRACH signals to gNB RX if (0) AssertFatal(gNB->num_RU>0,"Number of RU attached to gNB %d is zero\n",gNB->Mod_id); diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index cd4848ea8c..09f37d99fc 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -36,9 +36,10 @@ #include "MBSFN-SubframeConfigList.h"*/ #include "openair1/PHY/defs_RU.h" #include "openair1/PHY/CODING/nrLDPC_extern.h" +#include "LAYER2/NR_MAC_gNB/nr_mac_gNB.h" #include "assertions.h" #include - +#include #include "PHY/NR_TRANSPORT/nr_ulsch.h" #include "PHY/NR_REFSIG/nr_refsig.h" #include "SCHED_NR/fapi_nr_l1.h" @@ -71,6 +72,405 @@ int l1_north_init_gNB() { return(0); } +int mac_init_codebook_gNB(PHY_VARS_gNB *gNB, + gNB_MAC_INST *mac) { + //get RRC Codebook configuration + struct NR_CSI_ReportConfig *csi_reportconfig = mac->UE_info.CellGroup[0]->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup->csi_ReportConfigToAddModList->list.array[0]; + //int rrc_count = mac->UE_info.CellGroup[0]->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup->csi_ReportConfigToAddModList->list.count; + + if(csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present==NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel) { + int N1=1; + int N2=1; + int O1=0; + int O2=0; + int CSI_RS_antenna_ports=1; + + //Uniform Planner Array: UPA + // X X X X ... X + // X X X X ... X + // N2 . . . . ... . + // X X X X ... X + // |<-----N1---->| + printf("NR Codebook Config: codebookType, type1, subType_PR_typeI_SinglePanel\n"); + struct NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel *type1single = csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel; + if (type1single->nrOfAntennaPorts.present == NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two) { + N1=1; + N2=1; + O1=1; + O2=1; + CSI_RS_antenna_ports=2; + } else if(type1single->nrOfAntennaPorts.present == NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_moreThanTwo) { + //Type 1 Single Panel : Based on 38.214 v15.3-Table 5.2.2.2.1-2: Supported configurations of (N1,N2) and (O1,O2) + switch(type1single->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.present) { + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_one_TypeI_SinglePanel_Restriction: + printf("NR Codebook Config: codebookType, type1, n1_n2_PR_two_one\n"); + N1=2; + N2=1; + O1=4; + O2=1; + CSI_RS_antenna_ports=4; + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_two_TypeI_SinglePanel_Restriction: + printf("NR Codebook Config: codebookType, type1, n1_n2_PR_two_two_TypeI\n"); + N1=2; + N2=2; + O1=4; + O2=4; + CSI_RS_antenna_ports=8; + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_one_TypeI_SinglePanel_Restriction: + printf("NR Codebook Config: codebookType, type1, n1_n2_PR_four_one\n"); + N1=4; + N2=1; + O1=4; + O2=1; + CSI_RS_antenna_ports=8; + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_three_two_TypeI_SinglePanel_Restriction: + printf("NR Codebook Config: codebookType, type1, n1_n2_PR_three_two\n"); + N1=3; + N2=2; + O1=4; + O2=4; + CSI_RS_antenna_ports=12; + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_one_TypeI_SinglePanel_Restriction: + printf("NR Codebook Config: codebookType, type1, n1_n2_PR_six_one\n"); + N1=6; + N2=1; + O1=4; + O2=1; + CSI_RS_antenna_ports=12; + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_two_TypeI_SinglePanel_Restriction: + printf("NR Codebook Config: codebookType, type1, n1_n2_PR_four_two\n"); + N1=4; + N2=2; + O1=4; + O2=4; + CSI_RS_antenna_ports=16; + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_eight_one_TypeI_SinglePanel_Restriction: + printf("NR Codebook Config: codebookType, type1, n1_n2_PR_eight_one\n"); + N1=8; + N2=1; + O1=4; + O2=1; + CSI_RS_antenna_ports=16; + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_three_TypeI_SinglePanel_Restriction: + printf("NR Codebook Config: codebookType, type1, n1_n2_PR_four_three\n"); + N1=4; + N2=3; + O1=4; + O2=4; + CSI_RS_antenna_ports=24; + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_two_TypeI_SinglePanel_Restriction: + printf("NR Codebook Config: codebookType, type1, n1_n2_PR_six_two_\n"); + N1=6; + N2=2; + O1=4; + O2=4; + CSI_RS_antenna_ports=24; + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_twelve_one_TypeI_SinglePanel_Restriction: + printf("NR Codebook Config: codebookType, type1, n1_n2_PR_twelve_one\n"); + N1=12; + N2=1; + O1=4; + O2=1; + CSI_RS_antenna_ports=24; + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_four_TypeI_SinglePanel_Restriction: + printf("NR Codebook Config: codebookType, type1, n1_n2_PR_four_four\n"); + N1=4; + N2=4; + O1=4; + O2=4; + CSI_RS_antenna_ports=32; + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_eight_two_TypeI_SinglePanel_Restriction: + printf("NR Codebook Config: codebookType, type1, n1_n2_PR_eight_two\n"); + N1=8; + N2=2; + O1=4; + O2=4; + CSI_RS_antenna_ports=32; + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_sixteen_one_TypeI_SinglePanel_Restriction: + printf("NR Codebook Config: codebookType, type1, n1_n2_PR_sixteen_one\n"); + N1=16; + N2=1; + O1=4; + O2=1; + CSI_RS_antenna_ports=32; + break; + default: + printf("n1 n2 is %d\n",type1single->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.present); + N1=1; + N2=1; + O1=1; + O2=1; + CSI_RS_antenna_ports=2; + break; + } + } + + if(csi_reportconfig->codebookConfig->codebookType.choice.type1->codebookMode==1){ + if (CSI_RS_antenna_ports < 16) { + //Generate DFT vertical beams + //ll: index of a vertical beams vector (represented by i1_1 in TS 38.214) + double complex v[N1*O1][N1]; + for (int ll=0; ll=4) + pmi_size = N1*O1*N2*O2*(4)+N1*O1*N2*O2*N1*O1*N2*O2*2+N1*O1*N2*O2*N1*O1*N2*O2*2+(N1*O1-1)*N2*O2*N1*O1*N2*O2*2+(N2*O2-1)*N1*O1*N2*O2*2+(N1*O1-1)*N2*O2*2+(N2*O2-1)*2+2; + gNB->nr_mimo_precoding_matrix = (int32_t **)malloc16(pmi_size* sizeof(int32_t)); + int32_t **mat = gNB->nr_mimo_precoding_matrix; + + double complex res_code; + + //Table 5.2.2.2.1-5: + //Codebook for 1-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS + for(int ll=0; ll0) + ((short*) &mat[pmiq][len])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[pmiq][len])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[pmiq][len])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[pmiq][len])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + printf("%d %d result = %f+j %f FIXED POINT %d+j %d \n",pmiq, len, creal(res_code), cimag(res_code),((short*) &mat[pmiq][len])[0],((short*) &mat[pmiq][len])[1]); + } + + for(int len=N1*N2; len<2*N1*N2; len++) { + res_code=sqrt(1/(double)CSI_RS_antenna_ports)*theta_n[nn]*v_lm[ll][mm][len-N1*N2]; + if (creal(res_code)>0) + ((short*) &mat[pmiq][len])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[pmiq][len])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[pmiq][len])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[pmiq][len])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + printf("%d %d result = %f+j %f FIXED POINT %d+j %d \n",pmiq, len, creal(res_code), cimag(res_code),((short*) &mat[pmiq][len])[0],((short*) &mat[pmiq][len])[1]); + + } + } + int llc; + int mmc; + double complex phase_sign; + //Table 5.2.2.2.1-6: + //Codebook for 2-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS + for(int llb=0; llb0) + ((short*) &mat[pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + + if (cimag(res_code)>0) + ((short*) &mat[pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + printf("%d %d result = %f+j %f FIXED POINT %d+j %d \n",pmiq, i_rows, creal(res_code), cimag(res_code),((short*) &mat[pmiq][i_rows*2+j_col])[0],((short*) &mat[pmiq][i_rows*2+j_col])[1]); + } + for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { + res_code=sqrt(1/(double)(2*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; + if (creal(res_code)>0) + ((short*) &mat[pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + printf("%d %d result = %f+j %f FIXED POINT %d+j %d \n",pmiq, i_rows, creal(res_code), cimag(res_code),((short*) &mat[pmiq][i_rows*2+j_col])[0],((short*) &mat[pmiq][i_rows*2+j_col])[1]); + } + } + } + //Table 5.2.2.2.1-7: + //Codebook for 3-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS + if(CSI_RS_antenna_ports>=3) + for(int llb=0; llb0) + ((short*) &mat[pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + + if (cimag(res_code)>0) + ((short*) &mat[pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + printf("%d %d result = %f+j %f FIXED POINT %d+j %d \n",pmiq, i_rows, creal(res_code), cimag(res_code),((short*) &mat[pmiq][i_rows*3+j_col])[0],((short*) &mat[pmiq][i_rows*3+j_col])[1]); + } + for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { + res_code=sqrt(1/(double)(3*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; + if (creal(res_code)>0) + ((short*) &mat[pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + printf("%d %d result = %f+j %f FIXED POINT %d+j %d \n",pmiq, i_rows, creal(res_code), cimag(res_code),((short*) &mat[pmiq][i_rows*3+j_col])[0],((short*) &mat[pmiq][i_rows*3+j_col])[1]); + } + } + } + //Table 5.2.2.2.1-8: + //Codebook for 4-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS + if(CSI_RS_antenna_ports>=4) + for(int llb=0; llb0) + ((short*) &mat[pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q1else + ((short*) &mat[pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + printf("%d %d result = %f+j %f FIXED POINT %d+j %d \n",pmiq, i_rows, creal(res_code), cimag(res_code),((short*) &mat[pmiq][i_rows*4+j_col])[0],((short*) &mat[pmiq][i_rows*4+j_col])[1]); + } + for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { + res_code=sqrt(1/(double)(4*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; + if (creal(res_code)>0) + ((short*) &mat[pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + printf("%d %d result = %f+j %f FIXED POINT %d+j %d \n",pmiq, i_rows, creal(res_code), cimag(res_code),((short*) &mat[pmiq][i_rows*4+j_col])[0],((short*) &mat[pmiq][i_rows*4+j_col])[1]); + } + } + } + } + } else {//codebookMode 2 + printf("CodeBook Type 1, CodebookMode %ld is not supported\n",csi_reportconfig->codebookConfig->codebookType.choice.type1->codebookMode); + } + } else { + printf("subType_PR_typeI %d is not supported\n",csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present); + } + + return (0); +} int phy_init_nr_gNB(PHY_VARS_gNB *gNB, unsigned char is_secondary_gNB, diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 11b5112a6c..57e841ad40 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -804,6 +804,9 @@ typedef struct PHY_VARS_gNB_s { /// PDSCH DMRS sequence uint32_t ****nr_gold_pdsch_dmrs; + /// PDSCH codebook I precoding LUTs + int32_t **nr_mimo_precoding_matrix; + /// PUSCH DMRS uint32_t ****nr_gold_pusch_dmrs; diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 62d70f4f2c..e7715bec14 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -38,6 +38,8 @@ void set_cset_offset(uint16_t); void mac_top_init_gNB(void); +int mac_init_codebook_gNB(PHY_VARS_gNB *gNB, gNB_MAC_INST *mac); + void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts, diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 980bd39c37..c4e9389f99 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -1189,19 +1189,39 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco csirep1->codebookConfig->codebookType.choice.type1 = calloc(1,sizeof(*csirep1->codebookConfig->codebookType.choice.type1)); csirep1->codebookConfig->codebookType.choice.type1->subType.present=NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel; csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel=calloc(1,sizeof(*csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel)); - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present= - NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two; - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two= - calloc(1,sizeof(*csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two)); - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.size=1; - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.bits_unused=2; - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.buf=malloc(1); - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.buf[0]=0xfc; - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.size=1; - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.bits_unused=0; - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf=malloc(1); - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]=0x03; - csirep1->codebookConfig->codebookType.choice.type1->codebookMode=1; + if (dl_antenna_ports <= 2) { + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present= + NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two; + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two= + calloc(1,sizeof(*csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two)); + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.size=1; + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.bits_unused=2; + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.buf=malloc(1); + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.buf[0]=0xfc; + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.size=1; + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.bits_unused=0; + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf=malloc(1); + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]=0x03; + csirep1->codebookConfig->codebookType.choice.type1->codebookMode=1; + } else if (dl_antenna_ports < 16) { + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present= + NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_moreThanTwo; + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.moreThanTwo= + calloc(1,sizeof(*csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.moreThanTwo)); + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.present= + NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_three_two_TypeI_SinglePanel_Restriction; + /*csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.choice.two_one_TypeI_SinglePanel_Restriction.size=1; + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.choice.two_one_TypeI_SinglePanel_Restriction.bits_unused=1; + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.choice.two_one_TypeI_SinglePanel_Restriction.buf=malloc(1); + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.choice.two_one_TypeI_SinglePanel_Restriction.buf[0]=0xc0; //'00000011'B + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.moreThanTwo->typeI_SinglePanel_codebookSubsetRestriction_i2->size = 1; + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.moreThanTwo->typeI_SinglePanel_codebookSubsetRestriction_i2->bits_unused=1; + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.moreThanTwo->typeI_SinglePanel_codebookSubsetRestriction_i2->buf=malloc(1); + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.moreThanTwo->typeI_SinglePanel_codebookSubsetRestriction_i2->buf[0]=0xc0;*/ + csirep1->codebookConfig->codebookType.choice.type1->codebookMode=1; + } else {//32 antennas are Not implemented yet + csirep1->codebookConfig->codebookType.choice.type1->codebookMode=2; + } csirep1->dummy = NULL; csirep1->groupBasedBeamReporting.present = NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled; csirep1->groupBasedBeamReporting.choice.disabled=calloc(1,sizeof(*csirep1->groupBasedBeamReporting.choice.disabled)); From e993a59d22c12c3865baf86ff51a60d3356d5f3c Mon Sep 17 00:00:00 2001 From: sfn Date: Mon, 29 Nov 2021 11:15:31 +0100 Subject: [PATCH 02/67] Make use of gNB precoding matrix for PDSCH layer precoding --- openair1/PHY/INIT/nr_init.c | 810 ++++++++++-------- openair1/PHY/MODULATION/nr_modulation.c | 15 + openair1/PHY/MODULATION/nr_modulation.h | 5 + openair1/PHY/NR_TRANSPORT/nr_dlsch.c | 67 +- openair1/PHY/defs_gNB.h | 2 +- openair1/SIMULATION/NR_PHY/dlsim.c | 1 + openair2/RRC/NR/rrc_gNB_reconfig.c | 15 +- .../CONF/gnb.band78.tm1.106PRB.usrpn300.conf | 2 + 8 files changed, 497 insertions(+), 420 deletions(-) diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 09f37d99fc..f77526210d 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -76,399 +76,451 @@ int mac_init_codebook_gNB(PHY_VARS_gNB *gNB, gNB_MAC_INST *mac) { //get RRC Codebook configuration struct NR_CSI_ReportConfig *csi_reportconfig = mac->UE_info.CellGroup[0]->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup->csi_ReportConfigToAddModList->list.array[0]; - //int rrc_count = mac->UE_info.CellGroup[0]->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup->csi_ReportConfigToAddModList->list.count; - if(csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present==NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel) { - int N1=1; - int N2=1; - int O1=0; - int O2=0; - int CSI_RS_antenna_ports=1; + if(gNB->frame_parms.nb_antennas_tx>1){ + LOG_I(MAC,"NR mac_init_codebook_gNB: codebookType present %d\n",csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present); + if(csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present==NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel) { + int N1=1; + int N2=1; + int O1=0; + int O2=0; + int CSI_RS_antenna_ports=1; - //Uniform Planner Array: UPA - // X X X X ... X - // X X X X ... X - // N2 . . . . ... . - // X X X X ... X - // |<-----N1---->| - printf("NR Codebook Config: codebookType, type1, subType_PR_typeI_SinglePanel\n"); - struct NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel *type1single = csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel; - if (type1single->nrOfAntennaPorts.present == NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two) { - N1=1; - N2=1; - O1=1; - O2=1; - CSI_RS_antenna_ports=2; - } else if(type1single->nrOfAntennaPorts.present == NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_moreThanTwo) { - //Type 1 Single Panel : Based on 38.214 v15.3-Table 5.2.2.2.1-2: Supported configurations of (N1,N2) and (O1,O2) - switch(type1single->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.present) { - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_one_TypeI_SinglePanel_Restriction: - printf("NR Codebook Config: codebookType, type1, n1_n2_PR_two_one\n"); - N1=2; - N2=1; - O1=4; - O2=1; - CSI_RS_antenna_ports=4; - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_two_TypeI_SinglePanel_Restriction: - printf("NR Codebook Config: codebookType, type1, n1_n2_PR_two_two_TypeI\n"); - N1=2; - N2=2; - O1=4; - O2=4; - CSI_RS_antenna_ports=8; - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_one_TypeI_SinglePanel_Restriction: - printf("NR Codebook Config: codebookType, type1, n1_n2_PR_four_one\n"); - N1=4; - N2=1; - O1=4; - O2=1; - CSI_RS_antenna_ports=8; - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_three_two_TypeI_SinglePanel_Restriction: - printf("NR Codebook Config: codebookType, type1, n1_n2_PR_three_two\n"); - N1=3; - N2=2; - O1=4; - O2=4; - CSI_RS_antenna_ports=12; - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_one_TypeI_SinglePanel_Restriction: - printf("NR Codebook Config: codebookType, type1, n1_n2_PR_six_one\n"); - N1=6; - N2=1; - O1=4; - O2=1; - CSI_RS_antenna_ports=12; - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_two_TypeI_SinglePanel_Restriction: - printf("NR Codebook Config: codebookType, type1, n1_n2_PR_four_two\n"); - N1=4; - N2=2; - O1=4; - O2=4; - CSI_RS_antenna_ports=16; - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_eight_one_TypeI_SinglePanel_Restriction: - printf("NR Codebook Config: codebookType, type1, n1_n2_PR_eight_one\n"); - N1=8; - N2=1; - O1=4; - O2=1; - CSI_RS_antenna_ports=16; - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_three_TypeI_SinglePanel_Restriction: - printf("NR Codebook Config: codebookType, type1, n1_n2_PR_four_three\n"); - N1=4; - N2=3; - O1=4; - O2=4; - CSI_RS_antenna_ports=24; - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_two_TypeI_SinglePanel_Restriction: - printf("NR Codebook Config: codebookType, type1, n1_n2_PR_six_two_\n"); - N1=6; - N2=2; - O1=4; - O2=4; - CSI_RS_antenna_ports=24; - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_twelve_one_TypeI_SinglePanel_Restriction: - printf("NR Codebook Config: codebookType, type1, n1_n2_PR_twelve_one\n"); - N1=12; - N2=1; - O1=4; - O2=1; - CSI_RS_antenna_ports=24; - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_four_TypeI_SinglePanel_Restriction: - printf("NR Codebook Config: codebookType, type1, n1_n2_PR_four_four\n"); - N1=4; - N2=4; - O1=4; - O2=4; - CSI_RS_antenna_ports=32; - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_eight_two_TypeI_SinglePanel_Restriction: - printf("NR Codebook Config: codebookType, type1, n1_n2_PR_eight_two\n"); - N1=8; - N2=2; - O1=4; - O2=4; - CSI_RS_antenna_ports=32; - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_sixteen_one_TypeI_SinglePanel_Restriction: - printf("NR Codebook Config: codebookType, type1, n1_n2_PR_sixteen_one\n"); - N1=16; - N2=1; - O1=4; - O2=1; - CSI_RS_antenna_ports=32; - break; - default: - printf("n1 n2 is %d\n",type1single->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.present); - N1=1; - N2=1; - O1=1; - O2=1; - CSI_RS_antenna_ports=2; - break; + //Uniform Planner Array: UPA + // X X X X ... X + // X X X X ... X + // N2 . . . . ... . + // X X X X ... X + // |<-----N1---->| + LOG_I(MAC,"NR Codebook Config: codebookType, type1, subType_PR_typeI_SinglePanel\n"); + struct NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel *type1single = csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel; + if (type1single->nrOfAntennaPorts.present == NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two) { + N1=1; + N2=1; + O1=1; + O2=1; + CSI_RS_antenna_ports=2; + LOG_I(MAC,"NR Codebook Config: antenna ports: %d\n",CSI_RS_antenna_ports); + } else if(type1single->nrOfAntennaPorts.present == NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_moreThanTwo) { + //Type 1 Single Panel : Based on 38.214 v15.3-Table 5.2.2.2.1-2: Supported configurations of (N1,N2) and (O1,O2) + switch(type1single->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.present) { + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_one_TypeI_SinglePanel_Restriction: + N1=2; + N2=1; + O1=4; + O2=1; + CSI_RS_antenna_ports=4; + LOG_I(MAC,"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_two_one\n",CSI_RS_antenna_ports); + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_two_TypeI_SinglePanel_Restriction: + N1=2; + N2=2; + O1=4; + O2=4; + CSI_RS_antenna_ports=8; + LOG_I(MAC,"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_two_two_TypeI\n",CSI_RS_antenna_ports); + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_one_TypeI_SinglePanel_Restriction: + N1=4; + N2=1; + O1=4; + O2=1; + CSI_RS_antenna_ports=8; + LOG_I(MAC,"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_one\n",CSI_RS_antenna_ports); + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_three_two_TypeI_SinglePanel_Restriction: + N1=3; + N2=2; + O1=4; + O2=4; + CSI_RS_antenna_ports=12; + LOG_I(MAC,"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_three_two\n",CSI_RS_antenna_ports); + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_one_TypeI_SinglePanel_Restriction: + N1=6; + N2=1; + O1=4; + O2=1; + CSI_RS_antenna_ports=12; + LOG_I(MAC,"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_six_one\n",CSI_RS_antenna_ports); + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_two_TypeI_SinglePanel_Restriction: + N1=4; + N2=2; + O1=4; + O2=4; + CSI_RS_antenna_ports=16; + LOG_I(MAC,"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_two\n",CSI_RS_antenna_ports); + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_eight_one_TypeI_SinglePanel_Restriction: + N1=8; + N2=1; + O1=4; + O2=1; + CSI_RS_antenna_ports=16; + LOG_I(MAC,"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_eight_one\n",CSI_RS_antenna_ports); + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_three_TypeI_SinglePanel_Restriction: + N1=4; + N2=3; + O1=4; + O2=4; + CSI_RS_antenna_ports=24; + LOG_I(MAC,"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_three\n",CSI_RS_antenna_ports); + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_two_TypeI_SinglePanel_Restriction: + N1=6; + N2=2; + O1=4; + O2=4; + CSI_RS_antenna_ports=24; + LOG_I(MAC,"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_six_two\n",CSI_RS_antenna_ports); + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_twelve_one_TypeI_SinglePanel_Restriction: + N1=12; + N2=1; + O1=4; + O2=1; + CSI_RS_antenna_ports=24; + LOG_I(MAC,"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_twelve_one\n",CSI_RS_antenna_ports); + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_four_TypeI_SinglePanel_Restriction: + N1=4; + N2=4; + O1=4; + O2=4; + CSI_RS_antenna_ports=32; + LOG_I(MAC,"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_four\n",CSI_RS_antenna_ports); + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_eight_two_TypeI_SinglePanel_Restriction: + N1=8; + N2=2; + O1=4; + O2=4; + CSI_RS_antenna_ports=32; + LOG_I(MAC,"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_eight_two\n",CSI_RS_antenna_ports); + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_sixteen_one_TypeI_SinglePanel_Restriction: + N1=16; + N2=1; + O1=4; + O2=1; + CSI_RS_antenna_ports=32; + LOG_I(MAC,"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_sixteen_one\n",CSI_RS_antenna_ports); + break; + default: + N1=1; + N2=1; + O1=1; + O2=1; + CSI_RS_antenna_ports=2; + LOG_I(MAC,"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2 %d\n",CSI_RS_antenna_ports,type1single->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.present); + break; + } } - } - if(csi_reportconfig->codebookConfig->codebookType.choice.type1->codebookMode==1){ - if (CSI_RS_antenna_ports < 16) { - //Generate DFT vertical beams - //ll: index of a vertical beams vector (represented by i1_1 in TS 38.214) - double complex v[N1*O1][N1]; - for (int ll=0; ll=4) - pmi_size = N1*O1*N2*O2*(4)+N1*O1*N2*O2*N1*O1*N2*O2*2+N1*O1*N2*O2*N1*O1*N2*O2*2+(N1*O1-1)*N2*O2*N1*O1*N2*O2*2+(N2*O2-1)*N1*O1*N2*O2*2+(N1*O1-1)*N2*O2*2+(N2*O2-1)*2+2; - gNB->nr_mimo_precoding_matrix = (int32_t **)malloc16(pmi_size* sizeof(int32_t)); - int32_t **mat = gNB->nr_mimo_precoding_matrix; - - double complex res_code; - - //Table 5.2.2.2.1-5: - //Codebook for 1-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS - for(int ll=0; ll0) - ((short*) &mat[pmiq][len])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[pmiq][len])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[pmiq][len])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[pmiq][len])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - printf("%d %d result = %f+j %f FIXED POINT %d+j %d \n",pmiq, len, creal(res_code), cimag(res_code),((short*) &mat[pmiq][len])[0],((short*) &mat[pmiq][len])[1]); - } - - for(int len=N1*N2; len<2*N1*N2; len++) { - res_code=sqrt(1/(double)CSI_RS_antenna_ports)*theta_n[nn]*v_lm[ll][mm][len-N1*N2]; - if (creal(res_code)>0) - ((short*) &mat[pmiq][len])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[pmiq][len])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[pmiq][len])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[pmiq][len])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - printf("%d %d result = %f+j %f FIXED POINT %d+j %d \n",pmiq, len, creal(res_code), cimag(res_code),((short*) &mat[pmiq][len])[0],((short*) &mat[pmiq][len])[1]); - - } + if(csi_reportconfig->codebookConfig->codebookType.choice.type1->codebookMode==1){ + if (CSI_RS_antenna_ports < 16) { + //Generate DFT vertical beams + //ll: index of a vertical beams vector (represented by i1_1 in TS 38.214) + double complex v[N1*O1][N1]; + for (int ll=0; ll0) - ((short*) &mat[pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + //Generate DFT Horizontal beams + //mm: index of a Horizontal beams vector (represented by i1_2 in TS 38.214) + double complex u[N2*O2][N2]; + for (int mm=0; mm0) - ((short*) &mat[pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - printf("%d %d result = %f+j %f FIXED POINT %d+j %d \n",pmiq, i_rows, creal(res_code), cimag(res_code),((short*) &mat[pmiq][i_rows*2+j_col])[0],((short*) &mat[pmiq][i_rows*2+j_col])[1]); - } - for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { - res_code=sqrt(1/(double)(2*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; - if (creal(res_code)>0) - ((short*) &mat[pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - printf("%d %d result = %f+j %f FIXED POINT %d+j %d \n",pmiq, i_rows, creal(res_code), cimag(res_code),((short*) &mat[pmiq][i_rows*2+j_col])[0],((short*) &mat[pmiq][i_rows*2+j_col])[1]); - } - } - } - //Table 5.2.2.2.1-7: - //Codebook for 3-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS - if(CSI_RS_antenna_ports>=3) - for(int llb=0; llb0) - ((short*) &mat[pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + gNB->nr_mimo_precoding_matrix = (int32_t ***)malloc16(4* sizeof(int32_t **)); + int32_t ***mat = gNB->nr_mimo_precoding_matrix; + double complex res_code; - if (cimag(res_code)>0) - ((short*) &mat[pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - printf("%d %d result = %f+j %f FIXED POINT %d+j %d \n",pmiq, i_rows, creal(res_code), cimag(res_code),((short*) &mat[pmiq][i_rows*3+j_col])[0],((short*) &mat[pmiq][i_rows*3+j_col])[1]); - } - for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { - res_code=sqrt(1/(double)(3*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; - if (creal(res_code)>0) - ((short*) &mat[pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - printf("%d %d result = %f+j %f FIXED POINT %d+j %d \n",pmiq, i_rows, creal(res_code), cimag(res_code),((short*) &mat[pmiq][i_rows*3+j_col])[0],((short*) &mat[pmiq][i_rows*3+j_col])[1]); + //Table 5.2.2.2.1-5: + //Codebook for 1-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS + int pmiq_size = N1*O1*N2*O2*4+1; + mat[0] = (int32_t **)malloc16(pmiq_size*sizeof(int32_t *)); + + //pmi=0 corresponds to unit matrix + mat[0][0] = (int32_t *)calloc(2*N1*N2,sizeof(int32_t)); + for(int j_col=0; j_col<1; j_col++)//1 layer + for (int i_rows=0; i_rows<2*N1*N2; i_rows++)//2-x polarized antenna + if(j_col==i_rows) + ((short*) &mat[0][0][i_rows+j_col])[0] = 32768; + + for(int ll=0; ll0) + ((short*) &mat[0][pmiq][len])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[0][pmiq][len])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[0][pmiq][len])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[0][pmiq][len])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + LOG_I(MAC, "1 Layer Precoding Matrix[0][pmi %d][antPort %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq, len, creal(res_code), cimag(res_code),((short*) &mat[0][pmiq][len])[0],((short*) &mat[0][pmiq][len])[1]); + } + + for(int len=N1*N2; len<2*N1*N2; len++) { + res_code=sqrt(1/(double)CSI_RS_antenna_ports)*theta_n[nn]*v_lm[ll][mm][len-N1*N2]; + if (creal(res_code)>0) + ((short*) &mat[0][pmiq][len])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[0][pmiq][len])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[0][pmiq][len])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[0][pmiq][len])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + + LOG_I(MAC, "1 Layer Precoding Matrix[0][pmi %d][antPort %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq, len, creal(res_code), cimag(res_code),((short*) &mat[0][pmiq][len])[0],((short*) &mat[0][pmiq][len])[1]); + } + } + + int llc; + int mmc; + double complex phase_sign; + //Table 5.2.2.2.1-6: + //Codebook for 2-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS + pmiq_size = N1*O1*N2*O2*N1*O1*N2*O2*2+1; + mat[1] = (int32_t **)malloc16(pmiq_size*sizeof(int32_t *)); + + //pmi=0 corresponds to unit matrix + mat[1][0] = (int32_t *)calloc((2*N1*N2)*(2),sizeof(int32_t)); + for(int j_col=0; j_col<2; j_col++)//2 layers + for (int i_rows=0; i_rows<2*N1*N2; i_rows++)//2-x polarized antenna + if(j_col==i_rows) + ((short*) &mat[1][0][i_rows*2+j_col])[0] = 32768; + + //pmi=1,...,pmi_size are computed as follows + for(int llb=0; llb0) + ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + + if (cimag(res_code)>0) + ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + + LOG_I(MAC, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[1][pmiq][i_rows*2+j_col])[0],((short*) &mat[1][pmiq][i_rows*2+j_col])[1]); + } + for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { + res_code=sqrt(1/(double)(2*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; + if (creal(res_code)>0) + ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + + LOG_I(MAC, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[1][pmiq][i_rows*2+j_col])[0],((short*) &mat[1][pmiq][i_rows*2+j_col])[1]); + } } } - } - //Table 5.2.2.2.1-8: - //Codebook for 4-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS - if(CSI_RS_antenna_ports>=4) - for(int llb=0; llb=3){ + pmiq_size = N1*O1*N2*O2*N1*O1*N2*O2*2+1; + mat[2] = (int32_t **)malloc16(pmiq_size*sizeof(int32_t *)); + + //pmi=0 corresponds to unit matrix + mat[2][0] = (int32_t *)calloc((2*N1*N2)*(3),sizeof(int32_t)); + for(int j_col=0; j_col<3; j_col++)//3 layers + for (int i_rows=0; i_rows<2*N1*N2; i_rows++)//2-x polarized antenna + if(j_col==i_rows) + ((short*) &mat[2][0][i_rows*3+j_col])[0] = 32768; + + //pmi=1,...,pmi_size are computed as follows + for(int llb=0; llb0) + ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + + if (cimag(res_code)>0) + ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + + LOG_D(MAC, "3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[2][pmiq][i_rows*3+j_col])[0],((short*) &mat[2][pmiq][i_rows*3+j_col])[1]); + } + for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { + res_code=sqrt(1/(double)(3*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; + if (creal(res_code)>0) + ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + + LOG_D(MAC, "3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[2][pmiq][i_rows*3+j_col])[0],((short*) &mat[2][pmiq][i_rows*3+j_col])[1]); + } + } } - if (j_col==1) { - llc = ll; - mmc = mm; - phase_sign = 1; + } + //Table 5.2.2.2.1-8: + //Codebook for 4-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS + + if(CSI_RS_antenna_ports>=4){ + pmiq_size = N1*O1*N2*O2*N1*O1*N2*O2*2+1; + mat[3] = (int32_t **)malloc16(pmiq_size*sizeof(int32_t *)); + + //pmi=0 corresponds to unit matrix + mat[3][0] = (int32_t *)calloc((2*N1*N2)*(4),sizeof(int32_t)); + for(int j_col=0; j_col<4; j_col++)//4 layers + for (int i_rows=0; i_rows<2*N1*N2; i_rows++)//2-x polarized antenna + if(j_col==i_rows) + ((short*) &mat[3][0][i_rows*4+j_col])[0] = 32768; + + //pmi=1,...,pmi_size are computed as follows + for(int llb=0; llb0) + ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q1else + ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + + LOG_D(MAC, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); + } + + for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { + res_code=sqrt(1/(double)(4*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; + if (creal(res_code)>0) + ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + + LOG_D(MAC, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); + } + } } - if (j_col==3) { - llc = llb; - mmc = mmb; - phase_sign = -1; - } - if (j_col==4) { - llc = ll; - mmc = mm; - phase_sign = -1; - } - for (int i_rows=0; i_rows0) - ((short*) &mat[pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q1else - ((short*) &mat[pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - printf("%d %d result = %f+j %f FIXED POINT %d+j %d \n",pmiq, i_rows, creal(res_code), cimag(res_code),((short*) &mat[pmiq][i_rows*4+j_col])[0],((short*) &mat[pmiq][i_rows*4+j_col])[1]); - } - for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { - res_code=sqrt(1/(double)(4*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; - if (creal(res_code)>0) - ((short*) &mat[pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - printf("%d %d result = %f+j %f FIXED POINT %d+j %d \n",pmiq, i_rows, creal(res_code), cimag(res_code),((short*) &mat[pmiq][i_rows*4+j_col])[0],((short*) &mat[pmiq][i_rows*4+j_col])[1]); - } - } - } + } + } + } else {//codebookMode 2 + LOG_I(MAC,"CodeBook Type 1, CodebookMode %ld is not supported\n",csi_reportconfig->codebookConfig->codebookType.choice.type1->codebookMode); } - } else {//codebookMode 2 - printf("CodeBook Type 1, CodebookMode %ld is not supported\n",csi_reportconfig->codebookConfig->codebookType.choice.type1->codebookMode); + } else { + LOG_I(MAC,"subType_PR_typeI %d is not supported\n",csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present); } - } else { - printf("subType_PR_typeI %d is not supported\n",csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present); } - return (0); } diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c index c81a88ff30..1db5c5eb32 100644 --- a/openair1/PHY/MODULATION/nr_modulation.c +++ b/openair1/PHY/MODULATION/nr_modulation.c @@ -801,3 +801,18 @@ int nr_layer_precoder(int16_t **datatx_F_precoding, char *prec_matrix, uint8_t n /* ((int16_t *)precodatatx_F)[0] = (int16_t)((((int16_t *)precodatatx_F)[0]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t *)precodatatx_F)[1] = (int16_t)((((int16_t *)precodatatx_F)[1]*ONE_OVER_SQRT2_Q15)>>15);*/ } + +int nr_layer_precoder_cm(int16_t **datatx_F_precoding, int *prec_matrix, uint8_t n_layers, int32_t re_offset) +{ + int32_t precodatatx_F = 0; + for (int al = 0; al>15); + ((int16_t *) &precodatatx_F)[1] += (int16_t)(((int32_t)(antenna_re*(((int16_t *)&prec_matrix[al])[1])) + (int32_t)(antenna_im* (((int16_t *)&prec_matrix[al])[0])))>>15); + } + + return precodatatx_F; +} + diff --git a/openair1/PHY/MODULATION/nr_modulation.h b/openair1/PHY/MODULATION/nr_modulation.h index 75541a1361..de0dbcfd31 100644 --- a/openair1/PHY/MODULATION/nr_modulation.h +++ b/openair1/PHY/MODULATION/nr_modulation.h @@ -135,4 +135,9 @@ int nr_layer_precoder(int16_t **datatx_F_precoding, char *prec_matrix, uint8_t n_layers, int32_t re_offset); + +int nr_layer_precoder_cm(int16_t **datatx_F_precoding, + int *prec_matrix, + uint8_t n_layers, + int32_t re_offset); #endif diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index fa1b6c955b..47014fd0ff 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -459,47 +459,38 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, } } else { - //get the precoding matrix weights: - char *W_prec; - switch (frame_parms->nb_antennas_tx) { - case 1://1 antenna port - W_prec = nr_W_1l_2p[pmi][ap]; - break; - case 2://2 antenna ports - if (rel15->nrOfLayers == 1)//1 layer - W_prec = nr_W_1l_2p[pmi][ap]; - else//2 layers - W_prec = nr_W_2l_2p[pmi][ap]; - break; - case 4://4 antenna ports - if (rel15->nrOfLayers == 1)//1 layer - W_prec = nr_W_1l_4p[pmi][ap]; - else if (rel15->nrOfLayers == 2)//2 layers - W_prec = nr_W_2l_4p[pmi][ap]; - else if (rel15->nrOfLayers == 3)//3 layers - W_prec = nr_W_3l_4p[pmi][ap]; - else//4 layers - W_prec = nr_W_4l_4p[pmi][ap]; - break; - default: - LOG_D(PHY,"Precoding 1,2, or 4 antenna ports are currently supported\n"); - W_prec = nr_W_1l_2p[pmi][ap]; - break; - } - for (int i=0; iofdm_symbol_size + k; - int32_t precodatatx_F = nr_layer_precoder(txdataF_precoding, W_prec, rel15->nrOfLayers, re_offset+txdataF_offset); - ((int16_t*)txdataF[ap])[(re_offset<<1) + (2*txdataF_offset)] = ((int16_t *) &precodatatx_F)[0]; - ((int16_t*)txdataF[ap])[(re_offset<<1) + 1 + (2*txdataF_offset)] = ((int16_t *) &precodatatx_F)[1]; -#ifdef DEBUG_DLSCH_MAPPING - printf("antenna %d\t l %d \t k %d \t txdataF: %d %d\n", - ap, l, k, ((int16_t*)txdataF[ap])[(re_offset<<1) + (2*txdataF_offset)], - ((int16_t*)txdataF[ap])[(re_offset<<1) + 1 + (2*txdataF_offset)]); -#endif - if (++k >= frame_parms->ofdm_symbol_size) { + if(frame_parms->nb_antennas_tx==1){//no precoding matrix defined + memcpy((void*)&txdataF[ap][l*frame_parms->ofdm_symbol_size + txdataF_offset + k], + (void*)&txdataF_precoding[ap][2*(l*frame_parms->ofdm_symbol_size + txdataF_offset+ k)], + NR_NB_SC_PER_RB*sizeof(int32_t)); + k += NR_NB_SC_PER_RB; + if (k >= frame_parms->ofdm_symbol_size) { k -= frame_parms->ofdm_symbol_size; } } + else { + //get the precoding matrix weights: + int32_t **mat = gNB->nr_mimo_precoding_matrix[rel15->nrOfLayers-1]; + //i_row =0,...,dl_antenna_port + //j_col =0,...,nrOfLayers + //mat[pmi][i_rows*2+j_col] + int *W_prec; + W_prec = (int32_t *)&mat[pmi][ap*rel15->nrOfLayers]; + for (int i=0; iofdm_symbol_size + k; + int32_t precodatatx_F = nr_layer_precoder_cm(txdataF_precoding, W_prec, rel15->nrOfLayers, re_offset+txdataF_offset); + ((int16_t*)txdataF[ap])[(re_offset<<1) + (2*txdataF_offset)] = ((int16_t *) &precodatatx_F)[0]; + ((int16_t*)txdataF[ap])[(re_offset<<1) + 1 + (2*txdataF_offset)] = ((int16_t *) &precodatatx_F)[1]; + #ifdef DEBUG_DLSCH_MAPPING + printf("antenna %d\t l %d \t k %d \t txdataF: %d %d\n", + ap, l, k, ((int16_t*)txdataF[ap])[(re_offset<<1) + (2*txdataF_offset)], + ((int16_t*)txdataF[ap])[(re_offset<<1) + 1 + (2*txdataF_offset)]); + #endif + if (++k >= frame_parms->ofdm_symbol_size) { + k -= frame_parms->ofdm_symbol_size; + } + } + } } } //RB loop } // symbol loop diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 57e841ad40..a9e0707c74 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -805,7 +805,7 @@ typedef struct PHY_VARS_gNB_s { uint32_t ****nr_gold_pdsch_dmrs; /// PDSCH codebook I precoding LUTs - int32_t **nr_mimo_precoding_matrix; + int32_t ***nr_mimo_precoding_matrix; /// PUSCH DMRS uint32_t ****nr_gold_pusch_dmrs; diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 51fdfc917e..accd5f7099 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -794,6 +794,7 @@ int main(int argc, char **argv) // rrc_mac_config_req_gNB gNB_mac->pre_processor_dl = nr_dlsim_preprocessor; phy_init_nr_gNB(gNB,0,1); + mac_init_codebook_gNB(gNB,gNB_mac); N_RB_DL = gNB->frame_parms.N_RB_DL; NR_UE_info_t *UE_info = &RC.nrmac[0]->UE_info; UE_info->num_UEs=1; diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index c4e9389f99..f5a97f1bf7 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -1156,7 +1156,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco csi_MeasConfig->csi_ReportConfigToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_ReportConfigToAddModList)); csi_MeasConfig->csi_ReportConfigToReleaseList = NULL; - if (do_csirs && dl_antenna_ports > 1) { + if (dl_antenna_ports > 1) {/*do_csirs&&*/ NR_CSI_ReportConfig_t *csirep1 = calloc(1,sizeof(*csirep1)); csirep1->reportConfigId=0; csirep1->carrier=NULL; @@ -1208,8 +1208,19 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_moreThanTwo; csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.moreThanTwo= calloc(1,sizeof(*csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.moreThanTwo)); + if(dl_antenna_ports == 4) csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.present= - NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_three_two_TypeI_SinglePanel_Restriction; + NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_one_TypeI_SinglePanel_Restriction; + else if(dl_antenna_ports == 8) + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.present= + NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_one_TypeI_SinglePanel_Restriction; + else if(dl_antenna_ports == 12) + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.present= + NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_one_TypeI_SinglePanel_Restriction; + else//default + csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.present= + NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_one_TypeI_SinglePanel_Restriction; + /*csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.choice.two_one_TypeI_SinglePanel_Restriction.size=1; csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.choice.two_one_TypeI_SinglePanel_Restriction.bits_unused=1; csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.choice.two_one_TypeI_SinglePanel_Restriction.buf=malloc(1); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf index 30194647b8..f93e97ed65 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf @@ -239,6 +239,8 @@ RUs = ( #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; ## beamforming 2x2 matrix: #bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + ## beamforming 2x4 matrix: + #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000]; ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; From 2242c6a8a9ece30e59203023834ad7ccceb7f27d Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 4 Oct 2021 19:10:38 +0200 Subject: [PATCH 03/67] cosmetic changes in codebook initialization --- executables/nr-gnb.c | 2 +- openair1/PHY/INIT/nr_init.c | 196 ++++++++++++++----------- openair1/PHY/INIT/phy_init.h | 3 + openair1/SIMULATION/NR_PHY/dlsim.c | 2 +- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 2 - 5 files changed, 118 insertions(+), 87 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index e2385c45c0..0a893993a4 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -508,7 +508,7 @@ void init_eNB_afterRU(void) { mac = RC.nrmac[gNB->UL_INFO.module_id]; phy_init_nr_gNB(gNB,0,0); - mac_init_codebook_gNB(gNB,mac); + init_codebook_gNB(gNB,mac); // map antennas and PRACH signals to gNB RX if (0) AssertFatal(gNB->num_RU>0,"Number of RU attached to gNB %d is zero\n",gNB->Mod_id); diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index f77526210d..98df74ca87 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -72,13 +72,13 @@ int l1_north_init_gNB() { return(0); } -int mac_init_codebook_gNB(PHY_VARS_gNB *gNB, - gNB_MAC_INST *mac) { +int init_codebook_gNB(PHY_VARS_gNB *gNB, + gNB_MAC_INST *mac) { //get RRC Codebook configuration struct NR_CSI_ReportConfig *csi_reportconfig = mac->UE_info.CellGroup[0]->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup->csi_ReportConfigToAddModList->list.array[0]; if(gNB->frame_parms.nb_antennas_tx>1){ - LOG_I(MAC,"NR mac_init_codebook_gNB: codebookType present %d\n",csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present); + LOG_D(PHY, "NR init_codebook_gNB: codebookType present %d\n",csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present); if(csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present==NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel) { int N1=1; int N2=1; @@ -92,7 +92,7 @@ int mac_init_codebook_gNB(PHY_VARS_gNB *gNB, // N2 . . . . ... . // X X X X ... X // |<-----N1---->| - LOG_I(MAC,"NR Codebook Config: codebookType, type1, subType_PR_typeI_SinglePanel\n"); + LOG_D(PHY, "NR Codebook Config: codebookType, type1, subType_PR_typeI_SinglePanel\n"); struct NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel *type1single = csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel; if (type1single->nrOfAntennaPorts.present == NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two) { N1=1; @@ -100,7 +100,7 @@ int mac_init_codebook_gNB(PHY_VARS_gNB *gNB, O1=1; O2=1; CSI_RS_antenna_ports=2; - LOG_I(MAC,"NR Codebook Config: antenna ports: %d\n",CSI_RS_antenna_ports); + LOG_D(PHY, "NR Codebook Config: antenna ports: %d\n",CSI_RS_antenna_ports); } else if(type1single->nrOfAntennaPorts.present == NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_moreThanTwo) { //Type 1 Single Panel : Based on 38.214 v15.3-Table 5.2.2.2.1-2: Supported configurations of (N1,N2) and (O1,O2) switch(type1single->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.present) { @@ -110,7 +110,7 @@ int mac_init_codebook_gNB(PHY_VARS_gNB *gNB, O1=4; O2=1; CSI_RS_antenna_ports=4; - LOG_I(MAC,"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_two_one\n",CSI_RS_antenna_ports); + LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_two_one\n",CSI_RS_antenna_ports); break; case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_two_TypeI_SinglePanel_Restriction: N1=2; @@ -118,7 +118,7 @@ int mac_init_codebook_gNB(PHY_VARS_gNB *gNB, O1=4; O2=4; CSI_RS_antenna_ports=8; - LOG_I(MAC,"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_two_two_TypeI\n",CSI_RS_antenna_ports); + LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_two_two_TypeI\n",CSI_RS_antenna_ports); break; case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_one_TypeI_SinglePanel_Restriction: N1=4; @@ -126,7 +126,7 @@ int mac_init_codebook_gNB(PHY_VARS_gNB *gNB, O1=4; O2=1; CSI_RS_antenna_ports=8; - LOG_I(MAC,"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_one\n",CSI_RS_antenna_ports); + LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_one\n",CSI_RS_antenna_ports); break; case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_three_two_TypeI_SinglePanel_Restriction: N1=3; @@ -134,7 +134,7 @@ int mac_init_codebook_gNB(PHY_VARS_gNB *gNB, O1=4; O2=4; CSI_RS_antenna_ports=12; - LOG_I(MAC,"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_three_two\n",CSI_RS_antenna_ports); + LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_three_two\n",CSI_RS_antenna_ports); break; case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_one_TypeI_SinglePanel_Restriction: N1=6; @@ -142,7 +142,7 @@ int mac_init_codebook_gNB(PHY_VARS_gNB *gNB, O1=4; O2=1; CSI_RS_antenna_ports=12; - LOG_I(MAC,"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_six_one\n",CSI_RS_antenna_ports); + LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_six_one\n",CSI_RS_antenna_ports); break; case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_two_TypeI_SinglePanel_Restriction: N1=4; @@ -150,7 +150,7 @@ int mac_init_codebook_gNB(PHY_VARS_gNB *gNB, O1=4; O2=4; CSI_RS_antenna_ports=16; - LOG_I(MAC,"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_two\n",CSI_RS_antenna_ports); + LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_two\n",CSI_RS_antenna_ports); break; case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_eight_one_TypeI_SinglePanel_Restriction: N1=8; @@ -158,7 +158,7 @@ int mac_init_codebook_gNB(PHY_VARS_gNB *gNB, O1=4; O2=1; CSI_RS_antenna_ports=16; - LOG_I(MAC,"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_eight_one\n",CSI_RS_antenna_ports); + LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_eight_one\n",CSI_RS_antenna_ports); break; case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_three_TypeI_SinglePanel_Restriction: N1=4; @@ -166,7 +166,7 @@ int mac_init_codebook_gNB(PHY_VARS_gNB *gNB, O1=4; O2=4; CSI_RS_antenna_ports=24; - LOG_I(MAC,"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_three\n",CSI_RS_antenna_ports); + LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_three\n",CSI_RS_antenna_ports); break; case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_two_TypeI_SinglePanel_Restriction: N1=6; @@ -174,7 +174,7 @@ int mac_init_codebook_gNB(PHY_VARS_gNB *gNB, O1=4; O2=4; CSI_RS_antenna_ports=24; - LOG_I(MAC,"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_six_two\n",CSI_RS_antenna_ports); + LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_six_two\n",CSI_RS_antenna_ports); break; case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_twelve_one_TypeI_SinglePanel_Restriction: N1=12; @@ -182,7 +182,7 @@ int mac_init_codebook_gNB(PHY_VARS_gNB *gNB, O1=4; O2=1; CSI_RS_antenna_ports=24; - LOG_I(MAC,"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_twelve_one\n",CSI_RS_antenna_ports); + LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_twelve_one\n",CSI_RS_antenna_ports); break; case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_four_TypeI_SinglePanel_Restriction: N1=4; @@ -190,7 +190,7 @@ int mac_init_codebook_gNB(PHY_VARS_gNB *gNB, O1=4; O2=4; CSI_RS_antenna_ports=32; - LOG_I(MAC,"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_four\n",CSI_RS_antenna_ports); + LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_four\n",CSI_RS_antenna_ports); break; case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_eight_two_TypeI_SinglePanel_Restriction: N1=8; @@ -198,7 +198,7 @@ int mac_init_codebook_gNB(PHY_VARS_gNB *gNB, O1=4; O2=4; CSI_RS_antenna_ports=32; - LOG_I(MAC,"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_eight_two\n",CSI_RS_antenna_ports); + LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_eight_two\n",CSI_RS_antenna_ports); break; case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_sixteen_one_TypeI_SinglePanel_Restriction: N1=16; @@ -206,7 +206,7 @@ int mac_init_codebook_gNB(PHY_VARS_gNB *gNB, O1=4; O2=1; CSI_RS_antenna_ports=32; - LOG_I(MAC,"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_sixteen_one\n",CSI_RS_antenna_ports); + LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_sixteen_one\n",CSI_RS_antenna_ports); break; default: N1=1; @@ -214,7 +214,7 @@ int mac_init_codebook_gNB(PHY_VARS_gNB *gNB, O1=1; O2=1; CSI_RS_antenna_ports=2; - LOG_I(MAC,"NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2 %d\n",CSI_RS_antenna_ports,type1single->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.present); + LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2 %d\n",CSI_RS_antenna_ports,type1single->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.present); break; } } @@ -224,38 +224,43 @@ int mac_init_codebook_gNB(PHY_VARS_gNB *gNB, //Generate DFT vertical beams //ll: index of a vertical beams vector (represented by i1_1 in TS 38.214) double complex v[N1*O1][N1]; - for (int ll=0; llnr_mimo_precoding_matrix = (int32_t ***)malloc16(4* sizeof(int32_t **)); int32_t ***mat = gNB->nr_mimo_precoding_matrix; @@ -268,17 +273,20 @@ int mac_init_codebook_gNB(PHY_VARS_gNB *gNB, //pmi=0 corresponds to unit matrix mat[0][0] = (int32_t *)calloc(2*N1*N2,sizeof(int32_t)); - for(int j_col=0; j_col<1; j_col++)//1 layer - for (int i_rows=0; i_rows<2*N1*N2; i_rows++)//2-x polarized antenna - if(j_col==i_rows) + for(int j_col=0; j_col<1; j_col++) { //1 layer + for (int i_rows=0; i_rows<2*N1*N2; i_rows++) { //2-x polarized antenna + if(j_col==i_rows) { ((short*) &mat[0][0][i_rows+j_col])[0] = 32768; + } + } + } - for(int ll=0; ll0) @@ -289,7 +297,7 @@ int mac_init_codebook_gNB(PHY_VARS_gNB *gNB, ((short*) &mat[0][pmiq][len])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 else ((short*) &mat[0][pmiq][len])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_I(MAC, "1 Layer Precoding Matrix[0][pmi %d][antPort %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq, len, creal(res_code), cimag(res_code),((short*) &mat[0][pmiq][len])[0],((short*) &mat[0][pmiq][len])[1]); + LOG_D(PHY, "1 Layer Precoding Matrix[0][pmi %d][antPort %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq, len, creal(res_code), cimag(res_code),((short*) &mat[0][pmiq][len])[0],((short*) &mat[0][pmiq][len])[1]); } for(int len=N1*N2; len<2*N1*N2; len++) { @@ -303,9 +311,11 @@ int mac_init_codebook_gNB(PHY_VARS_gNB *gNB, else ((short*) &mat[0][pmiq][len])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_I(MAC, "1 Layer Precoding Matrix[0][pmi %d][antPort %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq, len, creal(res_code), cimag(res_code),((short*) &mat[0][pmiq][len])[0],((short*) &mat[0][pmiq][len])[1]); + LOG_D(PHY, "1 Layer Precoding Matrix[0][pmi %d][antPort %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq, len, creal(res_code), cimag(res_code),((short*) &mat[0][pmiq][len])[0],((short*) &mat[0][pmiq][len])[1]); } } + } + } int llc; int mmc; @@ -317,20 +327,23 @@ int mac_init_codebook_gNB(PHY_VARS_gNB *gNB, //pmi=0 corresponds to unit matrix mat[1][0] = (int32_t *)calloc((2*N1*N2)*(2),sizeof(int32_t)); - for(int j_col=0; j_col<2; j_col++)//2 layers - for (int i_rows=0; i_rows<2*N1*N2; i_rows++)//2-x polarized antenna - if(j_col==i_rows) + for(int j_col=0; j_col<2; j_col++) { //2 layers + for (int i_rows=0; i_rows<2*N1*N2; i_rows++) { //2-x polarized antenna + if(j_col==i_rows) { ((short*) &mat[1][0][i_rows*2+j_col])[0] = 32768; + } + } + } //pmi=1,...,pmi_size are computed as follows - for(int llb=0; llb0) ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 else ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_I(MAC, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[1][pmiq][i_rows*2+j_col])[0],((short*) &mat[1][pmiq][i_rows*2+j_col])[1]); + LOG_D(PHY, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[1][pmiq][i_rows*2+j_col])[0],((short*) &mat[1][pmiq][i_rows*2+j_col])[1]); } for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { res_code=sqrt(1/(double)(2*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; @@ -367,33 +379,40 @@ int mac_init_codebook_gNB(PHY_VARS_gNB *gNB, else ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_I(MAC, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[1][pmiq][i_rows*2+j_col])[0],((short*) &mat[1][pmiq][i_rows*2+j_col])[1]); + LOG_D(PHY, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[1][pmiq][i_rows*2+j_col])[0],((short*) &mat[1][pmiq][i_rows*2+j_col])[1]); } } } + } + } + } + } //Table 5.2.2.2.1-7: //Codebook for 3-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS - if(CSI_RS_antenna_ports>=3){ + if(CSI_RS_antenna_ports>=3) { pmiq_size = N1*O1*N2*O2*N1*O1*N2*O2*2+1; mat[2] = (int32_t **)malloc16(pmiq_size*sizeof(int32_t *)); //pmi=0 corresponds to unit matrix mat[2][0] = (int32_t *)calloc((2*N1*N2)*(3),sizeof(int32_t)); - for(int j_col=0; j_col<3; j_col++)//3 layers - for (int i_rows=0; i_rows<2*N1*N2; i_rows++)//2-x polarized antenna - if(j_col==i_rows) + for(int j_col=0; j_col<3; j_col++) { //3 layers + for (int i_rows=0; i_rows<2*N1*N2; i_rows++) { //2-x polarized antenna + if(j_col==i_rows) { ((short*) &mat[2][0][i_rows*3+j_col])[0] = 32768; + } + } + } //pmi=1,...,pmi_size are computed as follows - for(int llb=0; llb0) ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 else ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_D(MAC, "3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[2][pmiq][i_rows*3+j_col])[0],((short*) &mat[2][pmiq][i_rows*3+j_col])[1]); + LOG_D(PHY, "3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[2][pmiq][i_rows*3+j_col])[0],((short*) &mat[2][pmiq][i_rows*3+j_col])[1]); } for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { res_code=sqrt(1/(double)(3*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; @@ -435,34 +453,41 @@ int mac_init_codebook_gNB(PHY_VARS_gNB *gNB, else ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_D(MAC, "3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[2][pmiq][i_rows*3+j_col])[0],((short*) &mat[2][pmiq][i_rows*3+j_col])[1]); + LOG_D(PHY, "3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[2][pmiq][i_rows*3+j_col])[0],((short*) &mat[2][pmiq][i_rows*3+j_col])[1]); } } } + } + } + } + } } + //Table 5.2.2.2.1-8: //Codebook for 4-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS - - if(CSI_RS_antenna_ports>=4){ + if(CSI_RS_antenna_ports>=4) { pmiq_size = N1*O1*N2*O2*N1*O1*N2*O2*2+1; mat[3] = (int32_t **)malloc16(pmiq_size*sizeof(int32_t *)); //pmi=0 corresponds to unit matrix mat[3][0] = (int32_t *)calloc((2*N1*N2)*(4),sizeof(int32_t)); - for(int j_col=0; j_col<4; j_col++)//4 layers - for (int i_rows=0; i_rows<2*N1*N2; i_rows++)//2-x polarized antenna - if(j_col==i_rows) + for(int j_col=0; j_col<4; j_col++) { //4 layers + for (int i_rows=0; i_rows<2*N1*N2; i_rows++) { //2-x polarized antenna + if(j_col==i_rows) { ((short*) &mat[3][0][i_rows*4+j_col])[0] = 32768; + } + } + } //pmi=1,...,pmi_size are computed as follows - for(int llb=0; llb0) - ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q1else - ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_D(MAC, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); + LOG_D(PHY, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); } for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { @@ -508,20 +534,24 @@ int mac_init_codebook_gNB(PHY_VARS_gNB *gNB, else ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_D(MAC, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); + LOG_D(PHY, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); } } } + } + } + } + } } } } else {//codebookMode 2 - LOG_I(MAC,"CodeBook Type 1, CodebookMode %ld is not supported\n",csi_reportconfig->codebookConfig->codebookType.choice.type1->codebookMode); + AssertFatal(1==0, "CodeBook Type 1, CodebookMode %ld is not supported\n",csi_reportconfig->codebookConfig->codebookType.choice.type1->codebookMode); } } else { - LOG_I(MAC,"subType_PR_typeI %d is not supported\n",csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present); + AssertFatal(1==0, "subType_PR_typeI %d is not supported\n",csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present); } } - return (0); + return 0; } int phy_init_nr_gNB(PHY_VARS_gNB *gNB, diff --git a/openair1/PHY/INIT/phy_init.h b/openair1/PHY/INIT/phy_init.h index dd9232de83..94c0d22a4e 100644 --- a/openair1/PHY/INIT/phy_init.h +++ b/openair1/PHY/INIT/phy_init.h @@ -37,6 +37,8 @@ #include "LTE_SCellToAddMod-r10.h" #include "LTE_NonMBSFN-SubframeConfig-r14.h" +typedef struct gNB_MAC_INST_s gNB_MAC_INST; + /** @addtogroup _PHY_STRUCTURES_ * @{ */ @@ -400,6 +402,7 @@ void init_nr_ue_transport(PHY_VARS_NR_UE *ue,int abstraction_flag); void init_N_TA_offset(PHY_VARS_NR_UE *ue); void nr_dump_frame_parms(NR_DL_FRAME_PARMS *frame_parms); int phy_init_nr_gNB(PHY_VARS_gNB *gNB, unsigned char is_secondary_gNB, unsigned char lowmem_flag); +int init_codebook_gNB(PHY_VARS_gNB *gNB, gNB_MAC_INST *mac); void nr_phy_config_request(NR_PHY_Config_t *gNB); void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,int N_RB_DL,int N_RB_UL,int mu,int Nid_cell,uint64_t position_in_burst); void phy_free_nr_gNB(PHY_VARS_gNB *gNB); diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index accd5f7099..d05ffc9abe 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -794,7 +794,7 @@ int main(int argc, char **argv) // rrc_mac_config_req_gNB gNB_mac->pre_processor_dl = nr_dlsim_preprocessor; phy_init_nr_gNB(gNB,0,1); - mac_init_codebook_gNB(gNB,gNB_mac); + init_codebook_gNB(gNB,gNB_mac); N_RB_DL = gNB->frame_parms.N_RB_DL; NR_UE_info_t *UE_info = &RC.nrmac[0]->UE_info; UE_info->num_UEs=1; diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index e7715bec14..62d70f4f2c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -38,8 +38,6 @@ void set_cset_offset(uint16_t); void mac_top_init_gNB(void); -int mac_init_codebook_gNB(PHY_VARS_gNB *gNB, gNB_MAC_INST *mac); - void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts, From a778f69a7642e4e6dfc5a02dc2cda27662f485a9 Mon Sep 17 00:00:00 2001 From: sfn Date: Thu, 9 Dec 2021 10:36:01 +0100 Subject: [PATCH 04/67] Remove dependency of init_codebook_gNB on mac parameters --- executables/nr-gnb.c | 3 +- openair1/PHY/INIT/nr_init.c | 861 ++++++++++++++--------------- openair1/PHY/INIT/nr_parms.c | 9 + openair1/PHY/INIT/phy_init.h | 2 +- openair1/PHY/defs_nr_common.h | 6 +- openair1/SIMULATION/NR_PHY/dlsim.c | 2 +- 6 files changed, 438 insertions(+), 445 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index 0a893993a4..9e3c650f6e 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -505,10 +505,9 @@ void init_eNB_afterRU(void) { for (inst=0; instUL_INFO.module_id]; phy_init_nr_gNB(gNB,0,0); - init_codebook_gNB(gNB,mac); + init_codebook_gNB(gNB); // map antennas and PRACH signals to gNB RX if (0) AssertFatal(gNB->num_RU>0,"Number of RU attached to gNB %d is zero\n",gNB->Mod_id); diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 98df74ca87..1e825226af 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -72,471 +72,456 @@ int l1_north_init_gNB() { return(0); } -int init_codebook_gNB(PHY_VARS_gNB *gNB, - gNB_MAC_INST *mac) { - //get RRC Codebook configuration - struct NR_CSI_ReportConfig *csi_reportconfig = mac->UE_info.CellGroup[0]->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup->csi_ReportConfigToAddModList->list.array[0]; +int init_codebook_gNB(PHY_VARS_gNB *gNB) { if(gNB->frame_parms.nb_antennas_tx>1){ - LOG_D(PHY, "NR init_codebook_gNB: codebookType present %d\n",csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present); - if(csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present==NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel) { - int N1=1; - int N2=1; - int O1=0; - int O2=0; - int CSI_RS_antenna_ports=1; + //NR Codebook Generation for codebook type1 SinglePanel + //csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present + int N1; + int N2; + int O1; + int O2; + int CSI_RS_antenna_ports; + //Uniform Planner Array: UPA + // X X X X ... X + // X X X X ... X + // N2 . . . . ... . + // X X X X ... X + // |<-----N1---->| + if (gNB->frame_parms.nb_antennas_tx == 2) {//nrOfAntennaPorts = two + N1=1; + N2=1; + O1=1; + O2=1; + CSI_RS_antenna_ports=2; + LOG_D(PHY, "NR Codebook Config: antenna ports: %d\n",CSI_RS_antenna_ports); + } else if(gNB->frame_parms.nb_antennas_tx > 2) {//nrOfAntennaPorts moreThanTwo + //Type 1 Single Panel : Based on 38.214 v15.3-Table 5.2.2.2.1-2: Supported configurations of (N1,N2) and (O1,O2) + switch(gNB->frame_parms.antennas_tx_n1_n2) { + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_one_TypeI_SinglePanel_Restriction: + N1=2; + N2=1; + O1=4; + O2=1; + CSI_RS_antenna_ports=4; + LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_two_one\n",CSI_RS_antenna_ports); + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_two_TypeI_SinglePanel_Restriction: + N1=2; + N2=2; + O1=4; + O2=4; + CSI_RS_antenna_ports=8; + LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_two_two_TypeI\n",CSI_RS_antenna_ports); + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_one_TypeI_SinglePanel_Restriction: + N1=4; + N2=1; + O1=4; + O2=1; + CSI_RS_antenna_ports=8; + LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_one\n",CSI_RS_antenna_ports); + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_three_two_TypeI_SinglePanel_Restriction: + N1=3; + N2=2; + O1=4; + O2=4; + CSI_RS_antenna_ports=12; + LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_three_two\n",CSI_RS_antenna_ports); + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_one_TypeI_SinglePanel_Restriction: + N1=6; + N2=1; + O1=4; + O2=1; + CSI_RS_antenna_ports=12; + LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_six_one\n",CSI_RS_antenna_ports); + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_two_TypeI_SinglePanel_Restriction: + N1=4; + N2=2; + O1=4; + O2=4; + CSI_RS_antenna_ports=16; + LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_two\n",CSI_RS_antenna_ports); + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_eight_one_TypeI_SinglePanel_Restriction: + N1=8; + N2=1; + O1=4; + O2=1; + CSI_RS_antenna_ports=16; + LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_eight_one\n",CSI_RS_antenna_ports); + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_three_TypeI_SinglePanel_Restriction: + N1=4; + N2=3; + O1=4; + O2=4; + CSI_RS_antenna_ports=24; + LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_three\n",CSI_RS_antenna_ports); + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_two_TypeI_SinglePanel_Restriction: + N1=6; + N2=2; + O1=4; + O2=4; + CSI_RS_antenna_ports=24; + LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_six_two\n",CSI_RS_antenna_ports); + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_twelve_one_TypeI_SinglePanel_Restriction: + N1=12; + N2=1; + O1=4; + O2=1; + CSI_RS_antenna_ports=24; + LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_twelve_one\n",CSI_RS_antenna_ports); + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_four_TypeI_SinglePanel_Restriction: + N1=4; + N2=4; + O1=4; + O2=4; + CSI_RS_antenna_ports=32; + LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_four\n",CSI_RS_antenna_ports); + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_eight_two_TypeI_SinglePanel_Restriction: + N1=8; + N2=2; + O1=4; + O2=4; + CSI_RS_antenna_ports=32; + LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_eight_two\n",CSI_RS_antenna_ports); + break; + case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_sixteen_one_TypeI_SinglePanel_Restriction: + N1=16; + N2=1; + O1=4; + O2=1; + CSI_RS_antenna_ports=32; + LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_sixteen_one\n",CSI_RS_antenna_ports); + break; + default: + N1=1; + N2=1; + O1=1; + O2=1; + CSI_RS_antenna_ports=2; + LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d \n",CSI_RS_antenna_ports); + break; + } + } - //Uniform Planner Array: UPA - // X X X X ... X - // X X X X ... X - // N2 . . . . ... . - // X X X X ... X - // |<-----N1---->| - LOG_D(PHY, "NR Codebook Config: codebookType, type1, subType_PR_typeI_SinglePanel\n"); - struct NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel *type1single = csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel; - if (type1single->nrOfAntennaPorts.present == NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two) { - N1=1; - N2=1; - O1=1; - O2=1; - CSI_RS_antenna_ports=2; - LOG_D(PHY, "NR Codebook Config: antenna ports: %d\n",CSI_RS_antenna_ports); - } else if(type1single->nrOfAntennaPorts.present == NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_moreThanTwo) { - //Type 1 Single Panel : Based on 38.214 v15.3-Table 5.2.2.2.1-2: Supported configurations of (N1,N2) and (O1,O2) - switch(type1single->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.present) { - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_one_TypeI_SinglePanel_Restriction: - N1=2; - N2=1; - O1=4; - O2=1; - CSI_RS_antenna_ports=4; - LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_two_one\n",CSI_RS_antenna_ports); - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_two_TypeI_SinglePanel_Restriction: - N1=2; - N2=2; - O1=4; - O2=4; - CSI_RS_antenna_ports=8; - LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_two_two_TypeI\n",CSI_RS_antenna_ports); - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_one_TypeI_SinglePanel_Restriction: - N1=4; - N2=1; - O1=4; - O2=1; - CSI_RS_antenna_ports=8; - LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_one\n",CSI_RS_antenna_ports); - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_three_two_TypeI_SinglePanel_Restriction: - N1=3; - N2=2; - O1=4; - O2=4; - CSI_RS_antenna_ports=12; - LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_three_two\n",CSI_RS_antenna_ports); - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_one_TypeI_SinglePanel_Restriction: - N1=6; - N2=1; - O1=4; - O2=1; - CSI_RS_antenna_ports=12; - LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_six_one\n",CSI_RS_antenna_ports); - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_two_TypeI_SinglePanel_Restriction: - N1=4; - N2=2; - O1=4; - O2=4; - CSI_RS_antenna_ports=16; - LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_two\n",CSI_RS_antenna_ports); - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_eight_one_TypeI_SinglePanel_Restriction: - N1=8; - N2=1; - O1=4; - O2=1; - CSI_RS_antenna_ports=16; - LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_eight_one\n",CSI_RS_antenna_ports); - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_three_TypeI_SinglePanel_Restriction: - N1=4; - N2=3; - O1=4; - O2=4; - CSI_RS_antenna_ports=24; - LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_three\n",CSI_RS_antenna_ports); - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_two_TypeI_SinglePanel_Restriction: - N1=6; - N2=2; - O1=4; - O2=4; - CSI_RS_antenna_ports=24; - LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_six_two\n",CSI_RS_antenna_ports); - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_twelve_one_TypeI_SinglePanel_Restriction: - N1=12; - N2=1; - O1=4; - O2=1; - CSI_RS_antenna_ports=24; - LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_twelve_one\n",CSI_RS_antenna_ports); - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_four_TypeI_SinglePanel_Restriction: - N1=4; - N2=4; - O1=4; - O2=4; - CSI_RS_antenna_ports=32; - LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_four\n",CSI_RS_antenna_ports); - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_eight_two_TypeI_SinglePanel_Restriction: - N1=8; - N2=2; - O1=4; - O2=4; - CSI_RS_antenna_ports=32; - LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_eight_two\n",CSI_RS_antenna_ports); - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_sixteen_one_TypeI_SinglePanel_Restriction: - N1=16; - N2=1; - O1=4; - O2=1; - CSI_RS_antenna_ports=32; - LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_sixteen_one\n",CSI_RS_antenna_ports); - break; - default: - N1=1; - N2=1; - O1=1; - O2=1; - CSI_RS_antenna_ports=2; - LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2 %d\n",CSI_RS_antenna_ports,type1single->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.present); - break; + // Generation of codebook Type1 with codebookMode 1 (CSI_RS_antenna_ports < 16) + if (CSI_RS_antenna_ports < 16) { + //Generate DFT vertical beams + //ll: index of a vertical beams vector (represented by i1_1 in TS 38.214) + double complex v[N1*O1][N1]; + for (int ll=0; llcodebookConfig->codebookType.choice.type1->codebookMode==1){ - if (CSI_RS_antenna_ports < 16) { - //Generate DFT vertical beams - //ll: index of a vertical beams vector (represented by i1_1 in TS 38.214) - double complex v[N1*O1][N1]; - for (int ll=0; llnr_mimo_precoding_matrix = (int32_t ***)malloc16(4* sizeof(int32_t **)); + int32_t ***mat = gNB->nr_mimo_precoding_matrix; + double complex res_code; + + //Table 5.2.2.2.1-5: + //Codebook for 1-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS + int pmiq_size = N1*O1*N2*O2*4+1; + mat[0] = (int32_t **)malloc16(pmiq_size*sizeof(int32_t *)); + + //pmi=0 corresponds to unit matrix + mat[0][0] = (int32_t *)calloc(2*N1*N2,sizeof(int32_t)); + for(int j_col=0; j_col<1; j_col++) { //1 layer + for (int i_rows=0; i_rows<2*N1*N2; i_rows++) { //2-x polarized antenna + if(j_col==i_rows) { + ((short*) &mat[0][0][i_rows+j_col])[0] = 32768; + } + } + } + + for(int ll=0; ll0) + ((short*) &mat[0][pmiq][len])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[0][pmiq][len])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[0][pmiq][len])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[0][pmiq][len])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + LOG_D(PHY, "1 Layer Precoding Matrix[0][pmi %d][antPort %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq, len, creal(res_code), cimag(res_code),((short*) &mat[0][pmiq][len])[0],((short*) &mat[0][pmiq][len])[1]); + } + + for(int len=N1*N2; len<2*N1*N2; len++) { + res_code=sqrt(1/(double)CSI_RS_antenna_ports)*theta_n[nn]*v_lm[ll][mm][len-N1*N2]; + if (creal(res_code)>0) + ((short*) &mat[0][pmiq][len])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[0][pmiq][len])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[0][pmiq][len])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[0][pmiq][len])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + LOG_D(PHY, "1 Layer Precoding Matrix[0][pmi %d][antPort %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq, len, creal(res_code), cimag(res_code),((short*) &mat[0][pmiq][len])[0],((short*) &mat[0][pmiq][len])[1]); + } } - //Kronecker product v_lm - double complex v_lm[N1*O1][N2*O2][N2*N1]; - //v_ll_mm_codebook denotes the elements of a precoding matrix W_i1,1_i_1,2 + } + } + + int llc; + int mmc; + double complex phase_sign; + //Table 5.2.2.2.1-6: + //Codebook for 2-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS + pmiq_size = N1*O1*N2*O2*N1*O1*N2*O2*2+1; + mat[1] = (int32_t **)malloc16(pmiq_size*sizeof(int32_t *)); + + //pmi=0 corresponds to unit matrix + mat[1][0] = (int32_t *)calloc((2*N1*N2)*(2),sizeof(int32_t)); + for(int j_col=0; j_col<2; j_col++) { //2 layers + for (int i_rows=0; i_rows<2*N1*N2; i_rows++) { //2-x polarized antenna + if(j_col==i_rows) { + ((short*) &mat[1][0][i_rows*2+j_col])[0] = 32768; + } + } + } + + //pmi=1,...,pmi_size are computed as follows + for(int llb=0; llbnr_mimo_precoding_matrix = (int32_t ***)malloc16(4* sizeof(int32_t **)); - int32_t ***mat = gNB->nr_mimo_precoding_matrix; - double complex res_code; - - //Table 5.2.2.2.1-5: - //Codebook for 1-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS - int pmiq_size = N1*O1*N2*O2*4+1; - mat[0] = (int32_t **)malloc16(pmiq_size*sizeof(int32_t *)); - - //pmi=0 corresponds to unit matrix - mat[0][0] = (int32_t *)calloc(2*N1*N2,sizeof(int32_t)); - for(int j_col=0; j_col<1; j_col++) { //1 layer - for (int i_rows=0; i_rows<2*N1*N2; i_rows++) { //2-x polarized antenna - if(j_col==i_rows) { - ((short*) &mat[0][0][i_rows+j_col])[0] = 32768; - } - } - } - - for(int ll=0; ll0) - ((short*) &mat[0][pmiq][len])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[0][pmiq][len])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[0][pmiq][len])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[0][pmiq][len])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_D(PHY, "1 Layer Precoding Matrix[0][pmi %d][antPort %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq, len, creal(res_code), cimag(res_code),((short*) &mat[0][pmiq][len])[0],((short*) &mat[0][pmiq][len])[1]); - } - - for(int len=N1*N2; len<2*N1*N2; len++) { - res_code=sqrt(1/(double)CSI_RS_antenna_ports)*theta_n[nn]*v_lm[ll][mm][len-N1*N2]; - if (creal(res_code)>0) - ((short*) &mat[0][pmiq][len])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[0][pmiq][len])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[0][pmiq][len])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[0][pmiq][len])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - - LOG_D(PHY, "1 Layer Precoding Matrix[0][pmi %d][antPort %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq, len, creal(res_code), cimag(res_code),((short*) &mat[0][pmiq][len])[0],((short*) &mat[0][pmiq][len])[1]); - } - } - } - } - - int llc; - int mmc; - double complex phase_sign; - //Table 5.2.2.2.1-6: - //Codebook for 2-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS - pmiq_size = N1*O1*N2*O2*N1*O1*N2*O2*2+1; - mat[1] = (int32_t **)malloc16(pmiq_size*sizeof(int32_t *)); - - //pmi=0 corresponds to unit matrix - mat[1][0] = (int32_t *)calloc((2*N1*N2)*(2),sizeof(int32_t)); - for(int j_col=0; j_col<2; j_col++) { //2 layers - for (int i_rows=0; i_rows<2*N1*N2; i_rows++) { //2-x polarized antenna - if(j_col==i_rows) { - ((short*) &mat[1][0][i_rows*2+j_col])[0] = 32768; - } - } - } - - //pmi=1,...,pmi_size are computed as follows - for(int llb=0; llb0) - ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - - LOG_D(PHY, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[1][pmiq][i_rows*2+j_col])[0],((short*) &mat[1][pmiq][i_rows*2+j_col])[1]); - } - for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { - res_code=sqrt(1/(double)(2*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; - if (creal(res_code)>0) - ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - - LOG_D(PHY, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[1][pmiq][i_rows*2+j_col])[0],((short*) &mat[1][pmiq][i_rows*2+j_col])[1]); - } - } + for (int nn=0; nn<2; nn++) { + int pmiq = 1+llb*N2*O2*N1*O1*N2*O2*2+mmb*N1*O1*N2*O2*2+ll*N2*O2*2+mm*2+nn; + mat[1][pmiq] = (int32_t *)malloc16((2*N1*N2)*(2)*sizeof(int32_t)); + LOG_D(PHY, "layer 2 Codebook pmiq = %d\n",pmiq); + for(int j_col=0; j_col<2; j_col++) { + if (j_col==0) { + llc = llb; + mmc = mmb; + phase_sign = 1; + } + if (j_col==1) { + llc = ll; + mmc = mm; + phase_sign = -1; + } + for (int i_rows=0; i_rows0) + ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + LOG_D(PHY, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[1][pmiq][i_rows*2+j_col])[0],((short*) &mat[1][pmiq][i_rows*2+j_col])[1]); + } + for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { + res_code=sqrt(1/(double)(2*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; + if (creal(res_code)>0) + ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + LOG_D(PHY, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[1][pmiq][i_rows*2+j_col])[0],((short*) &mat[1][pmiq][i_rows*2+j_col])[1]); } } } } } + } + } - //Table 5.2.2.2.1-7: - //Codebook for 3-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS - if(CSI_RS_antenna_ports>=3) { - pmiq_size = N1*O1*N2*O2*N1*O1*N2*O2*2+1; - mat[2] = (int32_t **)malloc16(pmiq_size*sizeof(int32_t *)); + //Table 5.2.2.2.1-7: + //Codebook for 3-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS + if(CSI_RS_antenna_ports>=3) { + pmiq_size = N1*O1*N2*O2*N1*O1*N2*O2*2+1; + mat[2] = (int32_t **)malloc16(pmiq_size*sizeof(int32_t *)); - //pmi=0 corresponds to unit matrix - mat[2][0] = (int32_t *)calloc((2*N1*N2)*(3),sizeof(int32_t)); - for(int j_col=0; j_col<3; j_col++) { //3 layers - for (int i_rows=0; i_rows<2*N1*N2; i_rows++) { //2-x polarized antenna - if(j_col==i_rows) { - ((short*) &mat[2][0][i_rows*3+j_col])[0] = 32768; - } - } - } - - //pmi=1,...,pmi_size are computed as follows - for(int llb=0; llb0) - ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - - LOG_D(PHY, "3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[2][pmiq][i_rows*3+j_col])[0],((short*) &mat[2][pmiq][i_rows*3+j_col])[1]); - } - for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { - res_code=sqrt(1/(double)(3*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; - if (creal(res_code)>0) - ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - - LOG_D(PHY, "3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[2][pmiq][i_rows*3+j_col])[0],((short*) &mat[2][pmiq][i_rows*3+j_col])[1]); - } - } - } - } - } - } + //pmi=0 corresponds to unit matrix + mat[2][0] = (int32_t *)calloc((2*N1*N2)*(3),sizeof(int32_t)); + for(int j_col=0; j_col<3; j_col++) { //3 layers + for (int i_rows=0; i_rows<2*N1*N2; i_rows++) { //2-x polarized antenna + if(j_col==i_rows) { + ((short*) &mat[2][0][i_rows*3+j_col])[0] = 32768; } } + } - //Table 5.2.2.2.1-8: - //Codebook for 4-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS - if(CSI_RS_antenna_ports>=4) { - pmiq_size = N1*O1*N2*O2*N1*O1*N2*O2*2+1; - mat[3] = (int32_t **)malloc16(pmiq_size*sizeof(int32_t *)); - - //pmi=0 corresponds to unit matrix - mat[3][0] = (int32_t *)calloc((2*N1*N2)*(4),sizeof(int32_t)); - for(int j_col=0; j_col<4; j_col++) { //4 layers - for (int i_rows=0; i_rows<2*N1*N2; i_rows++) { //2-x polarized antenna - if(j_col==i_rows) { - ((short*) &mat[3][0][i_rows*4+j_col])[0] = 32768; + //pmi=1,...,pmi_size are computed as follows + for(int llb=0; llb0) + ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + LOG_D(PHY, "3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[2][pmiq][i_rows*3+j_col])[0],((short*) &mat[2][pmiq][i_rows*3+j_col])[1]); + } + for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { + res_code=sqrt(1/(double)(3*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; + if (creal(res_code)>0) + ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + LOG_D(PHY, "3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[2][pmiq][i_rows*3+j_col])[0],((short*) &mat[2][pmiq][i_rows*3+j_col])[1]); + } + } } } } + } + } + } - //pmi=1,...,pmi_size are computed as follows - for(int llb=0; llb0) - ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + //Table 5.2.2.2.1-8: + //Codebook for 4-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS + if(CSI_RS_antenna_ports>=4) { + pmiq_size = N1*O1*N2*O2*N1*O1*N2*O2*2+1; + mat[3] = (int32_t **)malloc16(pmiq_size*sizeof(int32_t *)); - LOG_D(PHY, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); - } + //pmi=0 corresponds to unit matrix + mat[3][0] = (int32_t *)calloc((2*N1*N2)*(4),sizeof(int32_t)); + for(int j_col=0; j_col<4; j_col++) { //4 layers + for (int i_rows=0; i_rows<2*N1*N2; i_rows++) { //2-x polarized antenna + if(j_col==i_rows) { + ((short*) &mat[3][0][i_rows*4+j_col])[0] = 32768; + } + } + } - for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { - res_code=sqrt(1/(double)(4*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; - if (creal(res_code)>0) - ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + //pmi=1,...,pmi_size are computed as follows + for(int llb=0; llb0) + ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + LOG_D(PHY, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); + } - LOG_D(PHY, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); - } - } + for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { + res_code=sqrt(1/(double)(4*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; + if (creal(res_code)>0) + ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + LOG_D(PHY, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); } } } @@ -544,11 +529,7 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB, } } } - } else {//codebookMode 2 - AssertFatal(1==0, "CodeBook Type 1, CodebookMode %ld is not supported\n",csi_reportconfig->codebookConfig->codebookType.choice.type1->codebookMode); } - } else { - AssertFatal(1==0, "subType_PR_typeI %d is not supported\n",csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present); } } return 0; diff --git a/openair1/PHY/INIT/nr_parms.c b/openair1/PHY/INIT/nr_parms.c index 42d4a30e3b..62da208f3d 100644 --- a/openair1/PHY/INIT/nr_parms.c +++ b/openair1/PHY/INIT/nr_parms.c @@ -269,6 +269,15 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg, fp->nb_antennas_rx = cfg->carrier_config.num_rx_ant.value; // It denotes the number of rx antennas at gNB fp->nb_antennas_tx = cfg->carrier_config.num_tx_ant.value; // It corresponds to pdsch_AntennaPorts (logical antenna ports) + //RRC Parameters: depends on the physical structure of the gNB Uniform planner array + if (fp->nb_antennas_tx == 4) + fp->antennas_tx_n1_n2 = 1;//NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_one_TypeI_SinglePanel_Restriction; + else if (fp->nb_antennas_tx == 8) + fp->antennas_tx_n1_n2 = 3;//NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_one_TypeI_SinglePanel_Restriction; + else if (fp->nb_antennas_tx == 12) + fp->antennas_tx_n1_n2 = 5;//NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_one_TypeI_SinglePanel_Restriction; + else//We currently support codebook 1 for nrOfAntennaPorts < 16 + fp->antennas_tx_n1_n2 = 0;//NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_NOTHING; fp->symbols_per_slot = ((Ncp == NORMAL)? 14 : 12); // to redefine for different slot formats fp->samples_per_subframe_wCP = fp->ofdm_symbol_size * fp->symbols_per_slot * fp->slots_per_subframe; diff --git a/openair1/PHY/INIT/phy_init.h b/openair1/PHY/INIT/phy_init.h index 94c0d22a4e..e45f40da42 100644 --- a/openair1/PHY/INIT/phy_init.h +++ b/openair1/PHY/INIT/phy_init.h @@ -402,7 +402,7 @@ void init_nr_ue_transport(PHY_VARS_NR_UE *ue,int abstraction_flag); void init_N_TA_offset(PHY_VARS_NR_UE *ue); void nr_dump_frame_parms(NR_DL_FRAME_PARMS *frame_parms); int phy_init_nr_gNB(PHY_VARS_gNB *gNB, unsigned char is_secondary_gNB, unsigned char lowmem_flag); -int init_codebook_gNB(PHY_VARS_gNB *gNB, gNB_MAC_INST *mac); +int init_codebook_gNB(PHY_VARS_gNB *gNB); void nr_phy_config_request(NR_PHY_Config_t *gNB); void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,int N_RB_DL,int N_RB_UL,int mu,int Nid_cell,uint64_t position_in_burst); void phy_free_nr_gNB(PHY_VARS_gNB *gNB); diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h index c385d323e3..8e024420af 100644 --- a/openair1/PHY/defs_nr_common.h +++ b/openair1/PHY/defs_nr_common.h @@ -318,8 +318,12 @@ struct NR_DL_FRAME_PARMS { uint32_t samples_per_frame_wCP; /// NR numerology index [0..5] as specified in 38.211 Section 4 (mu). 0=15khZ SCS, 1=30khZ, 2=60kHz, etc uint8_t numerology_index; - /// Number of Physical transmit antennas in node + /// Number of Physical transmit antennas in node (corresponds to nrOfAntennaPorts) uint8_t nb_antennas_tx; + /// UPA Panel Antenna configuration: two_one, two_two, four_one, three_two, six_one, etc + uint8_t antennas_tx_n1_n2; + /// UPA Panel Antenna Type: non, Single panel, or multiple + uint8_t antennas_tx_panel_type; /// Number of Receive antennas in node uint8_t nb_antennas_rx; /// Number of common transmit antenna ports in eNodeB (1 or 2) diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index d05ffc9abe..ee25934f2d 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -794,7 +794,7 @@ int main(int argc, char **argv) // rrc_mac_config_req_gNB gNB_mac->pre_processor_dl = nr_dlsim_preprocessor; phy_init_nr_gNB(gNB,0,1); - init_codebook_gNB(gNB,gNB_mac); + init_codebook_gNB(gNB); N_RB_DL = gNB->frame_parms.N_RB_DL; NR_UE_info_t *UE_info = &RC.nrmac[0]->UE_info; UE_info->num_UEs=1; From bfd0de0a22d2fcce5eb2b119b92dd0773361c248 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Thu, 9 Dec 2021 11:38:39 +0100 Subject: [PATCH 05/67] remove now unneccessary MAC includes and forward declaration --- executables/nr-gnb.c | 4 +--- openair1/PHY/INIT/nr_init.c | 1 - openair1/PHY/INIT/phy_init.h | 2 -- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index 9e3c650f6e..673eed0a31 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -63,7 +63,7 @@ #include "PHY/phy_extern.h" -#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h" +#include "common/ran_context.h" #include "RRC/LTE/rrc_extern.h" #include "PHY_INTERFACE/phy_interface.h" #include "common/utils/LOG/log_extern.h" @@ -74,7 +74,6 @@ #include "UTIL/OPT/opt.h" #include "enb_config.h" #include "gnb_paramdef.h" -#include "LAYER2/NR_MAC_gNB/mac_proto.h" #include "s1ap_eNB.h" #include "SIMULATION/ETH_TRANSPORT/proto.h" @@ -497,7 +496,6 @@ void print_opp_meas(void) { void init_eNB_afterRU(void) { int inst,ru_id,i,aa; PHY_VARS_gNB *gNB; - gNB_MAC_INST *mac; LOG_I(PHY,"%s() RC.nb_nr_inst:%d\n", __FUNCTION__, RC.nb_nr_inst); if(NFAPI_MODE == NFAPI_MODE_PNF) diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 1e825226af..de123ee3e3 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -36,7 +36,6 @@ #include "MBSFN-SubframeConfigList.h"*/ #include "openair1/PHY/defs_RU.h" #include "openair1/PHY/CODING/nrLDPC_extern.h" -#include "LAYER2/NR_MAC_gNB/nr_mac_gNB.h" #include "assertions.h" #include #include diff --git a/openair1/PHY/INIT/phy_init.h b/openair1/PHY/INIT/phy_init.h index e45f40da42..810f880789 100644 --- a/openair1/PHY/INIT/phy_init.h +++ b/openair1/PHY/INIT/phy_init.h @@ -37,8 +37,6 @@ #include "LTE_SCellToAddMod-r10.h" #include "LTE_NonMBSFN-SubframeConfig-r14.h" -typedef struct gNB_MAC_INST_s gNB_MAC_INST; - /** @addtogroup _PHY_STRUCTURES_ * @{ */ From b942851a4ccbc46d0aaea380c39fde03ba50a5d3 Mon Sep 17 00:00:00 2001 From: sfn Date: Fri, 10 Dec 2021 15:50:04 +0100 Subject: [PATCH 06/67] Fix failure of phy-sim --- openair2/RRC/NR/rrc_gNB_reconfig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index f5a97f1bf7..a73b3ef80d 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -1156,7 +1156,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco csi_MeasConfig->csi_ReportConfigToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_ReportConfigToAddModList)); csi_MeasConfig->csi_ReportConfigToReleaseList = NULL; - if (dl_antenna_ports > 1) {/*do_csirs&&*/ + if (do_csirs && dl_antenna_ports > 1) { NR_CSI_ReportConfig_t *csirep1 = calloc(1,sizeof(*csirep1)); csirep1->reportConfigId=0; csirep1->carrier=NULL; From 223ad6aabe2093de896163beff981a2ebf0b8758 Mon Sep 17 00:00:00 2001 From: sfn Date: Wed, 15 Dec 2021 12:55:27 +0100 Subject: [PATCH 07/67] Enable 4 layers Transmission for PDSCH: tested only for dlsim and RFsim with pmi=0 --- openair1/PHY/INIT/nr_init_ue.c | 21 +++++++------------ .../NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 20 +++--------------- openair1/PHY/defs_nr_common.h | 2 +- openair1/SIMULATION/NR_PHY/dlsim.c | 14 ++++++------- targets/ARCH/rfsimulator/simulator.c | 8 +++---- .../CONF/gnb.band78.tm1.106PRB.usrpn300.conf | 10 ++++----- 6 files changed, 28 insertions(+), 47 deletions(-) diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index b60e77e814..20211e45b9 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -66,9 +66,8 @@ extern uint16_t beta_cqi[16]; void phy_init_nr_ue__PDSCH(NR_UE_PDSCH *const pdsch, const NR_DL_FRAME_PARMS *const fp) { AssertFatal( pdsch, "pdsch==0" ); - pdsch->pmi_ext = (uint8_t *)malloc16_clear( fp->N_RB_DL ); - pdsch->llr[0] = (int16_t *)malloc16_clear( (8*(3*8*6144))*sizeof(int16_t) ); - pdsch->layer_llr[0] = (int16_t *)malloc16_clear( (8*(3*8*6144))*sizeof(int16_t) ); + + //pdsch->layer_llr[0] = (int16_t *)malloc16_clear( (8*(3*8*6144))*sizeof(int16_t) ); pdsch->llr128 = (int16_t **)malloc16_clear( sizeof(int16_t *) ); // FIXME! no further allocation for (int16_t*)pdsch->llr128 !!! expect SIGSEGV // FK, 11-3-2015: this is only as a temporary pointer, no memory is stored there @@ -80,8 +79,6 @@ void phy_init_nr_ue__PDSCH(NR_UE_PDSCH *const pdsch, pdsch->dl_ch_estimates_ext = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) ); pdsch->dl_bf_ch_estimates = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) ); pdsch->dl_bf_ch_estimates_ext = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) ); - //pdsch->dl_ch_rho_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); - //pdsch->dl_ch_rho2_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); pdsch->dl_ch_mag0 = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) ); pdsch->dl_ch_magb0 = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) ); pdsch->dl_ch_magr0 = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) ); @@ -110,8 +107,6 @@ void phy_init_nr_ue__PDSCH(NR_UE_PDSCH *const pdsch, pdsch->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num ); pdsch->dl_bf_ch_estimates[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * fp->ofdm_symbol_size*7*2); pdsch->dl_bf_ch_estimates_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num ); - //pdsch->dl_ch_rho_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num ); - //pdsch->dl_ch_rho2_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num ); pdsch->dl_ch_mag0[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num ); pdsch->dl_ch_magb0[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num ); pdsch->dl_ch_magr0[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num ); @@ -325,14 +320,14 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, } for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->llr_shifts = (uint8_t *)malloc16_clear(7*2*fp->N_RB_DL*12); - ue->pdsch_vars[th_id][gNB_id]->llr_shifts_p = ue->pdsch_vars[0][gNB_id]->llr_shifts; - ue->pdsch_vars[th_id][gNB_id]->llr[1] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) ); - ue->pdsch_vars[th_id][gNB_id]->layer_llr[1] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) ); - ue->pdsch_vars[th_id][gNB_id]->llr128_2ndstream = (int16_t **)malloc16_clear( sizeof(int16_t *) ); + for (int i=0; ipdsch_vars[th_id][gNB_id]->llr[i] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) );//Q_m = 8 bits/Sym, Code_Rate=3, Number of Segments =8, Circular Buffer K_cb = 8448 + } + for (int i=0; ipdsch_vars[th_id][gNB_id]->layer_llr[i] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) );//Q_m = 8 bits/Sym, Code_Rate=3, Number of Segments =8, Circular Buffer K_cb = 8448 + } } - for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); } diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 37a2849d21..7ec7207778 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -3009,26 +3009,12 @@ static int nr_dlsch_llr(NR_UE_PDSCH **pdsch_vars, uint8_t nr_slot_rx, uint8_t beamforming_mode) { - - int16_t *pllr_symbol_cw0; - int16_t *pllr_symbol_cw1; - int16_t *pllr_symbol_layer0; - int16_t *pllr_symbol_layer1; uint32_t llr_offset_symbol; - if (first_symbol_flag==1) pdsch_vars[gNB_id]->llr_offset[symbol-1] = 0; + if (first_symbol_flag==1) + pdsch_vars[gNB_id]->llr_offset[symbol-1] = 0; llr_offset_symbol = pdsch_vars[gNB_id]->llr_offset[symbol-1]; - //pllr_symbol_cw0_deint = (int8_t*)pdsch_vars[gNB_id]->llr[0]; - //pllr_symbol_cw1_deint = (int8_t*)pdsch_vars[gNB_id]->llr[1]; - pllr_symbol_layer0 = pdsch_vars[gNB_id]->layer_llr[0]; - pllr_symbol_layer1 = pdsch_vars[gNB_id]->layer_llr[1]; - pllr_symbol_layer0 += llr_offset_symbol; - pllr_symbol_layer1 += llr_offset_symbol; - pllr_symbol_cw0 = pdsch_vars[gNB_id]->llr[0]; - pllr_symbol_cw1 = pdsch_vars[gNB_id]->llr[1]; - pllr_symbol_cw0 += llr_offset_symbol; - pllr_symbol_cw1 += llr_offset_symbol; - + pdsch_vars[gNB_id]->llr_offset[symbol] = len*dlsch0_harq->Qm + llr_offset_symbol; /*LOG_I(PHY,"compute LLRs [symbol %d] NbRB %d Qm %d LLRs-Length %d LLR-Offset %d @LLR Buff %x @LLR Buff(symb) %x\n", diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h index 8e024420af..98f9d33efa 100644 --- a/openair1/PHY/defs_nr_common.h +++ b/openair1/PHY/defs_nr_common.h @@ -93,7 +93,7 @@ #define NR_MAX_CSET_DURATION 3 #define NR_MAX_NB_RBG 18 -#define NR_MAX_NB_LAYERS 2 // 8 // SU-MIMO (3GPP TS 38.211 V15.4.0 section 7.3.1.3) +#define NR_MAX_NB_LAYERS 4 // 8 // SU-MIMO (3GPP TS 38.211 V15.4.0 section 7.3.1.3) #define NR_MAX_NB_CODEWORDS 2 #define NR_MAX_NB_HARQ_PROCESSES 16 #define NR_MAX_PDSCH_ENCODED_LENGTH (NR_MAX_NB_RB*NR_SYMBOLS_PER_SLOT*NR_NB_SC_PER_RB*8*NR_MAX_NB_LAYERS) // 8 is the maximum modulation order (it was 950984 before !!) diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index ee25934f2d..6d2c819656 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -528,8 +528,8 @@ int main(int argc, char **argv) case 'x': g_nrOfLayers=atoi(optarg); - if ((g_nrOfLayers!=1) && - (g_nrOfLayers!=2)) { + if ((g_nrOfLayers==0) || + (g_nrOfLayers>4)) { printf("Unsupported nr Of Layers %d\n",g_nrOfLayers); exit(-1); } @@ -1170,10 +1170,10 @@ int main(int argc, char **argv) frame_length_complex_samples, 0); - double H_awgn_mimo[4][4] ={{1.0, 0.5, 0.25, 0.125},//rx 0 - {0.5, 1.0, 0.5, 0.25}, //rx 1 - {0.25, 0.5, 1.0, 0.5}, //rx 2 - {0.125, 0.25, 0.5, 1.0}};//rx 3 + double H_awgn_mimo[4][4] ={{1.0, 0.0, 0.0, 0.0}, //rx 0 + {0.0, 1.0, 0.0, 0.0}, //rx 1 + {0.0, 0.0, 1.0, 0.0}, //rx 2 + {0.0, 0.0, 0.0, 1.0}};//rx 3 for (i=frame_parms->get_samples_slot_timestamp(slot,frame_parms,0); iget_samples_slot_timestamp(slot+1,frame_parms,0); @@ -1228,7 +1228,7 @@ int main(int argc, char **argv) TBS = UE_harq_process->TBS;//rel15->TBSize[0]; uint16_t length_dmrs = get_num_dmrs(rel15->dlDmrsSymbPos); uint16_t nb_rb = rel15->rbSize; - uint8_t nb_re_dmrs = rel15->dmrsConfigType == NFAPI_NR_DMRS_TYPE1 ? 6 : 4; + uint8_t nb_re_dmrs = rel15->dmrsConfigType == NFAPI_NR_DMRS_TYPE1 ? 6*UE_harq_process->n_dmrs_cdm_groups : 4*UE_harq_process->n_dmrs_cdm_groups; uint8_t mod_order = rel15->qamModOrder[0]; uint8_t nb_symb_sch = rel15->NrOfSymbols; diff --git a/targets/ARCH/rfsimulator/simulator.c b/targets/ARCH/rfsimulator/simulator.c index 13945998d7..81233678fd 100644 --- a/targets/ARCH/rfsimulator/simulator.c +++ b/targets/ARCH/rfsimulator/simulator.c @@ -736,10 +736,10 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest CirSize ); else { // no channel modeling - double H_awgn_mimo[4][4] ={{1.0, 0.5, 0.25, 0.125},//rx 0 - {0.5, 1.0, 0.5, 0.25}, //rx 1 - {0.25, 0.5, 1.0, 0.5}, //rx 2 - {0.125, 0.25, 0.5, 1.0}};//rx 3 + double H_awgn_mimo[4][4] ={{1.0, 0.0, 0.0, 0.0},//rx 0 + {0.0, 1.0, 0.0, 0.0}, //rx 1 + {0.0, 0.0, 1.0, 0.0}, //rx 2 + {0.0, 0.0, 0.0, 1.0}};//rx 3 sample_t *out=(sample_t *)samplesVoid[a]; int nbAnt_tx = ptr->th.nbAnt;//number of Tx antennas diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf index f93e97ed65..0109bc966b 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf @@ -22,7 +22,7 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; + pdsch_AntennaPorts = 4; pusch_AntennaPorts = 1; servingCellConfigCommon = ( @@ -225,7 +225,7 @@ L1s = ( RUs = ( { local_rf = "yes" - nb_tx = 1 + nb_tx = 4 nb_rx = 1 att_tx = 0 att_rx = 0; @@ -238,11 +238,11 @@ RUs = ( ## beamforming 1x4 matrix: 1 layer x 4 antennas #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; ## beamforming 2x2 matrix: - #bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + # bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; ## beamforming 2x4 matrix: - #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000]; + #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000]; ## beamforming 4x4 matrix: - #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; + bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; clock_src = "external"; } From 461cf243e581f5b44342104dbaeb422db8971886 Mon Sep 17 00:00:00 2001 From: sfn Date: Wed, 15 Dec 2021 13:18:19 +0100 Subject: [PATCH 08/67] Minor change nr_mimo_precoding_matrix --- openair1/PHY/INIT/nr_init.c | 2 +- openair1/PHY/defs_gNB.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index de123ee3e3..6265eecc3a 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -255,7 +255,7 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { } } - gNB->nr_mimo_precoding_matrix = (int32_t ***)malloc16(4* sizeof(int32_t **)); + gNB->nr_mimo_precoding_matrix = (int32_t ***)malloc16(gNB->frame_parms.nb_antennas_tx* sizeof(int32_t **)); int32_t ***mat = gNB->nr_mimo_precoding_matrix; double complex res_code; diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index a9e0707c74..9b3236b837 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -805,6 +805,9 @@ typedef struct PHY_VARS_gNB_s { uint32_t ****nr_gold_pdsch_dmrs; /// PDSCH codebook I precoding LUTs + /// first dimension: Rank number [0,...,noOfLayers-1[ + /// second dimension: PMI [0,...,CodeSize-1[ + /// third dimension: [i_rows*noOfLayers+j_col], i_rows=0,...pdsch_AntennaPorts-1 and j_col=0,...,noOfLayers-1 int32_t ***nr_mimo_precoding_matrix; /// PUSCH DMRS From 1d7569b4af5fd53640ed4b0dd9b8246d1d4e3a49 Mon Sep 17 00:00:00 2001 From: sfn Date: Tue, 21 Dec 2021 12:48:21 +0100 Subject: [PATCH 09/67] clean up and optimize UE --- openair1/PHY/INIT/nr_init_ue.c | 50 +- openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c | 8 +- .../PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 4 +- .../NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 752 ++++-------------- .../NR_UE_TRANSPORT/nr_transport_proto_ue.h | 15 +- openair1/PHY/defs_nr_UE.h | 2 +- .../CONF/gnb.band78.tm1.106PRB.usrpn300.conf | 4 +- 7 files changed, 190 insertions(+), 645 deletions(-) diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index d31c3d806c..d3d36343e8 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -64,7 +64,7 @@ extern uint16_t beta_cqi[16]; * \param[in] frame_parms LTE_DL_FRAME_PARMS structure. * \note This function is optimistic in that it expects malloc() to succeed. */ -void phy_init_nr_ue__PDSCH(NR_UE_PDSCH *const pdsch, +void phy_init_nr_ue_PDSCH(NR_UE_PDSCH *const pdsch, const NR_DL_FRAME_PARMS *const fp) { AssertFatal( pdsch, "pdsch==0" ); @@ -132,7 +132,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, NR_UE_COMMON *const common_vars = &ue->common_vars; NR_UE_PBCH **const pbch_vars = ue->pbch_vars; NR_UE_PRACH **const prach_vars = ue->prach_vars; - int i,j,k,l,slot,symb,q; + int i,j,slot,symb,q; int gNB_id; int th_id; uint32_t ****pusch_dmrs; @@ -317,56 +317,18 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, if (abstraction_flag == 0) { for (th_id=0; th_idpdsch_vars[th_id][gNB_id], fp ); + phy_init_nr_ue_PDSCH( ue->pdsch_vars[th_id][gNB_id], fp ); } for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->llr[i] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) );//Q_m = 8 bits/Sym, Code_Rate=3, Number of Segments =8, Circular Buffer K_cb = 8448 } - for (int i=0; ipdsch_vars[th_id][gNB_id]->layer_llr[i] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) );//Q_m = 8 bits/Sym, Code_Rate=3, Number of Segments =8, Circular Buffer K_cb = 8448 } } - - for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); - } - - for (i=0; inb_antennas_rx; i++) - for (j=0; j<4; j++) { - const int idx = (j*fp->nb_antennas_rx)+i; - const size_t num = 7*2*fp->N_RB_DL*12+4; - - for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num ); - } - } - - //const size_t num = 7*2*fp->N_RB_DL*12+4; - for (k=0; k<8; k++) { //harq_pid - for (l=0; l<8; l++) { //round - for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->rxdataF_comp1[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); - ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); - ue->pdsch_vars[th_id][gNB_id]->dl_ch_mag1[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); - ue->pdsch_vars[th_id][gNB_id]->dl_ch_magb1[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); - } - - for (int i=0; inb_antennas_rx; i++) - for (int j=0; j<4; j++) { //frame_parms->nb_antennas_tx; j++) - const int idx = (j*fp->nb_antennas_rx)+i; - - for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12)); - ue->pdsch_vars[th_id][gNB_id]->rxdataF_comp1[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12)); - ue->pdsch_vars[th_id][gNB_id]->dl_ch_mag1[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12)); - ue->pdsch_vars[th_id][gNB_id]->dl_ch_magb1[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12)); - } - } - } - } - + // PDCCH // 100 PRBs * 12 REs/PRB * 4 PDCCH SYMBOLS * 2 LLRs/RE for (th_id=0; th_idpdcch_vars[th_id][gNB_id]->llr = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) ); diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c index 5286fe8780..8de8383ecc 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c @@ -386,15 +386,15 @@ void nr_processULSegment(void* arg) { p_procTime); if (check_crc((uint8_t*)llrProcBuf,length_dec,ulsch_harq->F,crc_type)) { -#ifdef PRINT_CRC_CHECK +//#ifdef PRINT_CRC_CHECK LOG_I(PHY, "Segment %d CRC OK, iterations %d/%d\n",r,no_iteration_ldpc,max_ldpc_iterations); -#endif +//#endif rdata->decodeIterations = no_iteration_ldpc; if (rdata->decodeIterations > p_decoderParms->numMaxIter) rdata->decodeIterations--; } else { -#ifdef PRINT_CRC_CHECK +//#ifdef PRINT_CRC_CHECK LOG_I(PHY, "CRC NOK\n"); -#endif +//#endif rdata->decodeIterations = max_ldpc_iterations + 1; } diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index 95c451fa1a..4a86af0d57 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -447,7 +447,7 @@ void nr_processDLSegment(void* arg) { // Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int if (check_crc((uint8_t *)llrProcBuf,length_dec,harq_process->F,crc_type)) { - LOG_D(PHY,"Segment %u CRC OK\n\033[0m",r); + LOG_I(PHY,"Segment %u CRC OK\n",r); if (r==0) { for (int i=0; i<10; i++) LOG_D(PHY,"byte %d : %x\n",i,((uint8_t *)llrProcBuf)[i]); @@ -457,7 +457,7 @@ void nr_processDLSegment(void* arg) { no_iteration_ldpc = dlsch->max_ldpc_iterations; rdata->decodeIterations = no_iteration_ldpc; } else { - LOG_D(PHY,"CRC NOT OK\n\033[0m"); + LOG_I(PHY,"CRC NOT OK\n"); } nb_total_decod++; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 08374b30ac..16f2310041 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -82,15 +82,6 @@ unsigned char offset_mumimo_llr_drange[29][3]={{8,8,8},{7,7,7},{7,7,7},{7,7,7},{ #define print_ints(s,x) printf("%s = %d %d %d %d\n",s,(x)[0],(x)[1],(x)[2],(x)[3]) #define print_shorts(s,x) printf("%s = [%d+j*%d, %d+j*%d, %d+j*%d, %d+j*%d]\n",s,(x)[0],(x)[1],(x)[2],(x)[3],(x)[4],(x)[5],(x)[6],(x)[7]) -static void nr_dlsch_dual_stream_correlation_core(int **dl_ch_estimates_ext, - int **dl_ch_estimates_ext_i, - int **dl_ch_rho_ext, - unsigned char n_tx, - unsigned char n_rx, - unsigned char output_shift, - int length, - int start_point); - uint8_t nr_zero_forcing_rx_2layers(int **rxdataF_comp, int **dl_ch_mag, int **dl_ch_magb, @@ -162,7 +153,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, unsigned char aatx=0,aarx=0; - unsigned short nb_rb = 0, round; + unsigned short round; int avgs = 0;// rb; NR_DL_UE_HARQ_t *dlsch0_harq, *dlsch1_harq = NULL; @@ -181,7 +172,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, //uint16_t bundle_L = 2; uint16_t n_tx=1, n_rx=1; int32_t median[16]; - uint32_t len; + uint32_t nb_re_pdsch; uint16_t startSymbIdx=0; uint16_t nbSymb=0; uint16_t pduBitmap=0x0; @@ -206,7 +197,6 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, dlsch = ue->dlsch[proc->thread_id][gNB_id]; dlsch0_harq = dlsch[0]->harq_processes[harq_pid]; dlsch1_harq = dlsch[1]->harq_processes[harq_pid]; - beamforming_mode = ue->transmission_mode[gNB_id] < 7 ? 0 :ue->transmission_mode[gNB_id]; break; default: @@ -315,79 +305,42 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, return(-1); } - if (dlsch0_harq->mimo_mode>NR_DUALSTREAM) { - LOG_E(PHY,"This transmission mode is not yet supported!\n"); - return(-1); - } - - if (dlsch0_harq->mimo_mode==NR_DUALSTREAM) { - DevAssert(dlsch1_harq); - } - if(symbol > ue->frame_parms.symbols_per_slot>>1) { slot = 1; } -#ifdef DEBUG_HARQ - printf("Demod dlsch0_harq->pmi_alloc %d\n", dlsch0_harq->pmi_alloc); -#endif - uint8_t pilots = (dlsch0_harq->dlDmrsSymbPos >> symbol) & 1; uint8_t config_type = dlsch0_harq->dmrsConfigType; - - if (beamforming_mode==0) {//No beamforming - start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); - if (dlsch0_harq->Nl > 1)//More than or equal 2 layers - nb_rb = nr_dlsch_extract_rbs_multiple(common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF, - pdsch_vars[gNB_id]->dl_ch_estimates, - pdsch_vars[gNB_id]->rxdataF_ext, - pdsch_vars[gNB_id]->dl_ch_estimates_ext, - symbol, - pilots, - config_type, - start_rb + dlsch0_harq->BWPStart, - nb_rb_pdsch, - dlsch0_harq->n_dmrs_cdm_groups, - dlsch0_harq->Nl, - frame_parms, - dlsch0_harq->dlDmrsSymbPos); - else// one layer - nb_rb = nr_dlsch_extract_rbs_single(common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF, - pdsch_vars[gNB_id]->dl_ch_estimates, - pdsch_vars[gNB_id]->rxdataF_ext, - pdsch_vars[gNB_id]->dl_ch_estimates_ext, - symbol, - pilots, - config_type, - start_rb + dlsch0_harq->BWPStart, - nb_rb_pdsch, - dlsch0_harq->n_dmrs_cdm_groups, - frame_parms, - dlsch0_harq->dlDmrsSymbPos); - } - else if(beamforming_mode>7) { - LOG_W(PHY,"dlsch_demodulation: beamforming mode not supported yet.\n"); - } - - //printf("nb_rb = %d, gNB_id %d\n",nb_rb,gNB_id); - if (nb_rb==0) { - LOG_D(PHY,"dlsch_demodulation.c: nb_rb=0\n"); - return(-1); - } - - len = (pilots==1)? ((config_type==NFAPI_NR_DMRS_TYPE1)?nb_rb*(12-6*dlsch0_harq->n_dmrs_cdm_groups): nb_rb*(12-4*dlsch0_harq->n_dmrs_cdm_groups)):(nb_rb*12); - + //---------------------------------------------------------- + //--------------------- RBs extraction --------------------- + //---------------------------------------------------------- + start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); + nr_dlsch_extract_rbs(common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF, + pdsch_vars[gNB_id]->dl_ch_estimates, + pdsch_vars[gNB_id]->rxdataF_ext, + pdsch_vars[gNB_id]->dl_ch_estimates_ext, + symbol, + pilots, + config_type, + start_rb + dlsch0_harq->BWPStart, + nb_rb_pdsch, + dlsch0_harq->n_dmrs_cdm_groups, + dlsch0_harq->Nl, + frame_parms, + dlsch0_harq->dlDmrsSymbPos); stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); if (cpumeas(CPUMEAS_GETSTATE)) LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d type %d: Pilot/Data extraction %5.2f \n", frame,nr_slot_rx,slot,symbol,type,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); - - start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); n_tx = dlsch0_harq->Nl; n_rx = frame_parms->nb_antennas_rx; - + nb_re_pdsch = (pilots==1)? ((config_type==NFAPI_NR_DMRS_TYPE1)?nb_rb_pdsch*(12-6*dlsch0_harq->n_dmrs_cdm_groups): nb_rb_pdsch*(12-4*dlsch0_harq->n_dmrs_cdm_groups)) : (nb_rb_pdsch*12); + //---------------------------------------------------------- + //--------------------- Channel Scaling -------------------- + //---------------------------------------------------------- + start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); nr_dlsch_scale_channel(pdsch_vars[gNB_id]->dl_ch_estimates_ext, frame_parms, n_tx, @@ -395,50 +348,48 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, dlsch, symbol, pilots, - len, + nb_re_pdsch, nb_rb_pdsch); + stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); - stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); - if (cpumeas(CPUMEAS_GETSTATE)) - LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Scale %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); + if (cpumeas(CPUMEAS_GETSTATE)) + LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Scale %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); - start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); + //---------------------------------------------------------- + //--------------------- Channel Level Calc. ---------------- + //---------------------------------------------------------- + start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); if (first_symbol_flag==1) { - if (beamforming_mode==0){ - nr_dlsch_channel_level(pdsch_vars[gNB_id]->dl_ch_estimates_ext, - frame_parms, - n_tx, - avg, - symbol, - len, - nb_rb_pdsch); - avgs = 0; - for (aatx=0;aatxnb_antennas_rx+aarx]); - avgs = cmax(avgs,avg[(aatx*frame_parms->nb_antennas_rx)+aarx]); - //LOG_I(PHY, "avgs Power per SC is %d\n", avgs); - median[(aatx*frame_parms->nb_antennas_rx)+aarx] = avg[(aatx*frame_parms->nb_antennas_rx)+aarx]; - } - - if (dlsch0_harq->mimo_mode == NR_DUALSTREAM) { - nr_dlsch_channel_level_median(pdsch_vars[gNB_id]->dl_ch_estimates_ext, - median, - n_tx, - n_rx, - len, - symbol*nb_rb*12); - - for (aatx = 0; aatx < n_tx; aatx++) { - for (aarx = 0; aarx < n_rx; aarx++) { - avgs = cmax(avgs, median[aatx*n_rx + aarx]); - } + nr_dlsch_channel_level(pdsch_vars[gNB_id]->dl_ch_estimates_ext, + frame_parms, + n_tx, + avg, + symbol, + nb_re_pdsch, + nb_rb_pdsch); + avgs = 0; + for (aatx=0;aatxnb_antennas_rx+aarx]); + avgs = cmax(avgs,avg[(aatx*frame_parms->nb_antennas_rx)+aarx]); + //LOG_I(PHY, "avgs Power per SC is %d\n", avgs); + median[(aatx*frame_parms->nb_antennas_rx)+aarx] = avg[(aatx*frame_parms->nb_antennas_rx)+aarx]; + } + if (dlsch0_harq->Nl > 1) { + nr_dlsch_channel_level_median(pdsch_vars[gNB_id]->dl_ch_estimates_ext, + median, + n_tx, + n_rx, + nb_re_pdsch, + symbol*nb_rb_pdsch*12); + for (aatx = 0; aatx < n_tx; aatx++) { + for (aarx = 0; aarx < n_rx; aarx++) { + avgs = cmax(avgs, median[aatx*n_rx + aarx]); } } - - pdsch_vars[gNB_id]->log2_maxh = (log2_approx(avgs)/2) + 1; - //LOG_I(PHY, "avgs Power per SC is %d lg2_maxh %d\n", avgs, pdsch_vars[gNB_id]->log2_maxh); } + pdsch_vars[gNB_id]->log2_maxh = (log2_approx(avgs)/2) + 1; + //LOG_I(PHY, "avgs Power per SC is %d lg2_maxh %d\n", avgs, pdsch_vars[gNB_id]->log2_maxh); LOG_D(PHY,"[DLSCH] AbsSubframe %d.%d log2_maxh = %d [log2_maxh0 %d log2_maxh1 %d] (%d,%d)\n", frame%1024, nr_slot_rx, @@ -448,64 +399,40 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, avg[0], avgs); } + stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); #if T_TRACER - if (type == PDSCH) - { - T(T_UE_PHY_PDSCH_ENERGY, T_INT(gNB_id), T_INT(0), T_INT(frame%1024), T_INT(nr_slot_rx), - T_INT(avg[0]), T_INT(avg[1]), T_INT(avg[2]), T_INT(avg[3])); - } + if (type == PDSCH) + { + T(T_UE_PHY_PDSCH_ENERGY, T_INT(gNB_id), T_INT(0), T_INT(frame%1024), T_INT(nr_slot_rx), + T_INT(avg[0]), T_INT(avg[1]), T_INT(avg[2]), T_INT(avg[3])); + } #endif - stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); - if (cpumeas(CPUMEAS_GETSTATE)) - LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d first_symbol_flag %d: Channel Level %5.2f \n",frame,nr_slot_rx,slot,symbol,first_symbol_flag,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); - - start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); -// Now channel compensation - if (dlsch0_harq->mimo_moderxdataF_ext, - pdsch_vars[gNB_id]->dl_ch_estimates_ext, - pdsch_vars[gNB_id]->dl_ch_mag0, - pdsch_vars[gNB_id]->dl_ch_magb0, - pdsch_vars[gNB_id]->dl_ch_magr0, - pdsch_vars[gNB_id]->rxdataF_comp0, - (n_tx>1) ? pdsch_vars[gNB_id]->rho : NULL, - frame_parms, - n_tx, - symbol, - len, - first_symbol_flag, - dlsch0_harq->Qm, - nb_rb_pdsch, - pdsch_vars[gNB_id]->log2_maxh, - measurements); // log2_maxh+I0_shift - } - - else if (dlsch0_harq->mimo_mode == NR_DUALSTREAM) { - nr_dlsch_channel_compensation_core(pdsch_vars[gNB_id]->rxdataF_ext, - pdsch_vars[gNB_id]->dl_ch_estimates_ext, - pdsch_vars[gNB_id]->dl_ch_mag0, - pdsch_vars[gNB_id]->dl_ch_magb0, - pdsch_vars[gNB_id]->rxdataF_comp0, //rxdataF_comp - NULL, - n_tx, - n_rx, - dlsch0_harq->Qm, - pdsch_vars[gNB_id]->log2_maxh, - 2*len, // subcarriers Re Im - 0); // we start from the beginning of the vector - // compute correlation between signal and interference channels (rho12 and rho21) - nr_dlsch_dual_stream_correlation_core(pdsch_vars[gNB_id]->dl_ch_estimates_ext, - &(pdsch_vars[gNB_id]->dl_ch_estimates_ext[2]), - pdsch_vars[gNB_id]->dl_ch_rho_ext[harq_pid][round], - n_tx, - n_rx, - pdsch_vars[gNB_id]->log2_maxh, - 2*len, - 0); - } + if (cpumeas(CPUMEAS_GETSTATE)) + LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d first_symbol_flag %d: Channel Level %5.2f \n",frame,nr_slot_rx,slot,symbol,first_symbol_flag,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); + //---------------------------------------------------------- + //--------------------- channel compensation --------------- + //---------------------------------------------------------- + // Disable correlation measurement for optimizing UE + start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); + nr_dlsch_channel_compensation(pdsch_vars[gNB_id]->rxdataF_ext, + pdsch_vars[gNB_id]->dl_ch_estimates_ext, + pdsch_vars[gNB_id]->dl_ch_mag0, + pdsch_vars[gNB_id]->dl_ch_magb0, + pdsch_vars[gNB_id]->dl_ch_magr0, + pdsch_vars[gNB_id]->rxdataF_comp0, + NULL,//NULL:disable meas. pdsch_vars[gNB_id]->rho:enable meas. + frame_parms, + n_tx, + symbol, + nb_re_pdsch, + first_symbol_flag, + dlsch0_harq->Qm, + nb_rb_pdsch, + pdsch_vars[gNB_id]->log2_maxh, + measurements); // log2_maxh+I0_shift stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); if (cpumeas(CPUMEAS_GETSTATE)) LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d log2_maxh %d channel_level %d: Channel Comp %5.2f \n", frame, nr_slot_rx, slot, symbol, pdsch_vars[gNB_id]->log2_maxh, proc->channel_level, ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); @@ -513,63 +440,41 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); if (frame_parms->nb_antennas_rx > 1) { - if (dlsch0_harq->mimo_moderxdataF_comp0, - (n_tx>1)? pdsch_vars[gNB_id]->rho : NULL, - pdsch_vars[gNB_id]->dl_ch_mag0, - pdsch_vars[gNB_id]->dl_ch_magb0, - pdsch_vars[gNB_id]->dl_ch_magr0, - n_tx, - n_rx, - symbol, - nb_rb_pdsch, - len); - if (n_tx == 2)//Apply zero forcing for 2 Tx layers - nr_zero_forcing_rx_2layers(pdsch_vars[gNB_id]->rxdataF_comp0, - pdsch_vars[gNB_id]->dl_ch_mag0, - pdsch_vars[gNB_id]->dl_ch_magb0, - pdsch_vars[gNB_id]->dl_ch_magr0, - pdsch_vars[gNB_id]->dl_ch_estimates_ext, - nb_rb_pdsch, - n_rx, - dlsch0_harq->Qm, - pdsch_vars[gNB_id]->log2_maxh, - symbol, - len); - } - else if (dlsch0_harq->mimo_mode == NR_DUALSTREAM) { - nr_dlsch_detection_mrc_core(pdsch_vars[gNB_id]->rxdataF_comp0, - NULL, - pdsch_vars[gNB_id]->dl_ch_rho_ext[harq_pid][round], - pdsch_vars[gNB_id]->dl_ch_rho2_ext, - pdsch_vars[gNB_id]->dl_ch_mag0, - pdsch_vars[gNB_id]->dl_ch_magb0, - NULL, - NULL, - n_tx, - n_rx, - 2*len, - 0); - } + nr_dlsch_detection_mrc(pdsch_vars[gNB_id]->rxdataF_comp0, + (n_tx>1)? pdsch_vars[gNB_id]->rho : NULL, + pdsch_vars[gNB_id]->dl_ch_mag0, + pdsch_vars[gNB_id]->dl_ch_magb0, + pdsch_vars[gNB_id]->dl_ch_magr0, + n_tx, + n_rx, + symbol, + nb_rb_pdsch, + nb_re_pdsch); + if (n_tx == 2)//Apply zero forcing for 2 Tx layers + nr_zero_forcing_rx_2layers(pdsch_vars[gNB_id]->rxdataF_comp0, + pdsch_vars[gNB_id]->dl_ch_mag0, + pdsch_vars[gNB_id]->dl_ch_magb0, + pdsch_vars[gNB_id]->dl_ch_magr0, + pdsch_vars[gNB_id]->dl_ch_estimates_ext, + nb_rb_pdsch, + n_rx, + dlsch0_harq->Qm, + pdsch_vars[gNB_id]->log2_maxh, + symbol, + nb_re_pdsch); } + stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); + //printf("start compute LLR\n"); - if (dlsch0_harq->mimo_mode == NR_DUALSTREAM) { - rxdataF_comp_ptr = pdsch_vars[gNB_id]->rxdataF_comp1[harq_pid][round]; - dl_ch_mag_ptr = pdsch_vars[gNB_id]->dl_ch_mag1[harq_pid][round]; - } - else { - rxdataF_comp_ptr = pdsch_vars[gNB_id_i]->rxdataF_comp0; - dl_ch_mag_ptr = pdsch_vars[gNB_id_i]->dl_ch_mag0; - //i_mod should have been passed as a parameter - } + rxdataF_comp_ptr = pdsch_vars[gNB_id_i]->rxdataF_comp0; + dl_ch_mag_ptr = pdsch_vars[gNB_id_i]->dl_ch_mag0; - stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); - if (cpumeas(CPUMEAS_GETSTATE)) - LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Combine %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); + if (cpumeas(CPUMEAS_GETSTATE)) + LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Combine %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); /* Store the valid DL RE's */ - pdsch_vars[gNB_id]->dl_valid_re[symbol-1] = len; + pdsch_vars[gNB_id]->dl_valid_re[symbol-1] = nb_re_pdsch; if(dlsch0_harq->status == ACTIVE) { startSymbIdx = dlsch0_harq->start_symbol; @@ -592,7 +497,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, gNB_id, nr_slot_rx, symbol, - (nb_rb*12), + (nb_rb_pdsch*12), dlsch[0]->rnti,rx_type); pdsch_vars[gNB_id]->dl_valid_re[symbol-1] -= pdsch_vars[gNB_id]->ptrs_re_per_slot[0][symbol]; } @@ -614,7 +519,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, rx_type, harq_pid, gNB_id, gNB_id_i, first_symbol_flag, - i, nb_rb, round, + i, nb_rb_pdsch, round, codeword_TB0, codeword_TB1, pdsch_vars[gNB_id]->dl_valid_re[i-1], nr_slot_rx, beamforming_mode); @@ -670,13 +575,13 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, for (int i=0; i < 2; i++){ snprintf(filename, 40, "llr%d_symb_%d_nr_slot_rx_%d.m", i, symbol, nr_slot_rx); - write_output(filename,"llr", &pdsch_vars[gNB_id]->llr[i][0], (NR_SYMBOLS_PER_SLOT*nb_rb*NR_NB_SC_PER_RB*dlsch1_harq->Qm) - 4*(nb_rb*4*dlsch1_harq->Qm), 1, 0); + write_output(filename,"llr", &pdsch_vars[gNB_id]->llr[i][0], (NR_SYMBOLS_PER_SLOT*nb_rb_pdsch*NR_NB_SC_PER_RB*dlsch1_harq->Qm) - 4*(nb_rb_pdsch*4*dlsch1_harq->Qm), 1, 0); } #endif #if T_TRACER T(T_UE_PHY_PDSCH_IQ, T_INT(gNB_id), T_INT(ue->Mod_id), T_INT(frame%1024), - T_INT(nr_slot_rx), T_INT(nb_rb), + T_INT(nr_slot_rx), T_INT(nb_rb_pdsch), T_INT(frame_parms->N_RB_UL), T_INT(frame_parms->symbols_per_slot), T_BUFFER(&pdsch_vars[gNB_id]->rxdataF_comp0[gNB_id][0], 2 * /* ulsch[UE_id]->harq_processes[harq_pid]->nb_rb */ frame_parms->N_RB_UL *12*frame_parms->symbols_per_slot*2)); #endif @@ -928,8 +833,8 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext, //rho[aarx][nb_aatx*nb_aatx] = [cov(H_aarx_0,H_aarx_0) cov(H_aarx_0,H_aarx_1) // cov(H_aarx_1,H_aarx_0) cov(H_aarx_1,H_aarx_1)], aarx=0,...,nb_antennas_rx-1 - int avg_rho_re[frame_parms->nb_antennas_rx][nb_aatx*nb_aatx]; - int avg_rho_im[frame_parms->nb_antennas_rx][nb_aatx*nb_aatx]; + //int avg_rho_re[frame_parms->nb_antennas_rx][nb_aatx*nb_aatx]; + //int avg_rho_im[frame_parms->nb_antennas_rx][nb_aatx*nb_aatx]; for (aarx=0; aarxnb_antennas_rx; aarx++) { @@ -937,8 +842,8 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext, dl_ch128 = (__m128i *)&dl_ch_estimates_ext[aatx*frame_parms->nb_antennas_rx+aarx][symbol*nb_rb*12]; for (atx=0; atxnb_antennas_rx+aarx][symbol*nb_rb*12]; @@ -966,15 +871,14 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext, //print_shorts("ch:",dl_ch128); //print_shorts("pack:",rho128); - avg_rho_re[aarx][aatx*nb_aatx+atx] +=(((int16_t*)&rho128[0])[0]+ + /*avg_rho_re[aarx][aatx*nb_aatx+atx] +=(((int16_t*)&rho128[0])[0]+ ((int16_t*)&rho128[0])[2] + ((int16_t*)&rho128[0])[4] + - ((int16_t*)&rho128[0])[6])/16;// - - avg_rho_im[aarx][aatx*nb_aatx+atx] +=(((int16_t*)&rho128[0])[1]+ + ((int16_t*)&rho128[0])[6])/16;*/ + /*avg_rho_im[aarx][aatx*nb_aatx+atx] +=(((int16_t*)&rho128[0])[1]+ ((int16_t*)&rho128[0])[3] + ((int16_t*)&rho128[0])[5] + - ((int16_t*)&rho128[0])[7])/16;// + ((int16_t*)&rho128[0])[7])/16;*/ // multiply by conjugated channel mmtmpD0 = _mm_madd_epi16(dl_ch128[1],dl_ch128_2[1]); @@ -994,15 +898,14 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext, //print_shorts("pack:",rho128+1); // multiply by conjugated channel - avg_rho_re[aarx][aatx*nb_aatx+atx] +=(((int16_t*)&rho128[1])[0]+ + /*avg_rho_re[aarx][aatx*nb_aatx+atx] +=(((int16_t*)&rho128[1])[0]+ ((int16_t*)&rho128[1])[2] + ((int16_t*)&rho128[1])[4] + - ((int16_t*)&rho128[1])[6])/16; - - avg_rho_im[aarx][aatx*nb_aatx+atx] +=(((int16_t*)&rho128[1])[1]+ + ((int16_t*)&rho128[1])[6])/16;*/ + /*avg_rho_im[aarx][aatx*nb_aatx+atx] +=(((int16_t*)&rho128[1])[1]+ ((int16_t*)&rho128[1])[3] + ((int16_t*)&rho128[1])[5] + - ((int16_t*)&rho128[1])[7])/16; + ((int16_t*)&rho128[1])[7])/16;*/ mmtmpD0 = _mm_madd_epi16(dl_ch128[2],dl_ch128_2[2]); // mmtmpD0 contains real part of 4 consecutive outputs (32-bit) @@ -1020,25 +923,28 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext, //print_shorts("rx:",dl_ch128_2+2); //print_shorts("ch:",dl_ch128+2); //print_shorts("pack:",rho128+2); - avg_rho_re[aarx][aatx*nb_aatx+atx] +=(((int16_t*)&rho128[2])[0]+ + + /*avg_rho_re[aarx][aatx*nb_aatx+atx] +=(((int16_t*)&rho128[2])[0]+ ((int16_t*)&rho128[2])[2] + ((int16_t*)&rho128[2])[4] + - ((int16_t*)&rho128[2])[6])/16; - - avg_rho_im[aarx][aatx*nb_aatx+atx] +=(((int16_t*)&rho128[2])[1]+ + ((int16_t*)&rho128[2])[6])/16;*/ + /*avg_rho_im[aarx][aatx*nb_aatx+atx] +=(((int16_t*)&rho128[2])[1]+ ((int16_t*)&rho128[2])[3] + ((int16_t*)&rho128[2])[5] + - ((int16_t*)&rho128[2])[7])/16; + ((int16_t*)&rho128[2])[7])/16;*/ dl_ch128+=3; dl_ch128_2+=3; rho128+=3; } if (first_symbol_flag==1) { - //measurements->rx_correlation[0][0][aarx] = signal_energy(&rho[aarx][aatx*nb_aatx+atx][symbol*nb_rb*12],rb*12); - avg_rho_re[aarx][aatx*nb_aatx+atx] = 16*avg_rho_re[aarx][aatx*nb_aatx+atx]/(nb_rb*12); - avg_rho_im[aarx][aatx*nb_aatx+atx] = 16*avg_rho_im[aarx][aatx*nb_aatx+atx]/(nb_rb*12); + //rho_nm = H_arx_n.conj(H_arx_m) + //rho_rx_corr[arx][nm] = |H_arx_n|^2.|H_arx_m|^2 &rho[aarx][aatx*nb_aatx+atx][symbol*nb_rb*12] + measurements->rx_correlation[0][aarx][aatx*nb_aatx+atx] = signal_energy(&rho[aarx][aatx*nb_aatx+atx][symbol*nb_rb*12],length); + //avg_rho_re[aarx][aatx*nb_aatx+atx] = 16*avg_rho_re[aarx][aatx*nb_aatx+atx]/length; + //avg_rho_im[aarx][aatx*nb_aatx+atx] = 16*avg_rho_im[aarx][aatx*nb_aatx+atx]/length; //printf("rho[rx]%d tx%d tx%d = Re: %d Im: %d\n",aarx, aatx,atx, avg_rho_re[aarx][aatx*nb_aatx+atx], avg_rho_im[aarx][aatx*nb_aatx+atx]); + //printf("rho_corr[rx]%d tx%d tx%d = %d ...\n",aarx, aatx,atx, measurements->rx_correlation[0][aarx][aatx*nb_aatx+atx]); } } } @@ -1691,310 +1597,22 @@ void nr_dlsch_channel_level_median(int **dl_ch_estimates_ext, } -static void nr_dlsch_dual_stream_correlation_core(int **dl_ch_estimates_ext, - int **dl_ch_estimates_ext_i, - int **dl_ch_rho_ext, - unsigned char n_tx, - unsigned char n_rx, - unsigned char output_shift, - int length, - int start_point) -{ -#if defined(__x86_64__)||defined(__i386__) - - __m128i *dl_ch128,*dl_ch128i,*dl_ch_rho128,mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3; - unsigned char aarx; - int ii, length2, length_mod8; - - - for (aarx=0; aarx>3; - - for (ii=0; ii1) { - - for (aatx=0; aatx>2; - - for (i=0; i>2; - - for (i=0; i>2; - - for (i=0; i>2; - - for (i=0; i1) { - - for (aatx=0; aatx>2; - - for (i=0; i>2; - - for (i=0; i>2; - - for (i=0; illr_offset[symbol], (int16_t*)pdsch_vars[gNB_id]->llr[0], pllr_symbol_cw0);*/ - - /*printf("compute LLRs [symbol %d] NbRB %d Qm %d LLRs-Length %d LLR-Offset %d @LLR Buff %p @LLR Buff(symb) %p\n", - symbol, - nb_rb,dlsch0_harq->Qm, - pdsch_vars[gNB_id]->llr_length[symbol], - pdsch_vars[gNB_id]->llr_offset[symbol], - pdsch_vars[gNB_id]->llr[0], - pllr_symbol_cw0);*/ switch (dlsch0_harq->Qm) { case 2 : @@ -3032,27 +2641,14 @@ static int nr_dlsch_llr(NR_UE_PDSCH **pdsch_vars, nb_rb, beamforming_mode); break; - case rx_IC_single_stream ://not implemented yet - /*nr_dlsch_qpsk_qpsk_llr(frame_parms, - pdsch_vars[gNB_id]->rxdataF_comp0, - rxdataF_comp_ptr, - pdsch_vars[gNB_id]->dl_ch_rho2_ext, - pdsch_vars[gNB_id]->layer_llr[0], - symbol,len,first_symbol_flag,nb_rb, - adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,2,nr_slot_rx,symbol), - pdsch_vars[gNB_id]->llr128);*/ + case rx_IC_single_stream ://From LTE Code!! + //not implemented yet break; - case rx_IC_dual_stream ://not implemented yet - /*nr_dlsch_qpsk_qpsk_llr(frame_parms, - rxdataF_comp_ptr, - pdsch_vars[gNB_id]->rxdataF_comp0, - pdsch_vars[gNB_id]->dl_ch_rho_ext[harq_pid][round], - pdsch_vars[gNB_id]->layer_llr[1], - symbol,len,first_symbol_flag,nb_rb, - adjust_G2(frame_parms,dlsch1_harq->rb_alloc_even,2,nr_slot_rx,symbol), - pdsch_vars[gNB_id]->llr128_2ndstream);*/ + case rx_IC_dual_stream : + //not implemented yet break; - case rx_SIC_dual_stream ://not implemented yet + case rx_SIC_dual_stream : + //not implemented yet break; } break; 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 3cb002f9e1..f2d470e81f 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h @@ -734,7 +734,7 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, @param n_dmrs_cdm_groups @param frame_parms Pointer to frame descriptor */ -unsigned short nr_dlsch_extract_rbs_multiple(int **rxdataF, +void nr_dlsch_extract_rbs(int **rxdataF, int **dl_ch_estimates, int **rxdataF_ext, int **dl_ch_estimates_ext, @@ -898,19 +898,6 @@ void nr_dlsch_detection_mrc(int **rxdataF_comp, unsigned short nb_rb, int length); -void nr_dlsch_detection_mrc_core(int **rxdataF_comp, - int **rxdataF_comp_i, - int **rho, - int **rho_i, - int **dl_ch_mag, - int **dl_ch_magb, - int **dl_ch_mag_i, - int **dl_ch_magb_i, - unsigned char n_tx, - unsigned char n_rx, - int length, - int start_point); - void det_HhH(int32_t *after_mf_00, int32_t *after_mf_01, int32_t *after_mf_10, diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 69978f5548..24f954aefe 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -184,7 +184,7 @@ typedef struct { //! estimated rssi (dBm) short rx_rssi_dBm[NUMBER_OF_CONNECTED_gNB_MAX]; //! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation) - int rx_correlation[NUMBER_OF_CONNECTED_gNB_MAX][4][4]; + int rx_correlation[NUMBER_OF_CONNECTED_gNB_MAX][NB_ANTENNAS_RX][NR_MAX_NB_LAYERS*NR_MAX_NB_LAYERS];// //! estimated correlation (wideband dB) between spatial channels (computed in dlsch_demodulation) int rx_correlation_dB[NUMBER_OF_CONNECTED_gNB_MAX][2]; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf index f7e6b71040..b682f130b1 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf @@ -216,11 +216,11 @@ RUs = ( ## beamforming 1x4 matrix: 1 layer x 4 antennas #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; ## beamforming 2x2 matrix: - # bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + #bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; ## beamforming 2x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000]; ## beamforming 4x4 matrix: - bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; + bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; clock_src = "external"; } From 8381cba16dd7a04b743b6b71880d39c379caca20 Mon Sep 17 00:00:00 2001 From: sfn Date: Sun, 9 Jan 2022 21:59:45 +0100 Subject: [PATCH 10/67] re-implement zero forcing rx for dlsch --- .../NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 1021 ++++++++--------- 1 file changed, 503 insertions(+), 518 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 16f2310041..2db09e2380 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -82,18 +82,21 @@ unsigned char offset_mumimo_llr_drange[29][3]={{8,8,8},{7,7,7},{7,7,7},{7,7,7},{ #define print_ints(s,x) printf("%s = %d %d %d %d\n",s,(x)[0],(x)[1],(x)[2],(x)[3]) #define print_shorts(s,x) printf("%s = [%d+j*%d, %d+j*%d, %d+j*%d, %d+j*%d]\n",s,(x)[0],(x)[1],(x)[2],(x)[3],(x)[4],(x)[5],(x)[6],(x)[7]) -uint8_t nr_zero_forcing_rx_2layers(int **rxdataF_comp, +/* compute H_h_H matrix inversion up to 4x4 matrices */ +uint8_t nr_zero_forcing_rx(int **rxdataF_comp, int **dl_ch_mag, int **dl_ch_magb, int **dl_ch_magr, int **dl_ch_estimates_ext, unsigned short nb_rb, unsigned char n_rx, + unsigned char n_tx,//number of layer unsigned char mod_order, int shift, unsigned char symbol, int length); +/* Apply layer demapping */ static void nr_dlsch_layer_demapping(int16_t **llr_cw, uint8_t Nl, uint8_t mod_order, @@ -102,7 +105,6 @@ static void nr_dlsch_layer_demapping(int16_t **llr_cw, int32_t codeword_TB1, int16_t **llr_layers); - /* compute LLR */ static int nr_dlsch_llr(NR_UE_PDSCH **pdsch_vars, NR_DL_FRAME_PARMS *frame_parms, @@ -450,14 +452,15 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, symbol, nb_rb_pdsch, nb_re_pdsch); - if (n_tx == 2)//Apply zero forcing for 2 Tx layers - nr_zero_forcing_rx_2layers(pdsch_vars[gNB_id]->rxdataF_comp0, + if (n_tx >= 2)//Apply zero forcing for 2, 3, and 4 Tx layers + nr_zero_forcing_rx(pdsch_vars[gNB_id]->rxdataF_comp0, pdsch_vars[gNB_id]->dl_ch_mag0, pdsch_vars[gNB_id]->dl_ch_magb0, pdsch_vars[gNB_id]->dl_ch_magr0, pdsch_vars[gNB_id]->dl_ch_estimates_ext, nb_rb_pdsch, n_rx, + n_tx, dlsch0_harq->Qm, pdsch_vars[gNB_id]->log2_maxh, symbol, @@ -1860,67 +1863,278 @@ void nr_dlsch_detection_mrc(int **rxdataF_comp, #endif } -/* Zero Forcing Rx function: nr_det_HhH() - * +/* Zero Forcing Rx function: nr_det_2x2() + * Compute the Matrix determinant for 2x2 * * */ -void nr_det_HhH(int32_t *after_mf_00,//a - int32_t *after_mf_01,//b - int32_t *after_mf_10,//c - int32_t *after_mf_11,//d - int32_t *det_fin,//1/ad-bc +void nr_det_2x2(int32_t *a,//a + int32_t *b,//b + int32_t *c,//c + int32_t *d,//d + int32_t *ad_bc,//ad-bc unsigned short nb_rb, - unsigned char symbol, - int32_t shift) + int32_t sign, + int32_t shift0) { int16_t nr_conjug2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1} ; unsigned short rb; - __m128i *after_mf_00_128,*after_mf_01_128, *after_mf_10_128, *after_mf_11_128, ad_re_128, bc_re_128; //ad_im_128, bc_im_128; - __m128i *det_fin_128, det_re_128; //det_im_128, tmp_det0, tmp_det1; + __m128i *a_128,*b_128, *c_128, *d_128, ad_re_128, bc_re_128, ad_im_128, bc_im_128; + __m128i *ad_bc_128, det_re_128, det_im_128, tmp_det0, tmp_det1; - after_mf_00_128 = (__m128i *)after_mf_00; - after_mf_01_128 = (__m128i *)after_mf_01; - after_mf_10_128 = (__m128i *)after_mf_10; - after_mf_11_128 = (__m128i *)after_mf_11; + a_128 = (__m128i *)a; + b_128 = (__m128i *)b; + c_128 = (__m128i *)c; + d_128 = (__m128i *)d; - det_fin_128 = (__m128i *)det_fin; + ad_bc_128 = (__m128i *)ad_bc; for (rb=0; rb<3*nb_rb; rb++) { //complex multiplication (I_a+jQ_a)(I_d+jQ_d) = (I_aI_d - Q_aQ_d) + j(Q_aI_d + I_aQ_d) - //The imag part is often zero, we compute only the real part - ad_re_128 = _mm_sign_epi16(after_mf_00_128[0],*(__m128i*)&nr_conjug2[0]); - ad_re_128 = _mm_madd_epi16(ad_re_128,after_mf_11_128[0]); //Re: I_a0*I_d0 - Q_a1*Q_d1 - //ad_im_128 = _mm_shufflelo_epi16(after_mf_00_128[0],_MM_SHUFFLE(2,3,0,1));//permutes IQs for the low 64 bits as [I_a0 Q_a1 I_a2 Q_a3]_64bits to [Q_a1 I_a0 Q_a3 I_a2]_64bits - //ad_im_128 = _mm_shufflehi_epi16(ad_im_128,_MM_SHUFFLE(2,3,0,1));//permutes IQs for the high 64 bits as [I_a0 Q_a1 I_a2 Q_a3]_64bits to [Q_a1 I_a0 Q_a3 I_a2]_64bits - //ad_im_128 = _mm_madd_epi16(ad_im_128,after_mf_11_128[0]);//Im: (Q_aI_d + I_aQ_d) + //The real part + ad_re_128 = _mm_sign_epi16(a_128[0],*(__m128i*)&nr_conjug2[0]); + ad_re_128 = _mm_madd_epi16(ad_re_128,d_128[0]); //Re: I_a0*I_d0 - Q_a1*Q_d1 + //The Imag part + ad_im_128 = _mm_shufflelo_epi16(a_128[0],_MM_SHUFFLE(2,3,0,1));//permutes IQs for the low 64 bits as [I_a0 Q_a1 I_a2 Q_a3]_64bits to [Q_a1 I_a0 Q_a3 I_a2]_64bits + ad_im_128 = _mm_shufflehi_epi16(ad_im_128,_MM_SHUFFLE(2,3,0,1));//permutes IQs for the high 64 bits as [I_a0 Q_a1 I_a2 Q_a3]_64bits to [Q_a1 I_a0 Q_a3 I_a2]_64bits + ad_im_128 = _mm_madd_epi16(ad_im_128,d_128[0]);//Im: (Q_aI_d + I_aQ_d) //complex multiplication (I_b+jQ_b)(I_c+jQ_c) = (I_bI_c - Q_bQ_c) + j(Q_bI_c + I_bQ_c) - //The imag part is often zero, we compute only the real part - bc_re_128 = _mm_sign_epi16(after_mf_01_128[0],*(__m128i*)&nr_conjug2[0]); - bc_re_128 = _mm_madd_epi16(bc_re_128,after_mf_10_128[0]); //Re: I_b0*I_c0 - Q_b1*Q_c1 - //bc_im_128 = _mm_shufflelo_epi16(after_mf_01_128[0],_MM_SHUFFLE(2,3,0,1));//permutes IQs for the low 64 bits as [I_b0 Q_b1 I_b2 Q_b3]_64bits to [Q_b1 I_b0 Q_b3 I_b2]_64bits - //bc_im_128 = _mm_shufflehi_epi16(bc_im_128,_MM_SHUFFLE(2,3,0,1));//permutes IQs for the high 64 bits as [I_b0 Q_b1 I_b2 Q_b3]_64bits to [Q_b1 I_b0 Q_b3 I_b2]_64bits - //bc_im_128 = _mm_madd_epi16(bc_im_128,after_mf_10_128[0]);//Im: (Q_bI_c + I_bQ_c) + //The real part + bc_re_128 = _mm_sign_epi16(b_128[0],*(__m128i*)&nr_conjug2[0]); + bc_re_128 = _mm_madd_epi16(bc_re_128,c_128[0]); //Re: I_b0*I_c0 - Q_b1*Q_c1 + //The imag part + bc_im_128 = _mm_shufflelo_epi16(b_128[0],_MM_SHUFFLE(2,3,0,1));//permutes IQs for the low 64 bits as [I_b0 Q_b1 I_b2 Q_b3]_64bits to [Q_b1 I_b0 Q_b3 I_b2]_64bits + bc_im_128 = _mm_shufflehi_epi16(bc_im_128,_MM_SHUFFLE(2,3,0,1));//permutes IQs for the high 64 bits as [I_b0 Q_b1 I_b2 Q_b3]_64bits to [Q_b1 I_b0 Q_b3 I_b2]_64bits + bc_im_128 = _mm_madd_epi16(bc_im_128,c_128[0]);//Im: (Q_bI_c + I_bQ_c) - det_re_128 = _mm_sub_epi32(ad_re_128, bc_re_128); - //det_im_128 = _mm_sub_epi32(ad_im_128, bc_im_128); + if (sign>0){ + det_re_128 = _mm_sub_epi32(ad_re_128, bc_re_128); + det_im_128 = _mm_sub_epi32(ad_im_128, bc_im_128); + }else{ + det_re_128 = _mm_sub_epi32(bc_re_128,ad_re_128); + det_im_128 = _mm_sub_epi32(bc_im_128,ad_im_128); + } + //convert back to Q15 before packing + det_re_128 = _mm_srai_epi32(det_re_128,shift0); + det_im_128 = _mm_srai_epi32(det_im_128,shift0); - //det in Q30 format - det_fin_128[0] = _mm_abs_epi32(det_re_128); + tmp_det0 = _mm_unpacklo_epi32(det_re_128,det_im_128); + //print_ints("unpack lo:",&tmp_det0[0]); + tmp_det1 = _mm_unpackhi_epi32(det_re_128,det_im_128); + //print_ints("unpack hi:",&tmp_det1[0]); + ad_bc_128[0] = _mm_packs_epi32(tmp_det0,tmp_det1); #ifdef DEBUG_DLSCH_DEMOD - printf("\n Computing det_HhH_inv \n"); + printf("\n Computing det_2x2 \n"); //print_ints("det_re_128:",(int32_t*)&det_re_128); //print_ints("det_im_128:",(int32_t*)&det_im_128); - print_ints("det_fin_128:",(int32_t*)&det_fin_128[0]); + print_shorts("ad-bc_128:",(int32_t*)&ad_bc_128[0]); #endif - det_fin_128+=1; - after_mf_00_128+=1; - after_mf_01_128+=1; - after_mf_10_128+=1; - after_mf_11_128+=1; + ad_bc_128+=1; + a_128+=1; + b_128+=1; + c_128+=1; + d_128+=1; + } + _mm_empty(); + _m_empty(); +} + +/* Zero Forcing Rx function: nr_a_mult_b() + * Compute the complex Multiplication c=a*b + * + * */ +void nr_a_mult_b(int *a, + int *b, + int32_t *c, + unsigned short nb_rb, + unsigned char output_shift0) +{ + //This function is used to compute complex multiplications + short nr_conjugate[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1}; + unsigned short rb; + __m128i *a_128,*b_128, *c_128, mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3; + + a_128 = (__m128i *)a; + b_128 = (__m128i *)b; + + c_128 = (__m128i *)c; + + for (rb=0; rb<3*nb_rb; rb++) { + // the real part + mmtmpD0 = _mm_sign_epi16(a_128[0],*(__m128i*)&nr_conjugate[0]); + mmtmpD0 = _mm_madd_epi16(mmtmpD0,b_128[0]); //Re: (a_re*b_re - a_im*b_im) + + // the imag part + mmtmpD1 = _mm_shufflelo_epi16(a_128[0],_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_madd_epi16(mmtmpD1,b_128[0]);//Im: (x_im*y_re + x_re*y_im) + + mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift0); + mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift0); + mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1); + mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); + + c_128[0] = _mm_packs_epi32(mmtmpD2,mmtmpD3); + + /*printf("\n Computing mult \n"); + print_shorts("a:",(int16_t*)&a_128[0]); + print_shorts("b:",(int16_t*)&b_128[0]); + print_shorts("pack:",(int16_t*)&c_128[0]);*/ + + a_128+=1; + b_128+=1; + c_128+=1; + } + _mm_empty(); + _m_empty(); +} + +/* Zero Forcing Rx function: nr_det_3x3() + * Compute the matrix determinant for 3x3 + * + * */ +void nr_det_3x3(int32_t *a11,// + int32_t *a12,// + int32_t *a13,// + int32_t *a21,// + int32_t *a22,// + int32_t *a23,// + int32_t *a31,// + int32_t *a32,// + int32_t *a33,// + int32_t *ad_bc,//ad-bc + unsigned short nb_rb, + int32_t sign, + int32_t shift0){ + int32_t outtemp[12*nb_rb] __attribute__((aligned(32))); + int32_t out1[12*nb_rb] __attribute__((aligned(32))); + int32_t out2[12*nb_rb] __attribute__((aligned(32))); + int32_t out3[12*nb_rb] __attribute__((aligned(32))); + + //a11 + nr_det_2x2(a22,//a + a23,//b + a32,//c + a33,//d + outtemp,//ad-bc + nb_rb, + +1, + shift0); + nr_a_mult_b(a11, + outtemp, + out1, + nb_rb, + shift0); + //a12 + nr_det_2x2(a21,//a + a23,//b + a31,//c + a33,//d + outtemp,//ad-bc + nb_rb, + -1, + shift0); + nr_a_mult_b(a12, + outtemp, + out2, + nb_rb, + shift0); + //a13 + nr_det_2x2(a21,//a + a22,//b + a31,//c + a32,//d + outtemp,//ad-bc + nb_rb, + +1, + shift0); + nr_a_mult_b(a13, + outtemp, + out3, + nb_rb, + shift0); + + __m128i *out1_128,*out2_128,*out3_128,*det_128; + + out1_128 = (__m128i *)out1; + out2_128 = (__m128i *)out2; + out3_128 = (__m128i *)out3; + det_128 = (__m128i *)ad_bc; + + for (int rb=0; rb<3*nb_rb; rb++) { + det_128[0] = _mm_adds_epi16(out1_128[0],out2_128[0]); + det_128[0] = _mm_adds_epi16(det_128[0],out3_128[0]); + out1_128+=1; + out2_128+=1; + out3_128+=1; + det_128+=1; + } + _mm_empty(); + _m_empty(); +} + +/* Zero Forcing Rx function: nr_element_sign() + * Compute b=sign*a + * + * */ +void nr_element_sign(int32_t *a,//a + int32_t *b,//b + unsigned short nb_rb, + int32_t sign) +{ + int16_t nr_sign[8]__attribute__((aligned(16))) = {-1,-1,-1,-1,-1,-1,-1,-1} ; + unsigned short rb; + __m128i *a_128,*b_128; + + a_128 = (__m128i *)a; + b_128 = (__m128i *)b; + + for (rb=0; rb<3*nb_rb; rb++) { + + if (sign < 0) + b_128[0] = _mm_sign_epi16(a_128[0],*(__m128i*)&nr_sign[0]); + else + b_128[0] = a_128[0]; + +#ifdef DEBUG_DLSCH_DEMOD + printf("\n Out \n"); + //print_ints("det_re_128:",(int32_t*)&det_re_128); + //print_ints("det_im_128:",(int32_t*)&det_im_128); + print_shorts("b:",(int32_t*)&b_128[0]); +#endif + a_128+=1; + b_128+=1; + } + _mm_empty(); + _m_empty(); +} + +/* Zero Forcing Rx function: nr_construct_HhH_elements() + * + * + * */ +void nr_construct_HhH_elements(int **conjH_H_elements, + unsigned char n_rx, + unsigned short nb_rb) +{ + //This function is used to construct the (H_hermitian * H matrix) matrix elements + unsigned short rb; + __m128i *conjH_H_elements_0_128, *conjH_H_elements_aarx_128; + + + for (rb=0; rb<3*nb_rb; rb++) { + conjH_H_elements_0_128 = (__m128i *)&conjH_H_elements[0][rb*4]; + for (int aarx=1;aarx>2); - //printf("det_%d = %d log2 =%d \n",k,(((int *)&det[0])[k]),log2_approx(((int *)&det[0])[k])); - } - - xy_re_128 = _mm_slli_epi32(xy_re_128,5); - xy_re_128 = _mm_srai_epi32(xy_re_128,log2_approx(sum_det)); - xy_re_128 = _mm_slli_epi32(xy_re_128,5); - - xy_im_128 = _mm_slli_epi32(xy_im_128,5); - xy_im_128 = _mm_srai_epi32(xy_im_128,log2_approx(sum_det)); - xy_im_128 = _mm_slli_epi32(xy_im_128,5); - + +//convert back to Q15 before packing + xy_re_128 = _mm_srai_epi32(xy_re_128,output_shift0); + xy_im_128 = _mm_srai_epi32(xy_im_128,output_shift0); + tmp_z0 = _mm_unpacklo_epi32(xy_re_128,xy_im_128); //print_ints("unpack lo:",&tmp_z0[0]); tmp_z1 = _mm_unpackhi_epi32(xy_re_128,xy_im_128); @@ -2071,486 +2276,266 @@ __m128i nr_comp_muli_sum(__m128i input_x, _m_empty(); return(output); } -/* Zero Forcing Rx function: nr_construct_HhH_elements() + +/* Zero Forcing Rx function: up to 4 layers * * * */ -void nr_construct_HhH_elements(int *conjch00_ch00, - int *conjch01_ch01, - int *conjch11_ch11, - int *conjch10_ch10,// - int *conjch20_ch20, - int *conjch21_ch21, - int *conjch30_ch30, - int *conjch31_ch31, - int *conjch00_ch01,//00_01 - int *conjch01_ch00,//01_00 - int *conjch10_ch11,//10_11 - int *conjch11_ch10,//11_10 - int *conjch20_ch21, - int *conjch21_ch20, - int *conjch30_ch31, - int *conjch31_ch30, - int32_t *after_mf_00, - int32_t *after_mf_01, - int32_t *after_mf_10, - int32_t *after_mf_11, - unsigned short nb_rb, - unsigned char symbol) -{ - //This function is used to construct the (H_hermitian * H matrix) matrix elements - unsigned short rb; - __m128i *conjch00_ch00_128, *conjch01_ch01_128, *conjch11_ch11_128, *conjch10_ch10_128; - __m128i *conjch20_ch20_128, *conjch21_ch21_128, *conjch30_ch30_128, *conjch31_ch31_128; - __m128i *conjch00_ch01_128, *conjch01_ch00_128, *conjch10_ch11_128, *conjch11_ch10_128; - __m128i *conjch20_ch21_128, *conjch21_ch20_128, *conjch30_ch31_128, *conjch31_ch30_128; - __m128i *after_mf_00_128, *after_mf_01_128, *after_mf_10_128, *after_mf_11_128; - - conjch00_ch00_128 = (__m128i *)conjch00_ch00; - conjch01_ch01_128 = (__m128i *)conjch01_ch01; - conjch11_ch11_128 = (__m128i *)conjch11_ch11; - conjch10_ch10_128 = (__m128i *)conjch10_ch10; - - conjch20_ch20_128 = (__m128i *)conjch20_ch20; - conjch21_ch21_128 = (__m128i *)conjch21_ch21; - conjch30_ch30_128 = (__m128i *)conjch30_ch30; - conjch31_ch31_128 = (__m128i *)conjch31_ch31; - - conjch00_ch01_128 = (__m128i *)conjch00_ch01; - conjch01_ch00_128 = (__m128i *)conjch01_ch00; - conjch10_ch11_128 = (__m128i *)conjch10_ch11; - conjch11_ch10_128 = (__m128i *)conjch11_ch10; - - conjch20_ch21_128 = (__m128i *)conjch20_ch21; - conjch21_ch20_128 = (__m128i *)conjch21_ch20; - conjch30_ch31_128 = (__m128i *)conjch30_ch31; - conjch31_ch30_128 = (__m128i *)conjch31_ch30; - - after_mf_00_128 = (__m128i *)after_mf_00; - after_mf_01_128 = (__m128i *)after_mf_01; - after_mf_10_128 = (__m128i *)after_mf_10; - after_mf_11_128 = (__m128i *)after_mf_11; - - for (rb=0; rb<3*nb_rb; rb++) { - - after_mf_00_128[0] =_mm_adds_epi16(conjch00_ch00_128[0],conjch10_ch10_128[0]);//00_00 + 10_10 - if (conjch20_ch20 != NULL) after_mf_00_128[0] =_mm_adds_epi16(after_mf_00_128[0],conjch20_ch20_128[0]); - if (conjch30_ch30 != NULL) after_mf_00_128[0] =_mm_adds_epi16(after_mf_00_128[0],conjch30_ch30_128[0]); - - after_mf_11_128[0] =_mm_adds_epi16(conjch01_ch01_128[0], conjch11_ch11_128[0]); //01_01 + 11_11 - if (conjch21_ch21 != NULL) after_mf_11_128[0] =_mm_adds_epi16(after_mf_11_128[0],conjch21_ch21_128[0]); - if (conjch31_ch31 != NULL) after_mf_11_128[0] =_mm_adds_epi16(after_mf_11_128[0],conjch31_ch31_128[0]); - - after_mf_01_128[0] =_mm_adds_epi16(conjch00_ch01_128[0], conjch10_ch11_128[0]);//00_01 + 10_11 - if (conjch20_ch21 != NULL) after_mf_01_128[0] =_mm_adds_epi16(after_mf_01_128[0],conjch20_ch21_128[0]); - if (conjch30_ch31 != NULL) after_mf_01_128[0] =_mm_adds_epi16(after_mf_01_128[0],conjch30_ch31_128[0]); - - after_mf_10_128[0] =_mm_adds_epi16(conjch01_ch00_128[0], conjch11_ch10_128[0]);//01_00 + 11_10 - if (conjch21_ch20 != NULL) after_mf_10_128[0] =_mm_adds_epi16(after_mf_10_128[0],conjch21_ch20_128[0]); - if (conjch31_ch30 != NULL) after_mf_10_128[0] =_mm_adds_epi16(after_mf_10_128[0],conjch31_ch30_128[0]); - -#ifdef DEBUG_DLSCH_DEMOD - if ((rb<=30)) - { - printf(" \n construct_HhH_elements \n"); - print_shorts("after_mf_00_128:",(int16_t*)&after_mf_00_128[0]); - print_shorts("after_mf_01_128:",(int16_t*)&after_mf_01_128[0]); - print_shorts("after_mf_10_128:",(int16_t*)&after_mf_10_128[0]); - print_shorts("after_mf_11_128:",(int16_t*)&after_mf_11_128[0]); - } -#endif - conjch00_ch00_128+=1; - conjch10_ch10_128+=1; - conjch01_ch01_128+=1; - conjch11_ch11_128+=1; - - if (conjch20_ch20 != NULL) conjch20_ch20_128+=1; - if (conjch21_ch21 != NULL) conjch21_ch21_128+=1; - if (conjch30_ch30 != NULL) conjch30_ch30_128+=1; - if (conjch31_ch31 != NULL) conjch31_ch31_128+=1; - - conjch00_ch01_128+=1; - conjch01_ch00_128+=1; - conjch10_ch11_128+=1; - conjch11_ch10_128+=1; - - if (conjch20_ch21 != NULL) conjch20_ch21_128+=1; - if (conjch21_ch20 != NULL) conjch21_ch20_128+=1; - if (conjch30_ch31 != NULL) conjch30_ch31_128+=1; - if (conjch31_ch30 != NULL) conjch31_ch30_128+=1; - - after_mf_00_128 += 1; - after_mf_01_128 += 1; - after_mf_10_128 += 1; - after_mf_11_128 += 1; - } - _mm_empty(); - _m_empty(); -} - -/* Zero Forcing Rx function: nr_zero_forcing_rx_2layers() - * - * - * */ -uint8_t nr_zero_forcing_rx_2layers(int **rxdataF_comp, +uint8_t nr_zero_forcing_rx(int **rxdataF_comp, int **dl_ch_mag, int **dl_ch_magb, int **dl_ch_magr, int **dl_ch_estimates_ext, unsigned short nb_rb, unsigned char n_rx, + unsigned char n_tx,//number of layer unsigned char mod_order, int shift, unsigned char symbol, int length) { - int *ch00, *ch01, *ch10, *ch11; - int *ch20, *ch30, *ch21, *ch31; - uint32_t nb_rb_0 = length/12 + ((length%12)?1:0); - /* we need at least alignment to 16 bytes, let's put 32 to be sure - * (maybe not necessary but doesn't hurt) - */ - int32_t conjch00_ch01[12*nb_rb] __attribute__((aligned(32))); - int32_t conjch01_ch00[12*nb_rb] __attribute__((aligned(32))); - int32_t conjch10_ch11[12*nb_rb] __attribute__((aligned(32))); - int32_t conjch11_ch10[12*nb_rb] __attribute__((aligned(32))); - int32_t conjch00_ch00[12*nb_rb] __attribute__((aligned(32))); - int32_t conjch01_ch01[12*nb_rb] __attribute__((aligned(32))); - int32_t conjch10_ch10[12*nb_rb] __attribute__((aligned(32))); - int32_t conjch11_ch11[12*nb_rb] __attribute__((aligned(32))); - int32_t conjch20_ch20[12*nb_rb] __attribute__((aligned(32))); - int32_t conjch21_ch21[12*nb_rb] __attribute__((aligned(32))); - int32_t conjch30_ch30[12*nb_rb] __attribute__((aligned(32))); - int32_t conjch31_ch31[12*nb_rb] __attribute__((aligned(32))); - int32_t conjch20_ch21[12*nb_rb] __attribute__((aligned(32))); - int32_t conjch30_ch31[12*nb_rb] __attribute__((aligned(32))); - int32_t conjch21_ch20[12*nb_rb] __attribute__((aligned(32))); - int32_t conjch31_ch30[12*nb_rb] __attribute__((aligned(32))); - - int32_t af_mf_00[12*nb_rb] __attribute__((aligned(32))); - int32_t af_mf_01[12*nb_rb] __attribute__((aligned(32))); - int32_t af_mf_10[12*nb_rb] __attribute__((aligned(32))); - int32_t af_mf_11[12*nb_rb] __attribute__((aligned(32))); + int *ch0r, *ch0c; int32_t determ_fin[12*nb_rb] __attribute__((aligned(32))); - switch (n_rx) { - case 2:// - ch00 = (int *)&dl_ch_estimates_ext[0][symbol*nb_rb*12]; - ch01 = (int *)&dl_ch_estimates_ext[2][symbol*nb_rb*12]; - ch10 = (int *)&dl_ch_estimates_ext[1][symbol*nb_rb*12]; - ch11 = (int *)&dl_ch_estimates_ext[3][symbol*nb_rb*12]; - ch20 = NULL; - ch21 = NULL; - ch30 = NULL; - ch31 = NULL; - break; + int32_t *** conjH_H_elements; - case 4:// - ch00 = (int *)&dl_ch_estimates_ext[0][symbol*nb_rb*12]; - ch01 = (int *)&dl_ch_estimates_ext[4][symbol*nb_rb*12]; - ch10 = (int *)&dl_ch_estimates_ext[1][symbol*nb_rb*12]; - ch11 = (int *)&dl_ch_estimates_ext[5][symbol*nb_rb*12]; - ch20 = (int *)&dl_ch_estimates_ext[2][symbol*nb_rb*12]; - ch21 = (int *)&dl_ch_estimates_ext[6][symbol*nb_rb*12]; - ch30 = (int *)&dl_ch_estimates_ext[3][symbol*nb_rb*12]; - ch31 = (int *)&dl_ch_estimates_ext[7][symbol*nb_rb*12]; - break; + uint32_t nb_rb_0 = length/12 + ((length%12)?1:0); - default: - return -1; - break; - } - - /* 1- Compute the rx channel matrix after compensation: (1/2^log2_max)x(H_herm x H) - * for n_rx = 2 - * |conj_H_00 conj_H_10| | H_00 H_01| |(conj_H_00xH_00+conj_H_10xH_10) (conj_H_00xH_01+conj_H_10xH_11)| - * | | x | | = | | - * |conj_H_01 conj_H_11| | H_10 H_11| |(conj_H_01xH_00+conj_H_11xH_10) (conj_H_01xH_01+conj_H_11xH_11)| - * - */ - - if (n_rx>=2){ - // (1/2^log2_maxh)*conj_H_00xH_00: (1/(64*2))conjH_00*H_00*2^15 - nr_conjch0_mult_ch1(ch00, - ch00, - conjch00_ch00, - nb_rb_0, - shift); - // (1/2^log2_maxh)*conj_H_10xH_10: (1/(64*2))conjH_10*H_10*2^15 - nr_conjch0_mult_ch1(ch10, - ch10, - conjch10_ch10, - nb_rb_0, - shift); - // conj_H_00xH_01 - nr_conjch0_mult_ch1(ch00, - ch01, - conjch00_ch01, - nb_rb_0, - shift); // this shift is equal to the channel level log2_maxh - // conj_H_10xH_11 - nr_conjch0_mult_ch1(ch10, - ch11, - conjch10_ch11, - nb_rb_0, - shift); - // conj_H_01xH_01 - nr_conjch0_mult_ch1(ch01, - ch01, - conjch01_ch01, - nb_rb_0, - shift); - // conj_H_11xH_11 - nr_conjch0_mult_ch1(ch11, - ch11, - conjch11_ch11, - nb_rb_0, - shift); - // conj_H_01xH_00 - nr_conjch0_mult_ch1(ch01, - ch00, - conjch01_ch00, - nb_rb_0, - shift); - // conj_H_11xH_10 - nr_conjch0_mult_ch1(ch11, - ch10, - conjch11_ch10, - nb_rb_0, - shift); - } - if (n_rx==4){ - // (1/2^log2_maxh)*conj_H_20xH_20: (1/(64*2*16))conjH_20*H_20*2^15 - nr_conjch0_mult_ch1(ch20, - ch20, - conjch20_ch20, - nb_rb_0, - shift); - - // (1/2^log2_maxh)*conj_H_30xH_30: (1/(64*2*4))conjH_30*H_30*2^15 - nr_conjch0_mult_ch1(ch30, - ch30, - conjch30_ch30, - nb_rb_0, - shift); - - // (1/2^log2_maxh)*conj_H_20xH_20: (1/(64*2))conjH_20*H_20*2^15 - nr_conjch0_mult_ch1(ch20, - ch21, - conjch20_ch21, - nb_rb_0, - shift); - - nr_conjch0_mult_ch1(ch30, - ch31, - conjch30_ch31, - nb_rb_0, - shift); - - nr_conjch0_mult_ch1(ch21, - ch21, - conjch21_ch21, - nb_rb_0, - shift); - - nr_conjch0_mult_ch1(ch31, - ch31, - conjch31_ch31, - nb_rb_0, - shift); - - // (1/2^log2_maxh)*conj_H_20xH_20: (1/(64*2))conjH_20*H_20*2^15 - nr_conjch0_mult_ch1(ch21, - ch20, - conjch21_ch20, - nb_rb_0, - shift); - - nr_conjch0_mult_ch1(ch31, - ch30, - conjch31_ch30, - nb_rb_0, - shift); - - nr_construct_HhH_elements(conjch00_ch00, - conjch01_ch01, - conjch11_ch11, - conjch10_ch10,// - conjch20_ch20, - conjch21_ch21, - conjch30_ch30, - conjch31_ch31, - conjch00_ch01, - conjch01_ch00, - conjch10_ch11, - conjch11_ch10,// - conjch20_ch21, - conjch21_ch20, - conjch30_ch31, - conjch31_ch30, - af_mf_00, - af_mf_01, - af_mf_10, - af_mf_11, - nb_rb_0, - symbol); - } - if (n_rx==2){ - nr_construct_HhH_elements(conjch00_ch00, - conjch01_ch01, - conjch11_ch11, - conjch10_ch10,// - NULL, - NULL, - NULL, - NULL, - conjch00_ch01, - conjch01_ch00, - conjch10_ch11, - conjch11_ch10,// - NULL, - NULL, - NULL, - NULL, - af_mf_00, - af_mf_01, - af_mf_10, - af_mf_11, - nb_rb_0, - symbol); - } - //det_HhH = ad -bc - nr_det_HhH(af_mf_00,//a - af_mf_01,//b - af_mf_10,//c - af_mf_11,//d - determ_fin, - nb_rb_0, - symbol, - shift); - /* 2- Compute the channel matrix inversion ********************************** - * - * |(conj_H_00xH_00+conj_H_10xH_10) (conj_H_00xH_01+conj_H_10xH_11)| - * A= | | - * |(conj_H_01xH_00+conj_H_11xH_10) (conj_H_01xH_01+conj_H_11xH_11)| - * - * - * - *inv(A) =(1/det)*[d -b - * -c a] - * - * - **************************************************************************/ - __m128i *rxdataF_comp128_0,*rxdataF_comp128_1,*dl_ch_mag128_0=NULL,*dl_ch_mag128b_0=NULL,*dl_ch_mag128r_0=NULL,*determ_fin_128;//*dl_ch_mag128_1,*dl_ch_mag128b_1,*dl_ch_mag128r_1 - __m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3; - __m128i *after_mf_a_128,*after_mf_b_128, *after_mf_c_128, *after_mf_d_128; - __m128i QAM_amp128={0},QAM_amp128b={0},QAM_amp128r={0}; - - determ_fin_128 = (__m128i *)&determ_fin[0]; - - rxdataF_comp128_0 = (__m128i *)&rxdataF_comp[0][symbol*nb_rb*12];//aatx=0 @ aarx =0 - rxdataF_comp128_1 = (__m128i *)&rxdataF_comp[n_rx][symbol*nb_rb*12];//aatx=1 @ aarx =0 - - after_mf_a_128 = (__m128i *)af_mf_00; - after_mf_b_128 = (__m128i *)af_mf_01; - after_mf_c_128 = (__m128i *)af_mf_10; - after_mf_d_128 = (__m128i *)af_mf_11; - - if (mod_order>2) { - if (mod_order == 4) { - QAM_amp128 = _mm_set1_epi16(QAM16_n1); //2/sqrt(10) - QAM_amp128b = _mm_setzero_si128(); - QAM_amp128r = _mm_setzero_si128(); - } else if (mod_order == 6) { - QAM_amp128 = _mm_set1_epi16(QAM64_n1); //4/sqrt{42} - QAM_amp128b = _mm_set1_epi16(QAM64_n2); //2/sqrt{42} - QAM_amp128r = _mm_setzero_si128(); - } else if (mod_order == 8) { - QAM_amp128 = _mm_set1_epi16(QAM256_n1); //8/sqrt{170} - QAM_amp128b = _mm_set1_epi16(QAM256_n2);//4/sqrt{170} - QAM_amp128r = _mm_set1_epi16(QAM256_n3);//2/sqrt{170} + //Allocate H^*H matrix elements and sub elements + conjH_H_elements = (int32_t ***)malloc16_clear( n_tx*n_tx*sizeof(int32_t **) ); + for (int rtx=0;rtx2) { - int sum_det =0; - for (int k=0; k<4;k++) { - sum_det += ((((int *)&determ_fin_128[0])[k])>>2); - //printf("det_%d = %d\n",k,sum_det); - } - - mmtmpD2 = _mm_slli_epi32(determ_fin_128[0],5); - mmtmpD2 = _mm_srai_epi32(mmtmpD2,log2_approx(sum_det)); - mmtmpD2 = _mm_slli_epi32(mmtmpD2,5); - - mmtmpD3 = _mm_unpacklo_epi32(mmtmpD2,mmtmpD2); - - mmtmpD2 = _mm_unpackhi_epi32(mmtmpD2,mmtmpD2); - - mmtmpD2 = _mm_packs_epi32(mmtmpD3,mmtmpD2); - - dl_ch_mag128_0[0] = mmtmpD2; - dl_ch_mag128b_0[0] = mmtmpD2; - dl_ch_mag128r_0[0] = mmtmpD2; - - dl_ch_mag128_0[0] = _mm_mulhi_epi16(dl_ch_mag128_0[0],QAM_amp128); - dl_ch_mag128_0[0] = _mm_slli_epi16(dl_ch_mag128_0[0],1); - - dl_ch_mag128b_0[0] = _mm_mulhi_epi16(dl_ch_mag128b_0[0],QAM_amp128b); - dl_ch_mag128b_0[0] = _mm_slli_epi16(dl_ch_mag128b_0[0],1); - - dl_ch_mag128r_0[0] = _mm_mulhi_epi16(dl_ch_mag128r_0[0],QAM_amp128r); - dl_ch_mag128r_0[0] = _mm_slli_epi16(dl_ch_mag128r_0[0],1); - - //print_shorts("mag layer 1:",(int16_t*)&dl_ch_mag128_0[0]); - //print_shorts("mag layer 2:",(int16_t*)&dl_ch_mag128_1[0]); - //print_shorts("magb layer 1:",(int16_t*)&dl_ch_mag128b_0[0]); - //print_shorts("magb layer 2:",(int16_t*)&dl_ch_mag128b_1[0]); - //print_shorts("magr layer 1:",(int16_t*)&dl_ch_mag128r_0[0]); - //print_shorts("magr layer 2:",(int16_t*)&dl_ch_mag128r_1[0]); } - // multiply by channel Inv - //rxdataF_zf128_0 = rxdataF_comp128_0*d - b*rxdataF_comp128_1 - //rxdataF_zf128_1 = rxdataF_comp128_1*a - c*rxdataF_comp128_0 - //printf("layer_1 \n"); - mmtmpD0 = nr_comp_muli_sum(rxdataF_comp128_0[0], - after_mf_d_128[0], - rxdataF_comp128_1[0], - after_mf_b_128[0], - determ_fin_128[0]); - - //printf("layer_2 \n"); - mmtmpD1 = nr_comp_muli_sum(rxdataF_comp128_1[0], - after_mf_a_128[0], - rxdataF_comp128_0[0], - after_mf_c_128[0], - determ_fin_128[0]); - - rxdataF_comp128_0[0] = mmtmpD0; - rxdataF_comp128_1[0] = mmtmpD1; -#ifdef DEBUG_DLSCH_DEMOD - printf("\n Rx signal after ZF l%d rb%d\n",symbol,rb); - print_shorts(" Rx layer 1:",(int16_t*)&rxdataF_comp128_0[0]); - print_shorts(" Rx layer 2:",(int16_t*)&rxdataF_comp128_1[0]); -#endif - determ_fin_128 += 1; - dl_ch_mag128_0 += 1; - dl_ch_mag128b_0 += 1; - dl_ch_mag128r_0 += 1; - rxdataF_comp128_0 += 1; - rxdataF_comp128_1 += 1; - after_mf_a_128 += 1; - after_mf_b_128 += 1; - after_mf_c_128 += 1; - after_mf_d_128 += 1; } - _mm_empty(); - _m_empty(); - return(0); + + //Compute H^*H matrix elements and sub elements:(1/2^log2_maxh)*conjH_H_elements + for (int rtx=0;rtx2) { + if (mod_order == 4) { + QAM_amp128 = _mm_set1_epi16(QAM16_n1); //2/sqrt(10) + QAM_amp128b = _mm_setzero_si128(); + QAM_amp128r = _mm_setzero_si128(); + } else if (mod_order == 6) { + QAM_amp128 = _mm_set1_epi16(QAM64_n1); //4/sqrt{42} + QAM_amp128b = _mm_set1_epi16(QAM64_n2); //2/sqrt{42} + QAM_amp128r = _mm_setzero_si128(); + } else if (mod_order == 8) { + QAM_amp128 = _mm_set1_epi16(QAM256_n1); //8/sqrt{170} + QAM_amp128b = _mm_set1_epi16(QAM256_n2);//4/sqrt{170} + QAM_amp128r = _mm_set1_epi16(QAM256_n3);//2/sqrt{170} + } + dl_ch_mag128_0 = (__m128i *)&dl_ch_mag[0][symbol*nb_rb*12]; + dl_ch_mag128b_0 = (__m128i *)&dl_ch_magb[0][symbol*nb_rb*12]; + dl_ch_mag128r_0 = (__m128i *)&dl_ch_magr[0][symbol*nb_rb*12]; + } + + for (int rb=0; rb<3*nb_rb_0; rb++) { + if (mod_order>2) { + /*int sum_det =0; + for (int k=0; k<4;k++) { + sum_det += ((((int *)&determ_fin_128[0])[k])>>2); + //printf("det_%d = %d\n",k,sum_det); + }*/ + + mmtmpD2 = _mm_sign_epi16(determ_fin_128[0],*(__m128i*)&nr_realpart[0]); + //mmtmpD2 = _mm_slli_epi32(mmtmpD2,5); + + mmtmpD3 = _mm_unpacklo_epi32(mmtmpD2,mmtmpD2); + + mmtmpD2 = _mm_unpackhi_epi32(mmtmpD2,mmtmpD2); + + mmtmpD2 = _mm_packs_epi32(mmtmpD3,mmtmpD2); + + dl_ch_mag128_0[0] = mmtmpD2; + dl_ch_mag128b_0[0] = mmtmpD2; + dl_ch_mag128r_0[0] = mmtmpD2; + + dl_ch_mag128_0[0] = _mm_mulhi_epi16(dl_ch_mag128_0[0],QAM_amp128); + dl_ch_mag128_0[0] = _mm_slli_epi16(dl_ch_mag128_0[0],1); + + dl_ch_mag128b_0[0] = _mm_mulhi_epi16(dl_ch_mag128b_0[0],QAM_amp128b); + dl_ch_mag128b_0[0] = _mm_slli_epi16(dl_ch_mag128b_0[0],1); + + dl_ch_mag128r_0[0] = _mm_mulhi_epi16(dl_ch_mag128r_0[0],QAM_amp128r); + dl_ch_mag128r_0[0] = _mm_slli_epi16(dl_ch_mag128r_0[0],1); + + //print_shorts("mag layer 1:",(int16_t*)&dl_ch_mag128_0[0]); + //print_shorts("mag layer 2:",(int16_t*)&dl_ch_mag128_1[0]); + //print_shorts("magb layer 1:",(int16_t*)&dl_ch_mag128b_0[0]); + //print_shorts("magb layer 2:",(int16_t*)&dl_ch_mag128b_1[0]); + //print_shorts("magr layer 1:",(int16_t*)&dl_ch_mag128r_0[0]); + //print_shorts("magr layer 2:",(int16_t*)&dl_ch_mag128r_1[0]); + } + // multiply by channel Inv + //rxdataF_zf128_0 = rxdataF_comp128_0*d - b*rxdataF_comp128_1 + //rxdataF_zf128_1 = rxdataF_comp128_1*a - c*rxdataF_comp128_0 + //printf("layer_1 \n"); + mmtmpD0 = nr_comp_muli_sum(rxdataF_comp128_0[0], + after_mf_d_128[0], + rxdataF_comp128_1[0], + after_mf_b_128[0], + 9); + + //printf("layer_2 \n"); + mmtmpD1 = nr_comp_muli_sum(rxdataF_comp128_1[0], + after_mf_a_128[0], + rxdataF_comp128_0[0], + after_mf_c_128[0], + 9); + + rxdataF_comp128_0[0] = mmtmpD0; + rxdataF_comp128_1[0] = mmtmpD1; + //#ifdef DEBUG_DLSCH_DEMOD + printf("\n Rx signal after ZF l%d rb%d\n",symbol,rb); + print_shorts(" Rx layer 1:",(int16_t*)&rxdataF_comp128_0[0]); + print_shorts(" Rx layer 2:",(int16_t*)&rxdataF_comp128_1[0]); + //#endif + determ_fin_128 += 1; + dl_ch_mag128_0 += 1; + dl_ch_mag128b_0 += 1; + dl_ch_mag128r_0 += 1; + rxdataF_comp128_0 += 1; + rxdataF_comp128_1 += 1; + after_mf_a_128 += 1; + after_mf_b_128 += 1; + after_mf_c_128 += 1; + after_mf_d_128 += 1; + } + } + _mm_empty(); + _m_empty(); + return(0); } static void nr_dlsch_layer_demapping(int16_t **llr_cw, From 9ca7f14ce8cbb8808044e8a8854e07c74287e12e Mon Sep 17 00:00:00 2001 From: sfn Date: Sat, 22 Jan 2022 07:47:24 +0100 Subject: [PATCH 11/67] Fix 2,3 , and 4 layers zero forcing Rx with fixed point implementation (tested in dlsim) --- .../NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 456 +++++++++--------- openair1/SIMULATION/NR_PHY/dlsim.c | 8 +- 2 files changed, 229 insertions(+), 235 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 2db09e2380..bc98539783 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -1942,6 +1942,29 @@ void nr_det_2x2(int32_t *a,//a _m_empty(); } +/* Zero Forcing Rx function: nr_a_sum_b() + * Compute the complex addition x=x+y + * + * */ +void nr_a_sum_b(__m128i *input_x, + __m128i *input_y, + unsigned short nb_rb) +{ + unsigned short rb; + + for (rb=0; rb2) { - if (mod_order == 4) { - QAM_amp128 = _mm_set1_epi16(QAM16_n1); //2/sqrt(10) - QAM_amp128b = _mm_setzero_si128(); - QAM_amp128r = _mm_setzero_si128(); - } else if (mod_order == 6) { - QAM_amp128 = _mm_set1_epi16(QAM64_n1); //4/sqrt{42} - QAM_amp128b = _mm_set1_epi16(QAM64_n2); //2/sqrt{42} - QAM_amp128r = _mm_setzero_si128(); - } else if (mod_order == 8) { - QAM_amp128 = _mm_set1_epi16(QAM256_n1); //8/sqrt{170} - QAM_amp128b = _mm_set1_epi16(QAM256_n2);//4/sqrt{170} - QAM_amp128r = _mm_set1_epi16(QAM256_n3);//2/sqrt{170} - } - dl_ch_mag128_0 = (__m128i *)&dl_ch_mag[0][symbol*nb_rb*12]; - dl_ch_mag128b_0 = (__m128i *)&dl_ch_magb[0][symbol*nb_rb*12]; - dl_ch_mag128r_0 = (__m128i *)&dl_ch_magr[0][symbol*nb_rb*12]; - } - - for (int rb=0; rb<3*nb_rb_0; rb++) { - if (mod_order>2) { - /*int sum_det =0; - for (int k=0; k<4;k++) { - sum_det += ((((int *)&determ_fin_128[0])[k])>>2); - //printf("det_%d = %d\n",k,sum_det); - }*/ - - mmtmpD2 = _mm_sign_epi16(determ_fin_128[0],*(__m128i*)&nr_realpart[0]); - //mmtmpD2 = _mm_slli_epi32(mmtmpD2,5); - - mmtmpD3 = _mm_unpacklo_epi32(mmtmpD2,mmtmpD2); - - mmtmpD2 = _mm_unpackhi_epi32(mmtmpD2,mmtmpD2); - - mmtmpD2 = _mm_packs_epi32(mmtmpD3,mmtmpD2); - - dl_ch_mag128_0[0] = mmtmpD2; - dl_ch_mag128b_0[0] = mmtmpD2; - dl_ch_mag128r_0[0] = mmtmpD2; - - dl_ch_mag128_0[0] = _mm_mulhi_epi16(dl_ch_mag128_0[0],QAM_amp128); - dl_ch_mag128_0[0] = _mm_slli_epi16(dl_ch_mag128_0[0],1); - - dl_ch_mag128b_0[0] = _mm_mulhi_epi16(dl_ch_mag128b_0[0],QAM_amp128b); - dl_ch_mag128b_0[0] = _mm_slli_epi16(dl_ch_mag128b_0[0],1); - - dl_ch_mag128r_0[0] = _mm_mulhi_epi16(dl_ch_mag128r_0[0],QAM_amp128r); - dl_ch_mag128r_0[0] = _mm_slli_epi16(dl_ch_mag128r_0[0],1); - - //print_shorts("mag layer 1:",(int16_t*)&dl_ch_mag128_0[0]); - //print_shorts("mag layer 2:",(int16_t*)&dl_ch_mag128_1[0]); - //print_shorts("magb layer 1:",(int16_t*)&dl_ch_mag128b_0[0]); - //print_shorts("magb layer 2:",(int16_t*)&dl_ch_mag128b_1[0]); - //print_shorts("magr layer 1:",(int16_t*)&dl_ch_mag128r_0[0]); - //print_shorts("magr layer 2:",(int16_t*)&dl_ch_mag128r_1[0]); - } - // multiply by channel Inv - //rxdataF_zf128_0 = rxdataF_comp128_0*d - b*rxdataF_comp128_1 - //rxdataF_zf128_1 = rxdataF_comp128_1*a - c*rxdataF_comp128_0 - //printf("layer_1 \n"); - mmtmpD0 = nr_comp_muli_sum(rxdataF_comp128_0[0], - after_mf_d_128[0], - rxdataF_comp128_1[0], - after_mf_b_128[0], - 9); - - //printf("layer_2 \n"); - mmtmpD1 = nr_comp_muli_sum(rxdataF_comp128_1[0], - after_mf_a_128[0], - rxdataF_comp128_0[0], - after_mf_c_128[0], - 9); - - rxdataF_comp128_0[0] = mmtmpD0; - rxdataF_comp128_1[0] = mmtmpD1; - //#ifdef DEBUG_DLSCH_DEMOD - printf("\n Rx signal after ZF l%d rb%d\n",symbol,rb); - print_shorts(" Rx layer 1:",(int16_t*)&rxdataF_comp128_0[0]); - print_shorts(" Rx layer 2:",(int16_t*)&rxdataF_comp128_1[0]); - //#endif - determ_fin_128 += 1; - dl_ch_mag128_0 += 1; - dl_ch_mag128b_0 += 1; - dl_ch_mag128r_0 += 1; - rxdataF_comp128_0 += 1; - rxdataF_comp128_1 += 1; - after_mf_a_128 += 1; - after_mf_b_128 += 1; - after_mf_c_128 += 1; - after_mf_d_128 += 1; - } + fpshift);//(64*2=2^7)/2^15 + print_shorts(" nr_det_2x2 ",(int16_t*)&determ_fin[0]); } - _mm_empty(); - _m_empty(); - return(0); + else if(n_tx==3) { + nr_det_3x3(conjH_H_elements[0][0],//a11 + conjH_H_elements[n_tx][0],//a12 + conjH_H_elements[2*n_tx][0],//a13 + conjH_H_elements[1][0],//a21 + conjH_H_elements[n_tx+1][0],//a22 + conjH_H_elements[2*n_tx+1][0],//a23 + conjH_H_elements[2][0],//a31 + conjH_H_elements[n_tx+2][0],//a32 + conjH_H_elements[2*n_tx+2][0],//a33 + determ_fin, + nb_rb, + +1, + fpshift); + print_shorts(" nr_det_3x3",(int16_t*)&determ_fin[0]); + } + else if(n_tx==4) { + nr_det_4x4(conjH_H_elements,// + determ_fin,//ad-bc + nb_rb, + +1, + fpshift); + print_shorts(" nr_det_4x4",(int16_t*)&determ_fin[0]); + } + + + // multiply Matrix inversion pf H_h_H by the rx signal vector + int32_t outtemp[12*nb_rb] __attribute__((aligned(32))); + int32_t **rxdataF_zforcing; + + //Allocate rxdataF for zforcing out + rxdataF_zforcing = (int32_t **)malloc16_clear( n_tx*sizeof(int32_t *) ); + for (int rtx=0;rtx Date: Sat, 22 Jan 2022 15:41:28 +0100 Subject: [PATCH 13/67] re-write the matrix inversion in zero forcing --- .../NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 432 ++++-------------- 1 file changed, 96 insertions(+), 336 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index d746cf0632..fe4338297b 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -1863,85 +1863,6 @@ void nr_dlsch_detection_mrc(int **rxdataF_comp, #endif } -/* Zero Forcing Rx function: nr_det_2x2() - * Compute the Matrix determinant for 2x2 - * - * */ -void nr_det_2x2(int32_t *a,//a - int32_t *b,//b - int32_t *c,//c - int32_t *d,//d - int32_t *ad_bc,//ad-bc - unsigned short nb_rb, - int32_t sign, - int32_t shift0) -{ - int16_t nr_conjug2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1} ; - unsigned short rb; - __m128i *a_128,*b_128, *c_128, *d_128, ad_re_128, bc_re_128, ad_im_128, bc_im_128; - __m128i *ad_bc_128, det_re_128, det_im_128, tmp_det0, tmp_det1; - - a_128 = (__m128i *)a; - b_128 = (__m128i *)b; - c_128 = (__m128i *)c; - d_128 = (__m128i *)d; - - ad_bc_128 = (__m128i *)ad_bc; - - for (rb=0; rb<3*nb_rb; rb++) { - - //complex multiplication (I_a+jQ_a)(I_d+jQ_d) = (I_aI_d - Q_aQ_d) + j(Q_aI_d + I_aQ_d) - //The real part - ad_re_128 = _mm_sign_epi16(a_128[0],*(__m128i*)&nr_conjug2[0]); - ad_re_128 = _mm_madd_epi16(ad_re_128,d_128[0]); //Re: I_a0*I_d0 - Q_a1*Q_d1 - //The Imag part - ad_im_128 = _mm_shufflelo_epi16(a_128[0],_MM_SHUFFLE(2,3,0,1));//permutes IQs for the low 64 bits as [I_a0 Q_a1 I_a2 Q_a3]_64bits to [Q_a1 I_a0 Q_a3 I_a2]_64bits - ad_im_128 = _mm_shufflehi_epi16(ad_im_128,_MM_SHUFFLE(2,3,0,1));//permutes IQs for the high 64 bits as [I_a0 Q_a1 I_a2 Q_a3]_64bits to [Q_a1 I_a0 Q_a3 I_a2]_64bits - ad_im_128 = _mm_madd_epi16(ad_im_128,d_128[0]);//Im: (Q_aI_d + I_aQ_d) - - //complex multiplication (I_b+jQ_b)(I_c+jQ_c) = (I_bI_c - Q_bQ_c) + j(Q_bI_c + I_bQ_c) - //The real part - bc_re_128 = _mm_sign_epi16(b_128[0],*(__m128i*)&nr_conjug2[0]); - bc_re_128 = _mm_madd_epi16(bc_re_128,c_128[0]); //Re: I_b0*I_c0 - Q_b1*Q_c1 - //The imag part - bc_im_128 = _mm_shufflelo_epi16(b_128[0],_MM_SHUFFLE(2,3,0,1));//permutes IQs for the low 64 bits as [I_b0 Q_b1 I_b2 Q_b3]_64bits to [Q_b1 I_b0 Q_b3 I_b2]_64bits - bc_im_128 = _mm_shufflehi_epi16(bc_im_128,_MM_SHUFFLE(2,3,0,1));//permutes IQs for the high 64 bits as [I_b0 Q_b1 I_b2 Q_b3]_64bits to [Q_b1 I_b0 Q_b3 I_b2]_64bits - bc_im_128 = _mm_madd_epi16(bc_im_128,c_128[0]);//Im: (Q_bI_c + I_bQ_c) - - if (sign>0){ - det_re_128 = _mm_sub_epi32(ad_re_128, bc_re_128); - det_im_128 = _mm_sub_epi32(ad_im_128, bc_im_128); - }else{ - det_re_128 = _mm_sub_epi32(bc_re_128,ad_re_128); - det_im_128 = _mm_sub_epi32(bc_im_128,ad_im_128); - } - //convert back to Q15 before packing - det_re_128 = _mm_srai_epi32(det_re_128,shift0); - det_im_128 = _mm_srai_epi32(det_im_128,shift0); - - tmp_det0 = _mm_unpacklo_epi32(det_re_128,det_im_128); - //print_ints("unpack lo:",&tmp_det0[0]); - tmp_det1 = _mm_unpackhi_epi32(det_re_128,det_im_128); - //print_ints("unpack hi:",&tmp_det1[0]); - ad_bc_128[0] = _mm_packs_epi32(tmp_det0,tmp_det1); - - -#ifdef DEBUG_DLSCH_DEMOD - printf("\n Computing det_2x2 \n"); - //print_ints("det_re_128:",(int32_t*)&det_re_128); - //print_ints("det_im_128:",(int32_t*)&det_im_128); - print_shorts("ad-bc_128:",(int32_t*)&ad_bc_128[0]); -#endif - ad_bc_128+=1; - a_128+=1; - b_128+=1; - c_128+=1; - d_128+=1; - } - _mm_empty(); - _m_empty(); -} - /* Zero Forcing Rx function: nr_a_sum_b() * Compute the complex addition x=x+y * @@ -2015,147 +1936,6 @@ void nr_a_mult_b(int *a, _m_empty(); } -/* Zero Forcing Rx function: nr_det_3x3() - * Compute the matrix determinant for 3x3 - * - * */ -void nr_det_3x3(int32_t *a11,// - int32_t *a12,// - int32_t *a13,// - int32_t *a21,// - int32_t *a22,// - int32_t *a23,// - int32_t *a31,// - int32_t *a32,// - int32_t *a33,// - int32_t *ad_bc,//ad-bc - unsigned short nb_rb, - int32_t sign, - int32_t shift0){ - int32_t outtemp[12*nb_rb] __attribute__((aligned(32))); - int32_t out1[12*nb_rb] __attribute__((aligned(32))); - int32_t out2[12*nb_rb] __attribute__((aligned(32))); - int32_t out3[12*nb_rb] __attribute__((aligned(32))); - - //a11 - nr_det_2x2(a22,//a - a23,//b - a32,//c - a33,//d - outtemp,//ad-bc - nb_rb, - +1*sign, - shift0); - //print_shorts(" out1 det2x2 ",(int16_t*)&outtemp[0]); - nr_a_mult_b(a11, - outtemp, - out1, - nb_rb, - shift0); - //print_shorts(" a11*out1 ",(int16_t*)&out1[0]); - //a12 - nr_det_2x2(a21,//a - a23,//b - a31,//c - a33,//d - outtemp,//ad-bc - nb_rb, - -1*sign, - shift0); - //print_shorts(" out2 det2x2 ",(int16_t*)&outtemp[0]); - nr_a_mult_b(a12, - outtemp, - out2, - nb_rb, - shift0); - //print_shorts(" a12*out2 ",(int16_t*)&out2[0]); - //a13 - nr_det_2x2(a21,//a - a22,//b - a31,//c - a32,//d - outtemp,//ad-bc - nb_rb, - +1*sign, - shift0); - //print_shorts(" out3 det2x2 ",(int16_t*)&outtemp[0]); - nr_a_mult_b(a13, - outtemp, - out3, - nb_rb, - shift0); - //print_shorts(" a13*out3 ",(int16_t*)&out3[0]); - __m128i *out1_128,*out2_128,*out3_128,*det_128; - - out1_128 = (__m128i *)out1; - out2_128 = (__m128i *)out2; - out3_128 = (__m128i *)out3; - det_128 = (__m128i *)ad_bc; - - for (int rb=0; rb<3*nb_rb; rb++) { - det_128[0] = _mm_adds_epi16(out1_128[0],out2_128[0]); - det_128[0] = _mm_adds_epi16(det_128[0],out3_128[0]); - //if (rb==0) print_shorts(" out det3x3 ",(int16_t*)&det_128[0]); - out1_128+=1; - out2_128+=1; - out3_128+=1; - det_128+=1; - } - _mm_empty(); - _m_empty(); -} - -/* Zero Forcing Rx function: nr_det_4x4() - * Compute the matrix determinant for 4x4 Matrix - * - * */ -void nr_det_4x4(int32_t ***a44,// - int32_t *ad_bc,//ad-bc - unsigned short nb_rb, - int32_t sign, - int32_t shift0){ - int32_t outtemp[12*nb_rb] __attribute__((aligned(32))); - int32_t outtemp1[12*nb_rb] __attribute__((aligned(32))); - int16_t k,rr[3],cc[3]; - for (int rtx=0;rtx<4;rtx++) {//row - k=0; - for(int rrtx=0;rrtx<4;rrtx++) - if(rrtx != rtx) rr[k++] = rrtx; - int ctx=0; - k=0; - for(int cctx=0;cctx<4;cctx++) - if(cctx != ctx) cc[k++] = cctx; - - nr_det_3x3(a44[cc[0]*4+rr[0]][0],//a11 - a44[cc[1]*4+rr[0]][0],//a12 - a44[cc[2]*4+rr[0]][0],//a13 - a44[cc[0]*4+rr[1]][0],//a21 - a44[cc[1]*4+rr[1]][0],//a22 - a44[cc[2]*4+rr[1]][0],//a23 - a44[cc[0]*4+rr[2]][0],//a31 - a44[cc[1]*4+rr[2]][0],//a32 - a44[cc[2]*4+rr[2]][0],//a33 - outtemp, - nb_rb, - ((rtx&1)==1?-1:1)*((ctx&1)==1?-1:1), - shift0); - - nr_a_mult_b(a44[ctx*4+rtx][0], - outtemp, - rtx==0? ad_bc:outtemp1, - nb_rb, - shift0); - - if (rtx != 0) nr_a_sum_b((__m128i *)ad_bc, - (__m128i *)outtemp1, - nb_rb); - - } - - _mm_empty(); - _m_empty(); -} - /* Zero Forcing Rx function: nr_element_sign() * Compute b=sign*a * @@ -2192,29 +1972,65 @@ void nr_element_sign(int32_t *a,//a _m_empty(); } -/* Zero Forcing Rx function: nr_construct_HhH_elements() - * +/* Zero Forcing Rx function: nr_det_4x4() + * Compute the matrix determinant for 4x4 Matrix * * */ -void nr_construct_HhH_elements(int **conjH_H_elements, - unsigned char n_rx, - unsigned short nb_rb) -{ - //This function is used to construct the (H_hermitian * H matrix) matrix elements - unsigned short rb; - __m128i *conjH_H_elements_0_128, *conjH_H_elements_aarx_128; - - - for (rb=0; rb<3*nb_rb; rb++) { - conjH_H_elements_0_128 = (__m128i *)&conjH_H_elements[0][rb*4]; - for (int aarx=1;aarx Date: Sun, 23 Jan 2022 23:48:38 +0100 Subject: [PATCH 14/67] implement and test foating point calc for zero forcing --- .../NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 318 +++++++++++++----- 1 file changed, 226 insertions(+), 92 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index fe4338297b..7e95033a26 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -42,6 +42,7 @@ #include "PHY/NR_REFSIG/nr_refsig.h" #include "PHY/NR_REFSIG/dmrs_nr.h" #include "common/utils/nr/nr_common.h" +#include /* dynamic shift for LLR computation for TM3/4 * set as command line argument, see lte-softmodem.c @@ -2021,13 +2022,13 @@ void nr_determin(int32_t **a44,// nb_rb, ((rtx&1)==1?-1:1)*((ctx&1)==1?-1:1)*sign, shift0); - nr_a_mult_b(a44[ctx*size+rtx], - outtemp, - rtx==0? ad_bc:outtemp1, - nb_rb, - shift0); + nr_a_mult_b(a44[ctx*size+rtx], + outtemp, + rtx==0? ad_bc:outtemp1, + nb_rb, + shift0); - if (rtx != 0) nr_a_sum_b((__m128i *)ad_bc, + if (rtx != 0) nr_a_sum_b((__m128i *)ad_bc, (__m128i *)outtemp1, nb_rb); } @@ -2036,6 +2037,172 @@ void nr_determin(int32_t **a44,// _m_empty(); } +double complex nr_determin_cpx(double complex *a44_cpx,// + int32_t size,//size + int32_t sign){ + double complex outtemp, outtemp1; + //Allocate the submatrix elements + double complex sub_matrix[(size-1)*(size-1)]; + int16_t k,rr[size-1],cc[size-1]; + + if(size==1) { + return((double complex)a44_cpx[0]*sign); + }else { + outtemp1 = 0; + for (int rtx=0;rtx inv_H_h_H(%d,%d) = %d+j%d \n",rtx,ctx,((short *)a44[ctx*size+rtx])[0],((short *)a44[ctx*size+rtx])[1],ctx,rtx,((short *)inv_H_h_H[rtx*size+ctx])[0],((short *)inv_H_h_H[rtx*size+ctx])[1]); + } + } + _mm_empty(); + _m_empty(); + } + else {//floating point calc. + //Allocate the submatrix elements + double complex sub_matrix_cpx[(size-1)*(size-1)]; + //Convert the IQ samples (in Q15 format) to float complex + double complex a44_cpx[size*size]; + double complex inv_H_h_H_cpx[size*size]; + double complex determin_cpx; + for (int i=0; i<12*nb_rb; i++) { + + for (int rtx=0;rtx0)//determin of the symmetric matrix is real part only + ((short*) ad_bc)[i<<1] = (short) ((creal(determin_cpx)/(1<<(size-1)*shift0))+0.5);// + else + ((short*) ad_bc)[i<<1] = (short) ((creal(determin_cpx)/(1<<(size-1)*shift0))-0.5);// + ((short*) ad_bc)[(i<<1)+1] = (short) 0;//Imag=0 + + //Compute Inversion of the H^*H matrix + for (int rtx=0;rtx inv_H_h_H(%d,%d) = %lf+j%lf \n",rtx,ctx,creal(a44_cpx[ctx*size+rtx]),cimag(a44_cpx[ctx*size+rtx]),ctx,rtx,creal(inv_H_h_H_cpx[rtx*size+ctx])*(1<<15),cimag(inv_H_h_H_cpx[rtx*size+ctx])*(1<<15)); + + if (creal(inv_H_h_H_cpx[rtx*size+ctx])>0) + ((short *) inv_H_h_H[rtx*size+ctx])[i<<1] = (short) ((creal(inv_H_h_H_cpx[rtx*size+ctx])*(1<<15))+0.5);// + else + ((short *) inv_H_h_H[rtx*size+ctx])[i<<1] = (short) ((creal(inv_H_h_H_cpx[rtx*size+ctx])*(1<<15))-0.5);// + + if (cimag(inv_H_h_H_cpx[rtx*size+ctx])>0) + ((short *) inv_H_h_H[rtx*size+ctx])[(i<<1)+1] = (short) ((cimag(inv_H_h_H_cpx[rtx*size+ctx])*(1<<15))+0.5);// + else + ((short *) inv_H_h_H[rtx*size+ctx])[(i<<1)+1] = (short) ((cimag(inv_H_h_H_cpx[rtx*size+ctx])*(1<<15))-0.5);// + } + } + } + } + return(0); +} + /* Zero Forcing Rx function: nr_conjch0_mult_ch1() * * @@ -2101,11 +2268,9 @@ uint8_t nr_zero_forcing_rx(int **rxdataF_comp, int length) { int *ch0r, *ch0c; - int32_t determ_fin[12*nb_rb] __attribute__((aligned(32))); - int32_t *** conjH_H_elements; - uint32_t nb_rb_0 = length/12 + ((length%12)?1:0); + int32_t determ_fin[12*nb_rb_0] __attribute__((aligned(32))); ///Allocate H^*H matrix elements and sub elements conjH_H_elements = (int32_t ***)malloc16_clear( n_rx*sizeof(int32_t **) ); @@ -2113,94 +2278,55 @@ uint8_t nr_zero_forcing_rx(int **rxdataF_comp, conjH_H_elements[aarx] = (int32_t **)malloc16_clear( n_tx*n_tx*sizeof(int32_t) ); for (int rtx=0;rtx Date: Sun, 23 Jan 2022 23:50:16 +0100 Subject: [PATCH 15/67] fix code book I gene. --- openair1/PHY/INIT/nr_init.c | 360 +++++++++++++++------------ openair1/PHY/NR_TRANSPORT/nr_dlsch.c | 3 +- 2 files changed, 205 insertions(+), 158 deletions(-) diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 0fa740d506..f19c1a9520 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -100,7 +100,7 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_one_TypeI_SinglePanel_Restriction: N1=2; N2=1; - O1=4; + O1=1;//or 4 O2=1; CSI_RS_antenna_ports=4; LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_two_one\n",CSI_RS_antenna_ports); @@ -108,15 +108,15 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_two_TypeI_SinglePanel_Restriction: N1=2; N2=2; - O1=4; - O2=4; + O1=1;//or 4 + O2=1;// or 4 CSI_RS_antenna_ports=8; LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_two_two_TypeI\n",CSI_RS_antenna_ports); break; case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_one_TypeI_SinglePanel_Restriction: N1=4; N2=1; - O1=4; + O1=1;//or 4 O2=1; CSI_RS_antenna_ports=8; LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_one\n",CSI_RS_antenna_ports); @@ -124,15 +124,15 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_three_two_TypeI_SinglePanel_Restriction: N1=3; N2=2; - O1=4; - O2=4; + O1=1;//or 4 + O2=1;// or 4 CSI_RS_antenna_ports=12; LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_three_two\n",CSI_RS_antenna_ports); break; case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_one_TypeI_SinglePanel_Restriction: N1=6; N2=1; - O1=4; + O1=1; O2=1; CSI_RS_antenna_ports=12; LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_six_one\n",CSI_RS_antenna_ports); @@ -140,15 +140,15 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_two_TypeI_SinglePanel_Restriction: N1=4; N2=2; - O1=4; - O2=4; + O1=1; + O2=1; CSI_RS_antenna_ports=16; LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_two\n",CSI_RS_antenna_ports); break; case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_eight_one_TypeI_SinglePanel_Restriction: N1=8; N2=1; - O1=4; + O1=1; O2=1; CSI_RS_antenna_ports=16; LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_eight_one\n",CSI_RS_antenna_ports); @@ -156,23 +156,23 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_three_TypeI_SinglePanel_Restriction: N1=4; N2=3; - O1=4; - O2=4; + O1=1; + O2=1; CSI_RS_antenna_ports=24; LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_three\n",CSI_RS_antenna_ports); break; case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_two_TypeI_SinglePanel_Restriction: N1=6; N2=2; - O1=4; - O2=4; + O1=1; + O2=1; CSI_RS_antenna_ports=24; LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_six_two\n",CSI_RS_antenna_ports); break; case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_twelve_one_TypeI_SinglePanel_Restriction: N1=12; N2=1; - O1=4; + O1=1; O2=1; CSI_RS_antenna_ports=24; LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_twelve_one\n",CSI_RS_antenna_ports); @@ -180,23 +180,23 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_four_TypeI_SinglePanel_Restriction: N1=4; N2=4; - O1=4; - O2=4; + O1=1; + O2=1; CSI_RS_antenna_ports=32; LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_four\n",CSI_RS_antenna_ports); break; case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_eight_two_TypeI_SinglePanel_Restriction: N1=8; N2=2; - O1=4; - O2=4; + O1=1; + O2=1; CSI_RS_antenna_ports=32; LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_eight_two\n",CSI_RS_antenna_ports); break; case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_sixteen_one_TypeI_SinglePanel_Restriction: N1=16; N2=1; - O1=4; + O1=1; O2=1; CSI_RS_antenna_ports=32; LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_sixteen_one\n",CSI_RS_antenna_ports); @@ -269,7 +269,7 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { for(int j_col=0; j_col<1; j_col++) { //1 layer for (int i_rows=0; i_rows<2*N1*N2; i_rows++) { //2-x polarized antenna if(j_col==i_rows) { - ((short*) &mat[0][0][i_rows+j_col])[0] = 32768; + mat[0][0][i_rows+j_col] = (1<<14); } } } @@ -314,7 +314,21 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { double complex phase_sign; //Table 5.2.2.2.1-6: //Codebook for 2-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS - pmiq_size = N1*O1*N2*O2*N1*O1*N2*O2*2+1; + //Compute the code book size for generating 2 layers out of Tx antenna ports + + //pmi_size is computed as follows + pmiq_size = 1;//1 for unity matrix + for(int llb=0; llb0) - ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_D(PHY, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[1][pmiq][i_rows*2+j_col])[0],((short*) &mat[1][pmiq][i_rows*2+j_col])[1]); - } - for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { - res_code=sqrt(1/(double)(2*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; - if (creal(res_code)>0) - ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_D(PHY, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[1][pmiq][i_rows*2+j_col])[0],((short*) &mat[1][pmiq][i_rows*2+j_col])[1]); + if((llb != ll) || (mmb != mm)){ + pmiq += 1; + mat[1][pmiq] = (int32_t *)malloc16((2*N1*N2)*(2)*sizeof(int32_t)); + LOG_I(PHY, "layer 2 Codebook pmiq = %d\n",pmiq); + for(int j_col=0; j_col<2; j_col++) { + if (j_col==0) { + llc = llb; + mmc = mmb; + phase_sign = 1; + } + if (j_col==1) { + llc = ll; + mmc = mm; + phase_sign = -1; + } + for (int i_rows=0; i_rows0) + ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + LOG_I(PHY, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[1][pmiq][i_rows*2+j_col])[0],((short*) &mat[1][pmiq][i_rows*2+j_col])[1]); + } + for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { + res_code=sqrt(1/(double)(2*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; + if (creal(res_code)>0) + ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + LOG_I(PHY, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[1][pmiq][i_rows*2+j_col])[0],((short*) &mat[1][pmiq][i_rows*2+j_col])[1]); + } } } } @@ -381,67 +398,82 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { //Table 5.2.2.2.1-7: //Codebook for 3-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS if(CSI_RS_antenna_ports>=3) { - pmiq_size = N1*O1*N2*O2*N1*O1*N2*O2*2+1; - mat[2] = (int32_t **)malloc16(pmiq_size*sizeof(int32_t *)); + //pmi_size is computed as follows + pmiq_size = 1;//unity matrix + for(int llb=0; llb0) - ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_D(PHY, "3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[2][pmiq][i_rows*3+j_col])[0],((short*) &mat[2][pmiq][i_rows*3+j_col])[1]); - } - for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { - res_code=sqrt(1/(double)(3*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; - if (creal(res_code)>0) - ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_D(PHY, "3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[2][pmiq][i_rows*3+j_col])[0],((short*) &mat[2][pmiq][i_rows*3+j_col])[1]); + if((llb != ll) || (mmb != mm)){ + pmiq += 1; + mat[2][pmiq] = (int32_t *)malloc16((2*N1*N2)*(3)*sizeof(int32_t)); + LOG_I(PHY, "layer 3 Codebook pmiq = %d\n",pmiq); + for(int j_col=0; j_col<3; j_col++) { + if (j_col==0) { + llc = llb; + mmc = mmb; + phase_sign = 1; + } + if (j_col==1) { + llc = ll; + mmc = mm; + phase_sign = 1; + } + if (j_col==3) { + llc = llb; + mmc = mmb; + phase_sign = -1; + } + for (int i_rows=0; i_rows0) + ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + LOG_I(PHY, "3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[2][pmiq][i_rows*3+j_col])[0],((short*) &mat[2][pmiq][i_rows*3+j_col])[1]); + } + for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { + res_code=sqrt(1/(double)(3*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; + if (creal(res_code)>0) + ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + LOG_I(PHY, "3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[2][pmiq][i_rows*3+j_col])[0],((short*) &mat[2][pmiq][i_rows*3+j_col])[1]); + } } } } @@ -454,73 +486,89 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { //Table 5.2.2.2.1-8: //Codebook for 4-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS if(CSI_RS_antenna_ports>=4) { - pmiq_size = N1*O1*N2*O2*N1*O1*N2*O2*2+1; - mat[3] = (int32_t **)malloc16(pmiq_size*sizeof(int32_t *)); + //pmi_size is computed as follows + pmiq_size = 1;//unity matrix + for(int llb=0; llb0) - ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_D(PHY, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); - } - for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { - res_code=sqrt(1/(double)(4*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; - if (creal(res_code)>0) - ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_D(PHY, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); + if((llb != ll) || (mmb != mm)){ + pmiq += 1; + mat[3][pmiq] = (int32_t *)malloc16((2*N1*N2)*4*sizeof(int32_t)); + LOG_I(PHY, "layer 4 pmiq = %d\n",pmiq); + for(int j_col=0; j_col<4; j_col++) { + if (j_col==0) { + llc = llb; + mmc = mmb; + phase_sign = 1; + } + if (j_col==1) { + llc = ll; + mmc = mm; + phase_sign = 1; + } + if (j_col==3) { + llc = llb; + mmc = mmb; + phase_sign = -1; + } + if (j_col==4) { + llc = ll; + mmc = mm; + phase_sign = -1; + } + for (int i_rows=0; i_rows0) + ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + LOG_I(PHY, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); + } + + for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { + res_code=sqrt(1/(double)(4*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; + if (creal(res_code)>0) + ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + LOG_I(PHY, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); + } } } } diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index dd76d38aa2..1e3db85a0a 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -495,8 +495,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, // The same precoding matrix is applied on prg_size RBs, Thus // pmi = prgs_list[rbidx/prg_size].pm_idx, rbidx =0,...,rbSize-1 // The Precoding matrix: - // The Codebook Type I and Type II are not supported yet. - // We`adopt the precoding matrices of PUSCH for 4 layers. + // The Codebook Type I start_meas(&gNB->dlsch_precoding_stats); for (int ap=0; apnb_antennas_tx; ap++) { From b66c3e0b7b47ddca5c8c204595f62258b898898e Mon Sep 17 00:00:00 2001 From: sfn Date: Tue, 25 Jan 2022 08:25:40 +0100 Subject: [PATCH 16/67] Fix Codebook gen. for 3 and 4 layers --- openair1/PHY/INIT/nr_init.c | 158 +++++------------------------------- 1 file changed, 21 insertions(+), 137 deletions(-) diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index f19c1a9520..3f72075ac9 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -87,130 +87,14 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { // N2 . . . . ... . // X X X X ... X // |<-----N1---->| - if (gNB->frame_parms.nb_antennas_tx == 2) {//nrOfAntennaPorts = two - N1=1; - N2=1; - O1=1; - O2=1; - CSI_RS_antenna_ports=2; - LOG_D(PHY, "NR Codebook Config: antenna ports: %d\n",CSI_RS_antenna_ports); - } else if(gNB->frame_parms.nb_antennas_tx > 2) {//nrOfAntennaPorts moreThanTwo - //Type 1 Single Panel : Based on 38.214 v15.3-Table 5.2.2.2.1-2: Supported configurations of (N1,N2) and (O1,O2) - switch(gNB->frame_parms.antennas_tx_n1_n2) { - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_one_TypeI_SinglePanel_Restriction: - N1=2; - N2=1; - O1=1;//or 4 - O2=1; - CSI_RS_antenna_ports=4; - LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_two_one\n",CSI_RS_antenna_ports); - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_two_TypeI_SinglePanel_Restriction: - N1=2; - N2=2; - O1=1;//or 4 - O2=1;// or 4 - CSI_RS_antenna_ports=8; - LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_two_two_TypeI\n",CSI_RS_antenna_ports); - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_one_TypeI_SinglePanel_Restriction: - N1=4; - N2=1; - O1=1;//or 4 - O2=1; - CSI_RS_antenna_ports=8; - LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_one\n",CSI_RS_antenna_ports); - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_three_two_TypeI_SinglePanel_Restriction: - N1=3; - N2=2; - O1=1;//or 4 - O2=1;// or 4 - CSI_RS_antenna_ports=12; - LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_three_two\n",CSI_RS_antenna_ports); - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_one_TypeI_SinglePanel_Restriction: - N1=6; - N2=1; - O1=1; - O2=1; - CSI_RS_antenna_ports=12; - LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_six_one\n",CSI_RS_antenna_ports); - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_two_TypeI_SinglePanel_Restriction: - N1=4; - N2=2; - O1=1; - O2=1; - CSI_RS_antenna_ports=16; - LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_two\n",CSI_RS_antenna_ports); - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_eight_one_TypeI_SinglePanel_Restriction: - N1=8; - N2=1; - O1=1; - O2=1; - CSI_RS_antenna_ports=16; - LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_eight_one\n",CSI_RS_antenna_ports); - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_three_TypeI_SinglePanel_Restriction: - N1=4; - N2=3; - O1=1; - O2=1; - CSI_RS_antenna_ports=24; - LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_three\n",CSI_RS_antenna_ports); - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_two_TypeI_SinglePanel_Restriction: - N1=6; - N2=2; - O1=1; - O2=1; - CSI_RS_antenna_ports=24; - LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_six_two\n",CSI_RS_antenna_ports); - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_twelve_one_TypeI_SinglePanel_Restriction: - N1=12; - N2=1; - O1=1; - O2=1; - CSI_RS_antenna_ports=24; - LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_twelve_one\n",CSI_RS_antenna_ports); - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_four_TypeI_SinglePanel_Restriction: - N1=4; - N2=4; - O1=1; - O2=1; - CSI_RS_antenna_ports=32; - LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_four_four\n",CSI_RS_antenna_ports); - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_eight_two_TypeI_SinglePanel_Restriction: - N1=8; - N2=2; - O1=1; - O2=1; - CSI_RS_antenna_ports=32; - LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_eight_two\n",CSI_RS_antenna_ports); - break; - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_sixteen_one_TypeI_SinglePanel_Restriction: - N1=16; - N2=1; - O1=1; - O2=1; - CSI_RS_antenna_ports=32; - LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2_PR_sixteen_one\n",CSI_RS_antenna_ports); - break; - default: - N1=1; - N2=1; - O1=1; - O2=1; - CSI_RS_antenna_ports=2; - LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d \n",CSI_RS_antenna_ports); - break; - } - } + int x_polarization=2;//1 or 2 + //Get the uniform planar array parameters + N2 = 1;//one-dimenstional array (1, 2, 3, 4 are supported in 5G) + O2 = 1;//Vertical beam oversampling (1 or 4) + N1 = gNB->frame_parms.nb_antennas_tx/(N2*x_polarization);// + O1=1;//Horizontal beam oversampling (1 or 4) + CSI_RS_antenna_ports=N1*N2*x_polarization; + LOG_D(PHY, "NR Codebook Config: antenna ports: %d N1 %d N2 %d\n",CSI_RS_antenna_ports,N1,N2); // Generation of codebook Type1 with codebookMode 1 (CSI_RS_antenna_ports < 16) if (CSI_RS_antenna_ports < 16) { @@ -269,7 +153,7 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { for(int j_col=0; j_col<1; j_col++) { //1 layer for (int i_rows=0; i_rows<2*N1*N2; i_rows++) { //2-x polarized antenna if(j_col==i_rows) { - mat[0][0][i_rows+j_col] = (1<<14); + mat[0][0][i_rows+j_col] = 0x7fff; } } } @@ -323,7 +207,7 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { for(int ll=0; ll Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); + LOG_D(PHY, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); } for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { @@ -567,7 +451,7 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 else ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_I(PHY, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); + LOG_D(PHY, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); } } } From 631cd33f152bad951f751a2148e126892d0af73a Mon Sep 17 00:00:00 2001 From: sfn Date: Tue, 25 Jan 2022 11:34:57 +0100 Subject: [PATCH 17/67] Adjust ZF Rx fixed point shift --- .../NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 66 ++++++++++--------- targets/ARCH/rfsimulator/simulator.c | 8 +-- .../CONF/gnb.band78.tm1.106PRB.usrpn300.conf | 2 +- 3 files changed, 40 insertions(+), 36 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 7e95033a26..7fc1e99c31 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -474,7 +474,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, dl_ch_mag_ptr = pdsch_vars[gNB_id_i]->dl_ch_mag0; if (cpumeas(CPUMEAS_GETSTATE)) - LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Combine %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); + LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Combine and zero forcing %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); /* Store the valid DL RE's */ @@ -2104,7 +2104,7 @@ uint8_t nr_matrix_inverse(int32_t **a44,//Input matrix//conjH_H_elements[0] nb_rb, +1, shift0); - print_shorts("nr_det_",(int16_t*)&ad_bc[0]); + //print_shorts("nr_det_",(int16_t*)&ad_bc[0]); //Compute Inversion of the H^*H matrix /* For 2x2 MIMO matrix, we compute @@ -2135,7 +2135,7 @@ uint8_t nr_matrix_inverse(int32_t **a44,//Input matrix//conjH_H_elements[0] nb_rb, ((rtx&1)==1?-1:1)*((ctx&1)==1?-1:1), shift0); - printf("H_h_H(r%d,c%d)=%d+j%d --> inv_H_h_H(%d,%d) = %d+j%d \n",rtx,ctx,((short *)a44[ctx*size+rtx])[0],((short *)a44[ctx*size+rtx])[1],ctx,rtx,((short *)inv_H_h_H[rtx*size+ctx])[0],((short *)inv_H_h_H[rtx*size+ctx])[1]); + //printf("H_h_H(r%d,c%d)=%d+j%d --> inv_H_h_H(%d,%d) = %d+j%d \n",rtx,ctx,((short *)a44[ctx*size+rtx])[0],((short *)a44[ctx*size+rtx])[1],ctx,rtx,((short *)inv_H_h_H[rtx*size+ctx])[0],((short *)inv_H_h_H[rtx*size+ctx])[1]); } } _mm_empty(); @@ -2159,15 +2159,18 @@ uint8_t nr_matrix_inverse(int32_t **a44,//Input matrix//conjH_H_elements[0] determin_cpx = nr_determin_cpx(a44_cpx,// size,//size +1); - if (i<4) printf("nr_det_cpx = %lf+j%lf \n",creal(determin_cpx)/(1<<(size-1)*shift0),cimag(determin_cpx)/(1<<(size-1)*shift0)); - //Round and convert to Q15 - if (creal(determin_cpx)>0)//determin of the symmetric matrix is real part only - ((short*) ad_bc)[i<<1] = (short) ((creal(determin_cpx)/(1<<(size-1)*shift0))+0.5);// - else - ((short*) ad_bc)[i<<1] = (short) ((creal(determin_cpx)/(1<<(size-1)*shift0))-0.5);// - ((short*) ad_bc)[(i<<1)+1] = (short) 0;//Imag=0 + //if (i<4) printf("order %d nr_det_cpx = %lf+j%lf \n",log2_approx(creal(determin_cpx)),creal(determin_cpx)/(1<<((size-1)*shift0)),cimag(determin_cpx)/(1<<((size-1)*shift0))); - //Compute Inversion of the H^*H matrix + //Round and convert to Q15 (Out in the same format as Fixed point). + if (creal(determin_cpx)>0) {//determin of the symmetric matrix is real part only + ((short*) ad_bc)[i<<1] = (short) ((creal(determin_cpx)/(1<<((size-1)*shift0)))+0.5);// + ((short*) ad_bc)[(i<<1)+1] = (short) ((cimag(determin_cpx)/(1<<((size-1)*shift0)))+0.5);// + } else { + ((short*) ad_bc)[i<<1] = (short) ((creal(determin_cpx)/(1<<((size-1)*shift0)))-0.5);// + ((short*) ad_bc)[(i<<1)+1] = (short) ((cimag(determin_cpx)/(1<<((size-1)*shift0)))-0.5);// + } + //if (i<4) printf("nr_det_FP= %d+j%d \n",((short*) ad_bc)[i<<1],((short*) ad_bc)[(i<<1)+1]); + //Compute Inversion of the H^*H matrix (normalized output divide by determinant) for (int rtx=0;rtx inv_H_h_H(%d,%d) = %lf+j%lf \n",rtx,ctx,creal(a44_cpx[ctx*size+rtx]),cimag(a44_cpx[ctx*size+rtx]),ctx,rtx,creal(inv_H_h_H_cpx[rtx*size+ctx])*(1<<15),cimag(inv_H_h_H_cpx[rtx*size+ctx])*(1<<15)); + ((rtx&1)==1?-1:1)*((ctx&1)==1?-1:1))/(determin_cpx); + //if (i==0) printf("H_h_H(r%d,c%d)=%lf+j%lf --> inv_H_h_H(%d,%d) = %lf+j%lf \n",rtx,ctx,creal(a44_cpx[ctx*size+rtx]),cimag(a44_cpx[ctx*size+rtx]),ctx,rtx,creal(inv_H_h_H_cpx[rtx*size+ctx])*(1<<18),cimag(inv_H_h_H_cpx[rtx*size+ctx])*(1<<18)); if (creal(inv_H_h_H_cpx[rtx*size+ctx])>0) - ((short *) inv_H_h_H[rtx*size+ctx])[i<<1] = (short) ((creal(inv_H_h_H_cpx[rtx*size+ctx])*(1<<15))+0.5);// + ((short *) inv_H_h_H[rtx*size+ctx])[i<<1] = (short) ((creal(inv_H_h_H_cpx[rtx*size+ctx])*(1<<18))+0.5);//Convert to Q 18 else - ((short *) inv_H_h_H[rtx*size+ctx])[i<<1] = (short) ((creal(inv_H_h_H_cpx[rtx*size+ctx])*(1<<15))-0.5);// + ((short *) inv_H_h_H[rtx*size+ctx])[i<<1] = (short) ((creal(inv_H_h_H_cpx[rtx*size+ctx])*(1<<18))-0.5);// if (cimag(inv_H_h_H_cpx[rtx*size+ctx])>0) - ((short *) inv_H_h_H[rtx*size+ctx])[(i<<1)+1] = (short) ((cimag(inv_H_h_H_cpx[rtx*size+ctx])*(1<<15))+0.5);// + ((short *) inv_H_h_H[rtx*size+ctx])[(i<<1)+1] = (short) ((cimag(inv_H_h_H_cpx[rtx*size+ctx])*(1<<18))+0.5);// else - ((short *) inv_H_h_H[rtx*size+ctx])[(i<<1)+1] = (short) ((cimag(inv_H_h_H_cpx[rtx*size+ctx])*(1<<15))-0.5);// + ((short *) inv_H_h_H[rtx*size+ctx])[(i<<1)+1] = (short) ((cimag(inv_H_h_H_cpx[rtx*size+ctx])*(1<<18))-0.5);// + + //if (i<4) printf("inv_H_h_H_FP(%d,%d)= %d+j%d \n",ctx,rtx, ((short *) inv_H_h_H[rtx*size+ctx])[i<<1],((short *) inv_H_h_H[rtx*size+ctx])[(i<<1)+1]); } } } @@ -2310,15 +2315,15 @@ uint8_t nr_zero_forcing_rx(int **rxdataF_comp, inv_H_h_H[ctx*n_tx+rtx] = (int32_t *)malloc16_clear( 12*nb_rb_0*sizeof(int32_t) ); } } - int fpshift = 5; - int fp_flag = 0; + int fp_flag = 1;//0: float point calc 1: Fixed point calc + int fpshift = 8; nr_matrix_inverse(conjH_H_elements[0],//Input matrix inv_H_h_H,//Inverse determ_fin,//determin n_tx,//size nb_rb_0, fp_flag,//fixed point flag - fpshift); + fpshift);//the out put is Q15 // multiply Matrix inversion pf H_h_H by the rx signal vector int32_t outtemp[12*nb_rb_0] __attribute__((aligned(32))); @@ -2339,17 +2344,17 @@ uint8_t nr_zero_forcing_rx(int **rxdataF_comp, (int *)&rxdataF_comp[ctx*n_rx][symbol*nb_rb*12], outtemp, nb_rb_0, - fpshift);//9 + fpshift + (fp_flag? 0: 2));//out in 15-fpshift nr_a_sum_b((__m128i *)rxdataF_zforcing[rtx], - (__m128i *)outtemp, - nb_rb_0);//a =a + b + (__m128i *)outtemp, + nb_rb_0);//a =a + b } -//#ifdef DEBUG_DLSCH_DEMOD +#ifdef DEBUG_DLSCH_DEMOD printf("Computing layer_%d \n",rtx);; print_shorts(" Rx signal:=",(int16_t*)&rxdataF_zforcing[rtx][0]); print_shorts(" Rx signal:=",(int16_t*)&rxdataF_zforcing[rtx][4]); print_shorts(" Rx signal:=",(int16_t*)&rxdataF_zforcing[rtx][8]); -//#endif +#endif } //Copy zero_forcing out to output array @@ -2387,9 +2392,8 @@ uint8_t nr_zero_forcing_rx(int **rxdataF_comp, for (int rb=0; rb<3*nb_rb_0; rb++) { //for symmetric H_h_H matrix, the determinant is only real values if (fp_flag) { - mmtmpD2 = _mm_sign_epi16(determ_fin_128[0],*(__m128i*)&nr_realpart[0]); - mmtmpD3 = mmtmpD2; - mmtmpD3 = _mm_shufflelo_epi16(mmtmpD3,_MM_SHUFFLE(2,3,0,1)); + mmtmpD2 = _mm_sign_epi16(determ_fin_128[0],*(__m128i*)&nr_realpart[0]);//set imag part to 0 + mmtmpD3 = _mm_shufflelo_epi16(mmtmpD2,_MM_SHUFFLE(2,3,0,1)); mmtmpD3 = _mm_shufflehi_epi16(mmtmpD3,_MM_SHUFFLE(2,3,0,1)); mmtmpD2 = _mm_add_epi16(mmtmpD2,mmtmpD3); @@ -2406,11 +2410,11 @@ uint8_t nr_zero_forcing_rx(int **rxdataF_comp, dl_ch_mag128r_0[0] = _mm_slli_epi16(dl_ch_mag128r_0[0],1); } else{ dl_ch_mag128_0[0] = QAM_amp128; - dl_ch_mag128_0[0] = _mm_srai_epi16(dl_ch_mag128_0[0],fpshift); + dl_ch_mag128_0[0] = _mm_srai_epi16(dl_ch_mag128_0[0],fpshift-1); dl_ch_mag128b_0[0] = QAM_amp128b; - dl_ch_mag128b_0[0] = _mm_srai_epi16(dl_ch_mag128b_0[0],fpshift); + dl_ch_mag128b_0[0] = _mm_srai_epi16(dl_ch_mag128b_0[0],fpshift-1); dl_ch_mag128r_0[0] = QAM_amp128r; - dl_ch_mag128r_0[0] = _mm_srai_epi16(dl_ch_mag128r_0[0],fpshift); + dl_ch_mag128r_0[0] = _mm_srai_epi16(dl_ch_mag128r_0[0],fpshift-1); } determ_fin_128 += 1; diff --git a/targets/ARCH/rfsimulator/simulator.c b/targets/ARCH/rfsimulator/simulator.c index bff62e522d..24a0348d35 100644 --- a/targets/ARCH/rfsimulator/simulator.c +++ b/targets/ARCH/rfsimulator/simulator.c @@ -736,10 +736,10 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest CirSize ); else { // no channel modeling - double H_awgn_mimo[4][4] ={{1.0, 0.0, 0.0, 0.0},//rx 0 - {0.0, 1.0, 0.0, 0.0}, //rx 1 - {0.0, 0.0, 1.0, 0.0}, //rx 2 - {0.0, 0.0, 0.0, 1.0}};//rx 3 + double H_awgn_mimo[4][4] ={{1.0, 0.2, 0.1, 0.05}, //rx 0 + {0.2, 1.0, 0.2, 0.1}, //rx 1 + {0.1, 0.2, 1.0, 0.2}, //rx 2 + {0.05, 0.1, 0.2, 1.0}};//rx 3 sample_t *out=(sample_t *)samplesVoid[a]; int nbAnt_tx = ptr->th.nbAnt;//number of Tx antennas diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf index b682f130b1..e5348ab605 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf @@ -219,7 +219,7 @@ RUs = ( #bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; ## beamforming 2x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000]; - ## beamforming 4x4 matrix: + #beamforming 4x4 matrix: bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; clock_src = "external"; From 0e17edc16526c146fe79165fa798f94c1e02c07c Mon Sep 17 00:00:00 2001 From: sfn Date: Wed, 26 Jan 2022 03:34:29 +0100 Subject: [PATCH 18/67] solve division by null for floating point zero forcing, fix fp shift --- .../NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 41 ++++++++----------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 7fc1e99c31..756278d51d 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -2150,24 +2150,26 @@ uint8_t nr_matrix_inverse(int32_t **a44,//Input matrix//conjH_H_elements[0] double complex determin_cpx; for (int i=0; i<12*nb_rb; i++) { + //Convert Q15 to floating point for (int rtx=0;rtx0) {//determin of the symmetric matrix is real part only - ((short*) ad_bc)[i<<1] = (short) ((creal(determin_cpx)/(1<<((size-1)*shift0)))+0.5);// - ((short*) ad_bc)[(i<<1)+1] = (short) ((cimag(determin_cpx)/(1<<((size-1)*shift0)))+0.5);// + ((short*) ad_bc)[i<<1] = (short) ((creal(determin_cpx)*(1<<(shift0)))+0.5);// + //((short*) ad_bc)[(i<<1)+1] = (short) ((cimag(determin_cpx)*(1<<(shift0)))+0.5);// } else { - ((short*) ad_bc)[i<<1] = (short) ((creal(determin_cpx)/(1<<((size-1)*shift0)))-0.5);// - ((short*) ad_bc)[(i<<1)+1] = (short) ((cimag(determin_cpx)/(1<<((size-1)*shift0)))-0.5);// + ((short*) ad_bc)[i<<1] = (short) ((creal(determin_cpx)*(1<<(shift0)))-0.5);// + //((short*) ad_bc)[(i<<1)+1] = (short) ((cimag(determin_cpx)*(1<<(shift0)))-0.5);// } //if (i<4) printf("nr_det_FP= %d+j%d \n",((short*) ad_bc)[i<<1],((short*) ad_bc)[(i<<1)+1]); //Compute Inversion of the H^*H matrix (normalized output divide by determinant) @@ -2187,18 +2189,18 @@ uint8_t nr_matrix_inverse(int32_t **a44,//Input matrix//conjH_H_elements[0] inv_H_h_H_cpx[rtx*size+ctx] = nr_determin_cpx(sub_matrix_cpx,// size-1,//size - ((rtx&1)==1?-1:1)*((ctx&1)==1?-1:1))/(determin_cpx); - //if (i==0) printf("H_h_H(r%d,c%d)=%lf+j%lf --> inv_H_h_H(%d,%d) = %lf+j%lf \n",rtx,ctx,creal(a44_cpx[ctx*size+rtx]),cimag(a44_cpx[ctx*size+rtx]),ctx,rtx,creal(inv_H_h_H_cpx[rtx*size+ctx])*(1<<18),cimag(inv_H_h_H_cpx[rtx*size+ctx])*(1<<18)); + ((rtx&1)==1?-1:1)*((ctx&1)==1?-1:1)); + //if (i==0) printf("H_h_H(r%d,c%d)=%lf+j%lf --> inv_H_h_H(%d,%d) = %lf+j%lf \n",rtx,ctx,creal(a44_cpx[ctx*size+rtx]),cimag(a44_cpx[ctx*size+rtx]),ctx,rtx,creal(inv_H_h_H_cpx[rtx*size+ctx]),cimag(inv_H_h_H_cpx[rtx*size+ctx])); if (creal(inv_H_h_H_cpx[rtx*size+ctx])>0) - ((short *) inv_H_h_H[rtx*size+ctx])[i<<1] = (short) ((creal(inv_H_h_H_cpx[rtx*size+ctx])*(1<<18))+0.5);//Convert to Q 18 + ((short *) inv_H_h_H[rtx*size+ctx])[i<<1] = (short) ((creal(inv_H_h_H_cpx[rtx*size+ctx])*(1<<(shift0-1)))+0.5);//Convert to Q 18 else - ((short *) inv_H_h_H[rtx*size+ctx])[i<<1] = (short) ((creal(inv_H_h_H_cpx[rtx*size+ctx])*(1<<18))-0.5);// + ((short *) inv_H_h_H[rtx*size+ctx])[i<<1] = (short) ((creal(inv_H_h_H_cpx[rtx*size+ctx])*(1<<(shift0-1)))-0.5);// if (cimag(inv_H_h_H_cpx[rtx*size+ctx])>0) - ((short *) inv_H_h_H[rtx*size+ctx])[(i<<1)+1] = (short) ((cimag(inv_H_h_H_cpx[rtx*size+ctx])*(1<<18))+0.5);// + ((short *) inv_H_h_H[rtx*size+ctx])[(i<<1)+1] = (short) ((cimag(inv_H_h_H_cpx[rtx*size+ctx])*(1<<(shift0-1)))+0.5);// else - ((short *) inv_H_h_H[rtx*size+ctx])[(i<<1)+1] = (short) ((cimag(inv_H_h_H_cpx[rtx*size+ctx])*(1<<18))-0.5);// + ((short *) inv_H_h_H[rtx*size+ctx])[(i<<1)+1] = (short) ((cimag(inv_H_h_H_cpx[rtx*size+ctx])*(1<<(shift0-1)))-0.5);// //if (i<4) printf("inv_H_h_H_FP(%d,%d)= %d+j%d \n",ctx,rtx, ((short *) inv_H_h_H[rtx*size+ctx])[i<<1],((short *) inv_H_h_H[rtx*size+ctx])[(i<<1)+1]); } @@ -2316,14 +2318,13 @@ uint8_t nr_zero_forcing_rx(int **rxdataF_comp, } } int fp_flag = 1;//0: float point calc 1: Fixed point calc - int fpshift = 8; nr_matrix_inverse(conjH_H_elements[0],//Input matrix inv_H_h_H,//Inverse determ_fin,//determin n_tx,//size nb_rb_0, fp_flag,//fixed point flag - fpshift);//the out put is Q15 + shift-(fp_flag==1?2:0));//the out put is Q15 // multiply Matrix inversion pf H_h_H by the rx signal vector int32_t outtemp[12*nb_rb_0] __attribute__((aligned(32))); @@ -2344,7 +2345,7 @@ uint8_t nr_zero_forcing_rx(int **rxdataF_comp, (int *)&rxdataF_comp[ctx*n_rx][symbol*nb_rb*12], outtemp, nb_rb_0, - fpshift + (fp_flag? 0: 2));//out in 15-fpshift + shift-(fp_flag==1?2:0)); nr_a_sum_b((__m128i *)rxdataF_zforcing[rtx], (__m128i *)outtemp, nb_rb_0);//a =a + b @@ -2391,7 +2392,6 @@ uint8_t nr_zero_forcing_rx(int **rxdataF_comp, for (int rb=0; rb<3*nb_rb_0; rb++) { //for symmetric H_h_H matrix, the determinant is only real values - if (fp_flag) { mmtmpD2 = _mm_sign_epi16(determ_fin_128[0],*(__m128i*)&nr_realpart[0]);//set imag part to 0 mmtmpD3 = _mm_shufflelo_epi16(mmtmpD2,_MM_SHUFFLE(2,3,0,1)); mmtmpD3 = _mm_shufflehi_epi16(mmtmpD3,_MM_SHUFFLE(2,3,0,1)); @@ -2408,14 +2408,7 @@ uint8_t nr_zero_forcing_rx(int **rxdataF_comp, dl_ch_mag128b_0[0] = _mm_slli_epi16(dl_ch_mag128b_0[0],1); dl_ch_mag128r_0[0] = _mm_mulhi_epi16(dl_ch_mag128r_0[0],QAM_amp128r); dl_ch_mag128r_0[0] = _mm_slli_epi16(dl_ch_mag128r_0[0],1); - } else{ - dl_ch_mag128_0[0] = QAM_amp128; - dl_ch_mag128_0[0] = _mm_srai_epi16(dl_ch_mag128_0[0],fpshift-1); - dl_ch_mag128b_0[0] = QAM_amp128b; - dl_ch_mag128b_0[0] = _mm_srai_epi16(dl_ch_mag128b_0[0],fpshift-1); - dl_ch_mag128r_0[0] = QAM_amp128r; - dl_ch_mag128r_0[0] = _mm_srai_epi16(dl_ch_mag128r_0[0],fpshift-1); - } + determ_fin_128 += 1; dl_ch_mag128_0 += 1; From a37240197c1dd815131598b4c41ed9edd05147ee Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 3 Feb 2022 18:57:22 +0100 Subject: [PATCH 19/67] minor changes, mostly cosmetic --- openair1/PHY/INIT/nr_init.c | 34 +++-- openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c | 8 +- .../PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 4 +- .../NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 126 +++++++++--------- .../NR_UE_TRANSPORT/nr_transport_proto_ue.h | 10 +- openair2/RRC/NR/rrc_gNB_reconfig.c | 2 +- 6 files changed, 98 insertions(+), 86 deletions(-) diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 3f72075ac9..83ec2cf64c 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -93,7 +93,7 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { O2 = 1;//Vertical beam oversampling (1 or 4) N1 = gNB->frame_parms.nb_antennas_tx/(N2*x_polarization);// O1=1;//Horizontal beam oversampling (1 or 4) - CSI_RS_antenna_ports=N1*N2*x_polarization; + CSI_RS_antenna_ports=gNB->frame_parms.nb_antennas_tx; LOG_D(PHY, "NR Codebook Config: antenna ports: %d N1 %d N2 %d\n",CSI_RS_antenna_ports,N1,N2); // Generation of codebook Type1 with codebookMode 1 (CSI_RS_antenna_ports < 16) @@ -139,7 +139,9 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { } } - gNB->nr_mimo_precoding_matrix = (int32_t ***)malloc16(gNB->frame_parms.nb_antennas_tx* sizeof(int32_t **)); + int max_mimo_layers =(CSI_RS_antenna_portsnr_mimo_precoding_matrix = (int32_t ***)malloc16(max_mimo_layers* sizeof(int32_t **)); int32_t ***mat = gNB->nr_mimo_precoding_matrix; double complex res_code; @@ -174,7 +176,8 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { ((short*) &mat[0][pmiq][len])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 else ((short*) &mat[0][pmiq][len])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_D(PHY, "1 Layer Precoding Matrix[0][pmi %d][antPort %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq, len, creal(res_code), cimag(res_code),((short*) &mat[0][pmiq][len])[0],((short*) &mat[0][pmiq][len])[1]); + LOG_D(PHY, "1 Layer Precoding Matrix[0][pmi %d][antPort %d]= %f+j %f -> Fixed Point %d+j %d \n", + pmiq, len, creal(res_code), cimag(res_code),((short*) &mat[0][pmiq][len])[0],((short*) &mat[0][pmiq][len])[1]); } for(int len=N1*N2; len<2*N1*N2; len++) { @@ -187,7 +190,8 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { ((short*) &mat[0][pmiq][len])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 else ((short*) &mat[0][pmiq][len])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_D(PHY, "1 Layer Precoding Matrix[0][pmi %d][antPort %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq, len, creal(res_code), cimag(res_code),((short*) &mat[0][pmiq][len])[0],((short*) &mat[0][pmiq][len])[1]); + LOG_D(PHY, "1 Layer Precoding Matrix[0][pmi %d][antPort %d]= %f+j %f -> Fixed Point %d+j %d \n", + pmiq, len, creal(res_code), cimag(res_code),((short*) &mat[0][pmiq][len])[0],((short*) &mat[0][pmiq][len])[1]); } } } @@ -257,7 +261,8 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 else ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_I(PHY, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[1][pmiq][i_rows*2+j_col])[0],((short*) &mat[1][pmiq][i_rows*2+j_col])[1]); + LOG_D(PHY, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", + pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[1][pmiq][i_rows*2+j_col])[0],((short*) &mat[1][pmiq][i_rows*2+j_col])[1]); } for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { res_code=sqrt(1/(double)(2*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; @@ -269,7 +274,8 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 else ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_I(PHY, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[1][pmiq][i_rows*2+j_col])[0],((short*) &mat[1][pmiq][i_rows*2+j_col])[1]); + LOG_D(PHY, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", + pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[1][pmiq][i_rows*2+j_col])[0],((short*) &mat[1][pmiq][i_rows*2+j_col])[1]); } } } @@ -281,7 +287,7 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { //Table 5.2.2.2.1-7: //Codebook for 3-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS - if(CSI_RS_antenna_ports>=3) { + if(max_mimo_layers>=3) { //pmi_size is computed as follows pmiq_size = 1;//unity matrix @@ -344,7 +350,8 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 else ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_I(PHY, "3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[2][pmiq][i_rows*3+j_col])[0],((short*) &mat[2][pmiq][i_rows*3+j_col])[1]); + LOG_D(PHY, "3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", + pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[2][pmiq][i_rows*3+j_col])[0],((short*) &mat[2][pmiq][i_rows*3+j_col])[1]); } for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { res_code=sqrt(1/(double)(3*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; @@ -356,7 +363,8 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 else ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_I(PHY, "3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[2][pmiq][i_rows*3+j_col])[0],((short*) &mat[2][pmiq][i_rows*3+j_col])[1]); + LOG_D(PHY, "3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", + pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[2][pmiq][i_rows*3+j_col])[0],((short*) &mat[2][pmiq][i_rows*3+j_col])[1]); } } } @@ -369,7 +377,7 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { //Table 5.2.2.2.1-8: //Codebook for 4-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS - if(CSI_RS_antenna_ports>=4) { + if(max_mimo_layers>=4) { //pmi_size is computed as follows pmiq_size = 1;//unity matrix for(int llb=0; llb Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); + LOG_D(PHY, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", + pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); } for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { @@ -451,7 +460,8 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 else ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_D(PHY, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); + LOG_D(PHY, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", + pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); } } } diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c index 62c8023da2..33071e4070 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c @@ -386,15 +386,15 @@ void nr_processULSegment(void* arg) { p_procTime); if (check_crc((uint8_t*)llrProcBuf,length_dec,ulsch_harq->F,crc_type)) { -//#ifdef PRINT_CRC_CHECK +#ifdef PRINT_CRC_CHECK LOG_I(PHY, "Segment %d CRC OK, iterations %d/%d\n",r,no_iteration_ldpc,max_ldpc_iterations); -//#endif +#endif rdata->decodeIterations = no_iteration_ldpc; if (rdata->decodeIterations > p_decoderParms->numMaxIter) rdata->decodeIterations--; } else { -//#ifdef PRINT_CRC_CHECK +#ifdef PRINT_CRC_CHECK LOG_I(PHY, "CRC NOK\n"); -//#endif +#endif rdata->decodeIterations = max_ldpc_iterations + 1; } diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index 8edc20daf0..20c5689a09 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -446,7 +446,7 @@ void nr_processDLSegment(void* arg) { // Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int if (check_crc((uint8_t *)llrProcBuf,length_dec,harq_process->F,crc_type)) { - LOG_I(PHY,"Segment %u CRC OK\n",r); + LOG_D(PHY,"Segment %u CRC OK\n",r); if (r==0) { for (int i=0; i<10; i++) LOG_D(PHY,"byte %d : %x\n",i,((uint8_t *)llrProcBuf)[i]); @@ -456,7 +456,7 @@ void nr_processDLSegment(void* arg) { no_iteration_ldpc = dlsch->max_ldpc_iterations; rdata->decodeIterations = no_iteration_ldpc; } else { - LOG_I(PHY,"CRC NOT OK\n"); + LOG_D(PHY,"CRC NOT OK\n"); } nb_total_decod++; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 756278d51d..4d945e96fa 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -99,12 +99,12 @@ uint8_t nr_zero_forcing_rx(int **rxdataF_comp, /* Apply layer demapping */ static void nr_dlsch_layer_demapping(int16_t **llr_cw, - uint8_t Nl, - uint8_t mod_order, - uint32_t length, - int32_t codeword_TB0, - int32_t codeword_TB1, - int16_t **llr_layers); + uint8_t Nl, + uint8_t mod_order, + uint32_t length, + int32_t codeword_TB0, + int32_t codeword_TB1, + int16_t **llr_layers); /* compute LLR */ static int nr_dlsch_llr(NR_UE_PDSCH **pdsch_vars, @@ -127,6 +127,7 @@ static int nr_dlsch_llr(NR_UE_PDSCH **pdsch_vars, uint8_t nr_slot_rx, uint8_t beamforming_mode); + /* Main Function */ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, @@ -173,7 +174,6 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, //int16_t *pllr_symbol_cw0_deint; //int16_t *pllr_symbol_cw1_deint; //uint16_t bundle_L = 2; - uint16_t n_tx=1, n_rx=1; int32_t median[16]; uint32_t nb_re_pdsch; uint16_t startSymbIdx=0; @@ -337,8 +337,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d type %d: Pilot/Data extraction %5.2f \n", frame,nr_slot_rx,slot,symbol,type,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); - n_tx = dlsch0_harq->Nl; - n_rx = frame_parms->nb_antennas_rx; + int nl = dlsch0_harq->Nl; + int n_rx = frame_parms->nb_antennas_rx; nb_re_pdsch = (pilots==1)? ((config_type==NFAPI_NR_DMRS_TYPE1)?nb_rb_pdsch*(12-6*dlsch0_harq->n_dmrs_cdm_groups): nb_rb_pdsch*(12-4*dlsch0_harq->n_dmrs_cdm_groups)) : (nb_rb_pdsch*12); //---------------------------------------------------------- //--------------------- Channel Scaling -------------------- @@ -346,7 +346,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); nr_dlsch_scale_channel(pdsch_vars[gNB_id]->dl_ch_estimates_ext, frame_parms, - n_tx, + nl, n_rx, dlsch, symbol, @@ -356,7 +356,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); if (cpumeas(CPUMEAS_GETSTATE)) - LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Scale %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); + LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Scale %5.2f \n", + frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); //---------------------------------------------------------- //--------------------- Channel Level Calc. ---------------- @@ -365,27 +366,27 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, if (first_symbol_flag==1) { nr_dlsch_channel_level(pdsch_vars[gNB_id]->dl_ch_estimates_ext, frame_parms, - n_tx, + nl, avg, symbol, nb_re_pdsch, nb_rb_pdsch); avgs = 0; - for (aatx=0;aatxnb_antennas_rx+aarx]); - avgs = cmax(avgs,avg[(aatx*frame_parms->nb_antennas_rx)+aarx]); + //LOG_I(PHY, "nb_rb %d len %d avg_%d_%d Power per SC is %d\n",nb_rb, len,aarx, aatx,avg[aatx*n_rx+aarx]); + avgs = cmax(avgs,avg[(aatx*n_rx)+aarx]); //LOG_I(PHY, "avgs Power per SC is %d\n", avgs); - median[(aatx*frame_parms->nb_antennas_rx)+aarx] = avg[(aatx*frame_parms->nb_antennas_rx)+aarx]; + median[(aatx*n_rx)+aarx] = avg[(aatx*n_rx)+aarx]; } if (dlsch0_harq->Nl > 1) { nr_dlsch_channel_level_median(pdsch_vars[gNB_id]->dl_ch_estimates_ext, median, - n_tx, + nl, n_rx, nb_re_pdsch, symbol*nb_rb_pdsch*12); - for (aatx = 0; aatx < n_tx; aatx++) { + for (aatx = 0; aatx < nl; aatx++) { for (aarx = 0; aarx < n_rx; aarx++) { avgs = cmax(avgs, median[aatx*n_rx + aarx]); } @@ -428,7 +429,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, pdsch_vars[gNB_id]->rxdataF_comp0, NULL,//NULL:disable meas. pdsch_vars[gNB_id]->rho:enable meas. frame_parms, - n_tx, + nl, symbol, nb_re_pdsch, first_symbol_flag, @@ -442,18 +443,18 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); - if (frame_parms->nb_antennas_rx > 1) { + if (n_rx > 1) { nr_dlsch_detection_mrc(pdsch_vars[gNB_id]->rxdataF_comp0, - (n_tx>1)? pdsch_vars[gNB_id]->rho : NULL, + (nl>1)? pdsch_vars[gNB_id]->rho : NULL, pdsch_vars[gNB_id]->dl_ch_mag0, pdsch_vars[gNB_id]->dl_ch_magb0, pdsch_vars[gNB_id]->dl_ch_magr0, - n_tx, + nl, n_rx, symbol, nb_rb_pdsch, nb_re_pdsch); - if (n_tx >= 2)//Apply zero forcing for 2, 3, and 4 Tx layers + if (nl >= 2)//Apply zero forcing for 2, 3, and 4 Tx layers nr_zero_forcing_rx(pdsch_vars[gNB_id]->rxdataF_comp0, pdsch_vars[gNB_id]->dl_ch_mag0, pdsch_vars[gNB_id]->dl_ch_magb0, @@ -461,7 +462,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, pdsch_vars[gNB_id]->dl_ch_estimates_ext, nb_rb_pdsch, n_rx, - n_tx, + nl, dlsch0_harq->Qm, pdsch_vars[gNB_id]->log2_maxh, symbol, @@ -1606,17 +1607,17 @@ void nr_dlsch_channel_level_median(int **dl_ch_estimates_ext, //============================================================================================== unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, - int **dl_ch_estimates, - int **rxdataF_ext, - int **dl_ch_estimates_ext, - unsigned char symbol, - uint8_t pilots, - uint8_t config_type, - unsigned short start_rb, - unsigned short nb_rb_pdsch, - uint8_t n_dmrs_cdm_groups, - NR_DL_FRAME_PARMS *frame_parms, - uint16_t dlDmrsSymbPos) + int **dl_ch_estimates, + int **rxdataF_ext, + int **dl_ch_estimates_ext, + unsigned char symbol, + uint8_t pilots, + uint8_t config_type, + unsigned short start_rb, + unsigned short nb_rb_pdsch, + uint8_t n_dmrs_cdm_groups, + NR_DL_FRAME_PARMS *frame_parms, + uint16_t dlDmrsSymbPos) { unsigned short k,rb; @@ -1702,18 +1703,18 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, } void nr_dlsch_extract_rbs(int **rxdataF, - int **dl_ch_estimates, - int **rxdataF_ext, - int **dl_ch_estimates_ext, - unsigned char symbol, - uint8_t pilots, - uint8_t config_type, - unsigned short start_rb, - unsigned short nb_rb_pdsch, - uint8_t n_dmrs_cdm_groups, - uint8_t Nl, - NR_DL_FRAME_PARMS *frame_parms, - uint16_t dlDmrsSymbPos) + int **dl_ch_estimates, + int **rxdataF_ext, + int **dl_ch_estimates_ext, + unsigned char symbol, + uint8_t pilots, + uint8_t config_type, + unsigned short start_rb, + unsigned short nb_rb_pdsch, + uint8_t n_dmrs_cdm_groups, + uint8_t Nl, + NR_DL_FRAME_PARMS *frame_parms, + uint16_t dlDmrsSymbPos) { unsigned short k,rb; @@ -1942,9 +1943,9 @@ void nr_a_mult_b(int *a, * * */ void nr_element_sign(int32_t *a,//a - int32_t *b,//b - unsigned short nb_rb, - int32_t sign) + int32_t *b,//b + unsigned short nb_rb, + int32_t sign) { int16_t nr_sign[8]__attribute__((aligned(16))) = {-1,-1,-1,-1,-1,-1,-1,-1} ; unsigned short rb; @@ -2000,7 +2001,7 @@ void nr_determin(int32_t **a44,// ad_bc,//b nb_rb, sign); - }else { + } else { for (int rtx=0;rtxcodebookConfig->codebookType.choice.type1 = calloc(1,sizeof(*csirep1->codebookConfig->codebookType.choice.type1)); csirep1->codebookConfig->codebookType.choice.type1->subType.present=NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel; csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel=calloc(1,sizeof(*csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel)); - if (dl_antenna_ports <= 2) { + if (dl_antenna_ports == 2) { csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present= NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two; csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two= From ec4ae32af0c8aad9a7101d6a74a647125a32d4a5 Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 10 Feb 2022 16:59:09 +0100 Subject: [PATCH 20/67] N1 N2 and XP for DL antenna ports in config file --- ci-scripts/conf_files/benetel-5g.conf | 4 +-- ci-scripts/conf_files/gNB_SA_DU.conf | 2 -- .../gNB_SA_n78_106PRB.2x2_usrpn310.conf | 2 +- .../gNB_SA_n78_133PRB.2x2_usrpn310.conf | 2 +- .../gnb.band261.tm1.32PRB.usrpn300.conf | 2 -- .../gnb.band66.tm1.106PRB.usrpn300.conf | 2 -- .../gnb.band78.nsa_2x2.106PRB.usrpn310.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 | 8 +++--- .../gnb.band78.tm1.106PRB.usrpn300.conf | 2 -- .../gnb.band78.tm1.fr1.106PRB.usrpb210.conf | 2 -- .../gnb.band78.tm1.fr1.106PRB.usrpn310.conf | 2 -- openair1/PHY/defs_gNB.h | 3 +++ openair1/SIMULATION/NR_PHY/dlsim.c | 14 +++++++--- openair1/SIMULATION/NR_PHY/ulsim.c | 11 +++++--- openair2/COMMON/rrc_messages_types.h | 4 ++- openair2/GNB_APP/gnb_config.c | 24 +++++++++++++---- openair2/GNB_APP/gnb_paramdef.h | 26 ++++++++++++------- openair2/LAYER2/NR_MAC_gNB/config.c | 18 +++++++------ openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 8 +++--- openair2/RRC/NR/MESSAGES/asn1_msg.c | 9 ------- openair2/RRC/NR/nr_rrc_defs.h | 7 ++++- openair2/RRC/NR/nr_rrc_proto.h | 4 +-- openair2/RRC/NR/rrc_gNB.c | 4 ++- openair2/RRC/NR/rrc_gNB_nsa.c | 4 +-- openair2/RRC/NR/rrc_gNB_reconfig.c | 6 +++-- .../GENERIC-LTE-EPC/CONF/benetel-5g.conf | 2 -- .../CONF/gnb.band257.tm1.32PRB.usrpn300.conf | 2 -- .../CONF/gnb.band257.tm1.32PRB.usrpx300.conf | 2 -- .../CONF/gnb.band257.tm1.66PRB.usrpn300.conf | 4 +-- .../CONF/gnb.band261.tm1.32PRB.usrpn300.conf | 2 -- .../CONF/gnb.band66.tm1.106PRB.usrpn300.conf | 2 -- .../CONF/gnb.band66.tm1.106PRB.usrpx300.conf | 2 -- .../gnb.band78.106PRB.30kHz,usrpb2x0.conf | 2 -- .../CONF/gnb.band78.106PRB.slave.conf | 4 +-- .../CONF/gnb.band78.slave.conf | 2 -- .../gnb.band78.tm1.106PRB.PTRS.usrpx300.conf | 2 -- .../CONF/gnb.band78.tm1.106PRB.usrpb210.conf | 4 +-- .../CONF/gnb.band78.tm1.106PRB.usrpn300.conf | 2 -- .../CONF/gnb.band78.tm1.106PRB.usrpx300.conf | 2 -- .../CONF/gnb.band78.tm1.217PRB.usrpn300.conf | 2 -- .../CONF/gnb.band78.tm1.217PRB.usrpx300.conf | 4 +-- .../CONF/gnb.band78.tm1.24PRB.usrpb210.conf | 4 +-- .../CONF/gnb.band78.tm1.24PRB.usrpn300.conf | 4 +-- .../CONF/gnb.band78.tm1.24PRB.usrpx300.conf | 2 -- .../CONF/gnb.band78.tm1.273PRB.usrpn300.conf | 2 -- .../CONF/rcc.band78.tm1.106PRB.nfapi.conf | 2 -- .../GENERIC-LTE-EPC/CONF/testing_gnb.conf | 2 -- .../CONF/testing_gnb_24PRB.conf | 2 -- .../CONF/testing_gnb_n310.conf | 2 -- .../CONF/testing_gnb_nsa_n310.conf | 2 -- .../PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf | 2 -- ...b.band78.tm1.106PRB.usrpn300.gtp-itti.conf | 2 -- .../gnb.sa.band41.fr1.106PRB.usrpb210.conf | 2 -- ...gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf | 2 +- .../gnb.sa.band78.fr1.106PRB.usrpb210.conf | 2 -- ...b.sa.band78.fr1.106PRB.usrpb210.sabox.conf | 2 -- ...gnb.sa.band78.fr1.162PRB.2x2.usrpn300.conf | 4 +-- 59 files changed, 107 insertions(+), 147 deletions(-) diff --git a/ci-scripts/conf_files/benetel-5g.conf b/ci-scripts/conf_files/benetel-5g.conf index dc86567c1f..68985e46f8 100644 --- a/ci-scripts/conf_files/benetel-5g.conf +++ b/ci-scripts/conf_files/benetel-5g.conf @@ -22,9 +22,7 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 31; //0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; - + servingCellConfigCommon = ( { #spCellConfigCommon diff --git a/ci-scripts/conf_files/gNB_SA_DU.conf b/ci-scripts/conf_files/gNB_SA_DU.conf index adcbcd45d0..d9abb5b395 100644 --- a/ci-scripts/conf_files/gNB_SA_DU.conf +++ b/ci-scripts/conf_files/gNB_SA_DU.conf @@ -37,8 +37,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; min_rxtxtime = 6; sib1_tda = 0; 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 e3bdde8469..b40403894d 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 @@ -38,7 +38,7 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; + pdsch_AntennaPorts_N1 = 2; pusch_AntennaPorts = 2; pdcch_ConfigSIB1 = ( 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 3955b1542e..5f6a5c55cd 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 @@ -39,7 +39,7 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; + pdsch_AntennaPorts_N1 = 2; pusch_AntennaPorts = 2; pdcch_ConfigSIB1 = ( 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 dd9c210c0d..e11e153b02 100644 --- a/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf @@ -22,8 +22,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; min_rxtxtime = 6; servingCellConfigCommon = ( diff --git a/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf index 2400136f9f..dbdbfe97f5 100644 --- a/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf @@ -22,8 +22,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; min_rxtxtime = 6; servingCellConfigCommon = ( 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 adb79ceb8d..f9cf916755 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 @@ -20,7 +20,7 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 31; //0; - pdsch_AntennaPorts = 1; + pdsch_AntennaPorts_N1 = 2; pusch_AntennaPorts = 2; pusch_TargetSNRx10 = 200; pucch_TargetSNRx10 = 200; 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 b71bd3acd9..bf388e23f7 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 @@ -38,7 +38,7 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; + pdsch_AntennaPorts_N1 = 2; pusch_AntennaPorts = 2; ul_prbblacklist = "51,52,53,54" do_SRS = 1; 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 32a40fe951..1599f33c50 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 @@ -38,8 +38,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; #pusch_TargetSNRx10 = 200; #pucch_TargetSNRx10 = 200; ul_prbblacklist = "51,52,53,54" 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 f28c3167b6..fa1ad38526 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 @@ -38,8 +38,8 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; + pdsch_AntennaPorts_N1 = 2; + pusch_AntennaPorts = 2; #pusch_TargetSNRx10 = 200; #pucch_TargetSNRx10 = 200; ul_prbblacklist = "51,52,53,54" @@ -247,8 +247,8 @@ L1s = ( RUs = ( { local_rf = "yes" - nb_tx = 1 - nb_rx = 1 + nb_tx = 2 + nb_rx = 2 att_tx = 0 att_rx = 0; bands = [78]; diff --git a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf index 9cc8f554e8..ef0af5f215 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf @@ -22,8 +22,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; min_rxtxtime = 6; servingCellConfigCommon = ( 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 249b7e4527..8de74fdf33 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 @@ -20,8 +20,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 31; //0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; servingCellConfigCommon = ( { diff --git a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf index f232106d56..71c6de48e9 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf @@ -21,8 +21,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 31; //0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; min_rxtxtime = 6; servingCellConfigCommon = ( diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index d39cdf95b5..f1030c6cb5 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -853,6 +853,9 @@ typedef struct PHY_VARS_gNB_s { /// counter to average prach energh over first 100 prach opportunities int prach_energy_counter; + int ap_N1; + int ap_N2; + int ap_XP; int pucch0_thres; int pusch_thres; int prach_thres; diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index c12bb8d085..18f2d30fac 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -196,7 +196,7 @@ int nr_derive_key(int alg_type, uint8_t alg_id, void config_common(int Mod_idP, int ssb_SubcarrierOffset, - int pdsch_AntennaPorts, + rrc_pdsch_AntennaPorts_t pdsch_AntennaPorts, int pusch_AntennaPorts, NR_ServingCellConfigCommon_t *scc ); @@ -777,7 +777,12 @@ int main(int argc, char **argv) prepare_scd(scd); - fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, 0, 1, n_tx, 6, 0, 0, 0, 0); + rrc_pdsch_AntennaPorts_t pdsch_AntennaPorts; + pdsch_AntennaPorts.N1 = n_tx; + pdsch_AntennaPorts.N2 = 1; + pdsch_AntennaPorts.XP = 1; + + fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, 0, 1, pdsch_AntennaPorts, 6, 0, 0, 0, 0); /* RRC parameter validation for secondaryCellGroup */ fix_scd(scd); @@ -795,10 +800,11 @@ int main(int argc, char **argv) AssertFatal((gNB->if_inst = NR_IF_Module_init(0))!=NULL,"Cannot register interface"); gNB->if_inst->NR_PHY_config_req = nr_phy_config_request; + // common configuration - rrc_mac_config_req_gNB(0,0, n_tx, n_tx, 0, scc, NULL, 0, 0, NULL); + rrc_mac_config_req_gNB(0,0, pdsch_AntennaPorts, n_rx, 0, scc, NULL, 0, 0, NULL); // UE dedicated configuration - rrc_mac_config_req_gNB(0,0, n_tx, n_tx, 0, scc, NULL, 1, secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup); + rrc_mac_config_req_gNB(0,0, pdsch_AntennaPorts, n_rx, 0, scc, NULL, 1, secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup); // reset preprocessor to the one of DLSIM after it has been set during // rrc_mac_config_req_gNB gNB_mac->pre_processor_dl = nr_dlsim_preprocessor; diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index c71f52c41a..6c5329de42 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -720,7 +720,12 @@ int main(int argc, char **argv) prepare_scd(scd); - fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, 0, 1, n_tx, 0, 0, 0, 0, 0); + rrc_pdsch_AntennaPorts_t pdsch_AntennaPorts; + pdsch_AntennaPorts.N1 = n_tx; + pdsch_AntennaPorts.N2 = 1; + pdsch_AntennaPorts.XP = 1; + + fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, 0, 1, pdsch_AntennaPorts, 0, 0, 0, 0, 0); // xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)secondaryCellGroup); @@ -731,9 +736,9 @@ int main(int argc, char **argv) gNB->if_inst->NR_PHY_config_req = nr_phy_config_request; // common configuration - rrc_mac_config_req_gNB(0,0, n_tx, n_rx, 0, scc, &rrc.carrier.mib,0, 0, NULL); + rrc_mac_config_req_gNB(0,0, pdsch_AntennaPorts, n_rx, 0, scc, &rrc.carrier.mib,0, 0, NULL); // UE dedicated configuration - rrc_mac_config_req_gNB(0,0, n_tx, n_rx, 0, scc, &rrc.carrier.mib,1, secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup); + rrc_mac_config_req_gNB(0,0, pdsch_AntennaPorts, n_rx, 0, scc, &rrc.carrier.mib,1, secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup); frame_parms->nb_antennas_tx = n_tx; frame_parms->nb_antennas_rx = n_rx; nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config; diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index 769bc7d01d..57b2267195 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -413,7 +413,9 @@ typedef struct NRRrcConfigurationReq_s { NR_ServingCellConfig_t *scd; int ssb_SubcarrierOffset; int sib1_tda; - int pdsch_AntennaPorts; + int pdsch_AntennaPorts_N1; + int pdsch_AntennaPorts_N2; + int pdsch_AntennaPorts_XP; int pusch_AntennaPorts; int minRXTXTIME; int do_CSIRS; diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index db9614b13f..d3f1499164 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -614,8 +614,11 @@ void RCconfig_NR_L1(void) { 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; + config_getlist( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL); + int N1 = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_N1_IDX].iptr; + int N2 = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_N2_IDX].iptr; + int XP = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_XP_IDX].iptr; + char *ulprbbl = *GNBParamList.paramarray[0][GNB_ULPRBBLACKLIST_IDX].strptr; if (ulprbbl) LOG_I(NR_PHY,"PRB blacklist %s\n",ulprbbl); char *pt = strtok(ulprbbl,","); int prbbl[275]; @@ -659,6 +662,9 @@ void RCconfig_NR_L1(void) { 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; + RC.gNB[j]->ap_N1 = N1; + RC.gNB[j]->ap_N2 = N2; + RC.gNB[j]->ap_XP = XP; 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) { @@ -1157,8 +1163,12 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { } printf("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); - NRRRC_CONFIGURATION_REQ (msg_p).pdsch_AntennaPorts = *GNBParamList.paramarray[i][GNB_PDSCH_ANTENNAPORTS_IDX].iptr; + printf("pdsch_AntennaPorts N1 %d\n",*GNBParamList.paramarray[i][GNB_PDSCH_ANTENNAPORTS_N1_IDX].iptr); + NRRRC_CONFIGURATION_REQ (msg_p).pdsch_AntennaPorts_N1 = *GNBParamList.paramarray[i][GNB_PDSCH_ANTENNAPORTS_N1_IDX].iptr; + printf("pdsch_AntennaPorts N2 %d\n",*GNBParamList.paramarray[i][GNB_PDSCH_ANTENNAPORTS_N2_IDX].iptr); + NRRRC_CONFIGURATION_REQ (msg_p).pdsch_AntennaPorts_N2 = *GNBParamList.paramarray[i][GNB_PDSCH_ANTENNAPORTS_N2_IDX].iptr; + printf("pdsch_AntennaPorts XP %d\n",*GNBParamList.paramarray[i][GNB_PDSCH_ANTENNAPORTS_XP_IDX].iptr); + NRRRC_CONFIGURATION_REQ (msg_p).pdsch_AntennaPorts_XP = *GNBParamList.paramarray[i][GNB_PDSCH_ANTENNAPORTS_XP_IDX].iptr; printf("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); @@ -2030,9 +2040,13 @@ void configure_gnb_du_mac(int inst) { gNB_RRC_INST *rrc = RC.nrrrc[inst]; // LOG_I(GNB_APP,"Configuring MAC/L1 %d, carrier->sib2 %p\n", inst, &carrier->sib2->radioResourceConfigCommon); LOG_I(GNB_APP,"Configuring gNB DU MAC/L1 %d \n", inst); + rrc_pdsch_AntennaPorts_t pdsch_AntennaPorts; + pdsch_AntennaPorts.N1 = rrc->configuration.pdsch_AntennaPorts_N1; + pdsch_AntennaPorts.N2 = rrc->configuration.pdsch_AntennaPorts_N2; + pdsch_AntennaPorts.XP = rrc->configuration.pdsch_AntennaPorts_XP; rrc_mac_config_req_gNB(rrc->module_id, rrc->configuration.ssb_SubcarrierOffset, - rrc->configuration.pdsch_AntennaPorts, + pdsch_AntennaPorts, rrc->configuration.pusch_AntennaPorts, rrc->configuration.sib1_tda, rrc->configuration.scc, diff --git a/openair2/GNB_APP/gnb_paramdef.h b/openair2/GNB_APP/gnb_paramdef.h index cde7819e25..dc319fbccf 100644 --- a/openair2/GNB_APP/gnb_paramdef.h +++ b/openair2/GNB_APP/gnb_paramdef.h @@ -114,7 +114,9 @@ typedef enum { #define GNB_CONFIG_STRING_LOCAL_S_PORTD "local_s_portd" #define GNB_CONFIG_STRING_REMOTE_S_PORTD "remote_s_portd" #define GNB_CONFIG_STRING_SSBSUBCARRIEROFFSET "ssb_SubcarrierOffset" -#define GNB_CONFIG_STRING_PDSCHANTENNAPORTS "pdsch_AntennaPorts" +#define GNB_CONFIG_STRING_PDSCHANTENNAPORTS_N1 "pdsch_AntennaPorts_N1" +#define GNB_CONFIG_STRING_PDSCHANTENNAPORTS_N2 "pdsch_AntennaPorts_N2" +#define GNB_CONFIG_STRING_PDSCHANTENNAPORTS_XP "pdsch_AntennaPorts_XP" #define GNB_CONFIG_STRING_PUSCHANTENNAPORTS "pusch_AntennaPorts" #define GNB_CONFIG_STRING_SIB1TDA "sib1_tda" #define GNB_CONFIG_STRING_DOCSIRS "do_CSIRS" @@ -144,7 +146,9 @@ typedef enum { {GNB_CONFIG_STRING_LOCAL_S_PORTD, NULL, 0, uptr:NULL, defuintval:50001, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_REMOTE_S_PORTD, NULL, 0, uptr:NULL, defuintval:50001, TYPE_UINT, 0}, \ {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_PDSCHANTENNAPORTS_N1, NULL, 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_PDSCHANTENNAPORTS_N2, NULL, 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_PDSCHANTENNAPORTS_XP, 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_DOCSIRS, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ @@ -169,14 +173,16 @@ typedef enum { #define GNB_LOCAL_S_PORTD_IDX 12 #define GNB_REMOTE_S_PORTD_IDX 13 #define GNB_SSB_SUBCARRIEROFFSET_IDX 14 -#define GNB_PDSCH_ANTENNAPORTS_IDX 15 -#define GNB_PUSCH_ANTENNAPORTS_IDX 16 -#define GNB_SIB1_TDA_IDX 17 -#define GNB_DO_CSIRS_IDX 18 -#define GNB_DO_SRS_IDX 19 -#define GNB_NRCELLID_IDX 20 -#define GNB_MINRXTXTIME_IDX 21 -#define GNB_ULPRBBLACKLIST_IDX 22 +#define GNB_PDSCH_ANTENNAPORTS_N1_IDX 15 +#define GNB_PDSCH_ANTENNAPORTS_N2_IDX 16 +#define GNB_PDSCH_ANTENNAPORTS_XP_IDX 17 +#define GNB_PUSCH_ANTENNAPORTS_IDX 18 +#define GNB_SIB1_TDA_IDX 19 +#define GNB_DO_CSIRS_IDX 20 +#define GNB_DO_SRS_IDX 21 +#define GNB_NRCELLID_IDX 22 +#define GNB_MINRXTXTIME_IDX 23 +#define GNB_ULPRBBLACKLIST_IDX 24 #define TRACKING_AREA_CODE_OKRANGE {0x0001,0xFFFD} #define GNBPARAMS_CHECK { \ diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 7b89e4e993..9443a11981 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -135,11 +135,12 @@ void process_CellGroup(NR_CellGroupConfig_t *CellGroup, NR_UE_sched_ctrl_t *sche process_rlcBearerConfig(CellGroup->rlc_BearerToAddModList,CellGroup->rlc_BearerToReleaseList,sched_ctrl); } -void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts, int pusch_AntennaPorts, NR_ServingCellConfigCommon_t *scc) { + +void config_common(int Mod_idP, int ssb_SubcarrierOffset, rrc_pdsch_AntennaPorts_t dl_antenna_ports_struct, int pusch_AntennaPorts, NR_ServingCellConfigCommon_t *scc) { nfapi_nr_config_request_scf_t *cfg = &RC.nrmac[Mod_idP]->config[0]; RC.nrmac[Mod_idP]->common_channels[0].ServingCellConfigCommon = scc; - int i; + int pdsch_AntennaPorts = dl_antenna_ports_struct.N1 * dl_antenna_ports_struct.N2 * dl_antenna_ports_struct.XP; // Carrier configuration @@ -156,7 +157,7 @@ void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts cfg->carrier_config.dl_frequency.tl.tag = NFAPI_NR_CONFIG_DL_FREQUENCY_TAG; cfg->num_tlv++; - for (i=0; i<5; i++) { + for (int i=0; i<5; i++) { if (i==scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) { cfg->carrier_config.dl_grid_size[i].value = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; cfg->carrier_config.dl_k0[i].value = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier; @@ -190,7 +191,7 @@ void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts cfg->carrier_config.uplink_frequency.tl.tag = NFAPI_NR_CONFIG_UPLINK_FREQUENCY_TAG; cfg->num_tlv++; - for (i=0; i<5; i++) { + for (int i=0; i<5; i++) { if (i==scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) { cfg->carrier_config.ul_grid_size[i].value = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; cfg->carrier_config.ul_k0[i].value = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier; @@ -281,7 +282,7 @@ void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts cfg->num_tlv++; cfg->prach_config.num_prach_fd_occasions_list = (nfapi_nr_num_prach_fd_occasions_t *) malloc(cfg->prach_config.num_prach_fd_occasions.value*sizeof(nfapi_nr_num_prach_fd_occasions_t)); - for (i=0; iprach_config.num_prach_fd_occasions.value; i++) { + for (int i=0; iprach_config.num_prach_fd_occasions.value; i++) { // cfg->prach_config.num_prach_fd_occasions_list[i].num_prach_fd_occasions = i; if (cfg->prach_config.prach_sequence_length.value) cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l139; @@ -350,7 +351,7 @@ void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts case 3 : cfg->ssb_table.ssb_mask_list[0].ssb_mask.value = 0; cfg->ssb_table.ssb_mask_list[1].ssb_mask.value = 0; - for (i=0; i<4; i++) { + for (int i=0; i<4; i++) { cfg->ssb_table.ssb_mask_list[0].ssb_mask.value += (scc->ssb_PositionsInBurst->choice.longBitmap.buf[3-i]<ssb_table.ssb_mask_list[1].ssb_mask.value += (scc->ssb_PositionsInBurst->choice.longBitmap.buf[7-i]<carrier_config.num_rx_ant.value = pusch_AntennaPorts; AssertFatal(pusch_AntennaPorts > 0 && pusch_AntennaPorts < 13, "pusch_AntennaPorts in 1...12\n"); cfg->carrier_config.num_rx_ant.tl.tag = NFAPI_NR_CONFIG_NUM_RX_ANT_TAG; - LOG_I(NR_MAC,"Set TX/RX antenna number to %d (num ssb %d: %x,%x)\n",cfg->carrier_config.num_tx_ant.value,num_ssb,cfg->ssb_table.ssb_mask_list[0].ssb_mask.value,cfg->ssb_table.ssb_mask_list[1].ssb_mask.value); + LOG_I(NR_MAC,"Set TX/RX antenna number to %d (num ssb %d: %x,%x)\n", + cfg->carrier_config.num_tx_ant.value,num_ssb,cfg->ssb_table.ssb_mask_list[0].ssb_mask.value,cfg->ssb_table.ssb_mask_list[1].ssb_mask.value); AssertFatal(cfg->carrier_config.num_tx_ant.value > 0,"carrier_config.num_tx_ant.value %d !\n",cfg->carrier_config.num_tx_ant.value ); cfg->num_tlv++; cfg->num_tlv++; @@ -426,7 +428,7 @@ 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, + rrc_pdsch_AntennaPorts_t pdsch_AntennaPorts, int pusch_AntennaPorts, int sib1_tda, NR_ServingCellConfigCommon_t *scc, diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 9afd2a4083..e05865b9ed 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -40,20 +40,20 @@ void mac_top_init_gNB(void); void config_common(int Mod_idP, int ssb_SubcarrierOffset, - int pdsch_AntennaPorts, + rrc_pdsch_AntennaPorts_t pdsch_AntennaPorts, int pusch_AntennaPorts, NR_ServingCellConfigCommon_t *scc ); int rrc_mac_config_req_gNB(module_id_t Mod_idP, int ssb_SubcarrierOffset, - int pdsch_AntennaPorts, + rrc_pdsch_AntennaPorts_t pdsch_AntennaPorts, int pusch_AntennaPorts, int sib1_tda, NR_ServingCellConfigCommon_t *scc, NR_BCCH_BCH_Message_t *mib, - int add_ue, - uint32_t rnti, + int add_ue, + uint32_t rnti, NR_CellGroupConfig_t *CellGroup); void clear_nr_nfapi_information(gNB_MAC_INST * gNB, diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index bbc05da506..d05da68d8c 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1904,15 +1904,6 @@ int16_t do_RRCReconfiguration( ie->radioBearerConfig->srb3_ToRelease = NULL; ie->radioBearerConfig->drb_ToReleaseList = DRB_releaseList; } - /******************** Secondary Cell Group ********************/ - // rrc_gNB_carrier_data_t *carrier = &(gnb_rrc_inst->carrier); - // fill_default_secondaryCellGroup( carrier->servingcellconfigcommon, - // ue_context_pP->ue_context.secondaryCellGroup, - // 1, - // 1, - // carrier->pdsch_AntennaPorts, - // carrier->initial_csi_index[ue_context_p->local_uid + 1], - // ue_context_pP->local_uid); /******************** Meas Config ********************/ // measConfig diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index 667b5ed24a..755c00e160 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -420,6 +420,11 @@ typedef struct rrc_gNB_ue_context_s { struct gNB_RRC_UE_s ue_context; } rrc_gNB_ue_context_t; +typedef struct { + int N1; + int N2; + int XP; +} rrc_pdsch_AntennaPorts_t; typedef struct { @@ -447,7 +452,7 @@ typedef struct { NR_BCCH_DL_SCH_Message_t systemInformation; // SIB23 int ssb_SubcarrierOffset; int sib1_tda; - int pdsch_AntennaPorts; + rrc_pdsch_AntennaPorts_t pdsch_AntennaPorts; int pusch_AntennaPorts; int minRXTXTIME; int do_CSIRS; diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index 40de13dfb0..18385e6123 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -78,7 +78,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco NR_CellGroupConfig_t *secondaryCellGroup, int scg_id, int servCellIndex, - int dl_antenna_ports, + rrc_pdsch_AntennaPorts_t dl_antenna_ports, int minRXTXTIMEpdsch, int do_csirs, int do_srs, @@ -91,7 +91,7 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon NR_ServingCellConfig_t *servingcellconfigdedicated, NR_RRCReconfiguration_IEs_t *reconfig, NR_CellGroupConfig_t *secondaryCellGroup, - int dl_antenna_ports, + rrc_pdsch_AntennaPorts_t dl_antenna_ports, int minRXTXTIMEpdsch, int do_csirs, int do_srs, diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index dda128f52f..c76d0e2296 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -234,7 +234,9 @@ char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigu rrc->ngap_id2_ngap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL); rrc->carrier.servingcellconfigcommon = configuration->scc; rrc->carrier.ssb_SubcarrierOffset = configuration->ssb_SubcarrierOffset; - rrc->carrier.pdsch_AntennaPorts = configuration->pdsch_AntennaPorts; + rrc->carrier.pdsch_AntennaPorts.N1 = configuration->pdsch_AntennaPorts_N1; + rrc->carrier.pdsch_AntennaPorts.N2 = configuration->pdsch_AntennaPorts_N2; + rrc->carrier.pdsch_AntennaPorts.XP = configuration->pdsch_AntennaPorts_XP; rrc->carrier.pusch_AntennaPorts = configuration->pusch_AntennaPorts; rrc->carrier.minRXTXTIME = configuration->minRXTXTIME; rrc->carrier.sib1_tda = configuration->sib1_tda; diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index 536010bbc6..57bf6c1f7e 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -381,7 +381,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ if (NODE_IS_DU(rrc->node_type)) { rrc_mac_config_req_gNB(rrc->module_id, rrc->carrier.ssb_SubcarrierOffset, - rrc->carrier.pdsch_AntennaPorts, + rrc->carrier.pdsch_AntennaPorts, rrc->carrier.pusch_AntennaPorts, rrc->carrier.sib1_tda, rrc->carrier.servingcellconfigcommon, @@ -392,7 +392,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ } else { rrc_mac_config_req_gNB(rrc->module_id, rrc->carrier.ssb_SubcarrierOffset, - rrc->carrier.pdsch_AntennaPorts, + rrc->carrier.pdsch_AntennaPorts, rrc->carrier.pusch_AntennaPorts, rrc->carrier.sib1_tda, NULL, diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 4589988bbb..cb0cb24ced 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -54,7 +54,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco NR_CellGroupConfig_t *secondaryCellGroup, int scg_id, int servCellIndex, - int dl_antenna_ports, + rrc_pdsch_AntennaPorts_t dl_antenna_ports_struct, int minRXTXTIME, int do_csirs, int do_srs, @@ -68,6 +68,8 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco // where the startPosition = 2 or 3 and sl160 = 17, 17, 27 ... 157 only give us 30 different allocations. AssertFatal(uid>=0 && uid<30, "gNB cannot allocate the SRS resources\n"); + int dl_antenna_ports = dl_antenna_ports_struct.N1 * dl_antenna_ports_struct.N2 * dl_antenna_ports_struct.XP; + uint64_t bitmap=0; switch (servingcellconfigcommon->ssb_PositionsInBurst->present) { case 1 : @@ -1404,7 +1406,7 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon NR_ServingCellConfig_t *servingcellconfigdedicated, NR_RRCReconfiguration_IEs_t *reconfig, NR_CellGroupConfig_t *secondaryCellGroup, - int dl_antenna_ports, + rrc_pdsch_AntennaPorts_t dl_antenna_ports, int minRXTXTIME, int do_csirs, int do_srs, diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf index 575fddda2b..9ed1acc0dd 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf @@ -23,8 +23,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 31; //0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; servingCellConfigCommon = ( { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpn300.conf index c3faa198dd..946815618f 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpn300.conf @@ -22,8 +22,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; servingCellConfigCommon = ( { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf index 8fa8fcf992..4bbe90158c 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf @@ -22,8 +22,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; servingCellConfigCommon = ( { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.66PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.66PRB.usrpn300.conf index c2e364b75e..6bef146f4c 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.66PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.66PRB.usrpn300.conf @@ -22,9 +22,7 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; - + servingCellConfigCommon = ( { #spCellConfigCommon diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf index 813a0e58e3..227c822e14 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf @@ -22,8 +22,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; servingCellConfigCommon = ( { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpn300.conf index d81655e5d5..e17699baec 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpn300.conf @@ -22,8 +22,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; servingCellConfigCommon = ( { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf index b063989fd2..aaf9734ec7 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf @@ -22,8 +22,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; servingCellConfigCommon = ( { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.30kHz,usrpb2x0.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.30kHz,usrpb2x0.conf index a171f2aae0..8aaf677958 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.30kHz,usrpb2x0.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.30kHz,usrpb2x0.conf @@ -22,8 +22,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 31; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; servingCellConfigCommon = ( { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.slave.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.slave.conf index 856eed4fc2..7a4bdec7a4 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.slave.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.slave.conf @@ -22,9 +22,7 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; - + servingCellConfigCommon = ( { #spCellConfigCommon diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.slave.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.slave.conf index 012f46401e..d93f8291c2 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.slave.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.slave.conf @@ -22,8 +22,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; servingCellConfigCommon = ( { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.PTRS.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.PTRS.usrpx300.conf index 2e4dc540f3..eda6a5927a 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.PTRS.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.PTRS.usrpx300.conf @@ -22,8 +22,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; servingCellConfigCommon = ( { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpb210.conf index a454af7b21..56273a3b7d 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpb210.conf @@ -22,9 +22,7 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; - + servingCellConfigCommon = ( { #spCellConfigCommon diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf index e72aaf95ff..c14c366159 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf @@ -22,8 +22,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 4; - pusch_AntennaPorts = 1; servingCellConfigCommon = ( { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf index 928c70113f..b1053812c6 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf @@ -22,8 +22,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; servingCellConfigCommon = ( { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf index 76bc5bf992..cb9c903654 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf @@ -22,8 +22,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; servingCellConfigCommon = ( { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpx300.conf index 7ff9d0ea77..3a3bd757b1 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpx300.conf @@ -22,9 +22,7 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; - + servingCellConfigCommon = ( { #spCellConfigCommon diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpb210.conf index 5c0434b57e..ac59a72fdd 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpb210.conf @@ -22,9 +22,7 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; - + servingCellConfigCommon = ( { #spCellConfigCommon diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpn300.conf index 4b1476a76d..699b58b5e1 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpn300.conf @@ -22,9 +22,7 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; - + servingCellConfigCommon = ( { #spCellConfigCommon diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpx300.conf index 50169f4bce..79ba52a8d8 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpx300.conf @@ -22,8 +22,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; servingCellConfigCommon = ( { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.273PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.273PRB.usrpn300.conf index e217f39b94..4d7b9b3a85 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.273PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.273PRB.usrpn300.conf @@ -22,8 +22,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; servingCellConfigCommon = ( { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf index 1583e07ca1..2915657ca7 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf @@ -22,8 +22,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; servingCellConfigCommon = ( { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf index 5591ed082d..17dff911a1 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf @@ -22,8 +22,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 31; //0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; servingCellConfigCommon = ( { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_24PRB.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_24PRB.conf index dd8113e059..b23565b961 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_24PRB.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_24PRB.conf @@ -22,8 +22,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 31; //0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; servingCellConfigCommon = ( { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_n310.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_n310.conf index 198ad8471c..b252675cb1 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_n310.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_n310.conf @@ -22,8 +22,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 31; //0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; servingCellConfigCommon = ( { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_nsa_n310.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_nsa_n310.conf index 96335f23ca..2d775bd1e6 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_nsa_n310.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_nsa_n310.conf @@ -22,8 +22,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 31; //0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; pusch_TargetSNRx10 = 200; pucch_TargetSNRx10 = 200; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf index 215a57b95c..076c88aa8d 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf @@ -40,8 +40,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; sib1_tda = 0; 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 ab4713f8b5..2310f4c65c 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,8 +37,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; sib1_tda = 0; servingCellConfigCommon = ( { 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 b77ad0b264..68217e209d 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 @@ -33,8 +33,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; min_rxtxtime = 6; sib1_tda = 0; do_SRS = 1; 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 27a1b6ad62..798338530e 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 @@ -33,7 +33,7 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; + pdsch_AntennaPorts_N1 = 2; pusch_AntennaPorts = 2; sib1_tda = 0; do_SRS = 1; 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 e96c545a4e..fa5a4be52d 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 @@ -33,8 +33,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; min_rxtxtime = 6; sib1_tda = 0; do_SRS = 1; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.sabox.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.sabox.conf index c8a0bace37..0340f0f418 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.sabox.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.sabox.conf @@ -31,8 +31,6 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; pdcch_ConfigSIB1 = ( { 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 befceae695..6ad826e666 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 @@ -33,10 +33,8 @@ gNBs = ////////// Physical parameters: ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; + pdsch_AntennaPorts_N1 = 2; pusch_AntennaPorts = 2; -# do_CSIRS = 1; - min_rxtxtime_pdsch = 2; ul_prbblacklist = "79,80,81,82" pdcch_ConfigSIB1 = ( { From 84eb7763bda9cae3dc4dc64ab017261e34a88116 Mon Sep 17 00:00:00 2001 From: francescomani Date: Tue, 15 Feb 2022 09:46:13 +0100 Subject: [PATCH 21/67] using config file parameters in init_codebook_gNB --- openair1/PHY/INIT/nr_init.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index a924a00fcb..e9bcc8fc98 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -75,25 +75,23 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { if(gNB->frame_parms.nb_antennas_tx>1){ //NR Codebook Generation for codebook type1 SinglePanel - //csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present - int N1; - int N2; - int O1; - int O2; - int CSI_RS_antenna_ports; + int N1 = gNB->ap_N1; + int N2 = gNB->ap_N2; //Uniform Planner Array: UPA // X X X X ... X // X X X X ... X // N2 . . . . ... . // X X X X ... X // |<-----N1---->| - int x_polarization=2;//1 or 2 + int x_polarization = gNB->ap_XP; //Get the uniform planar array parameters - N2 = 1;//one-dimenstional array (1, 2, 3, 4 are supported in 5G) - O2 = 1;//Vertical beam oversampling (1 or 4) - N1 = gNB->frame_parms.nb_antennas_tx/(N2*x_polarization);// - O1=1;//Horizontal beam oversampling (1 or 4) - CSI_RS_antenna_ports=gNB->frame_parms.nb_antennas_tx; + // To be confirmed + int O2 = N2 > 1? 4 : 1; //Vertical beam oversampling (1 or 4) + int O1 = 4; //Horizontal beam oversampling (1 or 4) + int CSI_RS_antenna_ports = gNB->frame_parms.nb_antennas_tx; + AssertFatal(CSI_RS_antenna_ports == N1*N2*x_polarization, + "Nb of antenna ports at PHY %d does not correspond to what passed down with fapi %d\n", + N1*N2*x_polarization, CSI_RS_antenna_ports); LOG_D(PHY, "NR Codebook Config: antenna ports: %d N1 %d N2 %d\n",CSI_RS_antenna_ports,N1,N2); // Generation of codebook Type1 with codebookMode 1 (CSI_RS_antenna_ports < 16) From 58e0e33327293f9223c976c144030b732fd3afe3 Mon Sep 17 00:00:00 2001 From: hardy Date: Fri, 18 Feb 2022 11:06:08 +0100 Subject: [PATCH 22/67] test T_stdout 2 for NSA --- ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml index 2476a75427..5dbd36f00d 100644 --- a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml +++ b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml @@ -75,7 +75,7 @@ Initialize_eNB Initialize gNB - -O ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf -q --usrp-tx-thread-config 1 --log_config.global_log_options level,nocolor,time,line_num,function + -O ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf -q --usrp-tx-thread-config 1 --T_stdout 2 --log_config.global_log_options level,nocolor,time,line_num,function 1 1 nr From 77c8439ba337b6f338eecea96e97a6fbf14bf000 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 21 Feb 2022 15:24:17 +0100 Subject: [PATCH 23/67] remoing unused parameter --- openair1/PHY/INIT/nr_parms.c | 9 --------- openair1/PHY/defs_nr_common.h | 4 ---- 2 files changed, 13 deletions(-) diff --git a/openair1/PHY/INIT/nr_parms.c b/openair1/PHY/INIT/nr_parms.c index 20dfd20508..35bc28d9c1 100644 --- a/openair1/PHY/INIT/nr_parms.c +++ b/openair1/PHY/INIT/nr_parms.c @@ -266,15 +266,6 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg, fp->nb_antennas_rx = cfg->carrier_config.num_rx_ant.value; // It denotes the number of rx antennas at gNB fp->nb_antennas_tx = cfg->carrier_config.num_tx_ant.value; // It corresponds to pdsch_AntennaPorts (logical antenna ports) - //RRC Parameters: depends on the physical structure of the gNB Uniform planner array - if (fp->nb_antennas_tx == 4) - fp->antennas_tx_n1_n2 = 1;//NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_one_TypeI_SinglePanel_Restriction; - else if (fp->nb_antennas_tx == 8) - fp->antennas_tx_n1_n2 = 3;//NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_one_TypeI_SinglePanel_Restriction; - else if (fp->nb_antennas_tx == 12) - fp->antennas_tx_n1_n2 = 5;//NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_one_TypeI_SinglePanel_Restriction; - else//We currently support codebook 1 for nrOfAntennaPorts < 16 - fp->antennas_tx_n1_n2 = 0;//NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_NOTHING; fp->symbols_per_slot = ((Ncp == NORMAL)? 14 : 12); // to redefine for different slot formats fp->samples_per_subframe_wCP = fp->ofdm_symbol_size * fp->symbols_per_slot * fp->slots_per_subframe; diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h index b309e663ed..c7b59f70c2 100644 --- a/openair1/PHY/defs_nr_common.h +++ b/openair1/PHY/defs_nr_common.h @@ -344,10 +344,6 @@ struct NR_DL_FRAME_PARMS { uint8_t numerology_index; /// Number of Physical transmit antennas in node (corresponds to nrOfAntennaPorts) uint8_t nb_antennas_tx; - /// UPA Panel Antenna configuration: two_one, two_two, four_one, three_two, six_one, etc - uint8_t antennas_tx_n1_n2; - /// UPA Panel Antenna Type: non, Single panel, or multiple - uint8_t antennas_tx_panel_type; /// Number of Receive antennas in node uint8_t nb_antennas_rx; /// Number of common transmit antenna ports in eNodeB (1 or 2) From 4fbf9ea10e4d105f15d8998e44c6913055e2dace Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 21 Feb 2022 18:35:08 +0100 Subject: [PATCH 24/67] fix for 2 antenna ports --- openair1/PHY/INIT/nr_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index e9bcc8fc98..bf8088143c 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -74,6 +74,7 @@ int l1_north_init_gNB() { int init_codebook_gNB(PHY_VARS_gNB *gNB) { if(gNB->frame_parms.nb_antennas_tx>1){ + int CSI_RS_antenna_ports = gNB->frame_parms.nb_antennas_tx; //NR Codebook Generation for codebook type1 SinglePanel int N1 = gNB->ap_N1; int N2 = gNB->ap_N2; @@ -87,8 +88,7 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { //Get the uniform planar array parameters // To be confirmed int O2 = N2 > 1? 4 : 1; //Vertical beam oversampling (1 or 4) - int O1 = 4; //Horizontal beam oversampling (1 or 4) - int CSI_RS_antenna_ports = gNB->frame_parms.nb_antennas_tx; + int O1 = CSI_RS_antenna_ports > 2? 4 : 1; //Horizontal beam oversampling (1 or 4) AssertFatal(CSI_RS_antenna_ports == N1*N2*x_polarization, "Nb of antenna ports at PHY %d does not correspond to what passed down with fapi %d\n", N1*N2*x_polarization, CSI_RS_antenna_ports); From 4a060892d218d8bbc691aa06100efaee632a6e72 Mon Sep 17 00:00:00 2001 From: hardy Date: Mon, 21 Feb 2022 08:01:38 +0100 Subject: [PATCH 25/67] fix NSA T tracer file copy --- ci-scripts/ran.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py index ad360d2179..66f1ebc1e7 100644 --- a/ci-scripts/ran.py +++ b/ci-scripts/ran.py @@ -676,13 +676,13 @@ class RANManagement(): # if T tracer was run with option 0 (no logs), analyze logs # from textlog, otherwise do normal analysis (e.g., option 2) result = re.search('T_stdout 0', str(self.Initialize_eNB_args)) + enbLogFile = self.eNBLogFiles[int(self.eNB_instance)] + raw_record_file = enbLogFile.replace('.log', '_record.raw') + replay_log_file = enbLogFile.replace('.log', '_replay.log') if (result is not None): logging.debug('\u001B[1m Replaying RAW record file\u001B[0m') mySSH.open(lIpAddr, lUserName, lPassWord) mySSH.command('cd ' + lSourcePath + '/common/utils/T/tracer/', '\$', 5) - enbLogFile = self.eNBLogFiles[int(self.eNB_instance)] - raw_record_file = enbLogFile.replace('.log', '_record.raw') - replay_log_file = enbLogFile.replace('.log', '_replay.log') extracted_txt_file = enbLogFile.replace('.log', '_extracted_messages.txt') extracted_log_file = enbLogFile.replace('.log', '_extracted_messages.log') mySSH.command('./extract_config -i ' + lSourcePath + '/cmake_targets/' + raw_record_file + ' > ' + lSourcePath + '/cmake_targets/' + extracted_txt_file, '\$', 5) @@ -705,6 +705,8 @@ class RANManagement(): mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/*stats.log', '.') mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/*.pickle', '.') mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/*.png', '.') + mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/'+raw_record_file, '.') + mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/'+replay_log_file, '.') # copyin_res = mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/' + fileToAnalyze, '.') if (copyin_res == -1): @@ -720,7 +722,9 @@ class RANManagement(): mySSH.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, './nrL1_stats.log', self.eNBSourceCodePath + '/cmake_targets/') mySSH.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, './nrMAC_stats.log', self.eNBSourceCodePath + '/cmake_targets/') mySSH.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, './gnb_stats_monitor.pickle', self.eNBSourceCodePath + '/cmake_targets/') - mySSH.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, './gnb_stats_monitor.png', self.eNBSourceCodePath + '/cmake_targets/') + mySSH.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, './gnb_stats_monitor.png', self.eNBSourceCodePath + '/cmake_targets/')#RH 21/02/2002 this does not work, there are more than 1 png file + mySSH.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword,'./'+raw_record_file, self.eNBSourceCodePath + '/cmake_targets/') + mySSH.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword,'./'+replay_log_file, self.eNBSourceCodePath + '/cmake_targets/') # mySSH.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, './' + fileToAnalyze, self.eNBSourceCodePath + '/cmake_targets/') logging.debug('\u001B[1m Analyzing ' + nodeB_prefix + 'NB logfile \u001B[0m ' + fileToAnalyze) From 774b750cb10f2759f2010c8f087972c6ed7e1bae Mon Sep 17 00:00:00 2001 From: francescomani Date: Tue, 22 Feb 2022 17:27:42 +0100 Subject: [PATCH 26/67] fix for mimo dlsim --- openair1/PHY/INIT/nr_init.c | 3 +-- openair1/SIMULATION/NR_PHY/dlsim.c | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index bf8088143c..e7f0771556 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -88,11 +88,10 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { //Get the uniform planar array parameters // To be confirmed int O2 = N2 > 1? 4 : 1; //Vertical beam oversampling (1 or 4) - int O1 = CSI_RS_antenna_ports > 2? 4 : 1; //Horizontal beam oversampling (1 or 4) + int O1 = CSI_RS_antenna_ports > 2 ? 4 : 1; //Horizontal beam oversampling (1 or 4) AssertFatal(CSI_RS_antenna_ports == N1*N2*x_polarization, "Nb of antenna ports at PHY %d does not correspond to what passed down with fapi %d\n", N1*N2*x_polarization, CSI_RS_antenna_ports); - LOG_D(PHY, "NR Codebook Config: antenna ports: %d N1 %d N2 %d\n",CSI_RS_antenna_ports,N1,N2); // Generation of codebook Type1 with codebookMode 1 (CSI_RS_antenna_ports < 16) if (CSI_RS_antenna_ports < 16) { diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 7753d807d1..5a5667506f 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -781,6 +781,9 @@ int main(int argc, char **argv) pdsch_AntennaPorts.N1 = n_tx; pdsch_AntennaPorts.N2 = 1; pdsch_AntennaPorts.XP = 1; + gNB->ap_N1 = pdsch_AntennaPorts.N1; + gNB->ap_N2 = pdsch_AntennaPorts.N2; + gNB->ap_XP = pdsch_AntennaPorts.XP; fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, 0, 1, pdsch_AntennaPorts, 6, 0, 0, 0, 0); From 68471d0525cff47a7b4cdf68750a302b7ca81168 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Thu, 23 Sep 2021 16:03:14 +0200 Subject: [PATCH 27/67] Extending DL scheduling to multiple LCIDs --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 199 ++++++++---------- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 9 +- 2 files changed, 94 insertions(+), 114 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 92391ed1d5..55771c0e3f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -466,76 +466,49 @@ void nr_store_dlsch_buffer(module_id_t module_id, NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info; for (int UE_id = UE_info->list.head; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) { + NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; - sched_ctrl->num_total_bytes = 0; + sched_ctrl->dl_pdus_total = 0; - int lcid; - const uint16_t rnti = UE_info->rnti[UE_id]; - LOG_D(NR_MAC,"UE %d/%x : lcid_mask %x\n",UE_id,rnti,sched_ctrl->lcid_mask); - if ((sched_ctrl->lcid_mask&(1<<2)) > 0) - sched_ctrl->rlc_status[DL_SCH_LCID_DCCH1] = mac_rlc_status_ind(module_id, + /* loop over all activated logical channels */ + // Note: DL_SCH_LCID_DCCH, DL_SCH_LCID_DCCH1, DL_SCH_LCID_DTCH + for (int i = 0; i < sched_ctrl->dl_lc_num; ++i) { + + 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); + 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, - DL_SCH_LCID_DCCH1, + lcid, 0, 0); - if ((sched_ctrl->lcid_mask&(1<<1)) > 0) - sched_ctrl->rlc_status[DL_SCH_LCID_DCCH] = mac_rlc_status_ind(module_id, - rnti, - module_id, - frame, - slot, - ENB_FLAG_YES, - MBMS_FLAG_NO, - DL_SCH_LCID_DCCH, - 0, - 0); - if ((sched_ctrl->lcid_mask&(1<<4)) > 0) { - start_meas(&RC.nrmac[module_id]->rlc_status_ind); - sched_ctrl->rlc_status[DL_SCH_LCID_DTCH] = mac_rlc_status_ind(module_id, - rnti, - module_id, - frame, - slot, - ENB_FLAG_YES, - MBMS_FLAG_NO, - DL_SCH_LCID_DTCH, - 0, - 0); - stop_meas(&RC.nrmac[module_id]->rlc_status_ind); - } - if(sched_ctrl->rlc_status[DL_SCH_LCID_DCCH].bytes_in_buffer > 0){ - lcid = DL_SCH_LCID_DCCH; - } - else if (sched_ctrl->rlc_status[DL_SCH_LCID_DCCH1].bytes_in_buffer > 0) - { - lcid = DL_SCH_LCID_DCCH1; - }else{ - lcid = DL_SCH_LCID_DTCH; - } - - sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer; - //later multiplex here. Just select DCCH/SRB before DTCH/DRB - sched_ctrl->lcid_to_schedule = lcid; + stop_meas(&RC.nrmac[module_id]->rlc_status_ind); - if (sched_ctrl->num_total_bytes == 0 - && !sched_ctrl->ta_apply) /* If TA should be applied, give at least one RB */ - continue; + if (sched_ctrl->rlc_status[lcid].bytes_in_buffer == 0) + continue; - LOG_D(NR_MAC, - "[%s][%d.%d], %s%d->DLSCH, RLC status %d bytes TA %d\n", - __func__, - frame, - slot, - lcid<4?"DCCH":"DTCH", - lcid, - sched_ctrl->rlc_status[lcid].bytes_in_buffer, - sched_ctrl->ta_apply); + sched_ctrl->dl_pdus_total += sched_ctrl->rlc_status[lcid].pdus_in_buffer; + sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer; + LOG_D(MAC, + "[gNB %d][%4d.%2d] %s%d->DLSCH, RLC status for UE %d: %d bytes in buffer, total DL buffer size = %d bytes, %d total PDU bytes, %s TA command\n", + module_id, + frame, + slot, + lcid < 4 ? "DCCH":"DTCH", + lcid, + UE_id, + sched_ctrl->rlc_status[lcid].bytes_in_buffer, + sched_ctrl->num_total_bytes, + sched_ctrl->dl_pdus_total, + sched_ctrl->ta_apply ? "send":"do not send"); + } } } @@ -882,7 +855,7 @@ void pf_dl(module_id_t module_id, sched_pdsch->pucch_allocation = alloc; uint32_t TBS = 0; uint16_t rbSize; - const int oh = 3 + 2 * (frame == (sched_ctrl->ta_frame + 10) % 1024); + const int oh = 3*sched_ctrl->dl_pdus_total + 2 * (frame == (sched_ctrl->ta_frame + 10) % 1024); nr_find_nb_rb(sched_pdsch->Qm, sched_pdsch->R, ps->nrOfLayers, @@ -1326,68 +1299,70 @@ void nr_schedule_ue_spec(module_id_t module_id, buf += written; int size = TBS - written; DevAssert(size >= 0); - /* next, get RLC data */ - // const int lcid = DL_SCH_LCID_DTCH; - const int lcid = sched_ctrl->lcid_to_schedule; - int dlsch_total_bytes = 0; start_meas(&gNB_mac->rlc_data_req); if (sched_ctrl->num_total_bytes > 0) { - tbs_size_t len = 0; - while (size > 3) { - // 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); + /* loop over all activated logical channels */ + for (int i = 0; i < sched_ctrl->dl_lc_num; ++i) { - len = mac_rlc_data_req(module_id, - rnti, - module_id, - frame, - ENB_FLAG_YES, - MBMS_FLAG_NO, - lcid, - ndata, - (char *)buf, - 0, - 0); + const int lcid = sched_ctrl->dl_lc_ids[i]; + int dlsch_total_bytes = 0; - LOG_D(NR_MAC, - "%4d.%2d RNTI %04x: %d bytes from %s %d (ndata %d, remaining size %d)\n", - frame, - slot, - rnti, - len, - lcid < 4 ? "DCCH" : "DTCH", - lcid, - ndata, - size); - if (len == 0) - break; + while (size > 3) { + // 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; - header->R = 0; - header->F = 1; - header->LCID = lcid; - header->L1 = (len >> 8) & 0xff; - header->L2 = len & 0xff; - size -= len; - buf += len; - dlsch_total_bytes += len; + /* 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); + tbs_size_t len = mac_rlc_data_req(module_id, + rnti, + module_id, + frame, + ENB_FLAG_YES, + MBMS_FLAG_NO, + lcid, + ndata, + (char *)buf, + 0, + 0); + + LOG_D(NR_MAC, + "%4d.%2d RNTI %04x: %d bytes from %s %d (ndata %d, remaining size %d)\n", + frame, + slot, + rnti, + len, + lcid < 4 ? "DCCH" : "DTCH", + lcid, + ndata, + size); + if (len == 0) { + /* RLC did not have data anymore, mark buffer as unused */ + buf -= 3; + size += 3; + break; + } + + header->R = 0; + header->F = 1; + header->LCID = lcid; + header->L1 = (len >> 8) & 0xff; + header->L2 = len & 0xff; + size -= len; + buf += len; + dlsch_total_bytes += len; + } + + UE_info->mac_stats[UE_id].lc_bytes_tx[lcid] += dlsch_total_bytes; } - 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) { + } else if (get_softmodem_params()->phy_test || get_softmodem_params()->do_ra) { /* 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; @@ -1405,7 +1380,6 @@ void nr_schedule_ue_spec(module_id_t module_id, header->L2 = size & 0xff; size -= size; buf += size; - dlsch_total_bytes += size; } stop_meas(&gNB_mac->rlc_data_req); @@ -1425,7 +1399,6 @@ void nr_schedule_ue_spec(module_id_t module_id, UE_info->mac_stats[UE_id].dlsch_total_bytes += TBS; UE_info->mac_stats[UE_id].dlsch_current_bytes = TBS; - UE_info->mac_stats[UE_id].lc_bytes_tx[lcid] += dlsch_total_bytes; /* save retransmission information */ harq->sched_pdsch = *sched_pdsch; diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 22a0932c3f..2745a4c46a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -597,8 +597,9 @@ typedef struct { /// total amount of data awaiting for this UE uint32_t num_total_bytes; + uint16_t dl_pdus_total; /// per-LC status data - mac_rlc_status_resp_t rlc_status[MAX_NUM_LCID]; + mac_rlc_status_resp_t rlc_status[NR_MAX_NUM_LCID]; /// Estimation of HARQ from BLER NR_DL_bler_stats_t dl_bler_stats; @@ -638,6 +639,12 @@ 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]; + } NR_UE_sched_ctrl_t; typedef struct { From 0df80e648a53b8e00f6ee59126df97f889c2173e Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Wed, 29 Sep 2021 09:04:25 +0200 Subject: [PATCH 28/67] Replaced lcid_mask with arrays logic - this will be later used to prioritise the LCs --- openair2/LAYER2/NR_MAC_gNB/config.c | 47 ++++++++++++++----- .../LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 1 - .../NR_MAC_gNB/gNB_scheduler_primitives.c | 1 + openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 2 - 4 files changed, 36 insertions(+), 15 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 19c82c71df..27dc7df94f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -58,19 +58,42 @@ void process_rlcBearerConfig(struct NR_CellGroupConfig__rlc_BearerToAddModList * struct NR_CellGroupConfig__rlc_BearerToReleaseList *rlc_bearer2release_list, NR_UE_sched_ctrl_t *sched_ctrl) { - - if (rlc_bearer2add_list) - // keep lcids - for (int i=0;ilist.count;i++) { - sched_ctrl->lcid_mask |= (1<list.array[i]->logicalChannelIdentity); - LOG_I(NR_MAC,"Adding LCID %d (%s %d)\n", - (int)rlc_bearer2add_list->list.array[i]->logicalChannelIdentity, - rlc_bearer2add_list->list.array[i]->logicalChannelIdentity<4 ? "SRB" : "DRB", - (int)rlc_bearer2add_list->list.array[i]->logicalChannelIdentity); + if (rlc_bearer2release_list) { + for (int i = 0; i < rlc_bearer2release_list->list.count; i++) { + for (int idx = 0; idx < sched_ctrl->dl_lc_num; idx++) { + if (sched_ctrl->dl_lc_ids[idx] == *rlc_bearer2release_list->list.array[i]) { + const int remaining_lcs = sched_ctrl->dl_lc_num - idx - 1; + memmove(&sched_ctrl->dl_lc_ids[idx], &sched_ctrl->dl_lc_ids[idx + 1], sizeof(sched_ctrl->dl_lc_ids[idx]) * remaining_lcs); + sched_ctrl->dl_lc_num--; + break; + } + } } - if (rlc_bearer2release_list) - for (int i=0;ilist.count;i++) - sched_ctrl->lcid_mask |= (1<<*rlc_bearer2release_list->list.array[i]); + } + + if (rlc_bearer2add_list) { + // keep lcids + for (int i = 0; i < rlc_bearer2add_list->list.count; i++) { + const int lcid = rlc_bearer2add_list->list.array[i]->logicalChannelIdentity; + bool found = false; + for (int idx = 0; idx < sched_ctrl->dl_lc_num; idx++) { + if (sched_ctrl->dl_lc_ids[idx] == lcid) { + found = true; + break; + } + } + + if (!found) { + sched_ctrl->dl_lc_num++; + sched_ctrl->dl_lc_ids[sched_ctrl->dl_lc_num - 1] = lcid; + LOG_D(NR_MAC, "Adding LCID %d (%s %d)\n", lcid, lcid < 4 ? "SRB" : "DRB", lcid); + } + } + } + + LOG_D(NR_MAC, "In %s: total num of active bearers %d) \n", + __FUNCTION__, + sched_ctrl->dl_lc_num); } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index fddf084a38..61cc2c505f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -329,7 +329,6 @@ void nr_preprocessor_phytest(module_id_t module_id, 0, 0); sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer; - sched_ctrl->lcid_to_schedule = lcid; uint8_t nr_of_candidates; for (int i=0; i<5; i++) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 721f67295b..b76a781491 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2152,6 +2152,7 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG if (!get_softmodem_params()->phy_test && !get_softmodem_params()->do_ra && !get_softmodem_params()->sa) { sched_ctrl->lcid_mask = 1<dl_lc_num = 0; sched_ctrl->ta_frame = 0; sched_ctrl->ta_update = 31; sched_ctrl->ta_apply = false; diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 2745a4c46a..b6364c6d15 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -604,8 +604,6 @@ typedef struct { /// Estimation of HARQ from BLER NR_DL_bler_stats_t dl_bler_stats; - int lcid_mask; - int lcid_to_schedule; uint16_t ta_frame; int16_t ta_update; bool ta_apply; From f8d6677d4d4ffeda5d29b34cf26f4186fc39d8c0 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Fri, 5 Nov 2021 14:01:06 +0100 Subject: [PATCH 29/67] Adapted phytest scheduler to multiple LCs scheduling logic --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 61cc2c505f..416c049473 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -314,7 +314,9 @@ void nr_preprocessor_phytest(module_id_t module_id, } sched_ctrl->num_total_bytes = 0; + sched_ctrl->dl_lc_num = 1; const int lcid = DL_SCH_LCID_DTCH; + sched_ctrl->dl_lc_ids[sched_ctrl->dl_lc_num - 1] = lcid; const uint16_t rnti = UE_info->rnti[UE_id]; /* update sched_ctrl->num_total_bytes so that postprocessor schedules data, * if available */ From 79591741e1b627a4d5e11832adec260a691d476f Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 1 Dec 2021 18:05:48 +0100 Subject: [PATCH 30/67] Fixup: do not abort scheduling when UE has no CCE --- 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 55771c0e3f..a5cfaefca2 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -828,6 +828,10 @@ void pf_dl(module_id_t module_id, CCEIndex, sched_ctrl->aggregation_level); + /* reduce max_num_ue once we are sure UE can be allocated, i.e., has CCE */ + max_num_ue--; + if (max_num_ue < 0) return; + /* MCS has been set above */ const int tda = RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0][slot]; From 06236ff7964b319b907764ebc76d675674c99411 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 1 Dec 2021 18:09:08 +0100 Subject: [PATCH 31/67] Consider fixed MAC overhead while no RLC PDU number --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index a5cfaefca2..94baf2adbd 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -859,7 +859,12 @@ void pf_dl(module_id_t module_id, sched_pdsch->pucch_allocation = alloc; uint32_t TBS = 0; uint16_t rbSize; - const int oh = 3*sched_ctrl->dl_pdus_total + 2 * (frame == (sched_ctrl->ta_frame + 10) % 1024); + // Fix me: currently, the RLC does not give us the total number of PDUs + // awaiting. Therefore, for the time being, we put a fixed overhead of 12 + // (for 4 PDUs) and optionally + 2 for TA. Once RLC gives the number of + // PDUs, we replace with 3 * numPDUs + const int oh = 3 * 4 + 2 * (frame == (sched_ctrl->ta_frame + 10) % 1024); + //const int oh = 3 * sched_ctrl->dl_pdus_total + 2 * (frame == (sched_ctrl->ta_frame + 10) % 1024); nr_find_nb_rb(sched_pdsch->Qm, sched_pdsch->R, ps->nrOfLayers, From f9079f1d2b03438861491845a1feb67f9db3e390 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 1 Dec 2021 18:17:14 +0100 Subject: [PATCH 32/67] Do not do RLC Ind if no data for LC --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 94baf2adbd..c9dd7fdd59 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -1317,8 +1317,10 @@ void nr_schedule_ue_spec(module_id_t module_id, for (int i = 0; i < sched_ctrl->dl_lc_num; ++i) { const int lcid = sched_ctrl->dl_lc_ids[i]; - int dlsch_total_bytes = 0; + if (sched_ctrl->rlc_status[lcid].bytes_in_buffer == 0) + continue; // no data for this LC + int dlsch_total_bytes = 0; while (size > 3) { // 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 From 4d90aad48f825c9145501004619418456164789a Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Tue, 16 Nov 2021 14:49:11 +0100 Subject: [PATCH 33/67] NR_UE: fix nr_dlsch_extract_rbs_single() for odd number of PDSCH RBs --- .../NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 164 +++++++++--------- 1 file changed, 85 insertions(+), 79 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 075aaecc08..ef7d398edf 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -647,28 +647,29 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, // Please keep it: useful for debugging #ifdef DEBUG_PDSCH_RX - char filename[40]; + char filename[50]; uint8_t aa = 0; - snprintf(filename, 40, "rxdataF0_symb_%d_nr_slot_rx_%d.m", symbol, nr_slot_rx); + snprintf(filename, 50, "rxdataF0_symb_%d_nr_slot_rx_%d.m", symbol, nr_slot_rx); write_output(filename, "rxdataF0", &common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[0][0], NR_SYMBOLS_PER_SLOT*frame_parms->ofdm_symbol_size, 1, 1); - snprintf(filename, 40, "dl_ch_estimates0%d_symb_%d_nr_slot_rx_%d.m", aa, symbol, nr_slot_rx); + snprintf(filename, 50, "dl_ch_estimates0%d_symb_%d_nr_slot_rx_%d.m", aa, symbol, nr_slot_rx); write_output(filename, "dl_ch_estimates", &pdsch_vars[gNB_id]->dl_ch_estimates[aa][0], NR_SYMBOLS_PER_SLOT*frame_parms->ofdm_symbol_size, 1, 1); - snprintf(filename, 40, "rxdataF_ext0%d_symb_%d_nr_slot_rx_%d.m", aa, symbol, nr_slot_rx); + snprintf(filename, 50, "rxdataF_ext0%d_symb_%d_nr_slot_rx_%d.m", aa, symbol, nr_slot_rx); write_output(filename, "rxdataF_ext", &pdsch_vars[gNB_id]->rxdataF_ext[aa][0], NR_SYMBOLS_PER_SLOT*frame_parms->N_RB_DL*NR_NB_SC_PER_RB, 1, 1); - snprintf(filename, 40, "dl_ch_estimates_ext0%d_symb_%d_nr_slot_rx_%d.m", aa, symbol, nr_slot_rx); + snprintf(filename, 50, "dl_ch_estimates_ext0%d_symb_%d_nr_slot_rx_%d.m", aa, symbol, nr_slot_rx); write_output(filename, "dl_ch_estimates_ext00", &pdsch_vars[gNB_id]->dl_ch_estimates_ext[aa][0], NR_SYMBOLS_PER_SLOT*frame_parms->N_RB_DL*NR_NB_SC_PER_RB, 1, 1); - snprintf(filename, 40, "rxdataF_comp0%d_symb_%d_nr_slot_rx_%d.m", aa, symbol, nr_slot_rx); + snprintf(filename, 50, "rxdataF_comp0%d_symb_%d_nr_slot_rx_%d.m", aa, symbol, nr_slot_rx); write_output(filename, "rxdataF_comp00", &pdsch_vars[gNB_id]->rxdataF_comp0[aa][0], NR_SYMBOLS_PER_SLOT*frame_parms->N_RB_DL*NR_NB_SC_PER_RB, 1, 1); - +/* for (int i=0; i < 2; i++){ - snprintf(filename, 40, "llr%d_symb_%d_nr_slot_rx_%d.m", i, symbol, nr_slot_rx); + snprintf(filename, 50, "llr%d_symb_%d_nr_slot_rx_%d.m", i, symbol, nr_slot_rx); write_output(filename,"llr", &pdsch_vars[gNB_id]->llr[i][0], (NR_SYMBOLS_PER_SLOT*nb_rb*NR_NB_SC_PER_RB*dlsch1_harq->Qm) - 4*(nb_rb*4*dlsch1_harq->Qm), 1, 0); } +*/ #endif #if T_TRACER @@ -888,9 +889,11 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext, mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); rxdataF_comp128[1] = _mm_packs_epi32(mmtmpD2,mmtmpD3); - //print_shorts("rx:",(int16_t*)&rxdataF128[1]); - //print_shorts("ch:",(int16_t*)&dl_ch128[1]); - //print_shorts("pack:",(int16_t*)&rxdataF_comp128[1]); +#ifdef DEBUG_DLSCH_DEMOD + print_shorts("rx:",(int16_t*)&rxdataF128[1]); + print_shorts("ch:",(int16_t*)&dl_ch128[1]); + print_shorts("pack:",(int16_t*)&rxdataF_comp128[1]); +#endif // multiply by conjugated channel mmtmpD0 = _mm_madd_epi16(dl_ch128[2],rxdataF128[2]); @@ -906,9 +909,11 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext, mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); rxdataF_comp128[2] = _mm_packs_epi32(mmtmpD2,mmtmpD3); - //print_shorts("rx:",(int16_t*)&rxdataF128[2]); - //print_shorts("ch:",(int16_t*)&dl_ch128[2]); - //print_shorts("pack:",(int16_t*)&rxdataF_comp128[2]); +#ifdef DEBUG_DLSCH_DEMOD + print_shorts("rx:",(int16_t*)&rxdataF128[2]); + print_shorts("ch:",(int16_t*)&dl_ch128[2]); + print_shorts("pack:",(int16_t*)&rxdataF_comp128[2]); +#endif dl_ch128+=3; dl_ch_mag128+=3; @@ -1993,87 +1998,88 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, NR_DL_FRAME_PARMS *frame_parms, uint16_t dlDmrsSymbPos) { - - unsigned short k,rb; - unsigned char nushift,i,aarx; - int *dl_ch0,*dl_ch0_ext,*rxF,*rxF_ext; - - int8_t validDmrsEst = 0; //store last DMRS Symbol index - - unsigned char j=0; - - if (config_type==NFAPI_NR_DMRS_TYPE1) { + if (config_type == NFAPI_NR_DMRS_TYPE1) { AssertFatal(n_dmrs_cdm_groups == 1 || n_dmrs_cdm_groups == 2, "n_dmrs_cdm_groups %d is illegal\n",n_dmrs_cdm_groups); - nushift = n_dmrs_cdm_groups -1;//delta in Table 7.4.1.1.2-1 - } else { AssertFatal(n_dmrs_cdm_groups == 1 || n_dmrs_cdm_groups == 2 || n_dmrs_cdm_groups == 3, "n_dmrs_cdm_groups %d is illegal\n",n_dmrs_cdm_groups); - nushift = (n_dmrs_cdm_groups -1)<<1;//delta in Table 7.4.1.1.2-2 - } + } - for (aarx=0; aarxnb_antennas_rx; aarx++) { + const unsigned short start_re = frame_parms->first_carrier_offset + start_rb * NR_NB_SC_PER_RB; + const int8_t validDmrsEst = get_valid_dmrs_idx_for_channel_est(dlDmrsSymbPos, symbol); - k = frame_parms->first_carrier_offset + NR_NB_SC_PER_RB*start_rb; + for (unsigned char aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) { - validDmrsEst = get_valid_dmrs_idx_for_channel_est(dlDmrsSymbPos,symbol); + int32_t *dl_ch0 = &dl_ch_estimates[aarx][validDmrsEst * frame_parms->ofdm_symbol_size]; + int32_t *dl_ch0_ext = &dl_ch_estimates_ext[aarx][symbol * nb_rb_pdsch * NR_NB_SC_PER_RB]; + int32_t *rxF_ext = &rxdataF_ext[aarx][symbol * nb_rb_pdsch * NR_NB_SC_PER_RB]; + int32_t *rxF = &rxdataF[aarx][symbol * frame_parms->ofdm_symbol_size]; - dl_ch0 = &dl_ch_estimates[aarx][(validDmrsEst*(frame_parms->ofdm_symbol_size))]; + if (pilots == 0) { //data symbol only + if (start_re + nb_rb_pdsch * NR_NB_SC_PER_RB < frame_parms->ofdm_symbol_size) { + memcpy((void*)rxF_ext, (void*)&rxF[start_re], nb_rb_pdsch * NR_NB_SC_PER_RB * sizeof(int32_t)); + } else { + int neg_length = frame_parms->ofdm_symbol_size - start_re; + int pos_length = nb_rb_pdsch * NR_NB_SC_PER_RB - neg_length; - dl_ch0_ext = &dl_ch_estimates_ext[aarx][symbol*(nb_rb_pdsch*12)]; - - rxF_ext = &rxdataF_ext[aarx][symbol*(nb_rb_pdsch*12)]; - rxF = &rxdataF[aarx][(k+(symbol*(frame_parms->ofdm_symbol_size)))]; - - for (rb = 0; rb < nb_rb_pdsch; rb++) { - if (k>=frame_parms->ofdm_symbol_size) { - k = k-frame_parms->ofdm_symbol_size; - rxF = &rxdataF[aarx][(k+(symbol*(frame_parms->ofdm_symbol_size)))]; + memcpy((void*)rxF_ext, (void*)&rxF[start_re], neg_length * sizeof(int32_t)); + memcpy((void*)&rxF_ext[neg_length], (void*)rxF, pos_length * sizeof(int32_t)); } - if (pilots==0) { - memcpy((void*)rxF_ext,(void*)rxF,12*sizeof(*rxF_ext)); - memcpy((void*)dl_ch0_ext,(void*)dl_ch0,12*sizeof(*dl_ch0_ext)); - dl_ch0_ext+=12; - rxF_ext+=12; - } else {//the symbol contains DMRS - j=0; - if (config_type==NFAPI_NR_DMRS_TYPE1){ - if (nushift == 0) {//data is multiplexed - for (i = (1-nushift); i<12; i+=2) { - rxF_ext[j]=rxF[i]; - dl_ch0_ext[j]=dl_ch0[i]; - j++; - } - dl_ch0_ext+=6; - rxF_ext+=6; - } - } else {//NFAPI_NR_DMRS_TYPE2 - for (i = (2+nushift); i<6; i++) { - rxF_ext[j]=rxF[i]; - dl_ch0_ext[j]=dl_ch0[i]; - j++; - } - for (i = (8+nushift); i<12; i++) { - rxF_ext[j]=rxF[i]; - dl_ch0_ext[j]=dl_ch0[i]; - j++; - } - dl_ch0_ext+= j; - rxF_ext+= j; + memcpy((void*)dl_ch0_ext, (void*)dl_ch0, nb_rb_pdsch * NR_NB_SC_PER_RB * sizeof(int32_t)); + } + else if (config_type == NFAPI_NR_DMRS_TYPE1){ + if (n_dmrs_cdm_groups == 1) { //data is multiplexed + unsigned short k = start_re; + for (unsigned short j = 0; j < 6*nb_rb_pdsch; j += 3) { + rxF_ext[j] = rxF[k+1]; + rxF_ext[j+1] = rxF[k+3]; + rxF_ext[j+2] = rxF[k+5]; + dl_ch0_ext[j] = dl_ch0[1]; + dl_ch0_ext[j+1] = dl_ch0[3]; + dl_ch0_ext[j+2] = dl_ch0[5]; + dl_ch0 += 6; + k += 6; + if (k >= frame_parms->ofdm_symbol_size) + k -= frame_parms->ofdm_symbol_size; } } - - dl_ch0+=12; - rxF+=12; - k+=12; - if (k>=frame_parms->ofdm_symbol_size) { - k = k-(frame_parms->ofdm_symbol_size); - rxF = &rxdataF[aarx][k+(symbol*(frame_parms->ofdm_symbol_size))]; + } + else {//NFAPI_NR_DMRS_TYPE2 + if (n_dmrs_cdm_groups == 1) { //data is multiplexed + unsigned short k = start_re; + for (unsigned short j = 0; j < 8*nb_rb_pdsch; j += 4) { + rxF_ext[j] = rxF[k+2]; + rxF_ext[j+1] = rxF[k+3]; + rxF_ext[j+2] = rxF[k+4]; + rxF_ext[j+3] = rxF[k+5]; + dl_ch0_ext[j] = dl_ch0[2]; + dl_ch0_ext[j+1] = dl_ch0[3]; + dl_ch0_ext[j+2] = dl_ch0[4]; + dl_ch0_ext[j+3] = dl_ch0[5]; + dl_ch0 += 6; + k += 6; + if (k >= frame_parms->ofdm_symbol_size) + k -= frame_parms->ofdm_symbol_size; + } + } + else if (n_dmrs_cdm_groups == 2) { //data is multiplexed + unsigned short k = start_re; + for (unsigned short j = 0; j < 4*nb_rb_pdsch; j += 2) { + rxF_ext[j] = rxF[k+4]; + rxF_ext[j+1] = rxF[k+5]; + dl_ch0_ext[j] = dl_ch0[4]; + dl_ch0_ext[j+1] = dl_ch0[5]; + dl_ch0 += 6; + k += 6; + if (k >= frame_parms->ofdm_symbol_size) + k -= frame_parms->ofdm_symbol_size; + } } } } - return(nb_rb_pdsch); + + return nb_rb_pdsch; } unsigned short nr_dlsch_extract_rbs_multiple(int **rxdataF, From c7ca405199f751969188c93bae69de1db89d5b7a Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Tue, 16 Nov 2021 14:52:23 +0100 Subject: [PATCH 34/67] gNB: fix nr_generate_pdsch() for odd number of PDSCH RBs --- openair1/PHY/NR_TRANSPORT/nr_dlsch.c | 36 +++++++++++++++++++++------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index 37ef5fb207..c5ff2c9f2d 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -457,14 +457,34 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, pmi = 0;//no precoding if (pmi == 0) {//unitary Precoding - if(apnrOfLayers) - memcpy((void*)&txdataF[ap][l*frame_parms->ofdm_symbol_size + txdataF_offset + k], - (void*)&txdataF_precoding[ap][2*(l*frame_parms->ofdm_symbol_size + k)], - NR_NB_SC_PER_RB*sizeof(int32_t)); - else - memset((void*)&txdataF[ap][l*frame_parms->ofdm_symbol_size + txdataF_offset + k], - 0, - NR_NB_SC_PER_RB*sizeof(int32_t)); + if (k + NR_NB_SC_PER_RB <= frame_parms->ofdm_symbol_size) { // RB does not cross DC + if(apnrOfLayers) + memcpy((void*)&txdataF[ap][l*frame_parms->ofdm_symbol_size + txdataF_offset + k], + (void*)&txdataF_precoding[ap][2*(l*frame_parms->ofdm_symbol_size + k)], + NR_NB_SC_PER_RB*sizeof(int32_t)); + else + memset((void*)&txdataF[ap][l*frame_parms->ofdm_symbol_size + txdataF_offset + k], + 0, + NR_NB_SC_PER_RB*sizeof(int32_t)); + } else { // RB does cross DC + int neg_length = frame_parms->ofdm_symbol_size - k; + int pos_length = NR_NB_SC_PER_RB - neg_length; + if (apnrOfLayers) { + memcpy((void*)&txdataF[ap][l*frame_parms->ofdm_symbol_size + txdataF_offset + k], + (void*)&txdataF_precoding[ap][2*(l*frame_parms->ofdm_symbol_size + k)], + neg_length*sizeof(int32_t)); + memcpy((void*)&txdataF[ap][l*frame_parms->ofdm_symbol_size + txdataF_offset], + (void*)&txdataF_precoding[ap][2*(l*frame_parms->ofdm_symbol_size)], + pos_length*sizeof(int32_t)); + } else { + memset((void*)&txdataF[ap][l*frame_parms->ofdm_symbol_size + txdataF_offset + k], + 0, + neg_length*sizeof(int32_t)); + memset((void*)&txdataF[ap][l*frame_parms->ofdm_symbol_size + txdataF_offset], + 0, + pos_length*sizeof(int32_t)); + } + } k += NR_NB_SC_PER_RB; if (k >= frame_parms->ofdm_symbol_size) { k -= frame_parms->ofdm_symbol_size; From d0beb9796c1f0742b299b981de40df9bd90f3919 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Wed, 17 Nov 2021 17:26:13 +0100 Subject: [PATCH 35/67] NR_UE: fix nr_pdcch_channel_estimation() for odd number of PDCCH RBs --- .../nr_dl_channel_estimation.c | 55 ++++++++++++++----- 1 file changed, 40 insertions(+), 15 deletions(-) diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c index 30eae2d30f..d8b84e95da 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -536,8 +536,12 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, 16); pil += 2; rxF += 8; - //for (int i= 0; i<8; i++) - //printf("dl_ch addr %p %d\n", dl_ch+i, *(dl_ch+i)); + k += 4; + + if (k >= ue->frame_parms.ofdm_symbol_size) { + k -= ue->frame_parms.ofdm_symbol_size; + rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+1)]; + } ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); @@ -550,6 +554,12 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, 16); pil += 2; rxF += 8; + k += 4; + + if (k >= ue->frame_parms.ofdm_symbol_size) { + k -= ue->frame_parms.ofdm_symbol_size; + rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+1)]; + } ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); @@ -562,23 +572,22 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ch, dl_ch, 16); - -#ifdef DEBUG_PDCCH +#ifdef DEBUG_PDCCH for (int m =0; m<12; m++) printf("data : dl_ch -> (%d,%d)\n",dl_ch[0+2*m],dl_ch[1+2*m]); -#endif +#endif + dl_ch += 24; + pil += 2; rxF += 8; - dl_ch += 24; - k += 12; - - + k += 4; for (pilot_cnt=3; pilot_cnt<(3*nb_rb_coreset); pilot_cnt += 3) { - if (k >= ue->frame_parms.ofdm_symbol_size){ - k-=ue->frame_parms.ofdm_symbol_size; - rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+1)];} + if (k >= ue->frame_parms.ofdm_symbol_size) { + k -= ue->frame_parms.ofdm_symbol_size; + rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+1)]; + } ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); @@ -595,6 +604,12 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, pil += 2; rxF += 8; + k += 4; + + if (k >= ue->frame_parms.ofdm_symbol_size) { + k -= ue->frame_parms.ofdm_symbol_size; + rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+1)]; + } ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); @@ -607,6 +622,12 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, 16); pil += 2; rxF += 8; + k += 4; + + if (k >= ue->frame_parms.ofdm_symbol_size) { + k -= ue->frame_parms.ofdm_symbol_size; + rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+1)]; + } ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); @@ -619,11 +640,15 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ch, dl_ch, 16); +#ifdef DEBUG_PDCCH + for (int m =0; m<12; m++) + printf("data : dl_ch -> (%d,%d)\n",dl_ch[0+2*m],dl_ch[1+2*m]); +#endif + dl_ch += 24; + pil += 2; rxF += 8; - dl_ch += 24; - k += 12; - + k += 4; } From 2655748b690e8d637b1385929e444ac619c9cbb9 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Wed, 17 Nov 2021 17:31:01 +0100 Subject: [PATCH 36/67] NR_UE: fix nr_pdcch_extract_rbs_single() for odd number od PDCCH RBs --- openair1/PHY/NR_UE_TRANSPORT/dci_nr.c | 118 ++++++++++---------------- 1 file changed, 44 insertions(+), 74 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index 84c9627c8a..b6ff0d9905 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -61,12 +61,8 @@ char nr_dci_format_string[8][30] = { //#define NR_LTE_PDCCH_DCI_SWITCH //#define NR_PDCCH_DCI_DEBUG // activates NR_PDCCH_DCI_DEBUG logs #ifdef NR_PDCCH_DCI_DEBUG -#define LOG_DNL(a, ...) printf("\n\t\t<-NR_PDCCH_DCI_DEBUG (%s)-> " a, __func__, ##__VA_ARGS__ ) -#define LOG_DD(a, ...) printf("\t<-NR_PDCCH_DCI_DEBUG (%s)-> " a, __func__, ##__VA_ARGS__ ) -#define LOG_DDD(a, ...) printf("\t\t<-NR_PDCCH_DCI_DEBUG (%s)-> " a, __func__, ##__VA_ARGS__ ) +#define LOG_DDD(a, ...) printf("<-NR_PDCCH_DCI_DEBUG (%s)-> " a, __func__, ##__VA_ARGS__ ) #else -#define LOG_DNL(a...) -#define LOG_DD(a...) #define LOG_DDD(a...) #endif #define NR_NBR_CORESET_ACT_BWP 3 // The number of CoreSets per BWP is limited to 3 (including initial CORESET: ControlResourceId 0) @@ -372,11 +368,6 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, uint8_t i, j, aarx; int32_t *dl_ch0, *dl_ch0_ext, *rxF, *rxF_ext; -#ifdef DEBUG_DCI_DECODING - uint8_t symbol_mod = (symbol >= (7 - frame_parms->Ncp)) ? symbol - (7 - frame_parms->Ncp) : symbol; - LOG_I(PHY, "extract_rbs_single: symbol_mod %d\n",symbol_mod); -#endif - for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) { dl_ch0 = &dl_ch_estimates[aarx][frame_parms->ofdm_symbol_size*symbol]; LOG_DDD("dl_ch0 = &dl_ch_estimates[aarx = (%d)][0]\n",aarx); @@ -398,9 +389,9 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, * 1.2 The RB is >= than the N_RB_DL/2 -> IQ symbols are in the first half of the rxdataF (from element 0) * 2. Number of RBs in the system bandwidth is odd * (particular case when the RB with DC as it is treated differently: it is situated in symbol borders of rxdataF) - * 2.1 The RB is <= than the N_RB_DL/2 -> IQ symbols are in the second half of the rxdataF (from first_carrier_offset) - * 2.2 The RB is > than the N_RB_DL/2+1 -> IQ symbols are in the first half of the rxdataF (from element 0 + 2nd half RB containing DC) - * 2.3 The RB is == N_RB_DL/2+1 -> IQ symbols are in the lower border of the rxdataF for first 6 IQ element and the upper border of the rxdataF for the last 6 IQ elements + * 2.1 The RB is < than the N_RB_DL/2 -> IQ symbols are in the second half of the rxdataF (from first_carrier_offset) + * 2.2 The RB is > than the N_RB_DL/2 -> IQ symbols are in the first half of the rxdataF (from element 0 + 2nd half RB containing DC) + * 2.3 The RB is == N_RB_DL/2 -> IQ symbols are in the upper border of the rxdataF for first 6 IQ element and the lower border of the rxdataF for the last 6 IQ elements * If the first RB containing PDCCH within the UE BWP and within the CORESET is higher than half of the system bandwidth (N_RB_DL), * then the IQ symbol is going to be found at the position 0+c_rb-N_RB_DL/2 in rxdataF and * we have to point the pointer at (1+c_rb-N_RB_DL/2) in rxdataF @@ -430,64 +421,65 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, if (((c_rb + n_BWP_start) >= (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) == 0)) { // number of RBs is even and c_rb is higher than half system bandwidth (we don't skip DC) // if these conditions are true the pointer has to be situated at the 1st part of the rxdataF - rxF = &rxdataF[aarx][(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12]; // we point at the 1st part of the rxdataF in symbol - LOG_DDD("in even case c_rb (%d) is higher than half N_RB_DL (not DC) -> rxF = &rxdataF[aarx = (%d)][(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n", - c_rb,aarx,(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size)))); - //rxF = &rxdataF[aarx][(1 + 12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size)))]; // we point at the 1st part of the rxdataF in symbol - //#ifdef NR_PDCCH_DCI_DEBUG - // LOG_DDD("in even case c_rb (%d) is higher than half N_RB_DL (not DC) -> rxF = &rxdataF[aarx = (%d)][(1 + 12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n", - // c_rb,aarx,(1 + 12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size)))); - //#endif + rxF = &rxdataF[aarx][12*(c_rb + n_BWP_start - (frame_parms->N_RB_DL>>1)) + symbol * frame_parms->ofdm_symbol_size]; // we point at the 1st part of the rxdataF in symbol + LOG_DDD("in even case c_rb (%d) is higher than half N_RB_DL (not DC) -> rxF = &rxdataF[aarx = (%d)][12*(c_rb + n_BWP_start - (frame_parms->N_RB_DL>>1)) + symbol * frame_parms->ofdm_symbol_size = (%d)]\n", + c_rb,aarx,(12*(c_rb + n_BWP_start - (frame_parms->N_RB_DL>>1)) + symbol * frame_parms->ofdm_symbol_size)); } if (((c_rb + n_BWP_start) < (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) { //if RB to be treated is lower than middle system bandwidth then rxdataF pointed at (offset + c_br + symbol * ofdm_symbol_size): odd case - rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12]; -#ifdef NR_PDCCH_DCI_DEBUG - LOG_D(PHY,"in odd case c_rb (%d) is lower or equal than half N_RB_DL -> rxF = &rxdataF[aarx = (%d)][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n", - c_rb,aarx,(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))); -#endif + rxF = &rxdataF[aarx][frame_parms->first_carrier_offset + 12 * (c_rb + n_BWP_start) + symbol * frame_parms->ofdm_symbol_size]; + LOG_DDD("in odd case c_rb (%d) is lower or equal than half N_RB_DL -> rxF = &rxdataF[aarx = (%d)][frame_parms->first_carrier_offset + 12 * (c_rb + n_BWP_start) + symbol * frame_parms->ofdm_symbol_size = (%d)]\n", + c_rb,aarx,(frame_parms->first_carrier_offset + 12 * (c_rb + n_BWP_start) + symbol * frame_parms->ofdm_symbol_size)); } if (((c_rb + n_BWP_start) > (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) { // number of RBs is odd and c_rb is higher than half system bandwidth + 1 // if these conditions are true the pointer has to be situated at the 1st part of the rxdataF just after the first IQ symbols of the RB containing DC - rxF = &rxdataF[aarx][(12*(c_rb - (frame_parms->N_RB_DL>>1)) - 6 + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12]; // we point at the 1st part of the rxdataF in symbol -#ifdef NR_PDCCH_DCI_DEBUG - LOG_D(PHY,"in odd case c_rb (%d) is higher than half N_RB_DL (not DC) -> rxF = &rxdataF[aarx = (%d)][(12*(c_rb - frame_parms->N_RB_DL) - 5 + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n", - c_rb,aarx,(12*(c_rb - (frame_parms->N_RB_DL>>1)) - 6 + (symbol * (frame_parms->ofdm_symbol_size)))); -#endif + rxF = &rxdataF[aarx][12*(c_rb + n_BWP_start - (frame_parms->N_RB_DL>>1)) - 6 + symbol * frame_parms->ofdm_symbol_size]; // we point at the 1st part of the rxdataF in symbol + LOG_DDD("in odd case c_rb (%d) is higher than half N_RB_DL (not DC) -> rxF = &rxdataF[aarx = (%d)][12*(c_rb + n_BWP_start - (frame_parms->N_RB_DL>>1)) - 6 + symbol * frame_parms->ofdm_symbol_size = (%d)]\n", + c_rb,aarx,(12*(c_rb + n_BWP_start - (frame_parms->N_RB_DL>>1)) - 6 + symbol * frame_parms->ofdm_symbol_size)); } if (((c_rb + n_BWP_start) == (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) { // treatment of RB containing the DC // if odd number RBs in system bandwidth and first RB to be treated is higher than middle system bandwidth (around DC) // we have to treat the RB in two parts: first part from i=0 to 5, the data is at the end of rxdataF (pointing at the end of the table) - rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12]; -#ifdef NR_PDCCH_DCI_DEBUG - LOG_D(PHY,"in odd case c_rb (%d) is half N_RB_DL + 1 we treat DC case -> rxF = &rxdataF[aarx = (%d)][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n", - c_rb,aarx,(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))); -#endif + rxF = &rxdataF[aarx][frame_parms->first_carrier_offset + 12 * (c_rb + n_BWP_start) + symbol * frame_parms->ofdm_symbol_size]; + LOG_DDD("in odd case c_rb (%d) is half N_RB_DL + 1 we treat DC case -> rxF = &rxdataF[aarx = (%d)][frame_parms->first_carrier_offset + 12 * (c_rb + n_BWP_start) + symbol * frame_parms->ofdm_symbol_size = (%d)]\n", + c_rb,aarx,(frame_parms->first_carrier_offset + 12 * (c_rb + n_BWP_start) + symbol * frame_parms->ofdm_symbol_size)); j = 0; for (i = 0; i < 6; i++) { //treating first part of the RB note that i=5 would correspond to DC. We treat it in NR if ((i != 1) && (i != 5)) { dl_ch0_ext[j] = dl_ch0[i]; - rxF_ext[j++] = rxF[i]; - // printf("**extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j-1],*(1+(short*)&rxF_ext[j-1])); + rxF_ext[j] = rxF[i]; + LOG_DDD("RB[c_rb %d] \t RE[re %d] => rxF_ext[%d]=(%d,%d)\t rxF[%d]=(%d,%d)\n", + c_rb, i, j, *(short *) &rxF_ext[j],*(1 + (short *) &rxF_ext[j]), i, + *(short *) &rxF[i], *(1 + (short *) &rxF[i])); + j++; + } else { + LOG_DDD("RB[c_rb %d] \t RE[re %d] => rxF_ext[%d]=(%d,%d)\t rxF[%d]=(%d,%d) \t\t <==> DM-RS PDCCH, this is a pilot symbol\n", + c_rb, i, j, *(short *) &rxF_ext[j], *(1 + (short *) &rxF_ext[j]), i, + *(short *) &rxF[i], *(1 + (short *) &rxF[i])); } } // then we point at the begining of the symbol part of rxdataF do process second part of RB - rxF = &rxdataF[aarx][((symbol * (frame_parms->ofdm_symbol_size)))]; // we point at the 1st part of the rxdataF in symbol -#ifdef NR_PDCCH_DCI_DEBUG - LOG_D(PHY,"in odd case c_rb (%d) is half N_RB_DL +1 we treat DC case -> rxF = &rxdataF[aarx = (%d)][(symbol * (frame_parms->ofdm_symbol_size)) = (%d)]\n", - c_rb,aarx,(symbol * (frame_parms->ofdm_symbol_size))); -#endif + rxF = &rxdataF[aarx][symbol * frame_parms->ofdm_symbol_size]; // we point at the 1st part of the rxdataF in symbol + LOG_DDD("in odd case c_rb (%d) is half N_RB_DL +1 we treat DC case -> rxF = &rxdataF[aarx = (%d)][symbol * frame_parms->ofdm_symbol_size = (%d)]\n", + c_rb,aarx,(symbol * frame_parms->ofdm_symbol_size)); for (; i < 12; i++) { if ((i != 9)) { dl_ch0_ext[j] = dl_ch0[i]; - rxF_ext[j++] = rxF[(1 + i - 6)]; - // printf("**extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j-1],*(1+(short*)&rxF_ext[j-1])); + rxF_ext[j] = rxF[i - 6]; + LOG_DDD("RB[c_rb %d] \t RE[re %d] => rxF_ext[%d]=(%d,%d)\t rxF[%d]=(%d,%d)\n", + c_rb, i, j, *(short *) &rxF_ext[j],*(1 + (short *) &rxF_ext[j]), i, + *(short *) &rxF[i-6], *(1 + (short *) &rxF[i-6])); + j++; + } else { + LOG_DDD("RB[c_rb %d] \t RE[re %d] => rxF_ext[%d]=(%d,%d)\t rxF[%d]=(%d,%d) \t\t <==> DM-RS PDCCH, this is a pilot symbol\n", + c_rb, i, j, *(short *) &rxF_ext[j], *(1 + (short *) &rxF_ext[j]), i, + *(short *) &rxF[i-6], *(1 + (short *) &rxF[i-6])); } } @@ -495,32 +487,21 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, dl_ch0_ext += NBR_RE_PER_RB_WITHOUT_DMRS; rxF_ext += NBR_RE_PER_RB_WITHOUT_DMRS; dl_ch0 += 12; - //rxF += 7; - //c_rb++; - //n_BWP_start++; // We have to increment this variable here to be consequent in the for loop afterwards - //} } else { // treatment of any RB that does not contain the DC j = 0; for (i = 0; i < 12; i++) { if ((i != 1) && (i != 5) && (i != 9)) { rxF_ext[j] = rxF[i]; -#ifdef NR_PDCCH_DCI_DEBUG - LOG_D(PHY,"RB[c_rb %d] \t RE[re %d] => rxF_ext[%d]=(%d,%d)\t rxF[%d]=(%d,%d)\n", + LOG_DDD("RB[c_rb %d] \t RE[re %d] => rxF_ext[%d]=(%d,%d)\t rxF[%d]=(%d,%d)\n", c_rb, i, j, *(short *) &rxF_ext[j],*(1 + (short *) &rxF_ext[j]), i, *(short *) &rxF[i], *(1 + (short *) &rxF[i])); -#endif dl_ch0_ext[j] = dl_ch0[i]; - - //LOG_DDD("ch %d => dl_ch0(%d,%d)\n", i, *(short *) &dl_ch0[i], *(1 + (short*) &dl_ch0[i])); - //printf("\t-> dl_ch0[%d] => dl_ch0_ext[%d](%d,%d)\n", i,j, *(short *) &dl_ch0[i], *(1 + (short*) &dl_ch0[i])); j++; } else { -#ifdef NR_PDCCH_DCI_DEBUG - LOG_D(PHY,"RB[c_rb %d] \t RE[re %d] => rxF_ext[%d]=(%d,%d)\t rxF[%d]=(%d,%d) \t\t <==> DM-RS PDCCH, this is a pilot symbol\n", + LOG_DDD("RB[c_rb %d] \t RE[re %d] => rxF_ext[%d]=(%d,%d)\t rxF[%d]=(%d,%d) \t\t <==> DM-RS PDCCH, this is a pilot symbol\n", c_rb, i, j, *(short *) &rxF_ext[j], *(1 + (short *) &rxF_ext[j]), i, *(short *) &rxF[i], *(1 + (short *) &rxF[i])); -#endif } } @@ -528,8 +509,6 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, dl_ch0_ext += NBR_RE_PER_RB_WITHOUT_DMRS; rxF_ext += NBR_RE_PER_RB_WITHOUT_DMRS; dl_ch0 += 12; - //rxF += 12; - //} } } } @@ -783,16 +762,7 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, rel15->number_of_candidates, rel15->CCE, rel15->L); - /* - nr_pdcch_unscrambling(rel15->rnti, - frame_parms, - slot, - pdcch_vars->e_rx, - rel15->coreset.duration*n_rb*9*2, - // get_nCCE(n_pdcch_symbols, frame_parms, mi) * 72, - rel15->coreset.pdcch_dmrs_scrambling_id); - */ - LOG_D(PHY,"we end nr_pdcch_unscrambling()\n"); + LOG_D(PHY,"we end nr_pdcch_demapping_deinterleaving()\n"); LOG_D(PHY,"Ending nr_rx_pdcch() function\n"); return (0); @@ -888,16 +858,16 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, uint64_t dci_estimation[2]= {0}; const t_nrPolar_params *currentPtrDCI = nr_polar_params(NR_POLAR_DCI_MESSAGE_TYPE, dci_length, L, 1, &ue->polarList); - 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, CCEind*9*6*2, L, dci_length,nr_dci_format_string[rel15->dci_format_options[k]]); + LOG_D(PHY, "(%i.%i) Trying DCI candidate %d of %d number of candidates, CCE %d (%d), L %d, length %d, format %s\n", + proc->frame_rx, proc->nr_slot_rx, j, rel15->number_of_candidates, CCEind, CCEind*9*6*2, L, dci_length,nr_dci_format_string[rel15->dci_format_options[k]]); nr_pdcch_unscrambling(&pdcch_vars->e_rx[CCEind*108], 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[CCEind*108]; - for (int index_z = 0; index_z < 96; index_z++){ + for (int index_z = 0; index_z < 6*L; 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])); + LOG_I(PHY,"z[%d]=(%d,%d) \n", (9*index_z + i), *(int16_t *) &z[9*index_z + i],*(1 + (int16_t *) &z[9*index_z + i])); } } #endif From b8511d511d4b3babbb548e1926460560bdf15d33 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Sat, 26 Feb 2022 00:05:36 +0100 Subject: [PATCH 37/67] fix --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index b76a781491..c83882935e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2148,11 +2148,6 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; memset(sched_ctrl, 0, sizeof(*sched_ctrl)); sched_ctrl->set_mcs = TRUE; - sched_ctrl->lcid_mask = 0; - if (!get_softmodem_params()->phy_test && !get_softmodem_params()->do_ra && !get_softmodem_params()->sa) { - sched_ctrl->lcid_mask = 1<dl_lc_num = 0; sched_ctrl->ta_frame = 0; sched_ctrl->ta_update = 31; sched_ctrl->ta_apply = false; From 49196f3c91fd8465725ee24a6cb3c2a13a0b91d9 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 28 Feb 2022 14:08:45 +0100 Subject: [PATCH 38/67] NR_UE: fix nr_dlsch_extract_rbs_single() for start_rb > nb_rb_pdsch/2 --- openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index ef7d398edf..ccce0d6861 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -2006,7 +2006,7 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, "n_dmrs_cdm_groups %d is illegal\n",n_dmrs_cdm_groups); } - const unsigned short start_re = frame_parms->first_carrier_offset + start_rb * NR_NB_SC_PER_RB; + const unsigned short start_re = (frame_parms->first_carrier_offset + start_rb * NR_NB_SC_PER_RB) % frame_parms->ofdm_symbol_size; const int8_t validDmrsEst = get_valid_dmrs_idx_for_channel_est(dlDmrsSymbPos, symbol); for (unsigned char aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) { From cf5dafe74e042a8ada6adf1131f18b668f2313d3 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 28 Feb 2022 14:14:01 +0100 Subject: [PATCH 39/67] use only one memcpy() in case "start_re + nb_re == ofdm_symbol_size" in nr_ulsch_demodulation.c and nr_dlsch_demodulation.c --- openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c | 2 +- openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c index 681a9eae16..e53b930bbb 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c @@ -356,7 +356,7 @@ void nr_ulsch_extract_rbs_single(int32_t **rxdataF, if (is_dmrs_symbol == 0) { // //rxF[ ((start_re + re)*2) % (frame_parms->ofdm_symbol_size*2)]); - if (start_re + nb_re_pusch < frame_parms->ofdm_symbol_size) { + if (start_re + nb_re_pusch <= frame_parms->ofdm_symbol_size) { memcpy1((void*)rxF_ext, (void*)&rxF[start_re*2], nb_re_pusch*sizeof(int32_t)); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index ccce0d6861..384d27ff7d 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -2017,7 +2017,7 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, int32_t *rxF = &rxdataF[aarx][symbol * frame_parms->ofdm_symbol_size]; if (pilots == 0) { //data symbol only - if (start_re + nb_rb_pdsch * NR_NB_SC_PER_RB < frame_parms->ofdm_symbol_size) { + if (start_re + nb_rb_pdsch * NR_NB_SC_PER_RB <= frame_parms->ofdm_symbol_size) { memcpy((void*)rxF_ext, (void*)&rxF[start_re], nb_rb_pdsch * NR_NB_SC_PER_RB * sizeof(int32_t)); } else { int neg_length = frame_parms->ofdm_symbol_size - start_re; From dcbc60df6b07671436b37e68ec36ed1154fdbf72 Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 2 Mar 2022 11:57:01 +0100 Subject: [PATCH 40/67] cleanup nr ue phy init --- openair1/PHY/INIT/nr_init_ue.c | 30 ------------------- .../NR_UE_TRANSPORT/nr_transport_proto_ue.h | 16 ---------- openair1/PHY/defs_nr_UE.h | 28 ----------------- 3 files changed, 74 deletions(-) diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index 930fa76908..c687e20920 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -378,7 +378,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) 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 *) ); ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); @@ -396,7 +395,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) // size_t num = 7*2*fp->N_RB_DL*12; size_t num = 4*273*12; // 4 symbols, 100 PRBs, 12 REs per PRB ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num); - ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num); ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num); ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num); } @@ -517,37 +515,11 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) // PDSCH for (int th_id = 0; th_id < RX_NB_TH_MAX; th_id++) { - for (int k = 0; k < 8; k++) { //harq_pid - for (int l = 0; l < 8; l++) { //round - for (int i = 0; i < fp->nb_antennas_rx; i++) { - for (int j = 0; j < 4; j++) { //frame_parms->nb_antennas_tx; j++) - const int idx = j * fp->nb_antennas_rx + i; - free_and_zero(ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l][idx]); - free_and_zero(ue->pdsch_vars[th_id][gNB_id]->rxdataF_comp1[k][l][idx]); - free_and_zero(ue->pdsch_vars[th_id][gNB_id]->dl_ch_mag1[k][l][idx]); - free_and_zero(ue->pdsch_vars[th_id][gNB_id]->dl_ch_magb1[k][l][idx]); - } - } - free_and_zero(ue->pdsch_vars[th_id][gNB_id]->rxdataF_comp1[k][l]); - free_and_zero(ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l]); - free_and_zero(ue->pdsch_vars[th_id][gNB_id]->dl_ch_mag1[k][l]); - free_and_zero(ue->pdsch_vars[th_id][gNB_id]->dl_ch_magb1[k][l]); - } - } - - for (int i = 0; i < fp->nb_antennas_rx; i++) { - for (int j = 0; j < 4; j++) { - const int idx = (j*fp->nb_antennas_rx)+i; - free_and_zero(ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext[idx]); - } - } free_and_zero(ue->pdsch_vars[th_id][gNB_id]->llr_shifts); free_and_zero(ue->pdsch_vars[th_id][gNB_id]->llr[1]); free_and_zero(ue->pdsch_vars[th_id][gNB_id]->layer_llr[1]); free_and_zero(ue->pdsch_vars[th_id][gNB_id]->llr128_2ndstream); - free_and_zero(ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext); - phy_term_nr_ue__PDSCH(ue->pdsch_vars[th_id][gNB_id], fp); free_and_zero(ue->pdsch_vars[th_id][gNB_id]); } @@ -559,7 +531,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]->dl_ch_estimates[idx]); free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time[idx]); free_and_zero(ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp[idx]); - free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext[idx]); free_and_zero(ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext[idx]); free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext[idx]); } @@ -570,7 +541,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]->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); free_and_zero(ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext); free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext); 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 308c536efd..ddbb2be5cf 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h @@ -830,22 +830,6 @@ void nr_dlsch_deinterleaving(uint8_t symbol, uint16_t *llr_deint, uint16_t nb_rb_pdsch); -void dlsch_dual_stream_correlation(NR_DL_FRAME_PARMS *frame_parms, - unsigned char symbol, - unsigned short nb_rb, - int **dl_ch_estimates_ext, - int **dl_ch_estimates_ext_i, - int **dl_ch_rho_ext, - unsigned char output_shift); - -void dlsch_dual_stream_correlationTM34(NR_DL_FRAME_PARMS *frame_parms, - unsigned char symbol, - unsigned short nb_rb, - int **dl_ch_estimates_ext, - int **dl_ch_estimates_ext_i, - int **dl_ch_rho_ext, - unsigned char output_shift0, - unsigned char output_shift1); //This function is used to compute multiplications in Hhermitian * H matrix void conjch0_mult_ch1(int *ch0, int *ch1, diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 9d5c979cd7..59ce97b557 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -276,12 +276,6 @@ typedef struct { /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx /// - second index: ? [0..168*N_RB_DL[ int32_t **rxdataF_comp0; - /// \brief Received frequency-domain signal after extraction and channel compensation for the second stream. For the SIC receiver we need to store the history of this for each harq process and round - /// - first index: ? [0..7] (hard coded) accessed via \c harq_pid - /// - second index: ? [0..7] (hard coded) accessed via \c round - /// - third index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - fourth index: ? [0..168*N_RB_DL[ - int32_t **rxdataF_comp1[8][8]; /// \brief Hold the channel estimates in frequency domain. /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx /// - second index: samples? [0..symbols_per_tti*(ofdm_symbol_size+LTE_CE_FILTER_LENGTH)[ @@ -294,12 +288,6 @@ typedef struct { /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx /// - second index: ? [0..168*N_RB_DL[ int32_t **dl_ch_ptrs_estimates_ext; - /// \brief Downlink cross-correlation of MIMO channel estimates (unquantized PMI) extracted in PRBS. For the SIC receiver we need to store the history of this for each harq process and round - /// - first index: ? [0..7] (hard coded) accessed via \c harq_pid - /// - second index: ? [0..7] (hard coded) accessed via \c round - /// - third index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - fourth index: ? [0..168*N_RB_DL[ - int32_t **dl_ch_rho_ext[8][8]; /// \brief Downlink beamforming channel estimates in frequency domain. /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx /// - second index: samples? [0..symbols_per_tti*(ofdm_symbol_size+LTE_CE_FILTER_LENGTH)[ @@ -308,10 +296,6 @@ typedef struct { /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx /// - second index: ? [0..168*N_RB_DL[ int32_t **dl_bf_ch_estimates_ext; - /// \brief Downlink cross-correlation of MIMO channel estimates (unquantized PMI) extracted in PRBS. - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..168*N_RB_DL[ - int32_t **dl_ch_rho2_ext; /// \brief Downlink PMIs extracted in PRBS and grouped in subbands. /// - first index: ressource block [0..N_RB_DL[ uint8_t *pmi_ext; @@ -319,18 +303,10 @@ typedef struct { /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx /// - second index: ? [0..168*N_RB_DL[ int32_t **dl_ch_mag0; - /// \brief Magnitude of Downlink Channel second layer (16QAM level/First 64QAM level). - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..168*N_RB_DL[ - int32_t **dl_ch_mag1[8][8]; /// \brief Magnitude of Downlink Channel, first layer (2nd 64QAM level). /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx /// - second index: ? [0..168*N_RB_DL[ int32_t **dl_ch_magb0; - /// \brief Magnitude of Downlink Channel second layer (2nd 64QAM level). - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..168*N_RB_DL[ - int32_t **dl_ch_magb1[8][8]; /// \brief Magnitude of Downlink Channel, first layer (256QAM level). int32_t **dl_ch_magr0; /// \brief Cross-correlation Matrix of the gNB Tx channel signals. @@ -600,10 +576,6 @@ typedef struct { /// - second index: ? [0..168*N_RB_DL[ int32_t **dl_ch_estimates_ext; /// \brief Pointers to channel cross-correlation vectors for multi-gNB detection. - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..168*N_RB_DL[ - int32_t **dl_ch_rho_ext; - /// \brief Pointers to channel cross-correlation vectors for multi-gNB detection. /// - first index: rx antenna [0..nb_antennas_rx[ /// - second index: ? [0..] int32_t **rho; From c36c8ccae05f04067c2d795f0161bec64d21f06e Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 2 Mar 2022 18:54:35 +0100 Subject: [PATCH 41/67] addressing additional review and some wrong allocation --- executables/nr-gnb.c | 1 - openair1/PHY/INIT/nr_init.c | 34 ++++++++++++++++++++---------- openair1/PHY/INIT/nr_init_ue.c | 23 ++++---------------- openair1/PHY/defs_gNB.h | 1 + openair1/SIMULATION/NR_PHY/dlsim.c | 5 ++--- openair2/GNB_APP/gnb_paramdef.h | 6 +++--- 6 files changed, 33 insertions(+), 37 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index caa5a52014..dbe1075884 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -512,7 +512,6 @@ void init_eNB_afterRU(void) { gNB = RC.gNB[inst]; phy_init_nr_gNB(gNB,0,0); - init_codebook_gNB(gNB); // map antennas and PRACH signals to gNB RX if (0) AssertFatal(gNB->num_RU>0,"Number of RU attached to gNB %d is zero\n",gNB->Mod_id); diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 9c466f9574..358fb54aeb 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -144,8 +144,8 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { //Table 5.2.2.2.1-5: //Codebook for 1-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS - int pmiq_size = N1*O1*N2*O2*4+1; - mat[0] = (int32_t **)malloc16(pmiq_size*sizeof(int32_t *)); + gNB->pmiq_size[0] = N1*O1*N2*O2*4+1; + mat[0] = (int32_t **)malloc16(gNB->pmiq_size[0]*sizeof(int32_t *)); //pmi=0 corresponds to unit matrix mat[0][0] = (int32_t *)calloc(2*N1*N2,sizeof(int32_t)); @@ -202,19 +202,19 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { //Compute the code book size for generating 2 layers out of Tx antenna ports //pmi_size is computed as follows - pmiq_size = 1;//1 for unity matrix + gNB->pmiq_size[1] = 1;//1 for unity matrix for(int llb=0; llbpmiq_size[1] += 1; } } } } } - mat[1] = (int32_t **)malloc16(pmiq_size*sizeof(int32_t *)); + mat[1] = (int32_t **)malloc16(gNB->pmiq_size[1]*sizeof(int32_t *)); //pmi=0 corresponds to unit matrix mat[1][0] = (int32_t *)calloc((2*N1*N2)*(2),sizeof(int32_t)); @@ -287,19 +287,19 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { if(max_mimo_layers>=3) { //pmi_size is computed as follows - pmiq_size = 1;//unity matrix + gNB->pmiq_size[2] = 1;//unity matrix for(int llb=0; llbpmiq_size[2] += 1; } } } } } - mat[2] = (int32_t **)malloc16(pmiq_size*sizeof(int32_t *)); + mat[2] = (int32_t **)malloc16(gNB->pmiq_size[2]*sizeof(int32_t *)); //pmi=0 corresponds to unit matrix mat[2][0] = (int32_t *)calloc((2*N1*N2)*(3),sizeof(int32_t)); for(int j_col=0; j_col<3; j_col++) { //3 layers @@ -376,20 +376,20 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { //Codebook for 4-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS if(max_mimo_layers>=4) { //pmi_size is computed as follows - pmiq_size = 1;//unity matrix + gNB->pmiq_size[3] = 1;//unity matrix for(int llb=0; llbpmiq_size[3] += 1; } } } } } - mat[3] = (int32_t **)malloc16(pmiq_size*sizeof(int32_t *)); + mat[3] = (int32_t **)malloc16(gNB->pmiq_size[3]*sizeof(int32_t *)); //pmi=0 corresponds to unit matrix mat[3][0] = (int32_t *)calloc((2*N1*N2)*(4),sizeof(int32_t)); for(int j_col=0; j_col<4; j_col++) { //4 layers @@ -509,6 +509,9 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, init_scrambling_luts(); init_pucch2_luts(); load_nrLDPClib(NULL); + + init_codebook_gNB(gNB); + // PBCH DMRS gold sequences generation nr_init_pbch_dmrs(gNB); //PDCCH DMRS init @@ -706,6 +709,15 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB) const int max_ul_mimo_layers = 4; // taken from phy_init_nr_gNB() const int n_buf = Prx * max_ul_mimo_layers; + int max_dl_mimo_layers =(fp->nb_antennas_txnb_antennas_tx : NR_MAX_NB_LAYERS; + for (int nl = 0; nl < max_dl_mimo_layers; nl++) { + for(int size = 0; size < gNB->pmiq_size[nl]; size++) { + free_and_zero(gNB->nr_mimo_precoding_matrix[nl][size]); + } + free_and_zero(gNB->nr_mimo_precoding_matrix[nl]); + } + free_and_zero(gNB->nr_mimo_precoding_matrix); + uint32_t ***pdcch_dmrs = gNB->nr_gold_pdcch_dmrs; for (int slot = 0; slot < fp->slots_per_frame; slot++) { for (int symb = 0; symb < fp->symbols_per_slot; symb++) diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index c687e20920..6a3c5c765c 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -59,7 +59,6 @@ void phy_init_nr_ue_PDSCH(NR_UE_PDSCH *const pdsch, const NR_DL_FRAME_PARMS *const fp) { AssertFatal( pdsch, "pdsch==0" ); - //pdsch->layer_llr[0] = (int16_t *)malloc16_clear( (8*(3*8*6144))*sizeof(int16_t) ); pdsch->llr128 = (int16_t **)malloc16_clear( sizeof(int16_t *) ); // FIXME! no further allocation for (int16_t*)pdsch->llr128 !!! expect SIGSEGV // FK, 11-3-2015: this is only as a temporary pointer, no memory is stored there @@ -130,8 +129,10 @@ void phy_term_nr_ue__PDSCH(NR_UE_PDSCH* pdsch, const NR_DL_FRAME_PARMS *const fp free_and_zero(pdsch->rho[i]); } free_and_zero(pdsch->pmi_ext); - free_and_zero(pdsch->llr[0]); - free_and_zero(pdsch->layer_llr[0]); + for (int i=0; illr[i]); + for (int i=0; ilayer_llr[i]); free_and_zero(pdsch->llr128); free_and_zero(pdsch->rxdataF_ext); free_and_zero(pdsch->rxdataF_uespec_pilots); @@ -426,13 +427,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) pbch_vars[gNB_id]->decoded_output = (uint8_t *)malloc16_clear(64); } - // initialization for the last instance of pdsch_vars (used for MU-MIMO) - for (th_id=0; th_idpdsch_vars[th_id][gNB_id] = malloc16_clear(sizeof(NR_UE_PDSCH)); - ue->pdsch_vars[th_id][gNB_id]->llr[1] = malloc16_clear((8*(3*8*8448))*sizeof(int16_t)); - ue->pdsch_vars[th_id][gNB_id]->layer_llr[1] = malloc16_clear((8*(3*8*8448))*sizeof(int16_t)); - } - ue->sinr_CQI_dB = (double *) malloc16_clear( fp->N_RB_DL*12*sizeof(double) ); ue->init_averaging = 1; @@ -517,8 +511,6 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) for (int th_id = 0; th_id < RX_NB_TH_MAX; th_id++) { free_and_zero(ue->pdsch_vars[th_id][gNB_id]->llr_shifts); - free_and_zero(ue->pdsch_vars[th_id][gNB_id]->llr[1]); - free_and_zero(ue->pdsch_vars[th_id][gNB_id]->layer_llr[1]); free_and_zero(ue->pdsch_vars[th_id][gNB_id]->llr128_2ndstream); phy_term_nr_ue__PDSCH(ue->pdsch_vars[th_id][gNB_id], fp); free_and_zero(ue->pdsch_vars[th_id][gNB_id]); @@ -594,13 +586,6 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) free_and_zero(ue->prach_vars[gNB_id]); } - const int gNB_id = ue->n_connected_gNB; - for (int th_id = 0; th_id < RX_NB_TH_MAX; th_id++) { - free_and_zero(ue->pdsch_vars[th_id][gNB_id]->llr[1]); - free_and_zero(ue->pdsch_vars[th_id][gNB_id]->layer_llr[1]); - free_and_zero(ue->pdsch_vars[th_id][gNB_id]); - } - free_and_zero(ue->sinr_CQI_dB); } diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index cf1da93c70..a849c5a0f2 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -807,6 +807,7 @@ typedef struct PHY_VARS_gNB_s { /// second dimension: PMI [0,...,CodeSize-1[ /// third dimension: [i_rows*noOfLayers+j_col], i_rows=0,...pdsch_AntennaPorts-1 and j_col=0,...,noOfLayers-1 int32_t ***nr_mimo_precoding_matrix; + int pmiq_size[NR_MAX_NB_LAYERS]; /// PUSCH DMRS uint32_t ****nr_gold_pusch_dmrs; diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 7f966380db..a106dab20a 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -785,9 +785,9 @@ int main(int argc, char **argv) prepare_scd(scd); rrc_pdsch_AntennaPorts_t pdsch_AntennaPorts; - pdsch_AntennaPorts.N1 = n_tx; + pdsch_AntennaPorts.N1 = n_tx>1 ? n_tx>>1 : 1; pdsch_AntennaPorts.N2 = 1; - pdsch_AntennaPorts.XP = 1; + pdsch_AntennaPorts.XP = n_tx>1 ? 2 : 1; gNB->ap_N1 = pdsch_AntennaPorts.N1; gNB->ap_N2 = pdsch_AntennaPorts.N2; gNB->ap_XP = pdsch_AntennaPorts.XP; @@ -819,7 +819,6 @@ int main(int argc, char **argv) // rrc_mac_config_req_gNB gNB_mac->pre_processor_dl = nr_dlsim_preprocessor; phy_init_nr_gNB(gNB,0,1); - init_codebook_gNB(gNB); N_RB_DL = gNB->frame_parms.N_RB_DL; NR_UE_info_t *UE_info = &RC.nrmac[0]->UE_info; UE_info->num_UEs=1; diff --git a/openair2/GNB_APP/gnb_paramdef.h b/openair2/GNB_APP/gnb_paramdef.h index dc319fbccf..d3a0218a0f 100644 --- a/openair2/GNB_APP/gnb_paramdef.h +++ b/openair2/GNB_APP/gnb_paramdef.h @@ -146,9 +146,9 @@ typedef enum { {GNB_CONFIG_STRING_LOCAL_S_PORTD, NULL, 0, uptr:NULL, defuintval:50001, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_REMOTE_S_PORTD, NULL, 0, uptr:NULL, defuintval:50001, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_SSBSUBCARRIEROFFSET, NULL, 0, iptr:NULL, defintval:31, TYPE_INT, 0}, \ -{GNB_CONFIG_STRING_PDSCHANTENNAPORTS_N1, NULL, 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \ -{GNB_CONFIG_STRING_PDSCHANTENNAPORTS_N2, NULL, 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \ -{GNB_CONFIG_STRING_PDSCHANTENNAPORTS_XP, NULL, 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_PDSCHANTENNAPORTS_N1, "horiz. log. antenna ports", 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_PDSCHANTENNAPORTS_N2, "vert. log. antenna ports", 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_PDSCHANTENNAPORTS_XP, "XP log. antenna ports", 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_DOCSIRS, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ From e0acdf6d67bd95ec9fe72018d38113940a9d3acc Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 3 Mar 2022 08:59:13 +0100 Subject: [PATCH 42/67] missing condition on free nr_mimo_precoding_matrix --- openair1/PHY/INIT/nr_init.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 358fb54aeb..913fafc291 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -710,13 +710,14 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB) const int n_buf = Prx * max_ul_mimo_layers; int max_dl_mimo_layers =(fp->nb_antennas_txnb_antennas_tx : NR_MAX_NB_LAYERS; - for (int nl = 0; nl < max_dl_mimo_layers; nl++) { - for(int size = 0; size < gNB->pmiq_size[nl]; size++) { - free_and_zero(gNB->nr_mimo_precoding_matrix[nl][size]); + if (fp->nb_antennas_tx>1) { + for (int nl = 0; nl < max_dl_mimo_layers; nl++) { + for(int size = 0; size < gNB->pmiq_size[nl]; size++) + free_and_zero(gNB->nr_mimo_precoding_matrix[nl][size]); + free_and_zero(gNB->nr_mimo_precoding_matrix[nl]); } - free_and_zero(gNB->nr_mimo_precoding_matrix[nl]); + free_and_zero(gNB->nr_mimo_precoding_matrix); } - free_and_zero(gNB->nr_mimo_precoding_matrix); uint32_t ***pdcch_dmrs = gNB->nr_gold_pdcch_dmrs; for (int slot = 0; slot < fp->slots_per_frame; slot++) { From e7500354c1440d5447cb84d5345d2ce0363c6339 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 7 Mar 2022 16:02:01 +0100 Subject: [PATCH 43/67] harmonize RLC and PDCP configurations in nr_DRB_preconfiguration() and fill_default_secondaryCellGroup() nr_DRB_preconfiguration() is used in phy-test mode by both, OAI UE and gNB, and in all other modes by OAI UE. Because of inconsistencies, data transfer with OAI UE was only reliably working in phy-test mode. Ultimately, OAI UE should use nr_DRB_preconfiguration() only in phy-test mode and do proper DRB configuration instead in all other modes! --- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 7 ++++--- openair2/RRC/NR/rrc_gNB_reconfig.c | 6 ++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index a08c9d2c78..0c869ceeb1 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -1156,9 +1156,9 @@ void nr_DRB_preconfiguration(uint16_t crnti) drb_ToAddMod->pdcp_Config->drb->discardTimer = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb->discardTimer)); *drb_ToAddMod->pdcp_Config->drb->discardTimer=NR_PDCP_Config__drb__discardTimer_infinity; drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL)); - *drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL = NR_PDCP_Config__drb__pdcp_SN_SizeUL_len12bits; + *drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL = NR_PDCP_Config__drb__pdcp_SN_SizeUL_len18bits; drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeDL = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeDL)); - *drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeDL = NR_PDCP_Config__drb__pdcp_SN_SizeDL_len12bits; + *drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeDL = NR_PDCP_Config__drb__pdcp_SN_SizeDL_len18bits; drb_ToAddMod->pdcp_Config->drb->headerCompression.present = NR_PDCP_Config__drb__headerCompression_PR_notUsed; drb_ToAddMod->pdcp_Config->drb->headerCompression.choice.notUsed = 0; @@ -1188,7 +1188,8 @@ void nr_DRB_preconfiguration(uint16_t crnti) NR_RLC_BearerConfig_t *RLC_BearerConfig = calloc(1,sizeof(*RLC_BearerConfig)); nr_rlc_bearer_init(RLC_BearerConfig,NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity); - nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_am); + nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_um_Bi_Directional); + //nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_am); nr_rlc_bearer_init_ul_spec(RLC_BearerConfig->mac_LogicalChannelConfig); Rlc_Bearer_ToAdd_list = calloc(1,sizeof(*Rlc_Bearer_ToAdd_list)); diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index b4938404bd..610fd8e699 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -89,10 +89,8 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco secondaryCellGroup->cellGroupId = scg_id; NR_RLC_BearerConfig_t *RLC_BearerConfig = calloc(1,sizeof(*RLC_BearerConfig)); nr_rlc_bearer_init(RLC_BearerConfig, NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity); - if (get_softmodem_params()->do_ra || get_softmodem_params()->sa) - nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_um_Bi_Directional); - else - nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_am); + nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_um_Bi_Directional); + //nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_am); nr_rlc_bearer_init_ul_spec(RLC_BearerConfig->mac_LogicalChannelConfig); secondaryCellGroup->rlc_BearerToAddModList = calloc(1,sizeof(*secondaryCellGroup->rlc_BearerToAddModList)); From e3901a499be0bd5584421a65adc2ee8696703fe0 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 7 Mar 2022 16:22:50 +0100 Subject: [PATCH 44/67] call process_CellGroup() after add_new_nr_ue() in gNB_scheduler_ulsch.c In case of do-ra mode (NSA) the OAI UE needs this, so the gNB correctly establishes the DRB. --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 34d4496eee..4b72b9cea3 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -818,6 +818,8 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); UE_info->active[UE_id] = true; + process_CellGroup(ra->CellGroup, UE_scheduling_control); + } else { LOG_A(NR_MAC,"[RAPROC] RA-Msg3 received (sdu_lenP %d)\n",sdu_lenP); From 57cfd7bc324406ef1271b4b1ea022e1fe54837b4 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 17 Mar 2022 08:25:16 +0100 Subject: [PATCH 45/67] Remove basic simulator The basic simulator can be replaced with the RF simulator. Use option --rfsim. --- ci-scripts/Jenkinsfile-gitlab | 45 +- ci-scripts/doc/vm_based_simulator_build.md | 1 - ci-scripts/doc/vm_based_simulator_create.md | 1 - .../doc/vm_based_simulator_main_scripts.md | 6 - ci-scripts/doc/vm_based_simulator_test.md | 70 +-- ci-scripts/oai-ci-vm-tool | 7 - ci-scripts/reportBuildLocally.sh | 23 - ci-scripts/reportTestLocally.sh | 150 ------ ci-scripts/runTestOnVM.sh | 426 +---------------- ci-scripts/waitBuildOnVM.sh | 14 +- cmake_targets/CMakeLists.txt | 24 +- cmake_targets/build_oai | 5 - common/utils/T/T.c | 6 - common/utils/T/T.h | 33 +- common/utils/T/T_defs.h | 14 +- common/utils/T/local_tracer.c | 16 - doc/BASIC_SIM.md | 191 -------- doc/RUNMODEM.md | 4 - docker/Dockerfile.eNB.rhel8.2 | 1 - docker/Dockerfile.eNB.rhel8.2.oc4-4 | 2 - docker/Dockerfile.eNB.ubuntu18 | 1 - docker/Dockerfile.gNB.rhel8.2 | 1 - docker/Dockerfile.gNB.rhel8.2.oc4-4 | 2 - docker/Dockerfile.gNB.ubuntu18 | 1 - docker/Dockerfile.lteRU.rhel8.2 | 1 - docker/Dockerfile.lteRU.ubuntu18 | 1 - docker/Dockerfile.lteUE.rhel8.2 | 1 - docker/Dockerfile.lteUE.rhel8.2.oc4-4 | 2 - docker/Dockerfile.lteUE.ubuntu18 | 1 - docker/Dockerfile.nrUE.rhel8.2 | 1 - docker/Dockerfile.nrUE.rhel8.2.oc4-4 | 2 - docker/Dockerfile.nrUE.ubuntu18 | 1 - executables/nr-uesoftmodem.c | 2 +- executables/softmodem-common.c | 6 +- executables/softmodem-common.h | 5 +- openair1/PHY/INIT/lte_param_init.c | 6 - openair1/PHY/LTE_TRANSPORT/pss.c | 4 - openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c | 5 - openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c | 77 ++- openair1/PHY/defs_RU.h | 2 - openair1/SCHED_UE/phy_procedures_lte_ue.c | 135 ++---- targets/ARCH/COMMON/common_lib.c | 3 - targets/ARCH/COMMON/common_lib.h | 2 - targets/ARCH/tcp_bridge/README | 4 - targets/ARCH/tcp_bridge/README.tcp_bridge_oai | 42 -- targets/ARCH/tcp_bridge/tcp_bridge.c | 292 ------------ targets/ARCH/tcp_bridge/tcp_bridge_oai.c | 443 ------------------ targets/RT/USER/lte-ru.c | 6 - targets/RT/USER/lte-ue.c | 20 +- targets/RT/USER/lte-uesoftmodem.c | 2 +- 50 files changed, 109 insertions(+), 2001 deletions(-) delete mode 100644 doc/BASIC_SIM.md delete mode 100644 targets/ARCH/tcp_bridge/README delete mode 100644 targets/ARCH/tcp_bridge/README.tcp_bridge_oai delete mode 100644 targets/ARCH/tcp_bridge/tcp_bridge.c delete mode 100644 targets/ARCH/tcp_bridge/tcp_bridge_oai.c diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab index 3042ada815..f331c975a8 100644 --- a/ci-scripts/Jenkinsfile-gitlab +++ b/ci-scripts/Jenkinsfile-gitlab @@ -159,16 +159,6 @@ pipeline { } } - stage ("Start VM -- basic-sim") { - steps { - lock (vmResource) { - timeout (time: 5, unit: 'MINUTES') { - sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon" - } - } - } - } - stage ("Start VM -- gnb-usrp") { steps { lock (vmResource) { @@ -211,15 +201,6 @@ pipeline { stage ("Variant Builds") { parallel { - stage ("Build basic simulator") { - steps { - gitlabCommitStatus(name: "Build basic-sim") { - timeout (time: 45, unit: 'MINUTES') { - sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" - } - } - } - } stage ("Build 5G gNB-USRP") { steps { gitlabCommitStatus(name: "Build gNB-USRP") { @@ -270,9 +251,9 @@ pipeline { script { dir ('archives') { if (fileExists('red_hat')) { - sh "zip -r -qq vm_build_logs.zip basic_sim enb_eth ue_eth gnb_usrp nr_ue_usrp red_hat" + sh "zip -r -qq vm_build_logs.zip enb_eth ue_eth gnb_usrp nr_ue_usrp red_hat" } else { - sh "zip -r -qq vm_build_logs.zip basic_sim enb_eth ue_eth gnb_usrp nr_ue_usrp" + sh "zip -r -qq vm_build_logs.zip enb_eth ue_eth gnb_usrp nr_ue_usrp" } } if(fileExists('archives/vm_build_logs.zip')) { @@ -324,26 +305,6 @@ pipeline { } } } - stage ("Test basic simulator") { - when { - expression {doMandatoryTests} - } - steps { - lock (vmResource) { - script { - timeout (time: 30, unit: 'MINUTES') { - try { - gitlabCommitStatus(name: "Test basic-sim") { - sh "./ci-scripts/oai-ci-vm-tool test --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}" - } - } catch (Exception e) { - currentBuild.result = 'FAILURE' - } - } - } - } - } - } stage ("Test L1 simulator") { when { expression {doMandatoryTests} @@ -581,7 +542,7 @@ pipeline { script { if (doMandatoryTests) { dir ('archives') { - sh "if [ -d basic_sim/test ] || [ -d rf_sim/test ] || [ -d l2_sim/test ]; then zip -r -qq vm_tests_logs.zip */test ; fi" + sh "if [ -d rf_sim/test ] || [ -d l2_sim/test ]; then zip -r -qq vm_tests_logs.zip */test ; fi" } if(fileExists('archives/vm_tests_logs.zip')) { archiveArtifacts artifacts: 'archives/vm_tests_logs.zip' diff --git a/ci-scripts/doc/vm_based_simulator_build.md b/ci-scripts/doc/vm_based_simulator_build.md index 28fbc955d5..16faa3ce9b 100644 --- a/ci-scripts/doc/vm_based_simulator_build.md +++ b/ci-scripts/doc/vm_based_simulator_build.md @@ -52,7 +52,6 @@ Options: -------- # OpenAirInterface Build Variants --variant enb-usrp OR -v1 ( build and test ) - --variant basic-sim OR -v2 ( build and test ) --variant phy-sim OR -v3 ( build and test ) --variant cppcheck OR -v4 ( build and test ) --variant gnb-usrp OR -v5 ( build and test ) diff --git a/ci-scripts/doc/vm_based_simulator_create.md b/ci-scripts/doc/vm_based_simulator_create.md index 09ce26c553..4681738038 100644 --- a/ci-scripts/doc/vm_based_simulator_create.md +++ b/ci-scripts/doc/vm_based_simulator_create.md @@ -45,7 +45,6 @@ Mandatory Options: # OpenAirInterface Build Variants --variant enb-usrp OR -v1 ( build and test ) - --variant basic-sim OR -v2 ( build and test ) --variant phy-sim OR -v3 ( build and test ) --variant cppcheck OR -v4 ( build and test ) --variant gnb-usrp OR -v5 ( build and test ) diff --git a/ci-scripts/doc/vm_based_simulator_main_scripts.md b/ci-scripts/doc/vm_based_simulator_main_scripts.md index 000d89a1eb..0d54d03521 100644 --- a/ci-scripts/doc/vm_based_simulator_main_scripts.md +++ b/ci-scripts/doc/vm_based_simulator_main_scripts.md @@ -109,12 +109,6 @@ You can get the list of variant specific variables specifying the variant argume NB_PATTERN_FILES=9 BUILD_OPTIONS="" LOG_PATTERN=.Rel15.txt - --variant basic-sim OR -v2 ( build and test ) - VM_NAME=ci-basic-sim ARCHIVES_LOC=basic_sim - VM_MEMORY=8192 VM_CPU=4 - NB_PATTERN_FILES=13 BUILD_OPTIONS="--eNB --UE" - LOG_PATTERN=.Rel15.txt - --variant phy-sim OR -v3 ( build and test ) VM_NAME=ci-phy-sim ARCHIVES_LOC=phy_sim VM_MEMORY=2048 VM_CPU=4 diff --git a/ci-scripts/doc/vm_based_simulator_test.md b/ci-scripts/doc/vm_based_simulator_test.md index 73308b972e..ab28101543 100644 --- a/ci-scripts/doc/vm_based_simulator_test.md +++ b/ci-scripts/doc/vm_based_simulator_test.md @@ -18,16 +18,14 @@ 2. [Detailed Description](#2-detailed-description) 3. [Typical Usage](#3-typical-usage) 1. [Testing the physical simulators](#31-testing-the-physicals-simulators) - 2. [Testing the basic simulator](#32-testing-the-basic-simulator) - 3. [Testing the RF simulator](#33-testing-the-rf-simulator) - 4. [Testing the L2-nFAPI simulator](#33-testing-the-l2-nfapi-simulator) + 2. [Testing the RF simulator](#33-testing-the-rf-simulator) + 3. [Testing the L2-nFAPI simulator](#33-testing-the-l2-nfapi-simulator) # 1. Introduction # -Currently 2 build variants can be directly tested: +Currently 1 build variant can be directly tested: * Physical Simulators -* Basic Simulator In addition, 2 build variants are used: @@ -73,7 +71,6 @@ Options: # OpenAirInterface Build Variants --variant enb-usrp OR -v1 ( build and test ) - --variant basic-sim OR -v2 ( build and test ) --variant phy-sim OR -v3 ( build and test ) --variant cppcheck OR -v4 ( build and test ) --variant gnb-usrp OR -v5 ( build and test ) @@ -143,64 +140,7 @@ $ ./ci-scripts/oai-ci-vm-tool test --workspace /var/jenkins/workspace/RAN-CI-dev Note that the VM instance is destroyed. You do that when you are sure your test is passing. -## 3.2. Testing the basic simulator ## - -```bash -$ ./ci-scripts/oai-ci-vm-tool test --workspace /var/jenkins/workspace/RAN-CI-develop --variant basic-sim --job-name RAN-CI-develop --build-id 48 -15:11:13 ############################################################ -15:11:13 OAI CI VM script -15:11:13 ############################################################ -15:11:13 VM_NAME = RAN-CI-develop-b48-basic-sim -15:11:13 VM_CMD_FILE = RAN-CI-develop-b48-basic-sim_cmds.txt -15:11:13 JENKINS_WKSP = /var/jenkins/workspace/RAN-CI-develop -15:11:13 ARCHIVES_LOC = /var/jenkins/workspace/RAN-CI-develop/archives/basic_sim/test -15:11:13 ############################################################ -15:11:13 Waiting for VM to be started -15:11:13 ############################################################ -15:11:14 Warning: Permanently added '192.168.122.29' (ECDSA) to the list of known hosts. -15:11:15 RAN-CI-develop-b48-basic-sim has for IP addr = 192.168.122.29 -15:11:15 ############################################################ -15:11:15 Test EPC on VM (RAN-CI-develop-b48-epc) will be using ltebox -15:11:15 ############################################################ -15:11:15 EPC_VM_CMD_FILE = RAN-CI-develop-b48-epc_cmds.txt -15:11:15 ############################################################ -15:11:15 Creating test EPC VM (RAN-CI-develop-b48-epc) on Ubuntu Cloud Image base -15:11:15 ############################################################ -15:11:18 Waiting for VM to be started -15:13:25 Warning: Permanently added '192.168.122.156' (ECDSA) to the list of known hosts. -15:13:25 RAN-CI-develop-b48-epc has for IP addr = 192.168.122.156 -15:13:25 Warning: Permanently added '192.168.122.156' (ECDSA) to the list of known hosts. -15:13:25 ls: cannot access '/opt/ltebox/tools/start_ltebox': No such file or directory -15:13:25 ############################################################ -15:13:25 Copying ltebox archives into EPC VM (RAN-CI-develop-b48-epc) -15:13:25 ############################################################ -15:13:25 ############################################################ -15:13:25 Install EPC on EPC VM (RAN-CI-develop-b48-epc) -15:13:25 ############################################################ -.... -15:24:39 ############################################################ -15:24:39 Terminate EPC -15:24:39 ############################################################ -15:24:39 cd /opt/ltebox/tools -15:24:39 sudo ./stop_ltebox -15:24:40 sudo daemon --name=simulated_hss --stop -15:24:40 sudo killall --signal SIGKILL hss_sim -15:24:40 ############################################################ -15:24:40 Destroying VMs -15:24:40 ############################################################ -15:24:41 # Host 192.168.122.29 found: line 18 -15:24:41 /home/eurecom/.ssh/known_hosts updated. -15:24:41 Original contents retained as /home/eurecom/.ssh/known_hosts.old -15:24:43 # Host 192.168.122.60 found: line 20 -15:24:43 /home/eurecom/.ssh/known_hosts updated. -15:24:43 Original contents retained as /home/eurecom/.ssh/known_hosts.old -15:24:43 ############################################################ -15:24:43 Checking run status -15:24:43 ############################################################ -15:24:43 STATUS seems OK -``` - -## 3.3. Test the RF simulator ## +## 3.2. Test the RF simulator ## ```bash ./ci-scripts/oai-ci-vm-tool test --workspace /var/jenkins/workspace/RAN-CI-develop --variant rf-sim --job-name RAN-CI-develop --build-id 48 --keep-vm-alive @@ -209,7 +149,7 @@ $ ./ci-scripts/oai-ci-vm-tool test --workspace /var/jenkins/workspace/RAN-CI-dev 15:24:45 STATUS seems OK ``` -## 3.4. Testing the L2-nFAPI simulator +## 3.3. Testing the L2-nFAPI simulator ```bash ./ci-scripts/oai-ci-vm-tool test --workspace /var/jenkins/workspace/RAN-CI-develop --variant l2-sim --job-name RAN-CI-develop --build-id 48 diff --git a/ci-scripts/oai-ci-vm-tool b/ci-scripts/oai-ci-vm-tool index 5ee653c8e1..49b9ee14f7 100755 --- a/ci-scripts/oai-ci-vm-tool +++ b/ci-scripts/oai-ci-vm-tool @@ -175,13 +175,6 @@ function variant__v1__enb_usrp { VM_MEMORY=3072 } -function variant__v2__basic_sim { - NB_PATTERN_FILES=11 - BUILD_OPTIONS="--eNB --UE" - VM_MEMORY=8192 - RUN_OPTIONS="complex" -} - function variant__v3__phy_sim { NB_PATTERN_FILES=11 BUILD_OPTIONS="--phy_simulators" diff --git a/ci-scripts/reportBuildLocally.sh b/ci-scripts/reportBuildLocally.sh index 8b6db9261a..bcd3e2f7fe 100755 --- a/ci-scripts/reportBuildLocally.sh +++ b/ci-scripts/reportBuildLocally.sh @@ -574,7 +574,6 @@ function report_build { summary_table_row "OAI ETHERNET transport - Release 15" ./archives/enb_eth/oai_eth_transpro.Rel15.txt "Built target oai_eth_transpro" ./enb_eth_row3.html summary_table_row "Parameters Lib Config - Release 15" ./archives/enb_eth/params_libconfig.Rel15.txt "Built target params_libconfig" ./enb_eth_row4.html summary_table_row "RF Simulator - Release 15" ./archives/enb_eth/rfsimulator.Rel15.txt "Built target rfsimulator" ./enb_eth_row5.html - summary_table_row "TCP OAI Bridge - Release 15" ./archives/enb_eth/tcp_bridge_oai.Rel15.txt "Built target tcp_bridge_oai" ./enb_eth_row6.html summary_table_row "OAI USRP device if - Release 15" ./archives/enb_eth/oai_usrpdevif.Rel15.txt "Built target oai_usrpdevif" ./enb_eth_row7.html summary_table_footer @@ -584,7 +583,6 @@ function report_build { summary_table_row "OAI ETHERNET transport - Release 15" ./archives/ue_eth/oai_eth_transpro.Rel15.txt "Built target oai_eth_transpro" ./ue_eth_row3.html summary_table_row "Parameters Lib Config - Release 15" ./archives/ue_eth/params_libconfig.Rel15.txt "Built target params_libconfig" ./ue_eth_row4.html summary_table_row "RF Simulator - Release 15" ./archives/ue_eth/rfsimulator.Rel15.txt "Built target rfsimulator" ./ue_eth_row5.html - summary_table_row "TCP OAI Bridge - Release 15" ./archives/ue_eth/tcp_bridge_oai.Rel15.txt "Built target tcp_bridge_oai" ./ue_eth_row6.html summary_table_row "Conf 2 UE Data - Release 15" ./archives/ue_eth/conf2uedata.Rel15.txt "Built target conf2uedata" ./ue_eth_row7.html summary_table_row "NVRAM - Release 15" ./archives/ue_eth/nvram.Rel15.txt "Built target nvram" ./ue_eth_row8.html summary_table_row "UE IP - Release 15" ./archives/ue_eth/ue_ip.Rel15.txt "Built target ue_ip" ./ue_eth_row9.html @@ -592,20 +590,6 @@ function report_build { summary_table_row "OAI USRP device if - Release 15" ./archives/ue_eth/oai_usrpdevif.Rel15.txt "Built target oai_usrpdevif" ./ue_eth_row9b.html summary_table_footer - summary_table_header "OAI Build: 4G LTE basic simulator option" ./archives/basic_sim - summary_table_row "LTE SoftModem - Release 15" ./archives/basic_sim/lte-softmodem.Rel15.txt "Built target lte-softmodem" ./basic_sim_row1.html - summary_table_row "LTE UE SoftModem - Release 15" ./archives/basic_sim/lte-uesoftmodem.Rel15.txt "Built target lte-uesoftmodem" ./basic_sim_row2.htm - summary_table_row "Coding - Release 15" ./archives/basic_sim/coding.Rel15.txt "Built target coding" ./basic_sim_row3.html - summary_table_row "Conf 2 UE data - Release 15" ./archives/basic_sim/conf2uedata.Rel15.txt "Built target conf2uedata" ./basic_sim_row4.html - summary_table_row "OAI ETHERNET transport - Release 15" ./archives/basic_sim/oai_eth_transpro.Rel15.txt "Built target oai_eth_transpro" ./basic_sim_row5.html - summary_table_row "Parameters Lib Config - Release 15" ./archives/basic_sim/params_libconfig.Rel15.txt "Built target params_libconfig" ./basic_sim_row7.html - summary_table_row "RF Simulator - Release 15" ./archives/basic_sim/rfsimulator.Rel15.txt "Built target rfsimulator" ./basic_sim_row9.html - summary_table_row "TCP Bridge - Release 15" ./archives/basic_sim/tcp_bridge_oai.Rel15.txt "Built target tcp_bridge_oai" ./basic_sim_row10.html - summary_table_row "UE IP - Release 15" ./archives/basic_sim/ue_ip.Rel15.txt "Built target ue_ip" ./basic_sim_row11.html - summary_table_row "USIM - Release 15" ./archives/basic_sim/usim.Rel15.txt "Built target usim" ./basic_sim_row12.html - summary_table_row "NVRAM - Release 15" ./archives/basic_sim/nvram.Rel15.txt "Built target nvram" ./basic_sim_row13.html - summary_table_footer - if [ -f archives/gnb_usrp/nr-softmodem.Rel15.txt ] then summary_table_header "OAI Build: 5G NR gNB -- USRP option" ./archives/gnb_usrp @@ -658,13 +642,6 @@ function report_build { cat $DETAILS_TABLE >> ./build_results.html done fi - if [ -f ./basic_sim_row1.html ] || [ -f ./basic_sim_row2.html ] || [ -f ./basic_sim_row3.html ] || [ -f ./basic_sim_row4.html ] || [ -f ./basic_sim_row5.html ] - then - for DETAILS_TABLE in `ls ./basic_sim_row*.html` - do - cat $DETAILS_TABLE >> ./build_results.html - done - fi if [ -f ./gnb_usrp_row1.html ] || [ -f ./gnb_usrp_row2.html ] || [ -f ./gnb_usrp_row3.html ] || [ -f ./gnb_usrp_row4.html ] then for DETAILS_TABLE in `ls ./gnb_usrp_row*.html` diff --git a/ci-scripts/reportTestLocally.sh b/ci-scripts/reportTestLocally.sh index d22bfe177a..c137fcdcbb 100755 --- a/ci-scripts/reportTestLocally.sh +++ b/ci-scripts/reportTestLocally.sh @@ -250,156 +250,6 @@ function report_test { echo " " >> ./test_simulator_results.html echo "

Test Summary

" >> ./test_simulator_results.html - ARCHIVES_LOC=archives/basic_sim/test - if [ -d $ARCHIVES_LOC ] - then - echo "

4G LTE Basic Simulator Check

" >> ./test_simulator_results.html - - if [ -f $ARCHIVES_LOC/test_final_status.log ] - then - if [ `grep -c TEST_OK $ARCHIVES_LOC/test_final_status.log` -eq 1 ] - then - echo "
" >> ./test_simulator_results.html - echo " TEST was SUCCESSFUL " >> ./test_simulator_results.html - echo "
" >> ./test_simulator_results.html - else - echo "
" >> ./test_simulator_results.html - echo " TEST was a FAILURE! " >> ./test_simulator_results.html - echo "
" >> ./test_simulator_results.html - fi - else - echo "
" >> ./test_simulator_results.html - echo " COULD NOT DETERMINE TEST FINAL STATUS! " >> ./test_simulator_results.html - echo "
" >> ./test_simulator_results.html - fi - - echo " " >> ./test_simulator_results.html - echo "
" >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - - TRANS_MODES=("fdd" "tdd") - BW_CASES=(05 10 20) - for TMODE in ${TRANS_MODES[@]} - do - echo " " >> ./test_simulator_results.html - if [[ $TMODE =~ .*fdd.* ]] - then - echo " " >> ./test_simulator_results.html - else - echo " " >> ./test_simulator_results.html - fi - echo " " >> ./test_simulator_results.html - for BW in ${BW_CASES[@]} - do - ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}MHz_enb.log - UE_LOG=`echo $ENB_LOG | sed -e "s#enb#ue#"` - if [ -f $ENB_LOG ] && [ -f $UE_LOG ] - then - NAME_ENB=`echo $ENB_LOG | sed -e "s#$ARCHIVES_LOC/##"` - NAME_UE=`echo $UE_LOG | sed -e "s#$ARCHIVES_LOC/##"` - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - NB_ENB_GOT_SYNC=`egrep -c "got sync" $ENB_LOG` - NB_UE_GOT_SYNC=`egrep -c "got sync" $UE_LOG` - NB_ENB_SYNCED_WITH_UE=`egrep -c "got UE capabilities for UE" $ENB_LOG` - if [ $NB_ENB_GOT_SYNC -gt 0 ] && [ $NB_UE_GOT_SYNC -eq 2 ] && [ $NB_ENB_SYNCED_WITH_UE -eq 1 ] - then - echo " " >> ./test_simulator_results.html - else - echo " " >> ./test_simulator_results.html - fi - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - fi - PING_LOGS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_ping_ue.txt 2> /dev/null` - analyzePingFiles - - IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}*iperf*client*txt 2> /dev/null` - analyzeIperfFiles - done - done - - echo "
Log File NameCommandStatusStatistics
Test in FDDTest in TDD
$NAME_ENB --- $NAME_UEN/AOKKO
" >> ./test_simulator_results.html
-                    if [ $NB_ENB_GOT_SYNC -gt 0 ]
-                    then
-                        echo "- eNB --> got sync" >> ./test_simulator_results.html
-                    else
-                        echo "- eNB NEVER got sync" >> ./test_simulator_results.html
-                    fi
-                    if [ $NB_UE_GOT_SYNC -eq 2 ]
-                    then
-                        echo "- UE --> got sync" >> ./test_simulator_results.html
-                    else
-                        echo "- UE NEVER got sync" >> ./test_simulator_results.html
-                    fi
-                    if [ $NB_ENB_SYNCED_WITH_UE -eq 1 ]
-                    then
-                        echo "- UE attached to eNB" >> ./test_simulator_results.html
-                    else
-                        echo "- UE NEVER attached to eNB" >> ./test_simulator_results.html
-                    fi
-                    NB_SEGFAULT_ENB=`egrep -i -c "Segmentation Fault" $ENB_LOG`
-                    if [ $NB_SEGFAULT_ENB -ne 0 ]
-                    then
-                        echo "- eNB --> Segmentation Fault" >> ./test_simulator_results.html
-                    fi
-                    NB_SEGFAULT_UE=`egrep -i -c "Segmentation Fault" $UE_LOG`
-                    if [ $NB_SEGFAULT_UE -ne 0 ]
-                    then
-                        echo "- UE --> Segmentation Fault" >> ./test_simulator_results.html
-                    fi
-                    NB_ASSERTION_ENB=`egrep -i -c "Assertion" $ENB_LOG`
-                    if [ $NB_ASSERTION_ENB -ne 0 ]
-                    then
-                        echo "- eNB --> Assertion" >> ./test_simulator_results.html
-                        awk 'BEGIN{assertion=10}{if(assertion < 3){print "    " $0; assertion++};if ($0 ~/Assertion/){print "    " $0;assertion=1}}END{}' $ENB_LOG >> ./test_simulator_results.html
-                    fi
-                    NB_ASSERTION_UE=`egrep -i -c "Assertion" $UE_LOG`
-                    if [ $NB_ASSERTION_UE -ne 0 ]
-                    then
-                        echo "- eNB --> Assertion" >> ./test_simulator_results.html
-                        awk 'BEGIN{assertion=10}{if(assertion < 3){print "    " $0; assertion++};if ($0 ~/Assertion/){print "    " $0;assertion=1}}END{}' $UE_LOG >> ./test_simulator_results.html
-                    fi
-                    echo "        
" >> ./test_simulator_results.html - echo "
" >> ./test_simulator_results.html - fi - - if [ -e $JENKINS_WKSP/flexran/flexran_build_complete.txt ] - then - echo "

4G LTE Basic Simulator + FlexRan Controller Check

" >> ./test_simulator_results.html - echo "
" >> ./test_simulator_results.html - echo " TEST was SUCCESSFUL " >> ./test_simulator_results.html - echo "
" >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo "
" >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - - FLEXRAN_QUERIES=`ls $ARCHIVES_LOC/flexran_ctl_query_*log` - for QUERY in $FLEXRAN_QUERIES - do - echo " " >> ./test_simulator_results.html - NAME=`echo $QUERY | sed -e "s#$ARCHIVES_LOC/##"` - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - done - echo "
Log File NameJSON Query Response
$NAME
" >> ./test_simulator_results.html
-            egrep -v "LOG_NAME|\-\-\-\-\-" $QUERY >> ./test_simulator_results.html
-            echo "        
" >> ./test_simulator_results.html - echo "
" >> ./test_simulator_results.html - fi - ARCHIVES_LOC=archives/rf_sim/test if [ -d $ARCHIVES_LOC ] then diff --git a/ci-scripts/runTestOnVM.sh b/ci-scripts/runTestOnVM.sh index b5abb5ff45..25e11edc4f 100755 --- a/ci-scripts/runTestOnVM.sh +++ b/ci-scripts/runTestOnVM.sh @@ -36,137 +36,6 @@ function test_usage { command_options_usage } -function start_basic_sim_enb { - local LOC_VM_IP_ADDR=$2 - local LOC_EPC_IP_ADDR=$3 - local LOC_LOG_FILE=$4 - local LOC_NB_RBS=$5 - local LOC_CONF_FILE=$6 - local LOC_FLEXRAN_CTL_IP_ADRR=$7 - echo "cd /home/ubuntu/tmp" > $1 - echo "echo \"sudo apt-get --yes --quiet install daemon \"" >> $1 - echo "sudo apt-get --yes install daemon >> /home/ubuntu/tmp/cmake_targets/log/daemon-install.txt 2>&1" >> $1 - echo "echo \"export ENODEB=1\"" >> $1 - echo "export ENODEB=1" >> $1 - echo "echo \"source oaienv\"" >> $1 - echo "source oaienv" >> $1 - echo "cd ci-scripts/conf_files/" >> $1 - echo "cp $LOC_CONF_FILE ci-$LOC_CONF_FILE" >> $1 - echo "sed -i -e 's#N_RB_DL.*=.*;#N_RB_DL = $LOC_NB_RBS;#' -e 's#CI_MME_IP_ADDR#$LOC_EPC_IP_ADDR#' -e 's#CI_ENB_IP_ADDR#$LOC_VM_IP_ADDR#' ci-$LOC_CONF_FILE" >> $1 - if [[ $LOC_FLEXRAN_CTL_IP_ADRR =~ .*none.* ]] - then - echo "sed -i -e 's#CI_FLEXRAN_CTL_IP_ADDR#127.0.0.1#' ci-$LOC_CONF_FILE" >> $1 - else - echo "sed -i -e 's#FLEXRAN_ENABLED = .*no.*;#FLEXRAN_ENABLED = \"yes\";#' -e 's#CI_FLEXRAN_CTL_IP_ADDR#$LOC_FLEXRAN_CTL_IP_ADRR#' ci-$LOC_CONF_FILE" >> $1 - fi - echo "echo \"grep N_RB_DL ci-$LOC_CONF_FILE\"" >> $1 - echo "grep N_RB_DL ci-$LOC_CONF_FILE | sed -e 's#N_RB_DL.*=#N_RB_DL =#'" >> $1 - echo "echo \"cd /home/ubuntu/tmp/cmake_targets/ran_build/build/\"" >> $1 - echo "sudo chmod 777 /home/ubuntu/tmp/cmake_targets/ran_build/" >> $1 - echo "sudo chmod 777 /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1 - echo "cd /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1 - echo "echo \"ulimit -c unlimited && ./lte-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor,time --basicsim\" > ./my-lte-softmodem-run.sh " >> $1 - echo "chmod 775 ./my-lte-softmodem-run.sh" >> $1 - echo "cat ./my-lte-softmodem-run.sh" >> $1 - echo "if [ -e /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ]; then sudo sudo rm -f /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE; fi" >> $1 - echo "sudo -E daemon --inherit --unsafe --name=enb_daemon --chdir=/home/ubuntu/tmp/cmake_targets/ran_build/build -o /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ./my-lte-softmodem-run.sh" >> $1 - - ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1 - rm $1 - sleep 5 - - local i="0" - echo "egrep -c \"got sync\" /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE" > $1 - while [ $i -lt 10 ] - do - CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1` - if [ $CONNECTED -ne 0 ] - then - i="100" - else - sleep 5 - i=$[$i+1] - fi - done - ENB_SYNC=0 - echo "echo \"free -m\"" > $1 - echo "free -m" >> $1 - ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1 - rm $1 - if [ $i -lt 50 ] - then - ENB_SYNC=0 - echo "Basic-Sim eNB: eNB did NOT got sync" - else - echo "Basic-Sim eNB: eNB GOT SYNC --> waiting for UE to connect" - fi - sleep 5 -} - -function start_basic_sim_ue { - local LOC_UE_LOG_FILE=$3 - local LOC_NB_RBS=$4 - local LOC_FREQUENCY=$5 - echo "echo \"cd /home/ubuntu/tmp/cmake_targets/ran_build/build/\"" > $1 - echo "sudo chmod 777 /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1 - echo "cd /home/ubuntu/tmp/cmake_targets/ran_build/build" >> $1 - echo "echo \"./lte-uesoftmodem -C ${LOC_FREQUENCY}000000 -r $LOC_NB_RBS --log_config.global_log_options nocolor,line_num,level --basicsim\" > ./my-lte-uesoftmodem-run.sh" >> $1 - echo "chmod 775 ./my-lte-uesoftmodem-run.sh" >> $1 - echo "cat ./my-lte-uesoftmodem-run.sh" >> $1 - echo "if [ -e /home/ubuntu/tmp/cmake_targets/log/$LOC_UE_LOG_FILE ]; then sudo sudo rm -f /home/ubuntu/tmp/cmake_targets/log/$LOC_UE_LOG_FILE; fi" >> $1 - echo "sudo -E daemon --inherit --unsafe --name=ue_daemon --chdir=/home/ubuntu/tmp/cmake_targets/ran_build/build -o /home/ubuntu/tmp/cmake_targets/log/$LOC_UE_LOG_FILE ./my-lte-uesoftmodem-run.sh" >> $1 - - ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1 - rm $1 - - local i="0" - echo "ifconfig oaitun_ue1 | egrep -c \"inet addr\"" > $1 - while [ $i -lt 10 ] - do - sleep 5 - CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1` - if [ $CONNECTED -eq 1 ] - then - i="100" - else - i=$[$i+1] - fi - done - UE_SYNC=1 - rm $1 - if [ $i -lt 50 ] - then - UE_SYNC=0 - echo "Basic-Sim UE: oaitun_ue1 is DOWN and/or NOT CONFIGURED" - else - echo "Basic-Sim UE: oaitun_ue1 is UP and CONFIGURED" - fi - i="0" - echo "egrep -c \"Generating RRCConnectionReconfigurationComplete\" /home/ubuntu/tmp/cmake_targets/log/$LOC_UE_LOG_FILE" > $1 - while [ $i -lt 10 ] - do - CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1` - if [ $CONNECTED -ne 0 ] - then - i="100" - else - sleep 5 - i=$[$i+1] - fi - done - echo "echo \"free -m\"" > $1 - echo "free -m" >> $1 - ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1 - rm $1 - if [ $i -lt 50 ] - then - UE_SYNC=0 - echo "Basic-Sim UE: UE did NOT complete RRC Connection" - else - echo "Basic-Sim UE: UE did COMPLETE RRC Connection" - fi -} - function get_ue_ip_addr { local LOC_IF_ID=$3 echo "ifconfig oaitun_ue${LOC_IF_ID} | egrep \"inet addr\" | sed -e 's#^.*inet addr:##' -e 's# P-t-P:.*\$##'" > $1 @@ -417,7 +286,6 @@ function check_iperf { local LOC_REQ_BW_MINUS_TWO=`echo "$LOC_REQ_BW - 2" | bc -l` local LOC_REQ_BW_MINUS_THREE=`echo "$LOC_REQ_BW - 3" | bc -l` local LOC_IS_DL=`echo $LOC_BASE_LOG | grep -c _dl` - local LOC_IS_BASIC_SIM=`echo $LOC_BASE_LOG | grep -c basic_sim` local LOC_IS_RF_SIM=`echo $LOC_BASE_LOG | grep -c rf_sim` local LOC_IS_NR=`echo $LOC_BASE_LOG | grep -c _106prb` if [ -f ${LOC_BASE_LOG}_client.txt ] @@ -438,28 +306,17 @@ function check_iperf { local EFFECTIVE_BANDWIDTH=`tail -n3 ${LOC_BASE_LOG}_client.txt | egrep "Kbits/sec" | sed -e "s#^.*KBytes *##" -e "s#sec.*#sec#"` local BW_PREFIX="K" fi - if [ $LOC_IS_DL -eq 1 ] && [ $LOC_IS_BASIC_SIM -eq 1 ] + if [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW}.*${BW_PREFIX}bits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_ONE}.*${BW_PREFIX}bits.* ]] then - if [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW}.*${BW_PREFIX}bits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_ONE}.*${BW_PREFIX}bits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_TWO}.*${BW_PREFIX}bits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_THREE}.*${BW_PREFIX}bits.* ]] + if [ $LOC_IS_DL -eq 1 ] then echo "got requested DL bandwidth: $EFFECTIVE_BANDWIDTH" else - echo "got LESS than requested DL bandwidth: $EFFECTIVE_BANDWIDTH" - IPERF_STATUS=-1 + echo "got requested UL bandwidth: $EFFECTIVE_BANDWIDTH" fi else - if [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW}.*${BW_PREFIX}bits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_ONE}.*${BW_PREFIX}bits.* ]] - then - if [ $LOC_IS_DL -eq 1 ] - then - echo "got requested DL bandwidth: $EFFECTIVE_BANDWIDTH" - else - echo "got requested UL bandwidth: $EFFECTIVE_BANDWIDTH" - fi - else - echo "got LESS than requested DL bandwidth: $EFFECTIVE_BANDWIDTH" - IPERF_STATUS=-1 - fi + echo "got LESS than requested DL bandwidth: $EFFECTIVE_BANDWIDTH" + IPERF_STATUS=-1 fi fi else @@ -526,22 +383,6 @@ function full_terminate { sleep 10 } -function full_basic_sim_destroy { - if [ $KEEP_VM_ALIVE -eq 0 ] - then - echo "############################################################" - echo "Destroying VMs" - echo "############################################################" - uvt-kvm destroy $VM_NAME - ssh-keygen -R $VM_IP_ADDR - if [ -e $JENKINS_WKSP/flexran/flexran_build_complete.txt ] - then - uvt-kvm destroy $FLEXRAN_CTL_VM_NAME - ssh-keygen -R $FLEXRAN_CTL_VM_IP_ADDR - fi - fi -} - function install_epc_on_vm { local LOC_EPC_VM_NAME=$1 local LOC_EPC_VM_CMDS=$2 @@ -744,35 +585,6 @@ function terminate_epc { fi } -function start_flexran_ctrl { - echo "cd /home/ubuntu/tmp" > $1 - echo "if [ -f cmake_targets/log/flexran_ctl_run.log ]; then rm -f cmake_targets/log/flexran_ctl_run.log cmake_targets/log/flexran_ctl_query*.log; fi" >> $1 - echo "echo \" sudo build/rt_controller -c log_config/basic_log\"" >> $1 - echo "nohup sudo build/rt_controller -c log_config/basic_log > cmake_targets/log/flexran_ctl_run.log 2>&1 &" >> $1 - ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1 - rm $1 - sleep 10 -} - -function stop_flexran_ctrl { - echo "echo \"sudo killall --signal SIGKILL rt_controller\"" > $1 - echo "sudo killall --signal SIGKILL rt_controller" > $1 - ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1 - rm $1 - sleep 2 -} - -function query_flexran_ctrl_status { - local LOC_MESSAGE=$3 - echo "cd /home/ubuntu/tmp" > $1 - echo "echo \"------------------------------------------------------------\" > cmake_targets/log/flexran_ctl_query_${LOC_MESSAGE}.log" >> $1 - echo "echo \"LOG_NAME: $LOC_MESSAGE\" >> cmake_targets/log/flexran_ctl_query_${LOC_MESSAGE}.log" >> $1 - echo "echo \"------------------------------------------------------------\" >> cmake_targets/log/flexran_ctl_query_${LOC_MESSAGE}.log" >> $1 - echo "curl http://localhost:9999/stats | jq '.' | tee -a cmake_targets/log/flexran_ctl_query_${LOC_MESSAGE}.log" >> $1 - ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1 - rm $1 -} - function build_ue_on_separate_folder { echo "mkdir tmp-ue" > $1 echo "cd tmp-ue" >> $1 @@ -1667,234 +1479,6 @@ function run_test_on_vm { fi fi - if [[ "$RUN_OPTIONS" == "complex" ]] && [[ $VM_NAME =~ .*-basic-sim.* ]] - then - PING_STATUS=0 - IPERF_STATUS=0 - if [ -d $ARCHIVES_LOC ] - then - rm -Rf $ARCHIVES_LOC - fi - mkdir --parents $ARCHIVES_LOC - - # Creating a VM for EPC and installing SW - EPC_VM_NAME=`echo $VM_NAME | sed -e "s#basic-sim#epc#"` - EPC_VM_CMDS=${EPC_VM_NAME}_cmds.txt - LTEBOX=0 - if [[ "$EPC_IPADDR" == "" ]] - then - # Creating a VM for EPC and installing SW - install_epc_on_vm $EPC_VM_NAME $EPC_VM_CMDS - EPC_VM_IP_ADDR=`uvt-kvm ip $EPC_VM_NAME` - - # Starting EPC - start_epc $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR - else - echo "We will use EPC on $EPC_IPADDR" - EPC_VM_IP_ADDR=$EPC_IPADDR - fi - - # Retrieve EPC real IP address - retrieve_real_epc_ip_addr $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR - - TRANS_MODES=("fdd" "tdd") - BW_CASES=(05 10 20) - - for TMODE in ${TRANS_MODES[@]} - do - for BW in ${BW_CASES[@]} - do - # Not Running in TDD-20MHz : too unstable - if [[ $TMODE =~ .*tdd.* ]] && [[ $BW =~ .*20.* ]]; then continue; fi - - if [[ $BW =~ .*05.* ]]; then PRB=25; fi - if [[ $BW =~ .*10.* ]]; then PRB=50; fi - if [[ $BW =~ .*20.* ]]; then PRB=100; fi - if [[ $TMODE =~ .*fdd.* ]]; then FREQUENCY=2680; else FREQUENCY=2350; fi - - echo "############################################################" - echo "Starting the eNB in ${TMODE}-${BW}MHz mode" - echo "############################################################" - CURRENT_ENB_LOG_FILE=${TMODE}_${BW}MHz_enb.log - start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE $PRB lte-${TMODE}-basic-sim.conf none - - echo "############################################################" - echo "Starting the UE in ${TMODE}-${BW}MHz mode" - echo "############################################################" - CURRENT_UE_LOG_FILE=${TMODE}_${BW}MHz_ue.log - start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE $PRB $FREQUENCY - if [ $UE_SYNC -eq 0 ] - then - echo "Problem w/ eNB and UE not syncing" - full_terminate - STATUS=-1 - continue - fi - get_ue_ip_addr $VM_CMDS $VM_IP_ADDR 1 - - echo "############################################################" - echo "Pinging the UE" - echo "############################################################" - PING_LOG_FILE=${TMODE}_${BW}MHz_ping_ue.txt - ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE 0 - scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC - check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20 - - # Not more testing in any TDD : too unstable - if [[ $TMODE =~ .*tdd.* ]] && [[ $BW =~ .*05.* ]]; then full_terminate; continue; fi - if [[ $TMODE =~ .*tdd.* ]] && [[ $BW =~ .*10.* ]]; then full_terminate; continue; fi - if [[ $TMODE =~ .*tdd.* ]] && [[ $BW =~ .*20.* ]]; then full_terminate; continue; fi - echo "############################################################" - echo "Iperf DL" - echo "############################################################" - if [[ $TMODE =~ .*fdd.* ]] - then - if [[ $BW =~ .*20.* ]]; then THROUGHPUT=12; else THROUGHPUT=10; fi - else - THROUGHPUT=6 - fi - CURR_IPERF_LOG_BASE=${TMODE}_${BW}MHz_iperf_dl - generic_iperf $VM_CMDS $VM_IP_ADDR $UE_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR $REAL_EPC_IP_ADDR $THROUGHPUT $CURR_IPERF_LOG_BASE 0 0 - scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC - scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC - check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE $THROUGHPUT - - # Not more testing in FDD-20MHz : too unstable - if [[ $TMODE =~ .*fdd.* ]] && [[ $BW =~ .*20.* ]]; then full_terminate; continue; fi - echo "############################################################" - echo "Iperf UL" - echo "############################################################" - THROUGHPUT=2 - CURR_IPERF_LOG_BASE=${TMODE}_${BW}MHz_iperf_ul - generic_iperf $EPC_VM_CMDS $EPC_VM_IP_ADDR $REAL_EPC_IP_ADDR $VM_CMDS $VM_IP_ADDR $UE_IP_ADDR $THROUGHPUT $CURR_IPERF_LOG_BASE 0 0 - scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC - scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC - check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE $THROUGHPUT - - full_terminate - - done - done - - if [ -d $JENKINS_WKSP/flexran ] - then - echo "############################################################" - echo "Flexran testing is possible" - echo "############################################################" - local j="0" - while [ $j -lt 20 ] - do - if [ -e $JENKINS_WKSP/flexran/flexran_build_complete.txt ] - then - echo "Found an proper flexran controller vm build" - j="100" - else - j=$[$j+1] - sleep 30 - fi - done - if [ $j -lt 50 ] - then - echo "ERROR: compiling flexran controller on vm went wrong" - terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR - echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log - STATUS=-1 - return - fi - FLEXRAN_CTL_VM_NAME=`echo $VM_NAME | sed -e "s#basic-sim#flexran-rtc#"` - FLEXRAN_CTL_VM_CMDS=`echo $VM_CMDS | sed -e "s#cmds#flexran-rtc-cmds#"` - IS_FLEXRAN_VM_ALIVE=`uvt-kvm list | grep -c $FLEXRAN_CTL_VM_NAME` - if [ $IS_FLEXRAN_VM_ALIVE -eq 0 ] - then - echo "ERROR: Flexran Ctl VM is not alive" - terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR - full_basic_sim_destroy - echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log - STATUS=-1 - return - fi - uvt-kvm wait $FLEXRAN_CTL_VM_NAME --insecure - FLEXRAN_CTL_VM_IP_ADDR=`uvt-kvm ip $FLEXRAN_CTL_VM_NAME` - - echo "$FLEXRAN_CTL_VM_NAME has for IP addr = $FLEXRAN_CTL_VM_IP_ADDR" - echo "FLEXRAN_CTL_VM_CMDS = $FLEXRAN_CTL_VM_CMDS" - echo "############################################################" - echo "Starting the FLEXRAN CONTROLLER" - echo "############################################################" - start_flexran_ctrl $FLEXRAN_CTL_VM_CMDS $FLEXRAN_CTL_VM_IP_ADDR - query_flexran_ctrl_status $FLEXRAN_CTL_VM_CMDS $FLEXRAN_CTL_VM_IP_ADDR 01_no_enb_connected - - echo "############################################################" - echo "Starting the eNB in FDD-5MHz mode with Flexran ON" - echo "############################################################" - CURRENT_ENB_LOG_FILE=fdd_05fMHz_enb.log - start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 25 lte-fdd-basic-sim.conf $FLEXRAN_CTL_VM_IP_ADDR - query_flexran_ctrl_status $FLEXRAN_CTL_VM_CMDS $FLEXRAN_CTL_VM_IP_ADDR 02_enb_connected - - echo "############################################################" - echo "Starting the UE in FDD-5MHz mode" - echo "############################################################" - CURRENT_UE_LOG_FILE=fdd_05fMHz_ue.log - start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE 25 2680 - if [ $UE_SYNC -eq 0 ] - then - echo "Problem w/ eNB and UE not syncing" - terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR 0 - scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC - scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC - recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC - terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR - stop_flexran_ctrl $FLEXRAN_CTL_VM_CMDS $FLEXRAN_CTL_VM_IP_ADDR - echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log - STATUS=-1 - return - fi - query_flexran_ctrl_status $FLEXRAN_CTL_VM_CMDS $FLEXRAN_CTL_VM_IP_ADDR 03_enb_ue_connected - get_ue_ip_addr $VM_CMDS $VM_IP_ADDR 1 - - sleep 30 - echo "############################################################" - echo "Terminate enb/ue simulators" - echo "############################################################" - terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR 0 - scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC - scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC - recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC - sleep 10 - - echo "############################################################" - echo "Stopping the FLEXRAN CONTROLLER" - echo "############################################################" - stop_flexran_ctrl $FLEXRAN_CTL_VM_CMDS $FLEXRAN_CTL_VM_IP_ADDR - scp -o StrictHostKeyChecking=no ubuntu@$FLEXRAN_CTL_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/flexran_ctl_*.log $ARCHIVES_LOC - fi - - echo "############################################################" - echo "Terminate EPC" - echo "############################################################" - - if [[ "$EPC_IPADDR" == "" ]] - then - terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR - fi - - full_basic_sim_destroy - - echo "############################################################" - echo "Checking run status" - echo "############################################################" - - if [ $PING_STATUS -ne 0 ]; then STATUS=-1; fi - if [ $IPERF_STATUS -ne 0 ]; then STATUS=-1; fi - - if [ $STATUS -eq 0 ] - then - echo "TEST_OK" > $ARCHIVES_LOC/test_final_status.log - else - echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log - fi - fi - if [[ "$RUN_OPTIONS" == "complex" ]] && [[ $VM_NAME =~ .*-rf-sim.* ]] then PING_STATUS=0 diff --git a/ci-scripts/waitBuildOnVM.sh b/ci-scripts/waitBuildOnVM.sh index 4a604a1fe9..946c0866e2 100755 --- a/ci-scripts/waitBuildOnVM.sh +++ b/ci-scripts/waitBuildOnVM.sh @@ -174,13 +174,13 @@ function check_on_vm_build { fi # If we were building the FlexRan Controller, flag-touch for basic-simulator to continue - if [[ "$VM_NAME" == *"-flexran-rtc"* ]] - then - if [[ $STATUS -eq 0 ]] - then - touch $JENKINS_WKSP/flexran/flexran_build_complete.txt - fi - fi + #if [[ "$VM_NAME" == *"-flexran-rtc"* ]] + #then + # if [[ $STATUS -eq 0 ]] + # then + # touch $JENKINS_WKSP/flexran/flexran_build_complete.txt + # fi + #fi if [[ "$VM_NAME" == *"-cppcheck"* ]] then diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 7975d4bc77..46e33e8803 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -755,27 +755,6 @@ add_library(oai_irisdevif MODULE ${HWLIB_IRIS_SOURCE}) target_include_directories(oai_irisdevif PRIVATE /usr/local/lib/SoapySDR/modules0.7/) target_link_libraries(oai_irisdevif SoapySDR) -# TCP bridge libraries -###################################################################### - -# this one is for internal use at Eurecom and is not documented -set(HWLIB_TCP_BRIDGE_SOURCE - ${OPENAIR_TARGETS}/ARCH/tcp_bridge/tcp_bridge.c - ) -add_library(tcp_bridge MODULE ${HWLIB_TCP_BRIDGE_SOURCE} ) - -#get_target_property(tcp_bridge_cflags tcp_bridge COMPILE_FLAGS) -#set_target_properties(tcp_bridge PROPERTIES COMPILE_FLAGS "${tcp_bridge_cflags} -fvisibility=hidden") -set_target_properties(tcp_bridge PROPERTIES COMPILE_FLAGS "-fvisibility=hidden") - -# this one is to connect OAI eNB and OAI UE in the basic simulator -# see targets/ARCH/tcp_bridge/README.tcp_bridge_oai for usage -set(HWLIB_TCP_BRIDGE_OAI_SOURCE - ${OPENAIR_TARGETS}/ARCH/tcp_bridge/tcp_bridge_oai.c - ) -add_library(tcp_bridge_oai MODULE ${HWLIB_TCP_BRIDGE_OAI_SOURCE} ) -set_target_properties(tcp_bridge_oai PROPERTIES COMPILE_FLAGS "-fvisibility=hidden") - # Benetel 4G library ###################################################################### @@ -3008,8 +2987,7 @@ if (${T_TRACER}) #all "add_library" definitions ITTI RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP params_libconfig oai_exmimodevif oai_usrpdevif oai_bladerfdevif oai_lmssdrdevif oai_iqplayer - oai_eth_transpro oai_mobipass tcp_bridge tcp_bridge_oai - coding FLPT_MSG FLEXRAN_AGENT HASHTABLE UTIL OMG_SUMO + oai_eth_transpro oai_mobipass coding FLPT_MSG FLEXRAN_AGENT HASHTABLE UTIL OMG_SUMO SECU_OSA SECU_CN SCHED_LIB SCHED_NR_LIB SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB default_sched remote_sched RAL NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_VNF_LIB NFAPI_USER_LIB PHY_COMMON PHY PHY_UE PHY_NR PHY_NR_COMMON PHY_NR_UE PHY_RU PHY_MEX diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 930f2a7f77..c65728a41d 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -894,11 +894,6 @@ function main() { compilations \ $BUILD_DIR rfsimulator \ librfsimulator.so $dbin/librfsimulator.so.$REL - - echo_info "Compiling tcp_bridge_oai" - compilations \ - $BUILD_DIR tcp_bridge_oai \ - libtcp_bridge_oai.so $dbin/libtcp_bridge_oai.so.$REL fi #build transport protocol libraries (currently only ETHERNET is available) diff --git a/common/utils/T/T.c b/common/utils/T/T.c index 49742bf600..2d724ffd00 100644 --- a/common/utils/T/T.c +++ b/common/utils/T/T.c @@ -33,12 +33,6 @@ volatile int _T_freelist_head; volatile int *T_freelist_head = &_T_freelist_head; T_cache_t *T_cache; -#if BASIC_SIMULATOR - /* global variables used by T_GET_SLOT, see in T.h */ - volatile uint64_t T_next_id; - volatile uint64_t T_active_id; -#endif - static void get_message(int s) { char t; int l; diff --git a/common/utils/T/T.h b/common/utils/T/T.h index 0142945054..df1e95d2df 100644 --- a/common/utils/T/T.h +++ b/common/utils/T/T.h @@ -111,39 +111,8 @@ typedef struct { extern volatile int *T_freelist_head; extern T_cache_t *T_cache; extern int *T_active; -/* When running the basic simulator, we may fill the T cache too fast. - * Let's serialize write accesses to the T cache. For that, we use a - * 'ticket' mechanism. To acquire a T slot the caller needs to own the - * current active ticket. We also wait for the slot to be free if - * it is already in use. - */ -#if BASIC_SIMULATOR -# define T_GET_SLOT \ - do { \ - extern volatile uint64_t T_next_id; \ - extern volatile uint64_t T_active_id; \ - uint64_t id; \ - /* get a ticket */ \ - id = __sync_fetch_and_add(&T_next_id, 1); \ - /* wait for our turn */ \ - while (id != __sync_fetch_and_add(&T_active_id, 0)) /* busy wait */; \ - /* this is our turn, try to acquire the slot until it's free */ \ - do { \ - T_LOCAL_busy = __sync_fetch_and_or(&T_cache[T_LOCAL_slot].busy, 0x01); \ - if (T_LOCAL_busy & 0x01) usleep(100); \ - } while (T_LOCAL_busy & 0x01); \ - /* check that there are still some tickets */ \ - if (__sync_fetch_and_add(&T_active_id, 0) == 0xffffffffffffffff) { \ - printf("T: reached the end of times, bye...\n"); \ - abort(); \ - } \ - /* free our ticket, which signals the next waiter that it's its turn */ \ - (void)__sync_fetch_and_add(&T_active_id, 1); \ - } while (0) -#else -# define T_GET_SLOT \ +#define T_GET_SLOT \ T_LOCAL_busy = __sync_fetch_and_or(&T_cache[T_LOCAL_slot].busy, 0x01); -#endif /* used at header of Tn, allocates buffer */ #define T_LOCAL_DATA \ diff --git a/common/utils/T/T_defs.h b/common/utils/T/T_defs.h index b74c0567ce..00e0df4963 100644 --- a/common/utils/T/T_defs.h +++ b/common/utils/T/T_defs.h @@ -40,20 +40,10 @@ #define T_MAX_ARGS 16 /* maximum size of a message - increase if needed */ -#if BASIC_SIMULATOR - /* let's have 100 RBs functional for the basic simulator */ -# define T_BUFFER_MAX (1024*64*4) -#else -# define T_BUFFER_MAX (1024*64*4) -#endif +#define T_BUFFER_MAX (1024*64*4) /* size of the local cache for messages (must be pow(2,something)) */ -#if BASIC_SIMULATOR - /* we don't need much space for the basic simulator */ -# define T_CACHE_SIZE 1024 -#else -# define T_CACHE_SIZE (8192) -#endif +#define T_CACHE_SIZE (8192) /* maximum number of bytes a message can contain */ #ifdef T_SEND_TIME diff --git a/common/utils/T/local_tracer.c b/common/utils/T/local_tracer.c index 539e72b223..b4f1804c41 100644 --- a/common/utils/T/local_tracer.c +++ b/common/utils/T/local_tracer.c @@ -357,22 +357,6 @@ static void forward(void *_forwarder, char *buf, int size) { if (f->tail != NULL) f->tail->next = new; f->tail = new; -#if BASIC_SIMULATOR - /* When runnng the basic simulator, the tracer may be too slow. - * Let's not take too much memory in the tracee and - * wait if there is too much data to send. 200MB is - * arbitrary. - */ - while (f->memusage > 200 * 1024 * 1024) { - if (pthread_cond_signal(&f->cond)) abort(); - - if (pthread_mutex_unlock(&f->lock)) abort(); - - usleep(1000); - - if (pthread_mutex_lock(&f->lock)) abort(); - } -#endif f->memusage += size+4; /* warn every 100MB */ diff --git a/doc/BASIC_SIM.md b/doc/BASIC_SIM.md deleted file mode 100644 index 1bfc6e76d2..0000000000 --- a/doc/BASIC_SIM.md +++ /dev/null @@ -1,191 +0,0 @@ - - - - - -
- - - - - - Running OAI Basic Simulator -
- -This page is valid on the following branches: - -- `master` starting from tag `v1.1.0` -- `develop` starting from tag `2019.w11` - -# 1. Building the basic-simulator. - -After the build simplification, the basic simulator is available directly from the standard build. - -```bash -$ source oaienv -$ cd cmake_targets -$ ./build_oai --eNB --UE -``` - -Both eNB (lte-softmodem) and UE (lte-uesoftmodem) are present on `cmake_targets/ran_build/build` folder. - -More details are available on the [build page](BUILD.md). - -# 2. Running the basic simulator. - -The basic simulator is a oai device replacing the radio heads (for example the USRP device). It allows connecting the oai UE and the oai eNodeB through a network interface carrying the time-domain samples, getting rid of over the air unpredictable perturbations. - -This is the ideal tool to check signal processing algorithms and protocols implementation and having debug sessions without any HW radio equipment. - -The main limitations are: - -- A single OAI UE will connect to the OAI eNB -- No channel noise - -## 2.1. Starting eNB - -The basic simulator is able to run with a connected EPC or without any (the so-called "noS1" mode). - -Example 1: running in FDD mode with EPC. - -```bash -$ source oaienv -$ cd cmake_targets/ran_build/build -$ ENODEB=1 sudo -E ./lte-softmodem -O $OPENAIR_HOME/ci-scripts/conf_files/lte-fdd-basic-sim.conf --basicsim -``` - -Edit previously the `ci-scripts/conf_files/lte-fdd-basic-sim.conf` file to modify: - -- `N_RB_DL` field to change the Bandwidth (25, 50, 100) -- `CI_MME_IP_ADDR` with the EPC IP address -- `CI_ENB_IP_ADDR` with the container (physical server, virtual machine, ...) on which you are executing the eNB soft-modem - -Example 2: running in TDD mode without any EPC. - -```bash -$ source oaienv -$ cd cmake_targets/ran_build/build -$ ENODEB=1 sudo -E ./lte-softmodem -O $OPENAIR_HOME/ci-scripts/conf_files/lte-tdd-basic-sim.conf --basicsim --noS1 -``` - -## 2.2. Starting UE - -Before starting the UE, you may need to edit the SIM parameters to adapt to your eNB configuration and HSS database. - -The file to use for conf2uedate is `openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf` - -You need to set the correct OPC, USIM_API_K, MSIN (this is the end par of the IMSI), HPLMN (the front part of IMSI) to match values from HSS. - -```bash -$ source oaienv -# Edit openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf -$ cd cmake_targets/ran_build/build -$ ../../nas_sim_tools/build/conf2uedata -c $OPENAIR_HOME/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf -o . -$ sudo -E ./lte-uesoftmodem -C 2625000000 -r 25 --ue-rxgain 140 --basicsim [--noS1] -``` - -The `-r 25` is to use if in the conf file of the eNB you use N_RB_DL=25. Use 50 if you have N_RB_DL=50 and 100 if you have N_RB_DL=100. - -The `-C 2625000000` is the downlink frequency. Use the same value as `downlink_frequency` in the eNB configuration file. - -The `--noS1` is mandatory if you started the eNB in that mode. - -# 3. Testing the data plane - -# 3.1. In S1 mode - -First we need to retrieve the IP address allocated to the OAI UE. - -On the server that runs the UE: - -```bash -$ ifconfig oaitun_ue1 -oaitun_ue1 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 - inet addr:192.172.0.2 P-t-P:192.172.0.2 Mask:255.255.255.0 -... -``` - -`192.172.0.2` is the IP address that has been allocated by the SPGW in the EPC. - -On the server that runs the EPC: - -```bash -$ ping -c 20 192.172.0.2 - --- 192.172.0.2 ping statistics --- - 20 packets transmitted, 20 received, 0% packet loss, time 19020ms - rtt min/avg/max/mdev = 13.241/18.999/24.208/2.840 ms -``` - -You can ping the EPC from the UE: - -```bash -$ ping -I oaitun_ue1 -c 20 192.172.0.1 - --- 192.172.0.1 ping statistics --- -... - 20 packets transmitted, 20 received, 0% packet loss, time 19019ms - rtt min/avg/max/mdev = 13.015/18.674/23.738/2.917 ms -``` - -For DL iperf testing: - -On the server that runs the UE. - -```bash -$ iperf -B 192.172.0.2 -u -s -i 1 -fm -p 5001 -``` - -On the server that runs the EPC. - -```bash -$ iperf -c 192.172.0.2 -u -t 30 -b 10M -i 1 -fm -B 192.172.0.1 -p 5001 -``` - -For UL iperf testing: - -On the server that runs the EPC. - -```bash -$ iperf -B 192.172.0.1 -u -s -i 1 -fm -p 5001 -``` - -On the server that runs the UE. - -```bash -$ iperf -c 192.172.0.1 -u -t 30 -b 2M -i 1 -fm -B 192.172.0.2 -p 5001 -``` - -# 3.2. In noS1 mode - -The IP addresses are fixed. But we can still retrieve them programmatically. - -For the UE it is quite the same: - -```bash -$ ifconfig oaitun_ue1 -oaitun_ue1 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 - inet addr:10.0.1.2 P-t-P:10.0.1.2 Mask:255.255.255.0 -... -``` - -For the eNB: - -```bash -$ ifconfig oaitun_enb1 -oaitun_enb1 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 - inet addr:10.0.1.1 P-t-P:10.0.1.1 Mask:255.255.255.0 -... -``` - -Pinging like this: - -```bash -$ ping -I oaitun_ue1 -c 20 10.0.1.1 -$ ping -I oaitun_enb1 -c 20 10.0.1.2 -``` - -And the same for iperf: - -```bash -$ iperf -B 10.0.1.2 -u -s -i 1 -fm -$ iperf -c 10.0.1.2 -u -b 1.00M -t 30 -i 1 -fm -B 10.0.1.1 -``` diff --git a/doc/RUNMODEM.md b/doc/RUNMODEM.md index 7ee3ae9d7e..919bbc2dc0 100644 --- a/doc/RUNMODEM.md +++ b/doc/RUNMODEM.md @@ -14,10 +14,6 @@ After you have [built the softmodem executables](BUILD.md) you can set your default directory to the build directory `cmake_targets/ran_build/build/` and start testing some use cases. Below, the description of the different oai functionalities should help you choose the oai configuration that suits your need. -# Basic Simulator - -See the [dedicated page](BASIC_SIM.md). - # RF Simulator The rf simulator is a oai device replacing the radio heads (for example the USRP device). It allows connecting the oai UE (LTE or 5G) and respectively the oai eNodeB or gNodeB through a network interface carrying the time-domain samples, getting rid of over the air unpredictable perturbations. This is the ideal tool to check signal processing algorithms and protocols implementation. The rf simulator has some preliminary support for channel modeling. diff --git a/docker/Dockerfile.eNB.rhel8.2 b/docker/Dockerfile.eNB.rhel8.2 index 6c921a4932..7924f5bd78 100644 --- a/docker/Dockerfile.eNB.rhel8.2 +++ b/docker/Dockerfile.eNB.rhel8.2 @@ -62,7 +62,6 @@ COPY --from=enb-build \ COPY --from=enb-build \ /oai-ran/cmake_targets/ran_build/build/liboai_eth_transpro.so \ - /oai-ran/cmake_targets/ran_build/build/libtcp_bridge_oai.so \ /oai-ran/cmake_targets/ran_build/build/librfsimulator.so \ /oai-ran/cmake_targets/ran_build/build/liboai_usrpdevif.so \ /oai-ran/cmake_targets/ran_build/build/libcoding.so \ diff --git a/docker/Dockerfile.eNB.rhel8.2.oc4-4 b/docker/Dockerfile.eNB.rhel8.2.oc4-4 index 5b784c08a2..03f6ec8e45 100644 --- a/docker/Dockerfile.eNB.rhel8.2.oc4-4 +++ b/docker/Dockerfile.eNB.rhel8.2.oc4-4 @@ -62,7 +62,6 @@ COPY --from=enb-build /oai-ran/targets/bin/lte-softmodem.Rel15 . WORKDIR /usr/local/lib/ COPY --from=enb-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 . -COPY --from=enb-build /oai-ran/targets/bin/libtcp_bridge_oai.so.Rel15 . COPY --from=enb-build /oai-ran/targets/bin/librfsimulator.so.Rel15 . COPY --from=enb-build /oai-ran/targets/bin/liboai_usrpdevif.so.Rel15 . COPY --from=enb-build /oai-ran/targets/bin/libcoding.so . @@ -95,7 +94,6 @@ RUN ldconfig #debug RUN ldd /usr/local/lib/liboai_eth_transpro.so.Rel15 -RUN ldd /usr/local/lib/libtcp_bridge_oai.so.Rel15 RUN ldd /usr/local/lib/librfsimulator.so.Rel15 RUN ldd /usr/local/lib/liboai_usrpdevif.so.Rel15 RUN ldd /usr/local/lib/libcoding.so diff --git a/docker/Dockerfile.eNB.ubuntu18 b/docker/Dockerfile.eNB.ubuntu18 index 1f375a20dc..222a7f42bb 100644 --- a/docker/Dockerfile.eNB.ubuntu18 +++ b/docker/Dockerfile.eNB.ubuntu18 @@ -69,7 +69,6 @@ COPY --from=enb-build \ COPY --from=enb-build \ /oai-ran/cmake_targets/ran_build/build/liboai_eth_transpro.so \ - /oai-ran/cmake_targets/ran_build/build/libtcp_bridge_oai.so \ /oai-ran/cmake_targets/ran_build/build/librfsimulator.so \ /oai-ran/cmake_targets/ran_build/build/liboai_usrpdevif.so \ /oai-ran/cmake_targets/ran_build/build/libcoding.so \ diff --git a/docker/Dockerfile.gNB.rhel8.2 b/docker/Dockerfile.gNB.rhel8.2 index 703f4c67b5..6a1b447a62 100644 --- a/docker/Dockerfile.gNB.rhel8.2 +++ b/docker/Dockerfile.gNB.rhel8.2 @@ -64,7 +64,6 @@ COPY --from=gnb-build \ COPY --from=gnb-build \ /oai-ran/cmake_targets/ran_build/build/liboai_eth_transpro.so \ - /oai-ran/cmake_targets/ran_build/build/libtcp_bridge_oai.so \ /oai-ran/cmake_targets/ran_build/build/librfsimulator.so \ /oai-ran/cmake_targets/ran_build/build/liboai_usrpdevif.so \ /oai-ran/cmake_targets/ran_build/build/libcoding.so \ diff --git a/docker/Dockerfile.gNB.rhel8.2.oc4-4 b/docker/Dockerfile.gNB.rhel8.2.oc4-4 index 1e1eba016e..6c88d3ad8e 100644 --- a/docker/Dockerfile.gNB.rhel8.2.oc4-4 +++ b/docker/Dockerfile.gNB.rhel8.2.oc4-4 @@ -65,7 +65,6 @@ COPY --from=gnb-build /oai-ran/targets/bin/nr-softmodem.Rel15 . WORKDIR /usr/local/lib/ COPY --from=gnb-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 . -COPY --from=gnb-build /oai-ran/targets/bin/libtcp_bridge_oai.so.Rel15 . COPY --from=gnb-build /oai-ran/targets/bin/librfsimulator.so.Rel15 . COPY --from=gnb-build /oai-ran/targets/bin/liboai_usrpdevif.so.Rel15 . COPY --from=gnb-build /oai-ran/targets/bin/libcoding.so . @@ -102,7 +101,6 @@ RUN ldconfig #debug RUN ldd /opt/oai-gnb/bin/nr-softmodem.Rel15 RUN ldd /usr/local/lib/liboai_eth_transpro.so.Rel15 -RUN ldd /usr/local/lib/libtcp_bridge_oai.so.Rel15 RUN ldd /usr/local/lib/librfsimulator.so.Rel15 RUN ldd /usr/local/lib/liboai_usrpdevif.so.Rel15 RUN ldd /usr/local/lib/libcoding.so diff --git a/docker/Dockerfile.gNB.ubuntu18 b/docker/Dockerfile.gNB.ubuntu18 index 24e4bcbc7c..6f990db833 100644 --- a/docker/Dockerfile.gNB.ubuntu18 +++ b/docker/Dockerfile.gNB.ubuntu18 @@ -68,7 +68,6 @@ COPY --from=gnb-build \ COPY --from=gnb-build \ /oai-ran/cmake_targets/ran_build/build/liboai_eth_transpro.so \ - /oai-ran/cmake_targets/ran_build/build/libtcp_bridge_oai.so \ /oai-ran/cmake_targets/ran_build/build/librfsimulator.so \ /oai-ran/cmake_targets/ran_build/build/liboai_usrpdevif.so \ /oai-ran/cmake_targets/ran_build/build/libcoding.so \ diff --git a/docker/Dockerfile.lteRU.rhel8.2 b/docker/Dockerfile.lteRU.rhel8.2 index 5addbca655..b41aee36dc 100644 --- a/docker/Dockerfile.lteRU.rhel8.2 +++ b/docker/Dockerfile.lteRU.rhel8.2 @@ -59,7 +59,6 @@ COPY --from=ru-build \ COPY --from=ru-build \ /oai-ran/cmake_targets/ran_build/build/liboai_eth_transpro.so \ - /oai-ran/cmake_targets/ran_build/build/libtcp_bridge_oai.so \ /oai-ran/cmake_targets/ran_build/build/librfsimulator.so \ /oai-ran/cmake_targets/ran_build/build/liboai_usrpdevif.so \ /oai-ran/cmake_targets/ran_build/build/libparams_libconfig.so \ diff --git a/docker/Dockerfile.lteRU.ubuntu18 b/docker/Dockerfile.lteRU.ubuntu18 index 1f1c903a15..1810afb621 100644 --- a/docker/Dockerfile.lteRU.ubuntu18 +++ b/docker/Dockerfile.lteRU.ubuntu18 @@ -64,7 +64,6 @@ COPY --from=ru-build \ COPY --from=ru-build \ /oai-ran/cmake_targets/ran_build/build/liboai_eth_transpro.so \ - /oai-ran/cmake_targets/ran_build/build/libtcp_bridge_oai.so \ /oai-ran/cmake_targets/ran_build/build/librfsimulator.so \ /oai-ran/cmake_targets/ran_build/build/liboai_usrpdevif.so \ /oai-ran/cmake_targets/ran_build/build/libparams_libconfig.so \ diff --git a/docker/Dockerfile.lteUE.rhel8.2 b/docker/Dockerfile.lteUE.rhel8.2 index f547558bdb..cc1be3d41d 100644 --- a/docker/Dockerfile.lteUE.rhel8.2 +++ b/docker/Dockerfile.lteUE.rhel8.2 @@ -66,7 +66,6 @@ COPY --from=lte-ue-build \ COPY --from=lte-ue-build \ /oai-ran/cmake_targets/ran_build/build/liboai_eth_transpro.so \ - /oai-ran/cmake_targets/ran_build/build/libtcp_bridge_oai.so \ /oai-ran/cmake_targets/ran_build/build/librfsimulator.so \ /oai-ran/cmake_targets/ran_build/build/liboai_usrpdevif.so \ /oai-ran/cmake_targets/ran_build/build/libcoding.so \ diff --git a/docker/Dockerfile.lteUE.rhel8.2.oc4-4 b/docker/Dockerfile.lteUE.rhel8.2.oc4-4 index 1339d18de6..cc492882f5 100644 --- a/docker/Dockerfile.lteUE.rhel8.2.oc4-4 +++ b/docker/Dockerfile.lteUE.rhel8.2.oc4-4 @@ -68,7 +68,6 @@ COPY --from=lte-ue-build /oai-ran/targets/bin/.usim.nvram0 . WORKDIR /usr/local/lib/ COPY --from=lte-ue-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 . -COPY --from=lte-ue-build /oai-ran/targets/bin/libtcp_bridge_oai.so.Rel15 . COPY --from=lte-ue-build /oai-ran/targets/bin/librfsimulator.so.Rel15 . COPY --from=lte-ue-build /oai-ran/targets/bin/liboai_usrpdevif.so.Rel15 . COPY --from=lte-ue-build /oai-ran/targets/bin/libcoding.so . @@ -105,7 +104,6 @@ RUN ldd /opt/oai-lte-ue/bin/conf2uedata RUN ldd /opt/oai-lte-ue/bin/nvram RUN ldd /opt/oai-lte-ue/bin/usim RUN ldd /usr/local/lib/liboai_eth_transpro.so.Rel15 -RUN ldd /usr/local/lib/libtcp_bridge_oai.so.Rel15 RUN ldd /usr/local/lib/librfsimulator.so.Rel15 RUN ldd /usr/local/lib/liboai_usrpdevif.so.Rel15 RUN ldd /usr/local/lib/libcoding.so diff --git a/docker/Dockerfile.lteUE.ubuntu18 b/docker/Dockerfile.lteUE.ubuntu18 index a5bf4cfe94..292ac37e5f 100644 --- a/docker/Dockerfile.lteUE.ubuntu18 +++ b/docker/Dockerfile.lteUE.ubuntu18 @@ -73,7 +73,6 @@ COPY --from=lte-ue-build \ COPY --from=lte-ue-build \ /oai-ran/cmake_targets/ran_build/build/liboai_eth_transpro.so \ - /oai-ran/cmake_targets/ran_build/build/libtcp_bridge_oai.so \ /oai-ran/cmake_targets/ran_build/build/librfsimulator.so \ /oai-ran/cmake_targets/ran_build/build/liboai_usrpdevif.so \ /oai-ran/cmake_targets/ran_build/build/libcoding.so \ diff --git a/docker/Dockerfile.nrUE.rhel8.2 b/docker/Dockerfile.nrUE.rhel8.2 index cbc8d8c65f..d38e81bd71 100644 --- a/docker/Dockerfile.nrUE.rhel8.2 +++ b/docker/Dockerfile.nrUE.rhel8.2 @@ -66,7 +66,6 @@ COPY --from=nr-ue-build /oai-ran/ci-scripts/conf_files/nr-ue-sim.conf . COPY --from=nr-ue-build \ /oai-ran/cmake_targets/ran_build/build/liboai_eth_transpro.so \ - /oai-ran/cmake_targets/ran_build/build/libtcp_bridge_oai.so \ /oai-ran/cmake_targets/ran_build/build/librfsimulator.so \ /oai-ran/cmake_targets/ran_build/build/liboai_usrpdevif.so \ /oai-ran/cmake_targets/ran_build/build/libcoding.so \ diff --git a/docker/Dockerfile.nrUE.rhel8.2.oc4-4 b/docker/Dockerfile.nrUE.rhel8.2.oc4-4 index d900fff998..2d018c96af 100644 --- a/docker/Dockerfile.nrUE.rhel8.2.oc4-4 +++ b/docker/Dockerfile.nrUE.rhel8.2.oc4-4 @@ -64,7 +64,6 @@ COPY --from=nr-ue-build /oai-ran/targets/bin/nr-uesoftmodem.Rel15 . WORKDIR /usr/local/lib/ COPY --from=nr-ue-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 . -COPY --from=nr-ue-build /oai-ran/targets/bin/libtcp_bridge_oai.so.Rel15 . COPY --from=nr-ue-build /oai-ran/targets/bin/librfsimulator.so.Rel15 . COPY --from=nr-ue-build /oai-ran/targets/bin/liboai_usrpdevif.so.Rel15 . COPY --from=nr-ue-build /oai-ran/targets/bin/libcoding.so . @@ -100,7 +99,6 @@ COPY --from=nr-ue-build /usr/local/lib64/libuhd.so.4.0.0 /usr/local/lib64 RUN ldconfig RUN ldd /opt/oai-nr-ue/bin/nr-uesoftmodem.Rel15 RUN ldd /usr/local/lib/liboai_eth_transpro.so.Rel15 -RUN ldd /usr/local/lib/libtcp_bridge_oai.so.Rel15 RUN ldd /usr/local/lib/librfsimulator.so.Rel15 RUN ldd /usr/local/lib/liboai_usrpdevif.so.Rel15 RUN ldd /usr/local/lib/libcoding.so diff --git a/docker/Dockerfile.nrUE.ubuntu18 b/docker/Dockerfile.nrUE.ubuntu18 index 126f268e00..0fa219296b 100644 --- a/docker/Dockerfile.nrUE.ubuntu18 +++ b/docker/Dockerfile.nrUE.ubuntu18 @@ -71,7 +71,6 @@ COPY --from=nr-ue-build /oai-ran/ci-scripts/conf_files/nr-ue-sim.conf . COPY --from=nr-ue-build \ /oai-ran/cmake_targets/ran_build/build/liboai_eth_transpro.so \ - /oai-ran/cmake_targets/ran_build/build/libtcp_bridge_oai.so \ /oai-ran/cmake_targets/ran_build/build/librfsimulator.so \ /oai-ran/cmake_targets/ran_build/build/liboai_usrpdevif.so \ /oai-ran/cmake_targets/ran_build/build/libcoding.so \ diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 76c21bb422..00f019c03a 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -373,7 +373,7 @@ void init_openair0(void) { static void init_pdcp(int ue_id) { uint32_t pdcp_initmask = (!IS_SOFTMODEM_NOS1) ? LINK_ENB_PDCP_TO_GTPV1U_BIT : (LINK_ENB_PDCP_TO_GTPV1U_BIT | PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT); - /*if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM || (nfapi_getmode()==NFAPI_UE_STUB_PNF)) { + /*if (IS_SOFTMODEM_RFSIM || (nfapi_getmode()==NFAPI_UE_STUB_PNF)) { pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT; }*/ diff --git a/executables/softmodem-common.c b/executables/softmodem-common.c index 12c60e98fd..c78fc70243 100644 --- a/executables/softmodem-common.c +++ b/executables/softmodem-common.c @@ -89,7 +89,7 @@ void get_common_options(uint32_t execmask) { uint32_t glog_level=0 ; uint32_t start_telnetsrv = 0, start_telnetclt = 0; uint32_t noS1 = 0, nokrnmod = 1, nonbiot = 0; - uint32_t rfsim = 0, basicsim = 0, do_forms = 0; + uint32_t rfsim = 0, do_forms = 0; char *logmem_filename = NULL; paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC ; paramdef_t cmdline_logparams[] =CMDLINE_LOGPARAMS_DESC ; @@ -141,10 +141,6 @@ void get_common_options(uint32_t execmask) { set_softmodem_optmask(SOFTMODEM_RFSIM_BIT); } - if (basicsim) { - set_softmodem_optmask(SOFTMODEM_BASICSIM_BIT); - } - if (do_forms) { set_softmodem_optmask(SOFTMODEM_DOSCOPE_BIT); } diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index 1f73720e70..06b53aac84 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -93,7 +93,7 @@ extern "C" #define CONFIG_HLP_USRP_THREAD "having extra thead for usrp tx\n" #define CONFIG_HLP_NOS1 "Disable s1 interface\n" -#define CONFIG_HLP_RFSIM "Run in rf simulator mode (also known as basic simulator)\n" +#define CONFIG_HLP_RFSIM "Run in rf simulator mode\n" #define CONFIG_HLP_NOKRNMOD "(noS1 only): Use tun instead of namesh module \n" #define CONFIG_HLP_DISABLNBIOT "disable nb-iot, even if defined in config\n" #define CONFIG_HLP_USRP_THREAD "having extra thead for usrp tx\n" @@ -154,7 +154,6 @@ extern int usrp_tx_thread; {"worker-config", CONFIG_HLP_WORKER_CMD, 0, strptr:(char **)&worker_config, defstrval:NULL, TYPE_STRING, 0}, \ {"noS1", CONFIG_HLP_NOS1, PARAMFLAG_BOOL, uptr:&noS1, defintval:0, TYPE_INT, 0}, \ {"rfsim", CONFIG_HLP_RFSIM, PARAMFLAG_BOOL, uptr:&rfsim, defintval:0, TYPE_INT, 0}, \ - {"basicsim", CONFIG_HLP_RFSIM, PARAMFLAG_BOOL, uptr:&basicsim, defintval:0, TYPE_INT, 0}, \ {"nokrnmod", CONFIG_HLP_NOKRNMOD, PARAMFLAG_BOOL, uptr:&nokrnmod, defintval:0, TYPE_INT, 0}, \ {"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, uptr:&nonbiot, defuintval:0, TYPE_INT, 0}, \ {"nsa", CONFIG_HLP_NSA, PARAMFLAG_BOOL, iptr:&NSA, defintval:0, TYPE_INT, 0}, \ @@ -201,7 +200,6 @@ extern int usrp_tx_thread; #define SOFTMODEM_NOKRNMOD_BIT (1<<1) #define SOFTMODEM_NONBIOT_BIT (1<<2) #define SOFTMODEM_RFSIM_BIT (1<<10) -#define SOFTMODEM_BASICSIM_BIT (1<<11) #define SOFTMODEM_SIML1_BIT (1<<12) #define SOFTMODEM_DOSCOPE_BIT (1<<15) #define SOFTMODEM_RECPLAY_BIT (1<<16) @@ -218,7 +216,6 @@ extern int usrp_tx_thread; #define IS_SOFTMODEM_NOKRNMOD ( get_softmodem_optmask() & SOFTMODEM_NOKRNMOD_BIT) #define IS_SOFTMODEM_NONBIOT ( get_softmodem_optmask() & SOFTMODEM_NONBIOT_BIT) #define IS_SOFTMODEM_RFSIM ( get_softmodem_optmask() & SOFTMODEM_RFSIM_BIT) -#define IS_SOFTMODEM_BASICSIM ( get_softmodem_optmask() & SOFTMODEM_BASICSIM_BIT) #define IS_SOFTMODEM_SIML1 ( get_softmodem_optmask() & SOFTMODEM_SIML1_BIT) #define IS_SOFTMODEM_DOSCOPE ( get_softmodem_optmask() & SOFTMODEM_DOSCOPE_BIT) #define IS_SOFTMODEM_IQPLAYER ( get_softmodem_optmask() & SOFTMODEM_RECPLAY_BIT) diff --git a/openair1/PHY/INIT/lte_param_init.c b/openair1/PHY/INIT/lte_param_init.c index 504c8fa80a..5b661d7c2d 100644 --- a/openair1/PHY/INIT/lte_param_init.c +++ b/openair1/PHY/INIT/lte_param_init.c @@ -151,11 +151,5 @@ void lte_param_init(PHY_VARS_eNB **eNBp, else if (eNB->frame_parms.N_RB_DL == 25) ru->N_TA_offset = 624/4; } else ru->N_TA_offset=0; - if (IS_SOFTMODEM_BASICSIM) - /* this is required for the basic simulator in TDD mode - * TODO: find a proper cleaner solution - */ - UE->N_TA_offset = 0; - printf("Done lte_param_init\n"); } diff --git a/openair1/PHY/LTE_TRANSPORT/pss.c b/openair1/PHY/LTE_TRANSPORT/pss.c index 9ebd841430..ce524ef611 100644 --- a/openair1/PHY/LTE_TRANSPORT/pss.c +++ b/openair1/PHY/LTE_TRANSPORT/pss.c @@ -72,10 +72,6 @@ int generate_pss(int32_t **txdataF, a = (frame_parms->nb_antenna_ports_eNB == 1) ? amp: (amp*ONE_OVER_SQRT2_Q15)>>15; //printf("[PSS] amp=%d, a=%d\n",amp,a); - if (IS_SOFTMODEM_BASICSIM) - /* a hack to remove at some point (the UE doesn't synch with 100 RBs) */ - a = (frame_parms->nb_antenna_ports_eNB == 1) ? 4*amp: (amp*ONE_OVER_SQRT2_Q15)>>15; - Nsymb = (frame_parms->Ncp==NORMAL)?14:12; for (aa=0; aanb_antenna_ports_eNB; aa++) { diff --git a/openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c b/openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c index ba904629a1..ff7affe1b3 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c @@ -557,11 +557,6 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) { ue->measurements.rx_power_avg_dB[0] = dB_fixed(ue->measurements.rx_power_avg[0]); LOG_I(PHY,"[UE%d] Initial sync : Estimated power: %d dB\n",ue->Mod_id,ue->measurements.rx_power_avg_dB[0] ); - if (IS_SOFTMODEM_BASICSIM ) - phy_adjust_gain(ue,ue->measurements.rx_power_avg_dB[0],0); - } else { - if (IS_SOFTMODEM_BASICSIM ) - phy_adjust_gain(ue,dB_fixed(ue->measurements.rssi),0); } return ret; diff --git a/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c index 929f63e9fc..82120dc3c3 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c @@ -81,29 +81,20 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1 int i, prach_len; uint16_t first_nonzero_root_idx=0; - if ( !(IS_SOFTMODEM_BASICSIM ) ) { - prach_start = (ue->rx_offset+subframe*ue->frame_parms.samples_per_tti-ue->hw_timing_advance-ue->N_TA_offset); + prach_start = (ue->rx_offset+subframe*ue->frame_parms.samples_per_tti-ue->hw_timing_advance-ue->N_TA_offset); #ifdef PRACH_DEBUG - LOG_I(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id, - prach_start, - ue->rx_offset, - ue->hw_timing_advance, - ue->N_TA_offset); + LOG_I(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id, + prach_start, + ue->rx_offset, + ue->hw_timing_advance, + ue->N_TA_offset); #endif - if (prach_start<0) - prach_start+=(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME); + if (prach_start<0) + prach_start+=(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME); - if (prach_start>=(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)) - prach_start-=(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME); - } else { //normal case (simulation) - prach_start = subframe*ue->frame_parms.samples_per_tti-ue->N_TA_offset; - LOG_I(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id, - prach_start, - ue->rx_offset, - ue->hw_timing_advance, - ue->N_TA_offset); - } + if (prach_start>=(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)) + prach_start-=(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME); // First compute physical root sequence if (restricted_set == 0) { @@ -476,40 +467,32 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1 AssertFatal(prach_fmt<4, "prach_fmt4 not fully implemented" ); - if (!(IS_SOFTMODEM_BASICSIM ) ) { - int j; - int overflow = prach_start + prach_len - LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*ue->frame_parms.samples_per_tti; - LOG_I( PHY, "prach_start=%d, overflow=%d\n", prach_start, overflow ); + int j; + int overflow = prach_start + prach_len - LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*ue->frame_parms.samples_per_tti; + LOG_I( PHY, "prach_start=%d, overflow=%d\n", prach_start, overflow ); - for (i=prach_start,j=0; iframe_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME,prach_start+prach_len); i++,j++) { - ((int16_t *)ue->common_vars.txdata[0])[2*i] = prach[2*j]; - ((int16_t *)ue->common_vars.txdata[0])[2*i+1] = prach[2*j+1]; - } + for (i=prach_start,j=0; iframe_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME,prach_start+prach_len); i++,j++) { + ((int16_t *)ue->common_vars.txdata[0])[2*i] = prach[2*j]; + ((int16_t *)ue->common_vars.txdata[0])[2*i+1] = prach[2*j+1]; + } - for (i=0; icommon_vars.txdata[0])[2*i] = prach[2*j]; - ((int16_t *)ue->common_vars.txdata[0])[2*i+1] = prach[2*j+1]; - } + for (i=0; icommon_vars.txdata[0])[2*i] = prach[2*j]; + ((int16_t *)ue->common_vars.txdata[0])[2*i+1] = prach[2*j+1]; + } #if defined(EXMIMO) - // handle switch before 1st TX subframe, guarantee that the slot prior to transmission is switch on - for (k=prach_start - (ue->frame_parms.samples_per_tti>>1) ; kcommon_vars.txdata[0][k+ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] &= 0xFFFEFFFE; - else if (k>(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)) - ue->common_vars.txdata[0][k-ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] &= 0xFFFEFFFE; - else - ue->common_vars.txdata[0][k] &= 0xFFFEFFFE; - } - -#endif - } else { // simulators - for (i=0; icommon_vars.txdata[0][prach_start]))[2*i] = prach[2*i]; - ((int16_t *)(&ue->common_vars.txdata[0][prach_start]))[2*i+1] = prach[2*i+1]; - } + // handle switch before 1st TX subframe, guarantee that the slot prior to transmission is switch on + for (k=prach_start - (ue->frame_parms.samples_per_tti>>1) ; kcommon_vars.txdata[0][k+ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] &= 0xFFFEFFFE; + else if (k>(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)) + ue->common_vars.txdata[0][k-ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] &= 0xFFFEFFFE; + else + ue->common_vars.txdata[0][k] &= 0xFFFEFFFE; } +#endif #if defined(PRACH_WRITE_OUTPUT_DEBUG) LOG_M("prach_txF0.m","prachtxF0",prachF,prach_len-Ncp,1,1); diff --git a/openair1/PHY/defs_RU.h b/openair1/PHY/defs_RU.h index 6b18e55c4b..0b20aa409b 100644 --- a/openair1/PHY/defs_RU.h +++ b/openair1/PHY/defs_RU.h @@ -458,8 +458,6 @@ typedef struct RU_t_s { int emulate_rf; /// numerology index int numerology; - /// flag to indicate basicsim operation - int basicsim; /// flag to indicate the RU is in sync with a master reference int in_synch; /// timing offset diff --git a/openair1/SCHED_UE/phy_procedures_lte_ue.c b/openair1/SCHED_UE/phy_procedures_lte_ue.c index 4635f2b741..b02f24e04e 100644 --- a/openair1/SCHED_UE/phy_procedures_lte_ue.c +++ b/openair1/SCHED_UE/phy_procedures_lte_ue.c @@ -1150,20 +1150,14 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, nsymb = (frame_parms->Ncp == 0) ? 14 : 12; - if (!IS_SOFTMODEM_BASICSIM) { - ulsch_start = (ue->rx_offset+subframe_tx*frame_parms->samples_per_tti- - ue->hw_timing_advance- - ue->timing_advance- - ue->N_TA_offset+5); + ulsch_start = ue->rx_offset + subframe_tx * frame_parms->samples_per_tti + - ue->hw_timing_advance - ue->timing_advance - ue->N_TA_offset + 5; - if(ulsch_start < 0) - ulsch_start = ulsch_start + (LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti); + if(ulsch_start < 0) + ulsch_start = ulsch_start + (LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti); - if (ulsch_start > (LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti)) - ulsch_start = ulsch_start % (LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti); - } else { //this is the simulators case - ulsch_start = (frame_parms->samples_per_tti*subframe_tx)-ue->N_TA_offset; //-ue->timing_advance; - } + if (ulsch_start > (LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti)) + ulsch_start = ulsch_start % (LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti); if (empty_subframe) { overflow = ulsch_start - 9*frame_parms->samples_per_tti; @@ -1181,8 +1175,7 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, } for (aa=0; aanb_antennas_tx; aa++) { - int *Buff = IS_SOFTMODEM_BASICSIM ? &ue->common_vars.txdata[aa][ulsch_start] :dummy_tx_buffer; - + int *Buff = dummy_tx_buffer; if (frame_parms->Ncp == 1) { PHY_ofdm_mod(&ue->common_vars.txdataF[aa][subframe_tx*nsymb*frame_parms->ofdm_symbol_size], Buff, @@ -1202,41 +1195,33 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, &ue->frame_parms); } - if (IS_SOFTMODEM_BASICSIM) { - apply_7_5_kHz(ue,&ue->common_vars.txdata[aa][ulsch_start],0); - apply_7_5_kHz(ue,&ue->common_vars.txdata[aa][ulsch_start],1); - } else { - apply_7_5_kHz(ue,dummy_tx_buffer,0); - apply_7_5_kHz(ue,dummy_tx_buffer,1); + apply_7_5_kHz(ue,dummy_tx_buffer,0); + apply_7_5_kHz(ue,dummy_tx_buffer,1); + + overflow = ulsch_start - 9*frame_parms->samples_per_tti; + + for (k=ulsch_start,l=0; ksamples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME,ulsch_start+frame_parms->samples_per_tti); k++,l++) { + ((short *)ue->common_vars.txdata[aa])[2*k] = ((short *)dummy_tx_buffer)[2*l]; + ((short *)ue->common_vars.txdata[aa])[2*k+1] = ((short *)dummy_tx_buffer)[2*l+1]; } - if (!(IS_SOFTMODEM_BASICSIM) ) { - overflow = ulsch_start - 9*frame_parms->samples_per_tti; - - for (k=ulsch_start,l=0; ksamples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME,ulsch_start+frame_parms->samples_per_tti); k++,l++) { - ((short *)ue->common_vars.txdata[aa])[2*k] = ((short *)dummy_tx_buffer)[2*l]; - ((short *)ue->common_vars.txdata[aa])[2*k+1] = ((short *)dummy_tx_buffer)[2*l+1]; - } - - for (k=0; kcommon_vars.txdata[aa])[2*k] = ((short *)dummy_tx_buffer)[2*l]; - ((short *)ue->common_vars.txdata[aa])[2*k+1] = ((short *)dummy_tx_buffer)[2*l+1]; - } + for (k=0; kcommon_vars.txdata[aa])[2*k] = ((short *)dummy_tx_buffer)[2*l]; + ((short *)ue->common_vars.txdata[aa])[2*k+1] = ((short *)dummy_tx_buffer)[2*l+1]; + } #if defined(EXMIMO) - // handle switch before 1st TX subframe, guarantee that the slot prior to transmission is switch on - for (k=ulsch_start - (frame_parms->samples_per_tti>>1) ; kcommon_vars.txdata[aa][k+frame_parms->samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] &= 0xFFFEFFFE; - else if (k>(frame_parms->samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)) - ue->common_vars.txdata[aa][k-frame_parms->samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] &= 0xFFFEFFFE; - else - ue->common_vars.txdata[aa][k] &= 0xFFFEFFFE; - } - -#endif + // handle switch before 1st TX subframe, guarantee that the slot prior to transmission is switch on + for (k=ulsch_start - (frame_parms->samples_per_tti>>1) ; kcommon_vars.txdata[aa][k+frame_parms->samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] &= 0xFFFEFFFE; + else if (k>(frame_parms->samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)) + ue->common_vars.txdata[aa][k-frame_parms->samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] &= 0xFFFEFFFE; + else + ue->common_vars.txdata[aa][k] &= 0xFFFEFFFE; } +#endif /* only for debug @@ -1314,14 +1299,7 @@ void ue_prach_procedures(PHY_VARS_UE *ue, ue->prach_resources[eNB_id]->ra_RNTI); ue->tx_total_RE[subframe_tx] = 96; - if (IS_SOFTMODEM_BASICSIM) { - ue->prach_vars[eNB_id]->amp = get_tx_amp(ue->tx_power_dBm[subframe_tx], - ue->tx_power_max_dBm, - ue->frame_parms.N_RB_UL, - 6); - } else { - ue->prach_vars[eNB_id]->amp = AMP; - } + ue->prach_vars[eNB_id]->amp = AMP; if ((mode == calib_prach_tx) && (((proc->frame_tx&0xfffe)%100)==0)) LOG_D(PHY,"[UE %d][RAPROC] Frame %d, Subframe %d : PRACH TX power %d dBm, amp %d\n", @@ -1688,14 +1666,10 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue, ue->tx_total_RE[subframe_tx] = nb_rb*12; - if (IS_SOFTMODEM_BASICSIM) { - tx_amp = AMP; - } else { - tx_amp = get_tx_amp(ue->tx_power_dBm[subframe_tx], - ue->tx_power_max_dBm, - ue->frame_parms.N_RB_UL, - nb_rb); - } + tx_amp = get_tx_amp(ue->tx_power_dBm[subframe_tx], + ue->tx_power_max_dBm, + ue->frame_parms.N_RB_UL, + nb_rb); T(T_UE_PHY_PUSCH_TX_POWER, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx),T_INT(ue->tx_power_dBm[subframe_tx]), T_INT(tx_amp),T_INT(ue->ulsch[eNB_id]->f_pusch),T_INT(get_PL(Mod_id,0,eNB_id)),T_INT(nb_rb)); @@ -1765,17 +1739,13 @@ void ue_srs_procedures(PHY_VARS_UE *ue, Po_SRS = ue->tx_power_max_dBm; } - if (IS_SOFTMODEM_BASICSIM) { - tx_amp = AMP; + if (ue->mac_enabled==1) { + tx_amp = get_tx_amp(Po_SRS, + ue->tx_power_max_dBm, + ue->frame_parms.N_RB_UL, + nb_rb_srs); } else { - if (ue->mac_enabled==1) { - tx_amp = get_tx_amp(Po_SRS, - ue->tx_power_max_dBm, - ue->frame_parms.N_RB_UL, - nb_rb_srs); - } else { - tx_amp = AMP; - } + tx_amp = AMP; } LOG_D(PHY,"SRS PROC; TX_MAX_POWER %d, Po_SRS %d, NB_RB_UL %d, NB_RB_SRS %d TX_AMPL %d\n",ue->tx_power_max_dBm, @@ -2008,14 +1978,10 @@ void ue_pucch_procedures(PHY_VARS_UE *ue, ue->tx_power_dBm[subframe_tx] = Po_PUCCH; ue->tx_total_RE[subframe_tx] = 12; - if (IS_SOFTMODEM_BASICSIM) { - tx_amp = AMP; - } else { - tx_amp = get_tx_amp(Po_PUCCH, - ue->tx_power_max_dBm, - ue->frame_parms.N_RB_UL, - 1); - } + tx_amp = get_tx_amp(Po_PUCCH, + ue->tx_power_max_dBm, + ue->frame_parms.N_RB_UL, + 1); T(T_UE_PHY_PUCCH_TX_POWER, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx),T_INT(ue->tx_power_dBm[subframe_tx]), T_INT(tx_amp),T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->g_pucch),T_INT(get_PL(ue->Mod_id,ue->CC_id,eNB_id))); @@ -2089,14 +2055,10 @@ void ue_pucch_procedures(PHY_VARS_UE *ue, ue->tx_power_dBm[subframe_tx] = Po_PUCCH; ue->tx_total_RE[subframe_tx] = 12; - if (IS_SOFTMODEM_BASICSIM) { - tx_amp = AMP; - } else { - tx_amp = get_tx_amp(Po_PUCCH, - ue->tx_power_max_dBm, - ue->frame_parms.N_RB_UL, - 1); - } + tx_amp = get_tx_amp(Po_PUCCH, + ue->tx_power_max_dBm, + ue->frame_parms.N_RB_UL, + 1); T(T_UE_PHY_PUCCH_TX_POWER, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx),T_INT(ue->tx_power_dBm[subframe_tx]), T_INT(tx_amp),T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->g_pucch),T_INT(get_PL(ue->Mod_id,ue->CC_id,eNB_id))); @@ -2344,9 +2306,6 @@ void ue_measurement_procedures(uint16_t l, // symbol index of each slot [0..6 // AGC VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL, VCD_FUNCTION_IN); - if (IS_SOFTMODEM_BASICSIM) - phy_adjust_gain (ue,dB_fixed(ue->measurements.rssi),0); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL, VCD_FUNCTION_OUT); eNB_id = 0; diff --git a/targets/ARCH/COMMON/common_lib.c b/targets/ARCH/COMMON/common_lib.c index 08daf58cf7..4d681b8d62 100644 --- a/targets/ARCH/COMMON/common_lib.c +++ b/targets/ARCH/COMMON/common_lib.c @@ -116,9 +116,6 @@ int load_lib(openair0_device *device, deflibname=OAI_IQPLAYER_LIBNAME; shlib_fdesc[0].fname="device_init"; set_softmodem_optmask(SOFTMODEM_RECPLAY_BIT); // softmodem has to know we use the iqplayer to workaround randomized algorithms - } else if ( IS_SOFTMODEM_BASICSIM ) { - deflibname=OAI_BASICSIM_LIBNAME; - shlib_fdesc[0].fname="device_init"; } else if (IS_SOFTMODEM_RFSIM && flag == RAU_LOCAL_RADIO_HEAD) { deflibname=OAI_RFSIM_LIBNAME; shlib_fdesc[0].fname="device_init"; diff --git a/targets/ARCH/COMMON/common_lib.h b/targets/ARCH/COMMON/common_lib.h index 38a7b0fa67..a60d5e78fc 100644 --- a/targets/ARCH/COMMON/common_lib.h +++ b/targets/ARCH/COMMON/common_lib.h @@ -46,8 +46,6 @@ #define OAI_THIRDPARTY_TP_LIBNAME "thirdparty_transpro" /* name of shared library implementing the rf simulator */ #define OAI_RFSIM_LIBNAME "rfsimulator" -/* name of shared library implementing the basic simulator */ -#define OAI_BASICSIM_LIBNAME "tcp_bridge_oai" /* name of shared library implementing the iq player */ #define OAI_IQPLAYER_LIBNAME "oai_iqplayer" diff --git a/targets/ARCH/tcp_bridge/README b/targets/ARCH/tcp_bridge/README deleted file mode 100644 index 9bd1a16e59..0000000000 --- a/targets/ARCH/tcp_bridge/README +++ /dev/null @@ -1,4 +0,0 @@ -This is sort of a "TCP driver" to ease debugging. This is mostly internal -to EURECOM. You probably don't want to use it. - -Same license as the rest. diff --git a/targets/ARCH/tcp_bridge/README.tcp_bridge_oai b/targets/ARCH/tcp_bridge/README.tcp_bridge_oai deleted file mode 100644 index 05a520f6ae..0000000000 --- a/targets/ARCH/tcp_bridge/README.tcp_bridge_oai +++ /dev/null @@ -1,42 +0,0 @@ -The driver tcp_bridge_oai.c is to be used with the basic simulator. - -To build the basic simulator: - cd [openair top directory] - . oaienv - cd cmake_targets - ./build_oai -I -w USRP - ./build_oai --basic-simulator - cd ../common/utils/T/tracer - make - -To use it, you need to run the eNB and the UE. - -The eNB requires the T tracer. -Open two terminals. -In one terminal, run: - cd [openair top directory] - cd common/utils/T/tracer - ./enb -d ../T_messages.txt -In the other terminal, run: - cd [openair top directory] - cd cmake_targets/basic_simulator/enb - export ENODEB=1 - sudo -E ./lte-softmodem -O [configuration file] --T_stdout 0 -[configuration file] is just a regular configuration file. -The eNB needs an EPC. - -To run the UE, open a terminal and run: - cd [openair top directory] - cd cmake_targets/basic_simulator/ue - sudo ./lte-uesoftmodem -C 2680000000 -r 25 --ue-rxgain 140 -Adapt the value of -r, it has to match the value N_RB_DL in the configuration -file of the eNB. (Same for -C which should match the value downlink_frequency -in the configuration file.) - -The UE configuration (security keys) is generated from the file -openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf. You need to configure -your EPC to know about the UE. If you change the file -openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf then you need to -regenerate the configuration files using the program targets/bin/conf2uedata. -You run it as: - $OPENAIR_DIR/targets/bin/conf2uedata -c $OPENAIR_DIR/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf -o $OPENAIR_DIR/cmake_targets/basic_simulator/ue diff --git a/targets/ARCH/tcp_bridge/tcp_bridge.c b/targets/ARCH/tcp_bridge/tcp_bridge.c deleted file mode 100644 index f8c12dcb7a..0000000000 --- a/targets/ARCH/tcp_bridge/tcp_bridge.c +++ /dev/null @@ -1,292 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -int fullread(int fd, void *_buf, int count) -{ - char *buf = _buf; - int ret = 0; - int l; - while (count) { - l = read(fd, buf, count); - if (l <= 0) return -1; - count -= l; - buf += l; - ret += l; - } - return ret; -} - -int fullwrite(int fd, void *_buf, int count) -{ - char *buf = _buf; - int ret = 0; - int l; - while (count) { - l = write(fd, buf, count); - if (l <= 0) return -1; - count -= l; - buf += l; - ret += l; - } - return ret; -} - -#include "common_lib.h" - -typedef struct { - int32_t data[30720]; /* max 20MHz */ - unsigned long timestamp; - int size; -} input_buffer; - -#define BSIZE 16 - -typedef struct { - int sock; - int samples_per_subframe; - input_buffer b[BSIZE]; - int bstart; - int blen; - unsigned long read_timestamp; -} tcp_bridge_state_t; - - -/****************************************************************************/ -/* buffer management */ -/* (could be simpler, we are synchronous) */ -/* maybe we should lock */ -/****************************************************************************/ - -void put_buffer(tcp_bridge_state_t *t, void *data, int size, unsigned long timestamp) -{ - int nextpos; - if (t->blen == BSIZE) { printf("tcp_bridge: buffer full\n"); exit(1); } - if (size > 30720*4) abort(); - if (t->blen) { - int lastpos = (t->bstart+t->blen-1) % BSIZE; - if (timestamp != t->b[lastpos].timestamp + t->samples_per_subframe) - { printf("tcp_bridge: discontinuity\n"); exit(1); } - } - nextpos = (t->bstart+t->blen) % BSIZE; - t->b[nextpos].timestamp = timestamp; - t->b[nextpos].size = size; - memcpy(t->b[nextpos].data, data, size); - t->blen++; -} - -void get_buffer(tcp_bridge_state_t *t, void *data, int size, unsigned long timestamp) -{ - int pos; - if (t->blen == 0) { printf("tcp_bridge: buffer empty\n"); exit(1); } - if (size >30720*4) abort(); - pos = t->bstart; - if (size != t->b[pos].size) { printf("tcp_bridge: bad size\n"); exit(1); } - memcpy(data, t->b[pos].data, size); - t->bstart = (t->bstart + 1) % BSIZE; - t->blen--; -} - -/****************************************************************************/ -/* end of buffer management */ -/****************************************************************************/ - - -/****************************************************************************/ -/* network management (read/write) */ -/****************************************************************************/ - -void read_data_from_network(int sock, input_buffer *b) -{ - if (fullread(sock, &b->timestamp, sizeof(b->timestamp)) != sizeof(b->timestamp)) goto err; - if (fullread(sock, &b->size, sizeof(b->size)) != sizeof(b->size)) goto err; - if (fullread(sock, b->data, b->size) != b->size) goto err; - return; - -err: - printf("tcp_bridge: read_data_from_network fails\n"); - exit(1); -} - -void write_data_to_network(int sock, input_buffer *b) -{ - if (fullwrite(sock, &b->timestamp, sizeof(b->timestamp)) != sizeof(b->timestamp)) goto err; - if (fullwrite(sock, &b->size, sizeof(b->size)) != sizeof(b->size)) goto err; - if (fullwrite(sock, b->data, b->size) != b->size) goto err; - return; - -err: - printf("tcp_bridge: write_data_to_network fails\n"); - exit(1); -} - -/****************************************************************************/ -/* end of network management */ -/****************************************************************************/ - - -int tcp_bridge_start(openair0_device *device) -{ - int i; - int port = 4042; - tcp_bridge_state_t *tcp_bridge = device->priv; - - int sock = socket(AF_INET, SOCK_STREAM, 0); - if (sock == -1) { perror("tcp_bridge: socket"); exit(1); } - - int enable = 1; - if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(int))) - { perror("tcp_bridge: SO_REUSEADDR"); exit(1); } - - struct sockaddr_in addr = { - sin_family: AF_INET, - sin_port: htons(port), - sin_addr: { s_addr: INADDR_ANY } - }; - - if (bind(sock, (struct sockaddr *)&addr, sizeof(addr))) - { perror("tcp_bridge: bind"); exit(1); } - - if (listen(sock, 5)) - { perror("tcp_bridge: listen"); exit(1); } - - printf("tcp_bridge: wait for connection on port %d\n", port); - - socklen_t len = sizeof(addr); - int sock2 = accept(sock, (struct sockaddr *)&addr, &len); - if (sock2 == -1) - { perror("tcp_bridge: accept"); exit(1); } - - close(sock); - - tcp_bridge->sock = sock2; - - /* the other end has to send 10 subframes at startup */ - for (i = 0; i < 10; i++) - read_data_from_network(sock2, &tcp_bridge->b[i]); - tcp_bridge->bstart = 0; - tcp_bridge->blen = 10; - - printf("tcp_bridge: connection established\n"); - - return 0; -} - -int tcp_bridge_request(openair0_device *device, void *msg, ssize_t msg_len) { abort(); return 0; } -int tcp_bridge_reply(openair0_device *device, void *msg, ssize_t msg_len) { abort(); return 0; } -int tcp_bridge_get_stats(openair0_device* device) { return 0; } -int tcp_bridge_reset_stats(openair0_device* device) { return 0; } -void tcp_bridge_end(openair0_device *device) {} -int tcp_bridge_stop(openair0_device *device) { return 0; } -int tcp_bridge_set_freq(openair0_device* device, openair0_config_t *openair0_cfg,int exmimo_dump_config) { return 0; } -int tcp_bridge_set_gains(openair0_device* device, openair0_config_t *openair0_cfg) { return 0; } - -int tcp_bridge_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) -{ - tcp_bridge_state_t *t = device->priv; - input_buffer out; - int i; -//printf("write ts %ld nsamps %d\n", timestamp, nsamps); - - if (nsamps > 30720) abort(); - - /* read buffer timestamped with 'timestamp' if not already here */ - for (i = 0; i < t->blen; i++) { - input_buffer *b = &t->b[(t->bstart + i) % BSIZE]; - if (b->timestamp == timestamp) break; - } - if (i == t->blen) { - int nextpos = (t->bstart + t->blen) % BSIZE; - if (t->blen == BSIZE) abort(); - read_data_from_network(t->sock, &t->b[nextpos]); - t->blen++; - if (t->b[nextpos].timestamp != timestamp) abort(); - } - - memcpy(out.data, buff[0], nsamps * 4); - out.timestamp = timestamp; - out.size = nsamps * 4; - write_data_to_network(t->sock, &out); - - return nsamps; -} - -int tcp_bridge_read(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc) -{ - tcp_bridge_state_t *t = device->priv; - input_buffer *b; - - if (cc != 1) abort(); - if (t->blen == 0) abort(); - - b = &t->b[t->bstart]; - - if (b->timestamp != t->read_timestamp) abort(); - if (b->size != nsamps * 4) abort(); - - *timestamp = b->timestamp; - memcpy(buff[0], b->data, b->size); - - t->read_timestamp += nsamps; - t->bstart = (t->bstart + 1) % BSIZE; - t->blen--; - -static unsigned long ts = 0; -//printf("read ts %ld nsamps %d\n", ts, nsamps); -*timestamp = ts; -ts += nsamps; - - return nsamps; -} - -int tcp_bridge_write_init(openair0_device *device) -{ - return 0; -} - -__attribute__((__visibility__("default"))) -int device_init(openair0_device* device, openair0_config_t *openair0_cfg) -{ - tcp_bridge_state_t *tcp_bridge = (tcp_bridge_state_t*)malloc(sizeof(tcp_bridge_state_t)); - memset(tcp_bridge, 0, sizeof(tcp_bridge_state_t)); - - /* only 25 or 50 PRBs handled for the moment */ - if (openair0_cfg[0].sample_rate != 61440000 && - openair0_cfg[0].sample_rate != 30720000 && - openair0_cfg[0].sample_rate != 15360000 && - openair0_cfg[0].sample_rate != 7680000) { - printf("tcp_bridge: ERROR: only sample rate 61.44, 30.72, 15.36, and 7.68 Msps supported\n"); - exit(1); - } - - device->trx_start_func = tcp_bridge_start; - device->trx_get_stats_func = tcp_bridge_get_stats; - device->trx_reset_stats_func = tcp_bridge_reset_stats; - device->trx_end_func = tcp_bridge_end; - device->trx_stop_func = tcp_bridge_stop; - device->trx_set_freq_func = tcp_bridge_set_freq; - device->trx_set_gains_func = tcp_bridge_set_gains; - device->trx_write_func = tcp_bridge_write; - device->trx_read_func = tcp_bridge_read; - device->trx_write_init = tcp_bridge_write_init; - - device->priv = tcp_bridge; - - switch ((int)openair0_cfg[0].sample_rate) { - case 61440000: tcp_bridge->samples_per_subframe = 61440; break; - case 30720000: tcp_bridge->samples_per_subframe = 30720; break; - case 15360000: tcp_bridge->samples_per_subframe = 15360; break; - case 7680000: tcp_bridge->samples_per_subframe = 7680; break; - } - - /* let's pretend to be a b2x0 */ - device->type = USRP_B200_DEV; - - device->openair0_cfg=&openair0_cfg[0]; - - return 0; -} diff --git a/targets/ARCH/tcp_bridge/tcp_bridge_oai.c b/targets/ARCH/tcp_bridge/tcp_bridge_oai.c deleted file mode 100644 index c3d5355876..0000000000 --- a/targets/ARCH/tcp_bridge/tcp_bridge_oai.c +++ /dev/null @@ -1,443 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -const int port = 4043; -#define helpTxt "\ -\x1b[31m\ -tcp_bridge: error: you have to run one UE and one eNB\n\ -For this, export TCPBRIDGE=enb (eNB case) or \n\ - TCPBRIDGE= (UE case)\n\ -\x1b[m" - -int fullread(int fd, void *_buf, int count) { - char *buf = _buf; - int ret = 0; - int l; - - while (count) { - l = read(fd, buf, count); - - if (l <= 0) return -1; - - count -= l; - buf += l; - ret += l; - } - - return ret; -} - -int fullwrite(int fd, void *_buf, int count) { - char *buf = _buf; - int ret = 0; - int l; - - while (count) { - l = write(fd, buf, count); - - if (l <= 0) return -1; - - count -= l; - buf += l; - ret += l; - } - - return ret; -} - -#include "common_lib.h" - -typedef struct { - int sock; - int samples_per_subframe; - uint64_t timestamp; - uint64_t next_tx_timestamp; - int is_enb; - char *ip; -} tcp_bridge_state_t; - -void verify_connection(int fd, int is_enb) { - char c = is_enb; - - if (fullwrite(fd, &c, 1) != 1) exit(1); - - if (fullread(fd, &c, 1) != 1) exit(1); - - if (c == is_enb) { - printf(helpTxt); - exit(1); - } -} - - -int start_enb(tcp_bridge_state_t *tcp_bridge) { - struct sockaddr_in addr = { -sin_family: - AF_INET, -sin_port: - htons(port), -sin_addr: - { s_addr: INADDR_ANY } - }; - - if (bind(tcp_bridge->sock, (struct sockaddr *)&addr, sizeof(addr))) { - perror("tcp_bridge: bind"); - exit(1); - } - - if (listen(tcp_bridge->sock, 5)) { - perror("tcp_bridge: listen"); - exit(1); - } - - printf("tcp_bridge: wait for connection on port %d\n", port); - socklen_t len = sizeof(addr); - int sockServ = accept(tcp_bridge->sock, (struct sockaddr *)&addr, &len); - - if ( sockServ == -1) { - perror("tcp_bridge: accept"); - exit(1); - } - - verify_connection(sockServ, tcp_bridge->is_enb); - printf("tcp_bridge: connection established\n"); - close(tcp_bridge->sock); - tcp_bridge->sock=sockServ; - return 0; -} - -int start_ue(tcp_bridge_state_t *tcp_bridge) { -struct sockaddr_in addr = {sin_family: - AF_INET, -sin_port: - htons(port), -sin_addr: - { s_addr: INADDR_ANY } - }; - addr.sin_addr.s_addr = inet_addr(tcp_bridge->ip); - - while(1) { - printf("tcp_bridge: trying to connect to %s:%d\n", tcp_bridge->ip, port); - - if (connect(tcp_bridge->sock, (struct sockaddr *)&addr, sizeof(addr)) == 0) { - verify_connection(tcp_bridge->sock, tcp_bridge->is_enb); - printf("tcp_bridge: connection established\n"); - return 0; - } - - perror("tcp_bridge"); - sleep(1); - } - - return 0; -} - -int tcp_bridge_start(openair0_device *device) { - tcp_bridge_state_t *tcp_bridge = device->priv; - tcp_bridge->sock = socket(AF_INET, SOCK_STREAM, 0); - - if (tcp_bridge->sock == -1) { - perror("tcp_bridge: socket"); - exit(1); - } - - int enable = 1; - - if (setsockopt(tcp_bridge->sock, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(int))) { - perror("tcp_bridge: SO_REUSEADDR"); - exit(1); - } - - if ( tcp_bridge->is_enb ) - return start_enb(tcp_bridge); - else - return start_ue(tcp_bridge); -} - -int tcp_bridge_request(openair0_device *device, void *msg, ssize_t msg_len) { - abort(); - return 0; -} -int tcp_bridge_reply(openair0_device *device, void *msg, ssize_t msg_len) { - abort(); - return 0; -} -int tcp_bridge_get_stats(openair0_device *device) { - return 0; -} -int tcp_bridge_reset_stats(openair0_device *device) { - return 0; -} -void tcp_bridge_end(openair0_device *device) {} -int tcp_bridge_stop(openair0_device *device) { - return 0; -} -int tcp_bridge_set_freq(openair0_device *device, openair0_config_t *openair0_cfg,int exmimo_dump_config) { - return 0; -} -int tcp_bridge_set_gains(openair0_device *device, openair0_config_t *openair0_cfg) { - return 0; -} - -int tcp_bridge_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) { - if (cc != 1) { - printf("tcp_bridge: only 1 antenna supported\n"); - exit(1); - } - - tcp_bridge_state_t *t = device->priv; - - /* deal with discontinuities in output (think: eNB in TDD mode) */ - if (t->next_tx_timestamp && timestamp != t->next_tx_timestamp) { - uint32_t b[4096]; - uint64_t to_send = timestamp - t->next_tx_timestamp; - memset(b, 0, 4096 * sizeof(uint32_t)); - - while (to_send) { - int len = to_send > 4096 ? 4096 : to_send; - int n = fullwrite(t->sock, b, len * 4); - - if (n != len * 4) { - printf("tcp_bridge: write error ret %d error %s\n", n, strerror(errno)); - abort(); - } - - to_send -= len; - } - } - - int n = fullwrite(t->sock, buff[0], nsamps * 4); - - if (n != nsamps * 4) { - printf("tcp_bridge: write error ret %d (wanted %d) error %s\n", n, nsamps*4, strerror(errno)); - abort(); - } - - t->next_tx_timestamp = timestamp + nsamps; - return nsamps; -} - -int tcp_bridge_read(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc) { - if (cc != 1) { - printf("tcp_bridge: only 1 antenna supported\n"); - exit(1); - } - - tcp_bridge_state_t *t = device->priv; - int n = fullread(t->sock, buff[0], nsamps * 4); - - if (n != nsamps * 4) { - printf("tcp_bridge: read error ret %d nsamps*4 %d error %s\n", n, nsamps * 4, strerror(errno)); - abort(); - } - - *timestamp = t->timestamp; - t->timestamp += nsamps; - return nsamps; -} - -int tcp_bridge_read_ue(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc) { - if (cc != 1) { - printf("tcp_bridge: only 1 antenna supported\n"); - exit(1); - } - - tcp_bridge_state_t *t = device->priv; - int n; - - /* In synch mode, UE does not write, but we need to - send something to the eNodeB. - We know that UE is in synch mode when it reads - 10 subframes at a time. - */ - if (nsamps == t->samples_per_subframe * 10) { - uint32_t b[nsamps]; - memset(b, 0, nsamps * 4); - n = fullwrite(t->sock, b, nsamps * 4); - - if (n != nsamps * 4) { - printf("tcp_bridge: write error ret %d error %s\n", n, strerror(errno)); - abort(); - } - } - - return tcp_bridge_read(device, timestamp, buff, nsamps, cc); -} - -/* To startup proper communcation between eNB and UE, - we need to understand that: - - eNodeB starts reading subframe 0 - - then eNodeB starts sending subframe 4 - and then repeats read/write for each subframe. - The UE: - - reads 10 subframes at a time until it is synchronized - - then reads subframe n and writes subframe n+2 - We also want to enforce that the subframe 0 is read - at the beginning of the UE RX buffer, not in the middle - of it. - So it means: - - for the eNodeB: let it run as in normal mode (as with a B210) - - for the UE, on its very first read: - - we want this read to get data from subframe 0 - but the first write of eNodeB is subframe 4 - so we first need to read and ignore 6 subframes - - the UE will start its TX only at the subframe 2 - corresponding to the subframe 0 it just read, - so we need to write 12 subframes before anything - (the function tcp_bridge_read_ue takes care to - insert dummy TX data during the synch phase) - - Here is a drawing of the beginning of things to make - this logic clearer. - - We see that eNB starts RX at subframe 0, starts TX at subfram 4, - and that UE starts RX at subframe 10 and TX at subframe 12. - - We understand that the UE has to transmit 12 empty - subframes for the eNodeB to start its processing. - - And because the eNodeB starts its TX at subframe 4 and we - want the UE to start its RX at subframe 10, we need to - read and ignore 6 subframes in the UE. - - ------------------------------------------------------------------------- - eNB RX: | *0* | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 ... - ------------------------------------------------------------------------- - - ------------------------------------------------------------------------- - eNB TX: | 0 | 1 | 2 | 3 | *4* | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 ... - ------------------------------------------------------------------------- - - ------------------------------------------------------------------------- - UE RX: | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *10* | 11 | 12 | 13 | 14 ... - ------------------------------------------------------------------------- - - ------------------------------------------------------------------------- - UE TX: | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | *12* | 13 | 14 ... - ------------------------------------------------------------------------- - - As a final note, we do TX before RX to ensure that the eNB will - get some data and send us something so there is no deadlock - at the beginning of things. Hopefully the kernel buffers for - the sockets are big enough so that the first (big) TX can - return to user mode before the buffers are full. If this - is wrong in some environment, we will need to work by smaller - units of data at a time. -*/ -int tcp_bridge_ue_first_read(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc) { - if (cc != 1) { - printf("tcp_bridge: only 1 antenna supported\n"); - exit(1); - } - - tcp_bridge_state_t *t = device->priv; - uint32_t b[t->samples_per_subframe * 12]; - memset(b, 0, t->samples_per_subframe * 12 * 4); - int n = fullwrite(t->sock, b, t->samples_per_subframe * 12 * 4); - - if (n != t->samples_per_subframe * 12 * 4) { - printf("tcp_bridge: write error ret %d error %s\n", n, strerror(errno)); - abort(); - } - - n = fullread(t->sock, b, t->samples_per_subframe * 6 * 4); - - if (n != t->samples_per_subframe * 6 * 4) { - printf("tcp_bridge: read error ret %d error %s\n", n, strerror(errno)); - abort(); - } - - /* Due to some unknown bug in the eNB (or UE, or both), the first frames - * are not correctly generated (or handled), which leads to a bad behavior - * of the simulator in some cases (seen with 100 RBs: the UE reads a bad - * MIB and switches to 25 RBs, which results in a deadlock in this driver). - * Let's skip 10 frames to avoid this issue. - */ - for (int i = 0; i < 10 * 10; i++) { - memset(b, 0, t->samples_per_subframe * 4); - n = fullwrite(t->sock, b, t->samples_per_subframe * 4); - - if (n != t->samples_per_subframe * 4) { - printf("tcp_bridge: write error ret %d error %s\n", n, strerror(errno)); - abort(); - } - - n = fullread(t->sock, b, t->samples_per_subframe * 4); - - if (n != t->samples_per_subframe * 4) { - printf("tcp_bridge: read error ret %d error %s\n", n, strerror(errno)); - abort(); - } - } - - device->trx_read_func = tcp_bridge_read_ue; - return tcp_bridge_read_ue(device, timestamp, buff, nsamps, cc); -} - -__attribute__((__visibility__("default"))) -int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { - tcp_bridge_state_t *tcp_bridge = (tcp_bridge_state_t *)calloc(sizeof(tcp_bridge_state_t),1); - - if ((tcp_bridge->ip=getenv("TCPBRIDGE")) == NULL ) { - /* for compatibility, we test the ENB environment variable */ - if ((tcp_bridge->ip=getenv("ENODEB")) != NULL ) { - tcp_bridge->ip=strdup("enb"); - } else { - tcp_bridge->ip=strdup("127.0.0.1"); - } - } - - tcp_bridge->is_enb = strncasecmp(tcp_bridge->ip,"enb",3) == 0; - printf("tcp_bridge: running as %s\n", tcp_bridge->is_enb ? "eNB" : "UE"); - - if (openair0_cfg[0].sample_rate != 61440000 && - openair0_cfg[0].sample_rate != 30720000 && - openair0_cfg[0].sample_rate != 15360000 && - openair0_cfg[0].sample_rate != 7680000) { - printf("tcp_bridge: ERROR: only sample rate 61.44, 30.72, 15.36, and 7.68 Msps supported\n"); - exit(1); - } - - device->trx_start_func = tcp_bridge_start; - device->trx_get_stats_func = tcp_bridge_get_stats; - device->trx_reset_stats_func = tcp_bridge_reset_stats; - device->trx_end_func = tcp_bridge_end; - device->trx_stop_func = tcp_bridge_stop; - device->trx_set_freq_func = tcp_bridge_set_freq; - device->trx_set_gains_func = tcp_bridge_set_gains; - device->trx_write_func = tcp_bridge_write; - - if (tcp_bridge->is_enb) { - device->trx_read_func = tcp_bridge_read; - } else { - device->trx_read_func = tcp_bridge_ue_first_read; - } - - device->priv = tcp_bridge; - - switch ((int)openair0_cfg[0].sample_rate) { - case 30720000: - tcp_bridge->samples_per_subframe = 30720; - break; - - case 15360000: - tcp_bridge->samples_per_subframe = 15360; - break; - - case 7680000: - tcp_bridge->samples_per_subframe = 7680; - break; - } - - /* let's pretend to be a b2x0 */ - device->type = USRP_B200_DEV; - device->openair0_cfg=&openair0_cfg[0]; - return 0; -} diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index 7e897c7deb..66ce6ef247 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -1387,12 +1387,6 @@ int setup_RU_buffers(RU_t *ru) { else if (frame_parms->N_RB_DL == 50) ru->N_TA_offset = 624/2; else if (frame_parms->N_RB_DL == 25) ru->N_TA_offset = 624/4; - if(IS_SOFTMODEM_BASICSIM) - /* this is required for the basic simulator in TDD mode - * TODO: find a proper cleaner solution - */ - ru->N_TA_offset = 0; - if (frame_parms->N_RB_DL == 100) /* no scaling to do */; else if (frame_parms->N_RB_DL == 50) { ru->sf_extension /= 2; diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 2e95e56d85..90a0534136 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -360,12 +360,6 @@ void init_UE(int nb_inst, } } else UE->N_TA_offset = 0; - if( IS_SOFTMODEM_BASICSIM) - /* this is required for the basic simulator in TDD mode - * TODO: find a proper cleaner solution - */ - UE->N_TA_offset = 0; - 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); @@ -883,7 +877,7 @@ static void *UE_thread_rxn_txnp4(void *arg) proc->instance_cnt_rxtx--; - if ( IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM ) { + if (IS_SOFTMODEM_RFSIM) { if (pthread_cond_signal(&proc->cond_rxtx) != 0) abort(); } @@ -1998,12 +1992,6 @@ void *UE_thread(void *arg) log_scheduler(__func__); while (!oai_exit) { - if (IS_SOFTMODEM_BASICSIM) - while (!(UE->proc.instance_cnt_synch < 0)) { - printf("ue sync not ready\n"); - usleep(500*1000); - } - AssertFatal ( 0== pthread_mutex_lock(&UE->proc.mutex_synch), ""); int instance_cnt_synch = UE->proc.instance_cnt_synch; int is_synchronized = UE->is_synchronized; @@ -2121,7 +2109,7 @@ void *UE_thread(void *arg) // update thread index for received subframe UE->current_thread_id[sub_frame] = thread_idx; - if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM ) { + if (IS_SOFTMODEM_RFSIM ) { int t; for (t = 0; t < 2; t++) { @@ -2213,8 +2201,8 @@ void *UE_thread(void *arg) LOG_E(PHY,"can't compensate: diff =%d\n", first_symbols); } - /* no timeout in IS_SOFTMODEM_BASICSIM or IS_SOFTMODEM_RFSIM mode */ - if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM) { + /* no timeout in IS_SOFTMODEM_RFSIM mode */ + if (IS_SOFTMODEM_RFSIM) { ret = pthread_mutex_lock(&proc->mutex_rxtx); } else { struct timespec tv; diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index 2b39bd3f0f..8cdef647ca 100644 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -519,7 +519,7 @@ int restart_L1L2(module_id_t enb_id) { static void init_pdcp(int ue_id) { uint32_t pdcp_initmask = (!IS_SOFTMODEM_NOS1) ? LINK_ENB_PDCP_TO_GTPV1U_BIT : (LINK_ENB_PDCP_TO_GTPV1U_BIT | PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT); - if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM || (nfapi_getmode()==NFAPI_UE_STUB_PNF)) { + if (IS_SOFTMODEM_RFSIM || (nfapi_getmode()==NFAPI_UE_STUB_PNF)) { pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT; } From 4d4f946a10f10a7e59c0e6cc3d1abc08975cb273 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Fri, 18 Mar 2022 10:39:58 +0100 Subject: [PATCH 46/67] fix(ci): properly disabling basic-sim build and test and also the obsolete flexran-rtc Signed-off-by: Raphael Defosseux --- ci-scripts/Jenkinsfile-gitlab | 28 ---------------------------- ci-scripts/buildOnVM.sh | 2 +- ci-scripts/oai-ci-vm-tool | 9 ++++++++- ci-scripts/runTestOnVM.sh | 5 +++++ ci-scripts/waitBuildOnVM.sh | 4 ++-- 5 files changed, 16 insertions(+), 32 deletions(-) diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab index f331c975a8..54be9b653d 100644 --- a/ci-scripts/Jenkinsfile-gitlab +++ b/ci-scripts/Jenkinsfile-gitlab @@ -136,16 +136,6 @@ pipeline { // For the moment, there is no fail criteria. Just a notification of number of files that do not follow sh "./ci-scripts/checkCodingFormattingRules.sh" } - // With Mosaic 5G being part of OSA and making all it's repositories public - // No need to pass credentials to clone flexran-rtc - if (doMandatoryTests) { - sh "mkdir flexran" - dir ('flexran') { - sh "git clone https://gitlab.eurecom.fr/flexran/flexran-rtc.git . > ../git_clone.log 2>&1" - sh "git checkout develop >> ../git_clone.log 2>&1" - sh "zip -r -qq flexran.zip ." - } - } } } post { @@ -287,24 +277,6 @@ pipeline { parallel { stage ("VM-based tests") { stages { - stage ("Build Flexran Controller") { - when { - expression {doMandatoryTests} - } - steps { - lock (vmResource) { - script { - timeout (time: 20, unit: 'MINUTES') { - try { - sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant flexran-rtc --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" - } catch (Exception e) { - currentBuild.result = 'FAILURE' - } - } - } - } - } - } stage ("Test L1 simulator") { when { expression {doMandatoryTests} diff --git a/ci-scripts/buildOnVM.sh b/ci-scripts/buildOnVM.sh index f4cf3931dd..eaca22f550 100755 --- a/ci-scripts/buildOnVM.sh +++ b/ci-scripts/buildOnVM.sh @@ -62,7 +62,7 @@ function build_on_vm { echo "ARCHIVES_LOC = $ARCHIVES_LOC" echo "BUILD_OPTIONS = $BUILD_OPTIONS" - if [[ "$VM_NAME" == *"-enb-usrp"* ]] || [[ "$VM_NAME" == *"-cppcheck"* ]] || [[ "$VM_NAME" == *"-phy-sim"* ]] + if [[ "$VM_NAME" == *"-enb-usrp"* ]] || [[ "$VM_NAME" == *"-cppcheck"* ]] || [[ "$VM_NAME" == *"-phy-sim"* ]] || [[ "$VM_NAME" == *"-basic-sim"* ]] || [[ "$VM_NAME" == *"-flexran-rtc"* ]] then echo "This VM type is no longer supported in the pipeline framework" return diff --git a/ci-scripts/oai-ci-vm-tool b/ci-scripts/oai-ci-vm-tool index 49b9ee14f7..5c17d5d4f9 100755 --- a/ci-scripts/oai-ci-vm-tool +++ b/ci-scripts/oai-ci-vm-tool @@ -174,7 +174,14 @@ function variant__v1__enb_usrp { BUILD_OPTIONS="--eNB -w USRP --mu" VM_MEMORY=3072 } - + +function variant__v2__basic_sim { + NB_PATTERN_FILES=11 + BUILD_OPTIONS="--eNB --UE" + VM_MEMORY=8192 + RUN_OPTIONS="complex" +} + function variant__v3__phy_sim { NB_PATTERN_FILES=11 BUILD_OPTIONS="--phy_simulators" diff --git a/ci-scripts/runTestOnVM.sh b/ci-scripts/runTestOnVM.sh index 25e11edc4f..69f19a6cda 100755 --- a/ci-scripts/runTestOnVM.sh +++ b/ci-scripts/runTestOnVM.sh @@ -1292,6 +1292,11 @@ function run_test_on_vm { echo "This VM test type is no longer supported in the pipeline framework" return fi + if [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-basic-sim.* )) ]] + then + echo "This VM test type is no longer supported in the pipeline framework" + return + fi if [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-rf-sim.* )) ]] then ENB_VM_NAME=`echo $VM_NAME | sed -e "s#rf-sim#enb-ethernet#"` diff --git a/ci-scripts/waitBuildOnVM.sh b/ci-scripts/waitBuildOnVM.sh index 946c0866e2..73a8b558fe 100755 --- a/ci-scripts/waitBuildOnVM.sh +++ b/ci-scripts/waitBuildOnVM.sh @@ -47,7 +47,7 @@ function wait_on_vm_build { echo "ARCHIVES_LOC = $ARCHIVES_LOC" echo "BUILD_OPTIONS = $BUILD_OPTIONS" - if [[ "$VM_NAME" == *"-enb-usrp"* ]] || [[ "$VM_NAME" == *"-cppcheck"* ]] || [[ "$VM_NAME" == *"-phy-sim"* ]] + if [[ "$VM_NAME" == *"-enb-usrp"* ]] || [[ "$VM_NAME" == *"-cppcheck"* ]] || [[ "$VM_NAME" == *"-phy-sim"* ]] || [[ "$VM_NAME" == *"-basic-sim"* ]] || [[ "$VM_NAME" == *"-flexran-rtc"* ]] then echo "This VM type is no longer supported in the pipeline framework" return @@ -93,7 +93,7 @@ function wait_on_vm_build { } function check_on_vm_build { - if [[ "$VM_NAME" == *"-enb-usrp"* ]] || [[ "$VM_NAME" == *"-cppcheck"* ]] || [[ "$VM_NAME" == *"-phy-sim"* ]] + if [[ "$VM_NAME" == *"-enb-usrp"* ]] || [[ "$VM_NAME" == *"-cppcheck"* ]] || [[ "$VM_NAME" == *"-phy-sim"* ]] || [[ "$VM_NAME" == *"-basic-sim"* ]] || [[ "$VM_NAME" == *"-flexran-rtc"* ]] then echo "This VM type is no longer supported in the pipeline framework" return From 94f8e5b2134e78f0711a75a96b723e113829ba7a Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Fri, 18 Mar 2022 11:20:17 +0100 Subject: [PATCH 47/67] fix(ci): tcp_bridge_oai.Rel15.txt is no longer built. That's one less report file Signed-off-by: Raphael Defosseux --- ci-scripts/oai-ci-vm-tool | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ci-scripts/oai-ci-vm-tool b/ci-scripts/oai-ci-vm-tool index 5c17d5d4f9..8363c91461 100755 --- a/ci-scripts/oai-ci-vm-tool +++ b/ci-scripts/oai-ci-vm-tool @@ -200,28 +200,28 @@ function variant__v4__cppcheck { function variant__v5__gnb_usrp { VM_MEMORY=10240 VM_CPU=8 - NB_PATTERN_FILES=7 + NB_PATTERN_FILES=6 BUILD_OPTIONS="--gNB -w USRP" } function variant__v6__nr_ue_usrp { VM_MEMORY=4096 VM_CPU=4 - NB_PATTERN_FILES=7 + NB_PATTERN_FILES=6 BUILD_OPTIONS="--nrUE -w USRP" } function variant__v7__enb_ethernet { VM_MEMORY=4096 ARCHIVES_LOC=enb_eth - NB_PATTERN_FILES=7 + NB_PATTERN_FILES=6 BUILD_OPTIONS="--eNB -w USRP" } function variant__v8__ue_ethernet { VM_MEMORY=4096 ARCHIVES_LOC=ue_eth - NB_PATTERN_FILES=11 + NB_PATTERN_FILES=10 BUILD_OPTIONS="--UE -w USRP" } From 663ad7df5cf2718cc49471e6f0d70ad43b5ca291 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Fri, 18 Mar 2022 17:57:53 +0100 Subject: [PATCH 48/67] fix(ci): typo on bash variable setting Signed-off-by: Raphael Defosseux --- ci-scripts/runTestOnVM.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ci-scripts/runTestOnVM.sh b/ci-scripts/runTestOnVM.sh index 69f19a6cda..31ffa9d727 100755 --- a/ci-scripts/runTestOnVM.sh +++ b/ci-scripts/runTestOnVM.sh @@ -1932,11 +1932,11 @@ function run_test_on_vm { echo "SA test NOT OK" echo "try_cnt = " $try_cnt try_cnt=$((try_cnt+1)) - SA_106PRB_STATUS = -1 + SA_106PRB_STATUS=-1 else echo "SA test OK" try_cnt=$((try_cnt+10)) - SA_106PRB_STATUS = 0 + SA_106PRB_STATUS=0 fi done ########### end SA test @@ -2015,11 +2015,11 @@ function run_test_on_vm { echo "SA test NOT OK" echo "try_cnt = " $try_cnt try_cnt=$((try_cnt+1)) - SA_24PRB_STATUS = -1 + SA_24PRB_STATUS=-1 else echo "SA test OK" try_cnt=$((try_cnt+10)) - SA_24PRB_STATUS = 0 + SA_24PRB_STATUS=0 fi done ########### end SA test From f646b9a57c7f8f227de10443ca447fab0eb9e903 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 18 Mar 2022 07:57:39 +0100 Subject: [PATCH 49/67] Add parameter to disable 256 QAM activation --- openair1/SIMULATION/NR_PHY/dlsim.c | 2 +- openair1/SIMULATION/NR_PHY/ulsim.c | 2 +- openair2/COMMON/rrc_messages_types.h | 1 + openair2/GNB_APP/gnb_config.c | 4 ++- openair2/GNB_APP/gnb_paramdef.h | 7 +++++- openair2/RRC/NR/MESSAGES/asn1_msg.c | 4 +-- openair2/RRC/NR/nr_rrc_defs.h | 1 + openair2/RRC/NR/nr_rrc_proto.h | 2 ++ openair2/RRC/NR/rrc_gNB.c | 1 + openair2/RRC/NR/rrc_gNB_nsa.c | 37 +++++++++++----------------- openair2/RRC/NR/rrc_gNB_reconfig.c | 5 +++- 11 files changed, 36 insertions(+), 30 deletions(-) diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index e797c01096..b465f47a33 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -789,7 +789,7 @@ int main(int argc, char **argv) N_RB_DL,g_mcsTableIdx); // TODO do a UECAP for phy-sim - fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, UE_Capability_nr, 0, 1, n_tx, 6, 0, 0, 0); + fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, UE_Capability_nr, 0, 1, n_tx, 6, 0, 0, false, 0); /* RRC parameter validation for secondaryCellGroup */ fix_scd(scd); diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 76d896a047..4fc91b3858 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -731,7 +731,7 @@ int main(int argc, char **argv) prepare_scd(scd); // TODO do a UECAP for phy-sim - fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, NULL, 0, 1, n_tx, 0, 0, 0, 0); + fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, NULL, 0, 1, n_tx, 0, 0, 0, false, 0); // xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)secondaryCellGroup); diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index 769bc7d01d..28a08c1dac 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -418,6 +418,7 @@ typedef struct NRRrcConfigurationReq_s { int minRXTXTIME; int do_CSIRS; int do_SRS; + bool force_256qam_off; int pusch_TargetSNRx10; int pucch_TargetSNRx10; } gNB_RrcConfigurationReq; diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 2795c07ce7..ee0bbb6843 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1172,8 +1172,10 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { NRRRC_CONFIGURATION_REQ (msg_p).sib1_tda = *GNBParamList.paramarray[i][GNB_SIB1_TDA_IDX].iptr; LOG_I(RRC,"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; - printf("Do SRS %d\n",*GNBParamList.paramarray[i][GNB_DO_SRS_IDX].iptr); + LOG_I(RRC, "Do SRS %d\n",*GNBParamList.paramarray[i][GNB_DO_SRS_IDX].iptr); NRRRC_CONFIGURATION_REQ (msg_p).do_SRS = *GNBParamList.paramarray[i][GNB_DO_SRS_IDX].iptr; + NRRRC_CONFIGURATION_REQ (msg_p).force_256qam_off = *GNBParamList.paramarray[i][GNB_FORCE256QAMOFF_IDX].iptr; + LOG_I(RRC, "256 QAM: %s\n", NRRRC_CONFIGURATION_REQ (msg_p).force_256qam_off ? "force off" : "may be on"); NRRRC_CONFIGURATION_REQ (msg_p).scc = scc; NRRRC_CONFIGURATION_REQ (msg_p).scd = scd; diff --git a/openair2/GNB_APP/gnb_paramdef.h b/openair2/GNB_APP/gnb_paramdef.h index cde7819e25..1d88426336 100644 --- a/openair2/GNB_APP/gnb_paramdef.h +++ b/openair2/GNB_APP/gnb_paramdef.h @@ -122,8 +122,11 @@ typedef enum { #define GNB_CONFIG_STRING_NRCELLID "nr_cellid" #define GNB_CONFIG_STRING_MINRXTXTIME "min_rxtxtime" #define GNB_CONFIG_STRING_ULPRBBLACKLIST "ul_prbblacklist" +#define GNB_CONFIG_STRING_FORCE256QAMOFF "force_256qam_off" +#define GNB_CONFIG_HLP_FORCE256QAMOFF "suppress activation of 256 QAM despite UE support" + /*-----------------------------------------------------------------------------------------------------------------------------------------*/ /* cell configuration parameters */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ @@ -151,7 +154,8 @@ typedef enum { {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}, \ {GNB_CONFIG_STRING_MINRXTXTIME, 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_FORCE256QAMOFF, GNB_CONFIG_HLP_FORCE256QAMOFF, PARAMFLAG_BOOL, iptr:NULL, defintval:0, TYPE_INT, 0} \ } #define GNB_GNB_ID_IDX 0 @@ -177,6 +181,7 @@ typedef enum { #define GNB_NRCELLID_IDX 20 #define GNB_MINRXTXTIME_IDX 21 #define GNB_ULPRBBLACKLIST_IDX 22 +#define GNB_FORCE256QAMOFF_IDX 23 #define TRACKING_AREA_CODE_OKRANGE {0x0001,0xFFFD} #define GNBPARAMS_CHECK { \ diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index d04ed78270..cde4aa4482 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1462,14 +1462,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); + carrier->force_256qam_off ? NULL : uecap, 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, carrier->force_256qam_off ? NULL : uecap, bwp->bwp_Dedicated, carrier->servingcellconfigcommon); } } } diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index 1b2c38c835..b6c6ead920 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -456,6 +456,7 @@ typedef struct { int minRXTXTIME; int do_CSIRS; int do_SRS; + bool force_256qam_off; NR_BCCH_DL_SCH_Message_t *siblock1; NR_ServingCellConfigCommon_t *servingcellconfigcommon; NR_PDCCH_ConfigSIB1_t *pdcch_ConfigSIB1; diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index 7dceb55a4b..db16d4e00a 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -83,6 +83,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco int minRXTXTIMEpdsch, int do_csirs, int do_srs, + bool force_256qam_off, int uid); void config_csirs(NR_ServingCellConfigCommon_t *servingcellconfigcommon, @@ -100,6 +101,7 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon int minRXTXTIMEpdsch, int do_csirs, int do_srs, + bool force_256qam_off, int uid); void fill_default_rbconfig(NR_RadioBearerConfig_t *rbconfig, diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index d6c658f01d..85e264d1d8 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -224,6 +224,7 @@ char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigu rrc->carrier.sib1_tda = configuration->sib1_tda; rrc->carrier.do_CSIRS = configuration->do_CSIRS; rrc->carrier.do_SRS = configuration->do_SRS; + rrc->carrier.force_256qam_off = configuration->force_256qam_off; nr_rrc_config_ul_tda(configuration->scc,configuration->minRXTXTIME); /// System Information INIT pthread_mutex_init(&rrc->cell_info_mutex,NULL); diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index 70dfebaaf7..02f1edf55c 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -240,29 +240,20 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ cipher_algo, NR_SecurityConfig__keyToUse_secondary); } - if (ue_context_p->ue_context.spCellConfig) { - fill_default_reconfig(carrier->servingcellconfigcommon, - ue_context_p->ue_context.spCellConfig->spCellConfigDedicated, - reconfig_ies, - ue_context_p->ue_context.secondaryCellGroup, - ue_context_p->ue_context.UE_Capability_nr, - carrier->pdsch_AntennaPorts, - carrier->minRXTXTIME, - carrier->do_CSIRS, - carrier->do_SRS, - ue_context_p->local_uid); - } else { - fill_default_reconfig(carrier->servingcellconfigcommon, - NULL, - reconfig_ies, - ue_context_p->ue_context.secondaryCellGroup, - ue_context_p->ue_context.UE_Capability_nr, - carrier->pdsch_AntennaPorts, - carrier->minRXTXTIME, - carrier->do_CSIRS, - carrier->do_SRS, - ue_context_p->local_uid); - } + 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, + ue_context_p->ue_context.secondaryCellGroup, + ue_context_p->ue_context.UE_Capability_nr, + carrier->pdsch_AntennaPorts, + carrier->minRXTXTIME, + carrier->do_CSIRS, + carrier->do_SRS, + carrier->force_256qam_off, + ue_context_p->local_uid); ue_context_p->ue_id_rnti = ue_context_p->ue_context.secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity; NR_CG_Config_t *CG_Config = calloc(1,sizeof(*CG_Config)); memset((void *)CG_Config,0,sizeof(*CG_Config)); diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 1de34804df..80347bddf5 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -60,6 +60,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco int minRXTXTIME, int do_csirs, int do_srs, + bool force_256qam_off, int uid) { AssertFatal(servingcellconfigcommon!=NULL,"servingcellconfigcommon is null\n"); @@ -605,7 +606,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, force_256qam_off ? NULL : uecap, 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; @@ -1347,6 +1348,7 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon int minRXTXTIME, int do_csirs, int do_srs, + bool force_256qam_off, int uid) { AssertFatal(servingcellconfigcommon!=NULL,"servingcellconfigcommon is null\n"); AssertFatal(reconfig!=NULL,"reconfig is null\n"); @@ -1364,6 +1366,7 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon minRXTXTIME, do_csirs, do_srs, + force_256qam_off, uid); xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)secondaryCellGroup); From e89dfc02437537650174f770239412a58d093d35 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 18 Mar 2022 18:07:49 +0100 Subject: [PATCH 50/67] Refactor RRC: do not duplicate configuration in rrc_gNB_carrier_t --- openair2/RRC/NR/L2_nr_interface.c | 2 +- openair2/RRC/NR/MESSAGES/asn1_msg.c | 40 +++++----- openair2/RRC/NR/MESSAGES/asn1_msg.h | 18 +++-- openair2/RRC/NR/nr_rrc_defs.h | 8 -- openair2/RRC/NR/rrc_gNB.c | 116 ++++++++++++++-------------- openair2/RRC/NR/rrc_gNB_nsa.c | 31 ++++---- 6 files changed, 106 insertions(+), 109 deletions(-) diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index 1cf690ac0c..e30b55cc94 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -321,7 +321,7 @@ int8_t nr_mac_rrc_data_ind(const module_id_t module_idP, ue_context_p->ue_context.Srb0.Active = 1; RB_INSERT(rrc_nr_ue_tree_s, &RC.nrrrc[module_idP]->rrc_ue_head, ue_context_p); - fill_initial_cellGroupConfig(ue_context_p->local_uid,&cellGroupConfig,scc,&RC.nrrrc[module_idP]->carrier); + fill_initial_cellGroupConfig(ue_context_p->local_uid,&cellGroupConfig,scc, &RC.nrrrc[module_idP]->configuration); MessageDef* tmp=itti_alloc_new_message_sized(TASK_RRC_GNB, 0, F1AP_INITIAL_UL_RRC_MESSAGE, sizeof(f1ap_initial_ul_rrc_message_t) + sdu_lenP); f1ap_initial_ul_rrc_message_t *msg = &F1AP_INITIAL_UL_RRC_MESSAGE(tmp); diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index cde4aa4482..9a59d1977a 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -197,6 +197,7 @@ uint8_t do_MIB_NR(gNB_RRC_INST *rrc,uint32_t frame) { asn_enc_rval_t enc_rval; rrc_gNB_carrier_data_t *carrier = &rrc->carrier; + const gNB_RrcConfigurationReq *configuration = &rrc->configuration; NR_BCCH_BCH_Message_t *mib = &carrier->mib; NR_ServingCellConfigCommon_t *scc = carrier->servingcellconfigcommon; @@ -220,7 +221,7 @@ 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 = (carrier->ssb_SubcarrierOffset)&15; + mib->message.choice.mib->ssb_SubcarrierOffset = (configuration->ssb_SubcarrierOffset)&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 @@ -1007,8 +1008,8 @@ long rrc_get_max_nr_csrs(uint8_t max_rbs, long b_SRS) { void fill_initial_SpCellConfig(int uid, NR_SpCellConfig_t *SpCellConfig, NR_ServingCellConfigCommon_t *scc, - rrc_gNB_carrier_data_t *carrier) { - + const gNB_RrcConfigurationReq *configuration) +{ // This assert will never happen in the current implementation because NUMBER_OF_UE_MAX = 4. // However, if in the future NUMBER_OF_UE_MAX is increased, it will be necessary to improve the allocation of SRS resources, // where the startPosition = 2 or 3 and sl160 = 17, 17, 27 ... 157 only give us 30 different allocations. @@ -1139,7 +1140,7 @@ void fill_initial_SpCellConfig(int uid, ASN_SEQUENCE_ADD(&srs_resset0->srs_ResourceIdList->list,srs_resset0_id); srs_Config->srs_ResourceToReleaseList=NULL; - if(carrier->do_SRS) { + if (configuration->do_SRS) { srs_resset0->resourceType.present = NR_SRS_ResourceSet__resourceType_PR_periodic; srs_resset0->resourceType.choice.periodic = calloc(1,sizeof(*srs_resset0->resourceType.choice.periodic)); srs_resset0->resourceType.choice.periodic->associatedCSI_RS = NULL; @@ -1183,7 +1184,7 @@ void fill_initial_SpCellConfig(int uid, srs_res0->freqHopping.b_SRS); srs_res0->groupOrSequenceHopping=NR_SRS_Resource__groupOrSequenceHopping_neither; - if(carrier->do_SRS) { + if (configuration->do_SRS) { srs_res0->resourceType.present= NR_SRS_Resource__resourceType_PR_periodic; srs_res0->resourceType.choice.periodic=calloc(1,sizeof(*srs_res0->resourceType.choice.periodic)); srs_res0->resourceType.choice.periodic->periodicityAndOffset_p.present = NR_SRS_PeriodicityAndOffset_PR_sl160; @@ -1229,9 +1230,9 @@ void fill_initial_SpCellConfig(int uid, long *delay[8]; for (int i=0;i<8;i++) { delay[i] = calloc(1,sizeof(*delay[i])); - AssertFatal(carrier->minRXTXTIME >=2 && carrier->minRXTXTIME <7, - "check minRXTXTIME %d\n",carrier->minRXTXTIME); - *delay[i] = (i+carrier->minRXTXTIME); + AssertFatal(configuration->minRXTXTIME >= 2 && configuration->minRXTXTIME < 7, + "minRXTXTIME is %d but should be within [2,7)\n", configuration->minRXTXTIME); + *delay[i] = i + configuration->minRXTXTIME; ASN_SEQUENCE_ADD(&pucch_Config->dl_DataToUL_ACK->list,delay[i]); } @@ -1453,8 +1454,9 @@ void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGr void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, rrc_gNB_carrier_data_t *carrier, - NR_UE_NR_Capability_t *uecap) { - + NR_UE_NR_Capability_t *uecap, + const gNB_RrcConfigurationReq* configuration) +{ NR_SpCellConfig_t *SpCellConfig = cellGroupConfig->spCellConfig; if (SpCellConfig == NULL) return; @@ -1462,14 +1464,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, - carrier->force_256qam_off ? NULL : uecap, bwp_Dedicated, scc); + configuration->force_256qam_off ? NULL : uecap, 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, carrier->force_256qam_off ? NULL : uecap, bwp->bwp_Dedicated, carrier->servingcellconfigcommon); + set_dl_mcs_table(scs, configuration->force_256qam_off ? NULL : uecap, bwp->bwp_Dedicated, carrier->servingcellconfigcommon); } } } @@ -1478,8 +1480,8 @@ void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, void fill_initial_cellGroupConfig(int uid, NR_CellGroupConfig_t *cellGroupConfig, NR_ServingCellConfigCommon_t *scc, - rrc_gNB_carrier_data_t *carrier) { - + const gNB_RrcConfigurationReq *configuration) +{ NR_RLC_BearerConfig_t *rlc_BearerConfig = NULL; NR_RLC_Config_t *rlc_Config = NULL; NR_LogicalChannelConfig_t *logicalChannelConfig = NULL; @@ -1569,7 +1571,7 @@ void fill_initial_cellGroupConfig(int uid, cellGroupConfig->spCellConfig = calloc(1,sizeof(*cellGroupConfig->spCellConfig)); - fill_initial_SpCellConfig(uid,cellGroupConfig->spCellConfig,scc,carrier); + fill_initial_SpCellConfig(uid,cellGroupConfig->spCellConfig,scc,configuration); cellGroupConfig->sCellToAddModList = NULL; cellGroupConfig->sCellToReleaseList = NULL; @@ -1581,7 +1583,7 @@ uint8_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP, const uint8_t transaction_id, OCTET_STRING_t *masterCellGroup_from_DU, NR_ServingCellConfigCommon_t *scc, - rrc_gNB_carrier_data_t *carrier) + const gNB_RrcConfigurationReq *configuration) //------------------------------------------------------------------------------ { asn_enc_rval_t enc_rval; @@ -1648,7 +1650,7 @@ uint8_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP, } else { cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t)); - fill_initial_cellGroupConfig(ue_context_pP->local_uid,cellGroupConfig,scc,carrier); + fill_initial_cellGroupConfig(ue_context_pP->local_uid, cellGroupConfig, scc, configuration); enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, NULL, @@ -1896,6 +1898,7 @@ int16_t do_RRCReconfiguration( struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *dedicatedNAS_MessageList, rrc_gNB_ue_context_t *const ue_context_pP, rrc_gNB_carrier_data_t *carrier, + const gNB_RrcConfigurationReq *configuration, NR_MAC_CellGroupConfig_t *mac_CellGroupConfig, NR_CellGroupConfig_t *cellGroupConfig) //------------------------------------------------------------------------------ @@ -1949,7 +1952,8 @@ int16_t do_RRCReconfiguration( if(cellGroupConfig!=NULL){ update_cellGroupConfig(cellGroupConfig, carrier, - ue_context_pP->ue_context.UE_Capability_nr); + ue_context_pP->ue_context.UE_Capability_nr, + configuration); enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, NULL, (void *)cellGroupConfig, diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.h b/openair2/RRC/NR/MESSAGES/asn1_msg.h index 7fe08704c2..befe83b141 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.h +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.h @@ -101,18 +101,19 @@ uint8_t do_RRCReject(uint8_t Mod_id, uint8_t *const buffer); void fill_initial_SpCellConfig(int uid, - NR_SpCellConfig_t *SpCellConfig, - NR_ServingCellConfigCommon_t *scc, - rrc_gNB_carrier_data_t *carrier); + NR_SpCellConfig_t *SpCellConfig, + NR_ServingCellConfigCommon_t *scc, + const gNB_RrcConfigurationReq *configuration); void fill_initial_cellGroupConfig(int uid, - NR_CellGroupConfig_t *cellGroupConfig, - NR_ServingCellConfigCommon_t *scc, - rrc_gNB_carrier_data_t *carrier); + NR_CellGroupConfig_t *cellGroupConfig, + NR_ServingCellConfigCommon_t *scc, + const gNB_RrcConfigurationReq *configuration); void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, rrc_gNB_carrier_data_t *carrier, - NR_UE_NR_Capability_t *uecap); + NR_UE_NR_Capability_t *uecap, + const gNB_RrcConfigurationReq *configuration); void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGroupConfig_t *ue_context_mastercellGroup); @@ -121,7 +122,7 @@ uint8_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP, const uint8_t transaction_id, OCTET_STRING_t *masterCellGroup_from_DU, NR_ServingCellConfigCommon_t *scc, - rrc_gNB_carrier_data_t *carrier); + const gNB_RrcConfigurationReq *configuration); uint8_t do_NR_SecurityModeCommand( const protocol_ctxt_t *const ctxt_pP, @@ -151,6 +152,7 @@ int16_t do_RRCReconfiguration( struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *dedicatedNAS_MessageList, rrc_gNB_ue_context_t *const ue_context_pP, rrc_gNB_carrier_data_t *carrier, + const gNB_RrcConfigurationReq *configuration, NR_MAC_CellGroupConfig_t *mac_CellGroupConfig, NR_CellGroupConfig_t *cellGroupConfig); diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index b6c6ead920..4ba8c4c3fa 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -449,14 +449,6 @@ typedef struct { NR_SIB2_t *sib2; NR_SIB3_t *sib3; NR_BCCH_DL_SCH_Message_t systemInformation; // SIB23 - int ssb_SubcarrierOffset; - int sib1_tda; - int pdsch_AntennaPorts; - int pusch_AntennaPorts; - int minRXTXTIME; - int do_CSIRS; - int do_SRS; - bool force_256qam_off; NR_BCCH_DL_SCH_Message_t *siblock1; NR_ServingCellConfigCommon_t *servingcellconfigcommon; NR_PDCCH_ConfigSIB1_t *pdcch_ConfigSIB1; diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 85e264d1d8..86b767f83c 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -166,17 +166,16 @@ static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration if (NODE_IS_MONOLITHIC(rrc->node_type)){ rrc_mac_config_req_gNB(rrc->module_id, - rrc->carrier.ssb_SubcarrierOffset, - rrc->carrier.pdsch_AntennaPorts, - rrc->carrier.pusch_AntennaPorts, - rrc->carrier.sib1_tda, - rrc->carrier.minRXTXTIME, - (NR_ServingCellConfigCommon_t *)rrc->carrier.servingcellconfigcommon, - &rrc->carrier.mib, - 0, - 0, // WIP hardcoded rnti - (NR_CellGroupConfig_t *)NULL - ); + rrc->configuration.ssb_SubcarrierOffset, + rrc->configuration.pdsch_AntennaPorts, + rrc->configuration.pusch_AntennaPorts, + rrc->configuration.sib1_tda, + rrc->configuration.minRXTXTIME, + rrc->carrier.servingcellconfigcommon, + &rrc->carrier.mib, + 0, + 0, // WIP hardcoded rnti + NULL); } /* set flag to indicate that cell information is configured. This is required @@ -216,15 +215,8 @@ char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigu rrc->s1ap_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL); rrc->initial_id2_ngap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL); rrc->ngap_id2_ngap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL); + rrc->configuration = *configuration; rrc->carrier.servingcellconfigcommon = configuration->scc; - rrc->carrier.ssb_SubcarrierOffset = configuration->ssb_SubcarrierOffset; - rrc->carrier.pdsch_AntennaPorts = configuration->pdsch_AntennaPorts; - rrc->carrier.pusch_AntennaPorts = configuration->pusch_AntennaPorts; - rrc->carrier.minRXTXTIME = configuration->minRXTXTIME; - rrc->carrier.sib1_tda = configuration->sib1_tda; - rrc->carrier.do_CSIRS = configuration->do_CSIRS; - rrc->carrier.do_SRS = configuration->do_SRS; - rrc->carrier.force_256qam_off = configuration->force_256qam_off; nr_rrc_config_ul_tda(configuration->scc,configuration->minRXTXTIME); /// System Information INIT pthread_mutex_init(&rrc->cell_info_mutex,NULL); @@ -280,24 +272,25 @@ void apply_macrlc_config(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *const ue_context_pP, const protocol_ctxt_t *const ctxt_pP ) { - rrc_mac_config_req_gNB(rrc->module_id, - rrc->carrier.ssb_SubcarrierOffset, - rrc->carrier.pdsch_AntennaPorts, - rrc->carrier.pusch_AntennaPorts, - rrc->carrier.sib1_tda, - rrc->carrier.minRXTXTIME, - NULL, - NULL, - 0, - ue_context_pP->ue_context.rnti, - get_softmodem_params()->sa ? ue_context_pP->ue_context.masterCellGroup : (NR_CellGroupConfig_t *)NULL); + NR_CellGroupConfig_t *cgc = get_softmodem_params()->sa ? ue_context_pP->ue_context.masterCellGroup : NULL; + rrc_mac_config_req_gNB(rrc->module_id, + rrc->configuration.ssb_SubcarrierOffset, + rrc->configuration.pdsch_AntennaPorts, + rrc->configuration.pusch_AntennaPorts, + rrc->configuration.sib1_tda, + rrc->configuration.minRXTXTIME, + NULL, + NULL, + 0, + ue_context_pP->ue_context.rnti, + cgc); - nr_rrc_rlc_config_asn1_req(ctxt_pP, - ue_context_pP->ue_context.SRB_configList, - ue_context_pP->ue_context.DRB_configList, - NULL, - NULL, - get_softmodem_params()->sa ? ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList : NULL); + nr_rrc_rlc_config_asn1_req(ctxt_pP, + ue_context_pP->ue_context.SRB_configList, + ue_context_pP->ue_context.DRB_configList, + NULL, + NULL, + get_softmodem_params()->sa ? cgc->rlc_BearerToAddModList : NULL); } @@ -341,10 +334,11 @@ rrc_gNB_generate_RRCSetup( gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id]; ue_p->Srb0.Tx_buffer.payload_size = do_RRCSetup(ue_context_pP, - (uint8_t *) ue_p->Srb0.Tx_buffer.Payload, - rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id), - masterCellGroup_from_DU, - scc,&rrc->carrier); + (uint8_t *) ue_p->Srb0.Tx_buffer.Payload, + rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id), + masterCellGroup_from_DU, + scc, + &rrc->configuration); LOG_DUMPMSG(NR_RRC, DEBUG_RRC, (char *)(ue_p->Srb0.Tx_buffer.Payload), @@ -451,10 +445,11 @@ rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest( gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; ue_p->Srb0.Tx_buffer.payload_size = do_RRCSetup(ue_context_pP, - (uint8_t *) ue_p->Srb0.Tx_buffer.Payload, - rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id), - NULL, - scc,&rrc_instance_p->carrier); + (uint8_t *) ue_p->Srb0.Tx_buffer.Payload, + rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id), + NULL, + scc, + &rrc_instance_p->configuration); LOG_DUMPMSG(NR_RRC, DEBUG_RRC, (char *)(ue_p->Srb0.Tx_buffer.Payload), @@ -466,17 +461,16 @@ rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest( PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP)); rrc_mac_config_req_gNB(rrc_instance_p->module_id, - rrc_instance_p->carrier.ssb_SubcarrierOffset, - rrc_instance_p->carrier.pdsch_AntennaPorts, - rrc_instance_p->carrier.pusch_AntennaPorts, - rrc_instance_p->carrier.sib1_tda, - rrc_instance_p->carrier.minRXTXTIME, - (NR_ServingCellConfigCommon_t *)rrc_instance_p->carrier.servingcellconfigcommon, + rrc_instance_p->configuration.ssb_SubcarrierOffset, + rrc_instance_p->configuration.pdsch_AntennaPorts, + rrc_instance_p->configuration.pusch_AntennaPorts, + rrc_instance_p->configuration.sib1_tda, + rrc_instance_p->configuration.minRXTXTIME, + rrc_instance_p->carrier.servingcellconfigcommon, &rrc_instance_p->carrier.mib, 0, ue_context_pP->ue_context.rnti, - (NR_CellGroupConfig_t *)NULL - ); + NULL); LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCSetup (bytes %d)\n", @@ -724,6 +718,7 @@ rrc_gNB_generate_defaultRRCReconfiguration( dedicatedNAS_MessageList, ue_context_pP, &rrc->carrier, + &rrc->configuration, NULL, ue_p->masterCellGroup); @@ -987,6 +982,7 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( dedicatedNAS_MessageList, ue_context_pP, &rrc->carrier, + &rrc->configuration, NULL, cellGroupConfig); LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size,"[MSG] RRC Reconfiguration\n"); @@ -1160,6 +1156,7 @@ rrc_gNB_modify_dedicatedRRCReconfiguration( NULL, NULL, NULL, + NULL, NULL); LOG_DUMPMSG(NR_RRC, DEBUG_RRC, (char *)buffer, size, "[MSG] RRC Reconfiguration\n"); @@ -1260,6 +1257,7 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release( NULL, NULL, NULL, + NULL, NULL); ue_context_pP->ue_context.pdu_session_release_command_flag = 1; @@ -1363,17 +1361,16 @@ rrc_gNB_process_RRCReconfigurationComplete( if (!NODE_IS_CU(RC.nrrrc[ctxt_pP->module_id]->node_type)) { rrc_mac_config_req_gNB(rrc->module_id, - rrc->carrier.ssb_SubcarrierOffset, - rrc->carrier.pdsch_AntennaPorts, - rrc->carrier.pusch_AntennaPorts, - rrc->carrier.sib1_tda, - rrc->carrier.minRXTXTIME, + rrc->configuration.ssb_SubcarrierOffset, + rrc->configuration.pdsch_AntennaPorts, + rrc->configuration.pusch_AntennaPorts, + rrc->configuration.sib1_tda, + rrc->configuration.minRXTXTIME, NULL, NULL, 0, ue_context_pP->ue_context.rnti, - ue_context_pP->ue_context.masterCellGroup - ); + ue_context_pP->ue_context.masterCellGroup); LOG_D(NR_RRC,"Configuring RLC DRBs/SRBs for UE %x\n",ue_context_pP->ue_context.rnti); nr_rrc_rlc_config_asn1_req(ctxt_pP, SRB_configList, // NULL, @@ -1811,6 +1808,7 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete( NULL, NULL, NULL, + NULL, NULL); LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size, "[MSG] RRC Reconfiguration\n"); diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index 02f1edf55c..ce858aec94 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -116,6 +116,7 @@ RB_PROTOTYPE(rrc_nr_ue_tree_s, rrc_gNB_ue_context_s, entries, void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_p, x2ap_ENDC_sgnb_addition_req_t *m) { // generate nr-Config-r15 containers for LTE RRC : inside message for X2 EN-DC (CG-Config Message from 38.331) rrc_gNB_carrier_data_t *carrier=&rrc->carrier; + const gNB_RrcConfigurationReq *configuration = &rrc->configuration; MessageDef *msg; msg = itti_alloc_new_message(TASK_RRC_ENB, 0, X2AP_ENDC_SGNB_ADDITION_REQ_ACK); gtpv1u_enb_create_tunnel_req_t create_tunnel_req; @@ -248,11 +249,11 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ reconfig_ies, ue_context_p->ue_context.secondaryCellGroup, ue_context_p->ue_context.UE_Capability_nr, - carrier->pdsch_AntennaPorts, - carrier->minRXTXTIME, - carrier->do_CSIRS, - carrier->do_SRS, - carrier->force_256qam_off, + configuration->pdsch_AntennaPorts, + configuration->minRXTXTIME, + configuration->do_CSIRS, + configuration->do_SRS, + configuration->force_256qam_off, ue_context_p->local_uid); ue_context_p->ue_id_rnti = ue_context_p->ue_context.secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity; NR_CG_Config_t *CG_Config = calloc(1,sizeof(*CG_Config)); @@ -350,11 +351,11 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ // configure MAC and RLC if (NODE_IS_DU(rrc->node_type)) { rrc_mac_config_req_gNB(rrc->module_id, - rrc->carrier.ssb_SubcarrierOffset, - rrc->carrier.pdsch_AntennaPorts, - rrc->carrier.pusch_AntennaPorts, - rrc->carrier.sib1_tda, - rrc->carrier.minRXTXTIME, + rrc->configuration.ssb_SubcarrierOffset, + rrc->configuration.pdsch_AntennaPorts, + rrc->configuration.pusch_AntennaPorts, + rrc->configuration.sib1_tda, + rrc->configuration.minRXTXTIME, rrc->carrier.servingcellconfigcommon, &rrc->carrier.mib, 1, // add_ue flag @@ -362,11 +363,11 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ ue_context_p->ue_context.secondaryCellGroup); } else { rrc_mac_config_req_gNB(rrc->module_id, - rrc->carrier.ssb_SubcarrierOffset, - rrc->carrier.pdsch_AntennaPorts, - rrc->carrier.pusch_AntennaPorts, - rrc->carrier.sib1_tda, - rrc->carrier.minRXTXTIME, + rrc->configuration.ssb_SubcarrierOffset, + rrc->configuration.pdsch_AntennaPorts, + rrc->configuration.pusch_AntennaPorts, + rrc->configuration.sib1_tda, + rrc->configuration.minRXTXTIME, NULL, NULL, 1, // add_ue flag From 70265d9c64fdea6ed164fad20f4f2b7bffcd81f0 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 18 Mar 2022 18:45:14 +0100 Subject: [PATCH 51/67] Refactor fill_default_secondaryCellGroup(): less parameters --- openair1/SIMULATION/NR_PHY/dlsim.c | 9 +++++++- openair1/SIMULATION/NR_PHY/ulsim.c | 9 +++++++- openair2/RRC/NR/nr_rrc_proto.h | 12 ++--------- openair2/RRC/NR/rrc_gNB_nsa.c | 6 +----- openair2/RRC/NR/rrc_gNB_reconfig.c | 34 ++++++++++++------------------ 5 files changed, 33 insertions(+), 37 deletions(-) diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index b465f47a33..ddab46f8c2 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -789,7 +789,14 @@ int main(int argc, char **argv) N_RB_DL,g_mcsTableIdx); // TODO do a UECAP for phy-sim - fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, UE_Capability_nr, 0, 1, n_tx, 6, 0, 0, false, 0); + const gNB_RrcConfigurationReq conf = { + .pdsch_AntennaPorts = n_tx, + .minRXTXTIME = 6, + .do_CSIRS = 0, + .do_SRS = 0, + .force_256qam_off = false + }; + fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, UE_Capability_nr, 0, 1, &conf, 0); /* RRC parameter validation for secondaryCellGroup */ fix_scd(scd); diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 4fc91b3858..cb9e4ffbd8 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -731,7 +731,14 @@ int main(int argc, char **argv) prepare_scd(scd); // TODO do a UECAP for phy-sim - fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, NULL, 0, 1, n_tx, 0, 0, 0, false, 0); + const gNB_RrcConfigurationReq conf = { + .pdsch_AntennaPorts = n_tx, + .minRXTXTIME = 0, + .do_CSIRS = 0, + .do_SRS = 0, + .force_256qam_off = false + }; + fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, NULL, 0, 1, &conf, 0); // xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)secondaryCellGroup); diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index db16d4e00a..f1462fee34 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -79,11 +79,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco NR_UE_NR_Capability_t *uecap, int scg_id, int servCellIndex, - int dl_antenna_ports, - int minRXTXTIMEpdsch, - int do_csirs, - int do_srs, - bool force_256qam_off, + const gNB_RrcConfigurationReq *configuration, int uid); void config_csirs(NR_ServingCellConfigCommon_t *servingcellconfigcommon, @@ -97,11 +93,7 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon NR_RRCReconfiguration_IEs_t *reconfig, NR_CellGroupConfig_t *secondaryCellGroup, NR_UE_NR_Capability_t *uecap, - int dl_antenna_ports, - int minRXTXTIMEpdsch, - int do_csirs, - int do_srs, - bool force_256qam_off, + const gNB_RrcConfigurationReq *configuration, int uid); void fill_default_rbconfig(NR_RadioBearerConfig_t *rbconfig, diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index ce858aec94..ea34cdd65a 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -249,11 +249,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ reconfig_ies, ue_context_p->ue_context.secondaryCellGroup, ue_context_p->ue_context.UE_Capability_nr, - configuration->pdsch_AntennaPorts, - configuration->minRXTXTIME, - configuration->do_CSIRS, - configuration->do_SRS, - configuration->force_256qam_off, + configuration, ue_context_p->local_uid); ue_context_p->ue_id_rnti = ue_context_p->ue_context.secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity; NR_CG_Config_t *CG_Config = calloc(1,sizeof(*CG_Config)); diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 80347bddf5..5e2c8e366d 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -56,12 +56,11 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco NR_UE_NR_Capability_t *uecap, int scg_id, int servCellIndex, - int dl_antenna_ports, - int minRXTXTIME, - int do_csirs, - int do_srs, - bool force_256qam_off, - int uid) { + const gNB_RrcConfigurationReq *configuration, + int uid) +{ + const int dl_antenna_ports = configuration->pdsch_AntennaPorts; + const int do_csirs = configuration->do_CSIRS; AssertFatal(servingcellconfigcommon!=NULL,"servingcellconfigcommon is null\n"); AssertFatal(secondaryCellGroup!=NULL,"secondaryCellGroup is null\n"); @@ -606,7 +605,10 @@ 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, force_256qam_off ? NULL : uecap, bwp->bwp_Dedicated, servingcellconfigcommon); + set_dl_mcs_table(bwp->bwp_Common->genericParameters.subcarrierSpacing, + configuration->force_256qam_off ? NULL : uecap, + 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; @@ -771,7 +773,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ASN_SEQUENCE_ADD(&srs_resset0->srs_ResourceIdList->list,srs_resset0_id); srs_Config->srs_ResourceToReleaseList=NULL; - if(do_srs) { + if (configuration->do_SRS) { srs_resset0->resourceType.present = NR_SRS_ResourceSet__resourceType_PR_periodic; srs_resset0->resourceType.choice.periodic = calloc(1,sizeof(*srs_resset0->resourceType.choice.periodic)); srs_resset0->resourceType.choice.periodic->associatedCSI_RS = NULL; @@ -815,7 +817,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco srs_res0->freqHopping.b_SRS); srs_res0->groupOrSequenceHopping=NR_SRS_Resource__groupOrSequenceHopping_neither; - if(do_srs) { + if (configuration->do_SRS) { srs_res0->resourceType.present= NR_SRS_Resource__resourceType_PR_periodic; srs_res0->resourceType.choice.periodic=calloc(1,sizeof(*srs_res0->resourceType.choice.periodic)); srs_res0->resourceType.choice.periodic->periodicityAndOffset_p.present = NR_SRS_PeriodicityAndOffset_PR_sl160; @@ -936,7 +938,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco long *delay[8]; for (int i=0;i<8;i++) { delay[i] = calloc(1,sizeof(*delay[i])); - *delay[i] = i+minRXTXTIME; + *delay[i] = i + configuration->minRXTXTIME; ASN_SEQUENCE_ADD(&pucch_Config->dl_DataToUL_ACK->list,delay[i]); } pucch_Config->spatialRelationInfoToAddModList = calloc(1,sizeof(*pucch_Config->spatialRelationInfoToAddModList)); @@ -1344,11 +1346,7 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon NR_RRCReconfiguration_IEs_t *reconfig, NR_CellGroupConfig_t *secondaryCellGroup, NR_UE_NR_Capability_t *uecap, - int dl_antenna_ports, - int minRXTXTIME, - int do_csirs, - int do_srs, - bool force_256qam_off, + const gNB_RrcConfigurationReq *configuration, int uid) { AssertFatal(servingcellconfigcommon!=NULL,"servingcellconfigcommon is null\n"); AssertFatal(reconfig!=NULL,"reconfig is null\n"); @@ -1362,11 +1360,7 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon uecap, 1, 1, - dl_antenna_ports, - minRXTXTIME, - do_csirs, - do_srs, - force_256qam_off, + configuration, uid); xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)secondaryCellGroup); From 408c9ec7c2aeae0cd806e4a17d47dff7d4ae4bb9 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Wed, 23 Mar 2022 22:17:03 +0000 Subject: [PATCH 52/67] Fix RIV value for 162 PRBs --- .../conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf | 4 ++-- .../CONF/gnb.sa.band78.fr1.162PRB.2x2.usrpn300.conf | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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 2361437f7c..fef2a47b9b 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 @@ -83,7 +83,7 @@ gNBs = #initialDownlinkBWP #genericParameters # this is RBstart=0,L=106 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 31899; + initialDLBWPlocationAndBandwidth = 31624; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; @@ -103,7 +103,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 31899; + initialULBWPlocationAndBandwidth = 31624; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; 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 fac54a298b..3e2c8fc95c 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 @@ -66,7 +66,7 @@ gNBs = #initialDownlinkBWP #genericParameters # this is RBstart=0,L=162 (275*(275-L+1))+(274-RBstart)) - initialDLBWPlocationAndBandwidth = 31899; + initialDLBWPlocationAndBandwidth = 31624; # # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 @@ -100,7 +100,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 31899; + initialULBWPlocationAndBandwidth = 31624; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; From 1a60377c56651244adf433eec9e6206c14e5cd97 Mon Sep 17 00:00:00 2001 From: Manish Date: Thu, 24 Mar 2022 08:05:53 +0000 Subject: [PATCH 53/67] Updating the 5G RF simulator tutorial for registration of 2 OAI UE with 5GC Signed-off-by: Manish --- .../yaml_files/5g_rfsimulator/README.md | 112 +++++++++++++++++- 1 file changed, 109 insertions(+), 3 deletions(-) diff --git a/ci-scripts/yaml_files/5g_rfsimulator/README.md b/ci-scripts/yaml_files/5g_rfsimulator/README.md index fc562dd1eb..5eb2a789a9 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/README.md +++ b/ci-scripts/yaml_files/5g_rfsimulator/README.md @@ -23,6 +23,7 @@ This page is only valid for an `Ubuntu18` host. 1. [Deploy OAI 5G Core Network](#21-deploy-oai-5g-core-network) 2. [Deploy OAI gNB in RF simulator mode and in Standalone Mode](#22-deploy-oai-gnb-in-rf-simulator-mode-and-in-standalone-mode) 3. [Deploy OAI NR-UE in RF simulator mode and in Standalone Mode](#23-deploy-oai-nr-ue-in-rf-simulator-mode-and-in-standalone-mode) + 4. [Deploy Second OAI NR-UE in RF simulator mode and in Standalone Mode](#24-deploy-second-oai-nr-ue-in-rf-simulator-mode-and-in-standalone-mode) 3. [Check traffic](#3-check-traffic) 1. [Check your Internet connectivity](#31-check-your-internet-connectivity) 2. [Start the iperf server inside the NR-UE container](#32-start-the-iperf-server-inside-the-nr-ue-container) @@ -203,6 +204,8 @@ $ docker logs rfsim5g-oai-amf $ docker-compose up -d oai-nr-ue rfsim5g-mysql is up-to-date rfsim5g-oai-nrf is up-to-date +rfsim5g-oai-amf is up-to-date +rfsim5g-oai-smf is up-to-date rfsim5g-oai-spgwu is up-to-date rfsim5g-oai-ext-dn is up-to-date rfsim5g-oai-gnb is up-to-date @@ -255,6 +258,98 @@ oaitun_ue1: flags=4305 mtu 1500 TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 ``` +## 2.4. Deploy Second OAI NR-UE in RF simulator mode and in Standalone Mode ## + +```bash +Create a entry for new IMSI (208990100001101) in oai_db.sql file +Refer Section - [Making the NR-UE connect to the core network](#51-making-the-nr-ue-connect-to-the-core-network) + +Create entry for Second UE in docker-compose.yaml file as follows: + oai-nr-ue2: + image: oai-nr-ue:develop + privileged: true + container_name: rfsim5g-oai-nr-ue2 + environment: + RFSIMULATOR: 192.168.71.136 + FULL_IMSI: '208990100001101' + FULL_KEY: 'fec86ba6eb707ed08905757b1bb44b8f' + OPC: 'C42449363BBAD02B66D16BC975D77CC1' + DNN: oai + NSSAI_SST: 1 + NSSAI_SD: 1 + USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 -C 3619200000 --nokrnmod --log_config.global_log_options level,nocolor,time + depends_on: + - oai-gnb + networks: + public_net: + ipv4_address: 192.168.71.138 + healthcheck: + test: /bin/bash -c "pgrep nr-uesoftmodem" + interval: 10s + timeout: 5s + retries: 5 +``` + + +```bash +$ docker-compose up -d oai-nr-ue2 +rfsim5g-mysql is up-to-date +rfsim5g-oai-nrf is up-to-date +rfsim5g-oai-amf is up-to-date +rfsim5g-oai-smf is up-to-date +rfsim5g-oai-spgwu is up-to-date +rfsim5g-oai-ext-dn is up-to-date +rfsim5g-oai-gnb is up-to-date +Creating rfsim5g-oai-nr-ue2 ... done +``` + +Wait for a bit. + +```bash +$ docker-compose ps -a + Name Command State Ports +------------------------------------------------------------------------------------------------- +rfsim5g-mysql docker-entrypoint.sh mysqld Up (healthy) 3306/tcp, 33060/tcp +rfsim5g-oai-amf /bin/bash /openair-amf/bin ... Up (healthy) 38412/sctp, 80/tcp, 9090/tcp +rfsim5g-oai-ext-dn /bin/bash -c apt update; ... Up (healthy) +rfsim5g-oai-gnb /opt/oai-gnb/bin/entrypoin ... Up (healthy) +rfsim5g-oai-nr-ue /opt/oai-nr-ue/bin/entrypo ... Up (healthy) +rfsim5g-oai-nr-ue2 /opt/oai-nr-ue/bin/entrypo ... Up (healthy) +rfsim5g-oai-nrf /bin/bash /openair-nrf/bin ... Up (healthy) 80/tcp, 9090/tcp +rfsim5g-oai-smf /bin/bash /openair-smf/bin ... Up (healthy) 80/tcp, 8805/udp, 9090/tcp +rfsim5g-oai-spgwu /openair-spgwu-tiny/bin/en ... Up (healthy) 2152/udp, 8805/udp +``` + +Making sure the Second OAI UE is connected: + +```bash +$ docker exec -it rfsim5g-oai-nr-ue2 /bin/bash +root@bb4d400a832d:/opt/oai-nr-ue# ifconfig +eth0: flags=4163 mtu 1500 + inet 192.168.71.138 netmask 255.255.255.192 broadcast 192.168.71.191 + ether 02:42:c0:a8:47:8a txqueuelen 0 (Ethernet) + RX packets 3192021 bytes 67784900946 (67.7 GB) + RX errors 0 dropped 0 overruns 0 frame 0 + TX packets 3397743 bytes 91320004542 (91.3 GB) + TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 + +lo: flags=73 mtu 65536 + inet 127.0.0.1 netmask 255.0.0.0 + loop txqueuelen 1000 (Local Loopback) + RX packets 0 bytes 0 (0.0 B) + RX errors 0 dropped 0 overruns 0 frame 0 + TX packets 0 bytes 0 (0.0 B) + TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 + +oaitun_ue1: flags=4305 mtu 1500 + inet 12.1.1.3 netmask 255.255.255.0 destination 12.1.1.3 + unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 500 (UNSPEC) + RX packets 0 bytes 0 (0.0 B) + RX errors 0 dropped 0 overruns 0 frame 0 + TX packets 0 bytes 0 (0.0 B) + TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 +``` + # 3. Check traffic # ## 3.1. Check your Internet connectivity ## @@ -299,6 +394,9 @@ Let now try to check UDP traffic in Downlink. You will need 2 terminals: one in the NR-UE container, one in the ext-dn container. +Note: +Similarly, Second OAI UE Internet connectivity can be checked. + ## 3.2. Start the `iperf` server inside the NR-UE container ## ```bash @@ -384,24 +482,26 @@ The `500 Kbits/sec` value may change depending on your CPU power! ```bash $ docker-compose down +Stopping rfsim5g-oai-nr-ue2 ... done Stopping rfsim5g-oai-nr-ue ... done Stopping rfsim5g-oai-gnb ... done Stopping rfsim5g-oai-ext-dn ... done +Stopping rfsim5g-oai-spgwu ... done Stopping rfsim5g-oai-smf ... done Stopping rfsim5g-oai-amf ... done -Stopping rfsim5g-oai-spgwu ... done Stopping rfsim5g-oai-nrf ... done Stopping rfsim5g-mysql ... done +Removing rfsim5g-oai-nr-ue2 ... done Removing rfsim5g-oai-nr-ue ... done Removing rfsim5g-oai-gnb ... done Removing rfsim5g-oai-ext-dn ... done +Removing rfsim5g-oai-spgwu ... done Removing rfsim5g-oai-smf ... done Removing rfsim5g-oai-amf ... done -Removing rfsim5g-oai-spgwu ... done Removing rfsim5g-oai-nrf ... done Removing rfsim5g-mysql ... done Removing network rfsim5g-oai-public-net -Removing network rfsim5g-oai-traffic_net-net +Removing network rfsim5g-oai-traffic-net ``` # 5. Explanations on the configuration in the `docker-compose.yaml` # @@ -419,13 +519,19 @@ This value is also present in the `oai_db.sql` file: ```bash INSERT INTO `users` VALUES ('208990100001100','1','55000000000000',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0xfec86ba6eb707ed08905757b1bb44b8f,0,0,0x40,'ebd07771ace8677a',0xc42449363bbad02b66d16bc975d77cc1); +INSERT INTO `users` VALUES ('208990100001101','1','55000000000000',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0xfec86ba6eb707ed08905757b1bb44b8f,0,0,0x40,'ebd07771ace8677a',0xc42449363bbad02b66d16bc975d77cc1); ``` As you can see, 2 other values shall match in the NR-UE section of `docker-compose.yaml`: +OAI UE - 1 * `FULL_IMSI: '208990100001100'` * `FULL_KEY: 'fec86ba6eb707ed08905757b1bb44b8f'` +OAI UE - 2 +* `FULL_IMSI: '208990100001101'` +* `FULL_KEY: 'fec86ba6eb707ed08905757b1bb44b8f'` + We are also using a dedicated `oai-smf.conf` for the `SMF` container: the `oai` DNN shall match the one in the NR-UE section of `docker-compose.yaml` (`DNN: oai`). ## 5.2. Making the gNB connect to the core network ## From 154c5d587c8009616cb6a6af41eed002c363e4b6 Mon Sep 17 00:00:00 2001 From: Manish Date: Thu, 24 Mar 2022 08:05:53 +0000 Subject: [PATCH 54/67] Updating the 5G RF simulator tutorial for registration of 2 OAI UE with 5GC Signed-off-by: Manish --- .../yaml_files/5g_rfsimulator/README.md | 112 +++++++++++++++++- 1 file changed, 109 insertions(+), 3 deletions(-) diff --git a/ci-scripts/yaml_files/5g_rfsimulator/README.md b/ci-scripts/yaml_files/5g_rfsimulator/README.md index fc562dd1eb..5eb2a789a9 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/README.md +++ b/ci-scripts/yaml_files/5g_rfsimulator/README.md @@ -23,6 +23,7 @@ This page is only valid for an `Ubuntu18` host. 1. [Deploy OAI 5G Core Network](#21-deploy-oai-5g-core-network) 2. [Deploy OAI gNB in RF simulator mode and in Standalone Mode](#22-deploy-oai-gnb-in-rf-simulator-mode-and-in-standalone-mode) 3. [Deploy OAI NR-UE in RF simulator mode and in Standalone Mode](#23-deploy-oai-nr-ue-in-rf-simulator-mode-and-in-standalone-mode) + 4. [Deploy Second OAI NR-UE in RF simulator mode and in Standalone Mode](#24-deploy-second-oai-nr-ue-in-rf-simulator-mode-and-in-standalone-mode) 3. [Check traffic](#3-check-traffic) 1. [Check your Internet connectivity](#31-check-your-internet-connectivity) 2. [Start the iperf server inside the NR-UE container](#32-start-the-iperf-server-inside-the-nr-ue-container) @@ -203,6 +204,8 @@ $ docker logs rfsim5g-oai-amf $ docker-compose up -d oai-nr-ue rfsim5g-mysql is up-to-date rfsim5g-oai-nrf is up-to-date +rfsim5g-oai-amf is up-to-date +rfsim5g-oai-smf is up-to-date rfsim5g-oai-spgwu is up-to-date rfsim5g-oai-ext-dn is up-to-date rfsim5g-oai-gnb is up-to-date @@ -255,6 +258,98 @@ oaitun_ue1: flags=4305 mtu 1500 TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 ``` +## 2.4. Deploy Second OAI NR-UE in RF simulator mode and in Standalone Mode ## + +```bash +Create a entry for new IMSI (208990100001101) in oai_db.sql file +Refer Section - [Making the NR-UE connect to the core network](#51-making-the-nr-ue-connect-to-the-core-network) + +Create entry for Second UE in docker-compose.yaml file as follows: + oai-nr-ue2: + image: oai-nr-ue:develop + privileged: true + container_name: rfsim5g-oai-nr-ue2 + environment: + RFSIMULATOR: 192.168.71.136 + FULL_IMSI: '208990100001101' + FULL_KEY: 'fec86ba6eb707ed08905757b1bb44b8f' + OPC: 'C42449363BBAD02B66D16BC975D77CC1' + DNN: oai + NSSAI_SST: 1 + NSSAI_SD: 1 + USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 -C 3619200000 --nokrnmod --log_config.global_log_options level,nocolor,time + depends_on: + - oai-gnb + networks: + public_net: + ipv4_address: 192.168.71.138 + healthcheck: + test: /bin/bash -c "pgrep nr-uesoftmodem" + interval: 10s + timeout: 5s + retries: 5 +``` + + +```bash +$ docker-compose up -d oai-nr-ue2 +rfsim5g-mysql is up-to-date +rfsim5g-oai-nrf is up-to-date +rfsim5g-oai-amf is up-to-date +rfsim5g-oai-smf is up-to-date +rfsim5g-oai-spgwu is up-to-date +rfsim5g-oai-ext-dn is up-to-date +rfsim5g-oai-gnb is up-to-date +Creating rfsim5g-oai-nr-ue2 ... done +``` + +Wait for a bit. + +```bash +$ docker-compose ps -a + Name Command State Ports +------------------------------------------------------------------------------------------------- +rfsim5g-mysql docker-entrypoint.sh mysqld Up (healthy) 3306/tcp, 33060/tcp +rfsim5g-oai-amf /bin/bash /openair-amf/bin ... Up (healthy) 38412/sctp, 80/tcp, 9090/tcp +rfsim5g-oai-ext-dn /bin/bash -c apt update; ... Up (healthy) +rfsim5g-oai-gnb /opt/oai-gnb/bin/entrypoin ... Up (healthy) +rfsim5g-oai-nr-ue /opt/oai-nr-ue/bin/entrypo ... Up (healthy) +rfsim5g-oai-nr-ue2 /opt/oai-nr-ue/bin/entrypo ... Up (healthy) +rfsim5g-oai-nrf /bin/bash /openair-nrf/bin ... Up (healthy) 80/tcp, 9090/tcp +rfsim5g-oai-smf /bin/bash /openair-smf/bin ... Up (healthy) 80/tcp, 8805/udp, 9090/tcp +rfsim5g-oai-spgwu /openair-spgwu-tiny/bin/en ... Up (healthy) 2152/udp, 8805/udp +``` + +Making sure the Second OAI UE is connected: + +```bash +$ docker exec -it rfsim5g-oai-nr-ue2 /bin/bash +root@bb4d400a832d:/opt/oai-nr-ue# ifconfig +eth0: flags=4163 mtu 1500 + inet 192.168.71.138 netmask 255.255.255.192 broadcast 192.168.71.191 + ether 02:42:c0:a8:47:8a txqueuelen 0 (Ethernet) + RX packets 3192021 bytes 67784900946 (67.7 GB) + RX errors 0 dropped 0 overruns 0 frame 0 + TX packets 3397743 bytes 91320004542 (91.3 GB) + TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 + +lo: flags=73 mtu 65536 + inet 127.0.0.1 netmask 255.0.0.0 + loop txqueuelen 1000 (Local Loopback) + RX packets 0 bytes 0 (0.0 B) + RX errors 0 dropped 0 overruns 0 frame 0 + TX packets 0 bytes 0 (0.0 B) + TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 + +oaitun_ue1: flags=4305 mtu 1500 + inet 12.1.1.3 netmask 255.255.255.0 destination 12.1.1.3 + unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 500 (UNSPEC) + RX packets 0 bytes 0 (0.0 B) + RX errors 0 dropped 0 overruns 0 frame 0 + TX packets 0 bytes 0 (0.0 B) + TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 +``` + # 3. Check traffic # ## 3.1. Check your Internet connectivity ## @@ -299,6 +394,9 @@ Let now try to check UDP traffic in Downlink. You will need 2 terminals: one in the NR-UE container, one in the ext-dn container. +Note: +Similarly, Second OAI UE Internet connectivity can be checked. + ## 3.2. Start the `iperf` server inside the NR-UE container ## ```bash @@ -384,24 +482,26 @@ The `500 Kbits/sec` value may change depending on your CPU power! ```bash $ docker-compose down +Stopping rfsim5g-oai-nr-ue2 ... done Stopping rfsim5g-oai-nr-ue ... done Stopping rfsim5g-oai-gnb ... done Stopping rfsim5g-oai-ext-dn ... done +Stopping rfsim5g-oai-spgwu ... done Stopping rfsim5g-oai-smf ... done Stopping rfsim5g-oai-amf ... done -Stopping rfsim5g-oai-spgwu ... done Stopping rfsim5g-oai-nrf ... done Stopping rfsim5g-mysql ... done +Removing rfsim5g-oai-nr-ue2 ... done Removing rfsim5g-oai-nr-ue ... done Removing rfsim5g-oai-gnb ... done Removing rfsim5g-oai-ext-dn ... done +Removing rfsim5g-oai-spgwu ... done Removing rfsim5g-oai-smf ... done Removing rfsim5g-oai-amf ... done -Removing rfsim5g-oai-spgwu ... done Removing rfsim5g-oai-nrf ... done Removing rfsim5g-mysql ... done Removing network rfsim5g-oai-public-net -Removing network rfsim5g-oai-traffic_net-net +Removing network rfsim5g-oai-traffic-net ``` # 5. Explanations on the configuration in the `docker-compose.yaml` # @@ -419,13 +519,19 @@ This value is also present in the `oai_db.sql` file: ```bash INSERT INTO `users` VALUES ('208990100001100','1','55000000000000',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0xfec86ba6eb707ed08905757b1bb44b8f,0,0,0x40,'ebd07771ace8677a',0xc42449363bbad02b66d16bc975d77cc1); +INSERT INTO `users` VALUES ('208990100001101','1','55000000000000',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0xfec86ba6eb707ed08905757b1bb44b8f,0,0,0x40,'ebd07771ace8677a',0xc42449363bbad02b66d16bc975d77cc1); ``` As you can see, 2 other values shall match in the NR-UE section of `docker-compose.yaml`: +OAI UE - 1 * `FULL_IMSI: '208990100001100'` * `FULL_KEY: 'fec86ba6eb707ed08905757b1bb44b8f'` +OAI UE - 2 +* `FULL_IMSI: '208990100001101'` +* `FULL_KEY: 'fec86ba6eb707ed08905757b1bb44b8f'` + We are also using a dedicated `oai-smf.conf` for the `SMF` container: the `oai` DNN shall match the one in the NR-UE section of `docker-compose.yaml` (`DNN: oai`). ## 5.2. Making the gNB connect to the core network ## From 7bdf4f19a79ddcbc5245c0257b29843573c976ce Mon Sep 17 00:00:00 2001 From: Manish Date: Thu, 24 Mar 2022 11:09:35 +0000 Subject: [PATCH 55/67] OAI Database Updated for IMSI and OAI UE Added in Docker Compose. Signed-off-by: Manish --- .../5g_rfsimulator/docker-compose.yaml | 24 +++++++++++++++++++ .../yaml_files/5g_rfsimulator/oai_db.sql | 1 + 2 files changed, 25 insertions(+) diff --git a/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml index 808be7d83d..f27ec3050d 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml @@ -279,6 +279,30 @@ services: timeout: 5s retries: 5 + oai-nr-ue2: + image: oai-nr-ue:develop + privileged: true + container_name: rfsim5g-oai-nr-ue2 + environment: + RFSIMULATOR: 192.168.71.140 + FULL_IMSI: '208990100001101' + FULL_KEY: 'fec86ba6eb707ed08905757b1bb44b8f' + OPC: 'C42449363BBAD02B66D16BC975D77CC1' + DNN: oai + NSSAI_SST: 1 + NSSAI_SD: 1 + USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 -C 3619200000 --nokrnmod --log_config.global_log_options level,nocolor,time + depends_on: + - oai-gnb + networks: + public_net: + ipv4_address: 192.168.71.151 + healthcheck: + test: /bin/bash -c "pgrep nr-uesoftmodem" + interval: 10s + timeout: 5s + retries: 5 + networks: public_net: driver: bridge diff --git a/ci-scripts/yaml_files/5g_rfsimulator/oai_db.sql b/ci-scripts/yaml_files/5g_rfsimulator/oai_db.sql index fbd7907a71..75f586c299 100755 --- a/ci-scripts/yaml_files/5g_rfsimulator/oai_db.sql +++ b/ci-scripts/yaml_files/5g_rfsimulator/oai_db.sql @@ -192,6 +192,7 @@ LOCK TABLES `users` WRITE; /*!40000 ALTER TABLE `users` DISABLE KEYS */; INSERT INTO `users` VALUES ('20834123456789','380561234567','35609204079300',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,'+�E��ų\0�,IH��H',0,0,00000000000000000096,'Px�X \Z1��x��','^��K�����FeU���'),('20810000001234','33611123456','35609204079299',NULL,'PURGED',120,40000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000281454575616225,'\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0','�4�s@���z��~�'),('31002890832150','33638060059','35611302209414',NULL,'PURGED',120,40000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012416,'`�F�݆��D��ϛ���','�4�s@���z��~�'),('001010123456789','33600101789','35609204079298',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'\0 \n \r',1,0,00000000000000000351,'\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0','L�*\\�����^��]� '),('208930000000001','33638030001','35609204079301',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208950000000002','33638050002','35609204079502',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000020471,'\0 \n \r','�4�s@���z��~�'),('208950000000003','33638050003','35609204079503',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012343,'\0 \n \r','�4�s@���z��~�'),('208950000000004','33638050004','35609204079504',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000005','33638050005','35609204079505',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000001','33638050001','35609204079501',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208950000000006','33638050006','35609204079506',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000007','33638050007','35609204079507',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208930000000002','33638030002','35609204079302',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208930000000003','33638030003','35609204079303',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208930000000004','33638030004','35609204079304',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208930000000005','33638030005','35609204079305',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208930000000006','33638030006','35609204079306',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208930000000007','33638030007','35609204079307',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208940000000007','33638040007','35609204079407',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208940000000006','33638040006','35609204079406',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208940000000005','33638040005','35609204079405',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208940000000004','33638040004','35609204079404',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208940000000003','33638040003','35609204079403',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208940000000002','33638040002','35609204079402',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208940000000001','33638040001','35609204079401',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208920100001100','33638020001','35609204079201',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001101','33638020001','35609204079201',NULL,'NOT_PURGED',120,50000000,100000000,47,0000000000,1,'��k��p~Љu{�K�',1,0,00000281044204937234,'\0 \n \r','�$I6;��+f�k�u�|�'),('208920100001102','33638020002','35609204079202',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001103','33638020003','35609204079203',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001104','33638020004','35609204079204',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001105','33638020005','35609204079205',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001106','33638020006','35609204079206',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��k��p~Љu{�K�',1,0,00000000000000006103,'ebd07771ace8677a','�$I6;��+f�k�u�|�'),('208920100001107','33638020007','35609204079207',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001108','33638020008','35609204079208',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001109','33638020009','35609204079209',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001110','33638020010','35609204079210',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208930100001111','33638030011','35609304079211',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208930100001112','33638030012','35609304079212',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208930100001113','33638030013','35609304079213',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006263,'�SNܒ�Iv��e�6','�4�s@���z��~�'),('208950000000008','33638050008','35609204079508',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000009','33638050009','35609204079509',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000010','33638050010','35609204079510',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000011','33638050011','35609204079511',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000012','33638050012','35609204079512',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000013','33638050013','35609204079513',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000014','33638050014','35609204079514',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000015','33638050015','35609204079515',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000000000,'3536663032363164','�4�s@���z��~�'),('208920100001118','33638020010','35609204079210',NULL,'NOT_PURGED',120,50000000,100000000,47,0000000000,1,'��k��p~Љu{�K�',1,0,00000281044204934762,'~?03�u-%�ey�y�','�$I6;��+f�k�u�|�'),('208920100001121','33638020010','35609204079210',NULL,'NOT_PURGED',120,50000000,100000000,47,0000000000,1,'��k��p~Љu{�K�',1,0,00000281044204935293,'&��@xg�]���\n��Vp','�$I6;��+f�k�u�|�'),('208920100001119','33638020010','35609204079210',NULL,'NOT_PURGED',120,50000000,100000000,47,0000000000,1,'��k��p~Љu{�K�',1,0,00000281044204935293,'269482407867805d','�$I6;��+f�k�u�|�'),('208920100001120','33638020010','35609204079210',NULL,'NOT_PURGED',120,50000000,100000000,47,0000000000,1,'��k��p~Љu{�K�',1,0,00000281044204935293,'3236393438323430','�$I6;��+f�k�u�|�'); INSERT INTO `users` VALUES ('208990100001100','1','55000000000000',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0xfec86ba6eb707ed08905757b1bb44b8f,0,0,0x40,'ebd07771ace8677a',0xc42449363bbad02b66d16bc975d77cc1); +INSERT INTO `users` VALUES ('208990100001101','1','55000000000000',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0xfec86ba6eb707ed08905757b1bb44b8f,0,0,0x40,'ebd07771ace8677a',0xc42449363bbad02b66d16bc975d77cc1); INSERT INTO `users` VALUES ('208950000000031','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); INSERT INTO `users` VALUES ('208950000000032','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); INSERT INTO `users` VALUES ('208950000000033','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); From 128bd86f67ba36611d8785281824515c3908d7d7 Mon Sep 17 00:00:00 2001 From: Manish Date: Thu, 24 Mar 2022 11:33:19 +0000 Subject: [PATCH 56/67] OAI UE IP Address Aligned in Readme with New IP Series for OAI UEs Signed-off-by: Manish --- ci-scripts/yaml_files/5g_rfsimulator/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ci-scripts/yaml_files/5g_rfsimulator/README.md b/ci-scripts/yaml_files/5g_rfsimulator/README.md index 5eb2a789a9..64c9084500 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/README.md +++ b/ci-scripts/yaml_files/5g_rfsimulator/README.md @@ -234,7 +234,7 @@ Making sure the OAI UE is connected: $ docker exec -it rfsim5g-oai-nr-ue /bin/bash root@bb4d400a832d:/opt/oai-nr-ue# ifconfig eth0: flags=4163 mtu 1500 - inet 192.168.71.137 netmask 255.255.255.192 broadcast 192.168.71.191 + inet 192.168.71.150 netmask 255.255.255.192 broadcast 192.168.71.191 ether 02:42:c0:a8:47:89 txqueuelen 0 (Ethernet) RX packets 224259 bytes 5821372018 (5.8 GB) RX errors 0 dropped 0 overruns 0 frame 0 @@ -270,7 +270,7 @@ Create entry for Second UE in docker-compose.yaml file as follows: privileged: true container_name: rfsim5g-oai-nr-ue2 environment: - RFSIMULATOR: 192.168.71.136 + RFSIMULATOR: 192.168.71.140 FULL_IMSI: '208990100001101' FULL_KEY: 'fec86ba6eb707ed08905757b1bb44b8f' OPC: 'C42449363BBAD02B66D16BC975D77CC1' @@ -282,7 +282,7 @@ Create entry for Second UE in docker-compose.yaml file as follows: - oai-gnb networks: public_net: - ipv4_address: 192.168.71.138 + ipv4_address: 192.168.71.151 healthcheck: test: /bin/bash -c "pgrep nr-uesoftmodem" interval: 10s @@ -326,7 +326,7 @@ Making sure the Second OAI UE is connected: $ docker exec -it rfsim5g-oai-nr-ue2 /bin/bash root@bb4d400a832d:/opt/oai-nr-ue# ifconfig eth0: flags=4163 mtu 1500 - inet 192.168.71.138 netmask 255.255.255.192 broadcast 192.168.71.191 + inet 192.168.71.151 netmask 255.255.255.192 broadcast 192.168.71.191 ether 02:42:c0:a8:47:8a txqueuelen 0 (Ethernet) RX packets 3192021 bytes 67784900946 (67.7 GB) RX errors 0 dropped 0 overruns 0 frame 0 From 9a884af00adf6b0001976a03e73060644b328a27 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Thu, 10 Mar 2022 13:19:40 +0000 Subject: [PATCH 57/67] Fix rballoc_mask variable type from uint8_t to uint16_t --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index aa49b14fe5..ea4628818c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -956,7 +956,7 @@ int next_list_entry_looped(NR_list_t *list, int UE_id) bool allocate_ul_retransmission(module_id_t module_id, frame_t frame, sub_frame_t slot, - uint8_t *rballoc_mask, + uint16_t *rballoc_mask, int *n_rb_sched, int UE_id, int harq_pid) @@ -1119,7 +1119,7 @@ void pf_ul(module_id_t module_id, NR_list_t *UE_list, int max_num_ue, int n_rb_sched, - uint8_t *rballoc_mask) { + uint16_t *rballoc_mask) { const int CC_id = 0; gNB_MAC_INST *nrmac = RC.nrmac[module_id]; @@ -1503,7 +1503,7 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t LOG_D(NR_MAC,"UL %d.%d : start_prb %d, end PRB %d\n",frame,slot,st,e); - uint8_t rballoc_mask[bwpSize]; + uint16_t rballoc_mask[bwpSize]; /* 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++) From 52ead754c0a33ce2560ea7b6df66e67f6d586a04 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Mon, 21 Mar 2022 16:54:00 +0100 Subject: [PATCH 58/67] fix(ci): some little cosmetics fixes * The quectel CM program output is now redirected to a file. Easier to follow when running * I added `-i 1` option to all server iperf commands to have details * module-based iperf logs are also copied to the RAN enb log folder so they are artifacted * iperf3 console output was badly formatted * `docker kill --signal INT` does not stop the container Signed-off-by: Raphael Defosseux --- ci-scripts/cls_containerize.py | 2 + ci-scripts/cls_module_ue.py | 3 +- ci-scripts/cls_oaicitest.py | 62 +++++++++---------- ci-scripts/ran.py | 4 +- .../xml_files/container_nsa_b200_quectel.xml | 36 +++++++++-- 5 files changed, 69 insertions(+), 38 deletions(-) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index fdc2bc1597..d85659568b 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -606,6 +606,8 @@ class Containerize(): if containerToKill: mySSH.command('docker kill --signal INT ' + containerName, '\$', 30) time.sleep(5) + mySSH.command('docker kill --signal KILL ' + containerName, '\$', 30) + time.sleep(5) mySSH.command('docker logs ' + containerName + ' > ' + lSourcePath + '/cmake_targets/' + self.eNB_logFile[self.eNB_instance], '\$', 30) mySSH.command('docker rm -f ' + containerName, '\$', 30) # Forcing the down now to remove the networks and any artifacts diff --git a/ci-scripts/cls_module_ue.py b/ci-scripts/cls_module_ue.py index cabd0a045d..4e2efaeda5 100644 --- a/ci-scripts/cls_module_ue.py +++ b/ci-scripts/cls_module_ue.py @@ -76,7 +76,8 @@ class Module_UE: logging.debug('Starting ' + self.Process['Name']) mySSH = sshconnection.SSHConnection() mySSH.open(self.HostIPAddress, self.HostUsername, self.HostPassword) - mySSH.command('echo $USER; echo ' + self.HostPassword + ' | nohup sudo -S ' + self.Process['Cmd'] + ' ' + self.Process['Apn'][CNType] + ' > /dev/null 2>&1 &','\$',5) + mySSH.command('sudo rm -f /tmp/quectel-cm.log','\$',5) + mySSH.command('echo $USER; echo ' + self.HostPassword + ' | nohup sudo -S stdbuf -o0 ' + self.Process['Cmd'] + ' ' + self.Process['Apn'][CNType] + ' > /tmp/quectel-cm.log 2>&1 &','\$',5) mySSH.close() #checking the process time.sleep(5) diff --git a/ci-scripts/cls_oaicitest.py b/ci-scripts/cls_oaicitest.py index 5d89a7b2e0..ec1202cb21 100644 --- a/ci-scripts/cls_oaicitest.py +++ b/ci-scripts/cls_oaicitest.py @@ -122,6 +122,7 @@ def GetPingTimeAnalysis(RAN,ping_log_file,ping_rttavg_threshold): try: mySSH = sshconnection.SSHConnection() mySSH.copyout(RAN.eNBIPAddress, RAN.eNBUserName, RAN.eNBPassword, ping_log_file+'.png', RAN.eNBSourceCodePath + '/cmake_targets/') + mySSH.copyout(RAN.eNBIPAddress, RAN.eNBUserName, RAN.eNBPassword, ping_log_file, RAN.eNBSourceCodePath + '/cmake_targets/') except: logging.debug('\u001B[1;37;41m Ping PNG SCP to eNB FAILED\u001B[0m') @@ -1598,7 +1599,7 @@ class OaiCiTest(): else: if launchfromModule == False: #ping log file is on the python executor - cmd = 'ping ' + self.ping_args + ' ' + UE_IPAddress + ' 2>&1 > ping_' + self.testCase_id + '_' + device_id + '.log' + cmd = 'ping ' + self.ping_args + ' ' + UE_IPAddress + ' > ping_' + self.testCase_id + '_' + device_id + '.log 2>&1' message = cmd + '\n' logging.debug(cmd) ret = subprocess.run(cmd, shell=True) @@ -1623,7 +1624,7 @@ class OaiCiTest(): else: Target = EPC.IPAddress #ping from module NIC rather than IP address to make sure round trip is over the air - cmd = 'ping -I ' + Module_UE.UENetwork + ' ' + self.ping_args + ' ' + Target + ' 2>&1 > ping_' + self.testCase_id + '_' + self.ue_id + '.log' + cmd = 'ping -I ' + Module_UE.UENetwork + ' ' + self.ping_args + ' ' + Target + ' > ping_' + self.testCase_id + '_' + self.ue_id + '.log 2>&1' SSH.command(cmd,'\$',int(ping_time[0])*1.5) #copy the ping log file to have it locally for analysis (ping stats) SSH.copyin(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword, 'ping_' + self.testCase_id + '_' + self.ue_id + '.log', '.') @@ -2084,7 +2085,8 @@ class OaiCiTest(): statusQueue.put(UE_IPAddress) statusQueue.put(report_msg) logging.debug('\u001B[1;37;45m TCP Bidir Iperf Result (' + UE_IPAddress + ') \u001B[0m') - logging.debug('\u001B[1;35m ' + report_msg + '\u001B[0m') + for rLine in report_msg.split('\n'): + logging.debug('\u001B[1;35m ' + rLine + '\u001B[0m') lock.release() else: self.ping_iperf_wrong_exit(lock, UE_IPAddress, device_id, statusQueue, 'Bidir TCP : Could not analyze from Log file') @@ -2379,10 +2381,12 @@ class OaiCiTest(): SSH.copyout(EPC.IPAddress, EPC.UserName, EPC.Password, 'iperf_' + self.testCase_id + '_' + device_id + '.log', EPC.SourceCodePath + '/scripts') - def Iperf_Module(self, lock, UE_IPAddress, device_id, idx, ue_num, statusQueue,EPC, Module_UE): + def Iperf_Module(self, lock, UE_IPAddress, device_id, idx, ue_num, statusQueue,EPC, Module_UE, RAN): + SSH = sshconnection.SSHConnection() + server_filename = 'iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log' + client_filename = 'iperf_client_' + self.testCase_id + '_' + self.ue_id + '.log' if (re.match('OAI-Rel14-Docker', EPC.Type, re.IGNORECASE)) or (re.match('OAICN5G', EPC.Type, re.IGNORECASE)): #retrieve trf-gen container IP address - SSH = sshconnection.SSHConnection() SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password) SSH.command('docker inspect --format="TRF_IP_ADDR = {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" prod-trf-gen', '\$', 5) result = re.search('TRF_IP_ADDR = (?P[0-9\.]+)', SSH.getBefore()) @@ -2404,20 +2408,18 @@ class OaiCiTest(): if self.iperf_direction=="DL": logging.debug("Iperf for Module in DL mode detected") ##server side UE - server_filename='iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log' SSH.open(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword) cmd = 'rm ' + server_filename SSH.command(cmd,'\$',5) - cmd = 'echo $USER; nohup iperf -s -B ' + UE_IPAddress + ' -u 2>&1 > ' + server_filename + ' &' + cmd = 'echo $USER; nohup iperf -s -B ' + UE_IPAddress + ' -u -i 1 > ' + server_filename + ' 2>&1 &' SSH.command(cmd,'\$',5) SSH.close() ##client side EPC SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password) - client_filename = 'iperf_client_' + self.testCase_id + '_' + self.ue_id + '.log' #remove old client file in EPC.SourceCodePath cmd = 'rm ' + EPC.SourceCodePath + '/' + client_filename SSH.command(cmd,'\$',5) - iperf_cmd = 'bin/iperf -c ' + UE_IPAddress + ' ' + self.iperf_args + ' 2>&1 > ' + client_filename + iperf_cmd = 'bin/iperf -c ' + UE_IPAddress + ' ' + self.iperf_args + ' > ' + client_filename + ' 2>&1' cmd = 'docker exec -w /iperf-2.0.13 -it prod-trf-gen /bin/bash -c \"' + iperf_cmd + '\"' SSH.command(cmd,'\$',int(iperf_time)*5.0) SSH.command('docker cp prod-trf-gen:/iperf-2.0.13/'+ client_filename + ' ' + EPC.SourceCodePath, '\$', 5) @@ -2433,19 +2435,17 @@ class OaiCiTest(): logging.debug("Iperf for Module in UL mode detected") #server side EPC SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password) - server_filename = 'iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log' - iperf_cmd = 'echo $USER; nohup bin/iperf -s -u 2>&1 > ' + server_filename + iperf_cmd = 'echo $USER; nohup bin/iperf -s -u -i 1 > ' + server_filename + ' 2>&1' cmd = 'docker exec -d -w /iperf-2.0.13 prod-trf-gen /bin/bash -c \"' + iperf_cmd + '\"' SSH.command(cmd,'\$',5) SSH.close() #client side UE SSH.open(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword) - client_filename = 'iperf_client_' + self.testCase_id + '_' + self.ue_id + '.log' cmd = 'rm '+ client_filename SSH.command(cmd,'\$',5) - SSH.command('iperf -B ' + UE_IPAddress + ' -c ' + trf_gen_IP + ' ' + self.iperf_args + ' 2>&1 > ' + client_filename, '\$', int(iperf_time)*5.0) + SSH.command('iperf -B ' + UE_IPAddress + ' -c ' + trf_gen_IP + ' ' + self.iperf_args + ' > ' + client_filename + ' 2>&1', '\$', int(iperf_time)*5.0) SSH.close() #once client is done, retrieve the server file from container to EPC Host @@ -2461,12 +2461,10 @@ class OaiCiTest(): elif self.iperf_direction=="BIDIR": logging.debug("Iperf for Module in BIDIR mode detected") - server_filename = 'iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log' - client_filename = 'iperf_client_' + self.testCase_id + '_' + self.ue_id + '.log' #server side EPC SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password) - iperf_cmd = 'echo $USER; nohup /usr/local/bin/iperf3 -s 2>&1 > ' + server_filename + iperf_cmd = 'echo $USER; nohup /usr/local/bin/iperf3 -s -i 1 > ' + server_filename + ' 2>&1' cmd = 'docker exec -d -w /iperf-2.0.13 prod-trf-gen /bin/bash -c \"' + iperf_cmd + '\"' SSH.command(cmd,'\$',5) SSH.close() @@ -2475,7 +2473,7 @@ class OaiCiTest(): SSH.open(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword) cmd = 'rm '+ client_filename SSH.command(cmd,'\$',5) - SSH.command('iperf3 -B ' + UE_IPAddress + ' -c ' + trf_gen_IP + ' ' + self.iperf_args + ' 2>&1 > ' + client_filename, '\$', int(iperf_time)*5.0) + SSH.command('iperf3 -B ' + UE_IPAddress + ' -c ' + trf_gen_IP + ' ' + self.iperf_args + ' > ' + client_filename + ' 2>&1', '\$', int(iperf_time)*5.0) SSH.close() #once client is done, retrieve the server file from container to EPC Host @@ -2499,8 +2497,6 @@ class OaiCiTest(): else: #default is ltebox - SSH = sshconnection.SSHConnection() - #kill iperf processes before (in case there are still some remaining) SSH.open(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword) cmd = 'killall --signal=SIGKILL iperf' @@ -2524,14 +2520,14 @@ class OaiCiTest(): SSH.open(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword) cmd = 'rm iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log' SSH.command(cmd,'\$',5) - cmd = 'echo $USER; nohup /opt/iperf-2.0.10/iperf -s -B ' + UE_IPAddress + ' -u 2>&1 > iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log &' + cmd = 'echo $USER; nohup /opt/iperf-2.0.10/iperf -s -B ' + UE_IPAddress + ' -u -i 1 > iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log 2>&1 &' SSH.command(cmd,'\$',5) SSH.close() #client side EPC SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password) cmd = 'rm iperf_client_' + self.testCase_id + '_' + self.ue_id + '.log' SSH.command(cmd,'\$',5) - cmd = 'iperf -c ' + UE_IPAddress + ' ' + self.iperf_args + ' 2>&1 > iperf_client_' + self.testCase_id + '_' + self.ue_id + '.log' + cmd = 'iperf -c ' + UE_IPAddress + ' ' + self.iperf_args + ' > iperf_client_' + self.testCase_id + '_' + self.ue_id + '.log 2>&1' SSH.command(cmd,'\$',int(iperf_time)*5.0) SSH.close() #copy the 2 resulting files locally @@ -2547,7 +2543,7 @@ class OaiCiTest(): SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password) cmd = 'rm iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log' SSH.command(cmd,'\$',5) - cmd = 'echo $USER; nohup iperf -s -u 2>&1 > iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log &' + cmd = 'echo $USER; nohup iperf -s -u -i 1 > iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log 2>&1 &' SSH.command(cmd,'\$',5) SSH.close() @@ -2555,7 +2551,7 @@ class OaiCiTest(): SSH.open(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword) cmd = 'rm iperf_client_' + self.testCase_id + '_' + self.ue_id + '.log' SSH.command(cmd,'\$',5) - SSH.command('/opt/iperf-2.0.10/iperf -c 192.172.0.1 ' + self.iperf_args + ' 2>&1 > iperf_client_' + self.testCase_id + '_' + self.ue_id + '.log', '\$', int(iperf_time)*5.0) + SSH.command('/opt/iperf-2.0.10/iperf -c 192.172.0.1 ' + self.iperf_args + ' > iperf_client_' + self.testCase_id + '_' + self.ue_id + '.log 2>&1', '\$', int(iperf_time)*5.0) SSH.close() #copy the 2 resulting files locally @@ -2566,15 +2562,13 @@ class OaiCiTest(): self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, self.iperf_args,filename,1) elif self.iperf_direction=="BIDIR": logging.debug("Iperf for Module in BIDIR mode detected") - server_filename = 'iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log' - client_filename = 'iperf_client_' + self.testCase_id + '_' + self.ue_id + '.log' #server side EPC SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password) cmd = 'rm ' + server_filename SSH.command(cmd,'\$',5) - cmd = 'echo $USER; nohup iperf3 -s 2>&1 > '+server_filename+' &' + cmd = 'echo $USER; nohup iperf3 -s -i 1 > '+server_filename+' 2>&1 &' SSH.command(cmd,'\$',5) SSH.close() @@ -2582,7 +2576,7 @@ class OaiCiTest(): SSH.open(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword) cmd = 'rm ' + client_filename SSH.command(cmd,'\$',5) - SSH.command('iperf3 -c 192.172.0.1 ' + self.iperf_args + ' 2>&1 > '+client_filename, '\$', int(iperf_time)*5.0) + SSH.command('iperf3 -c 192.172.0.1 ' + self.iperf_args + ' > '+client_filename + ' 2>&1', '\$', int(iperf_time)*5.0) SSH.close() #copy the 2 resulting files locally @@ -2593,6 +2587,7 @@ class OaiCiTest(): else : logging.debug("Incorrect or missing IPERF direction in XML") + #kill iperf processes after to be clean SSH.open(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword) cmd = 'killall --signal=SIGKILL iperf' @@ -2606,7 +2601,12 @@ class OaiCiTest(): cmd = 'killall --signal=SIGKILL iperf3' SSH.command(cmd,'\$',5) SSH.close() - return + + # Copying to xNB server for Jenkins artifacting + if (os.path.isfile(server_filename)): + SSH.copyout(RAN.eNBIPAddress, RAN.eNBUserName, RAN.eNBPassword, server_filename, RAN.eNBSourceCodePath + '/cmake_targets/') + if (os.path.isfile(client_filename)): + SSH.copyout(RAN.eNBIPAddress, RAN.eNBUserName, RAN.eNBPassword, client_filename, RAN.eNBSourceCodePath + '/cmake_targets/') def Iperf_common(self, lock, UE_IPAddress, device_id, idx, ue_num, statusQueue,EPC): try: @@ -2804,12 +2804,12 @@ class OaiCiTest(): else: SSH.copyin(self.ADBIPAddress, self.ADBUserName, self.ADBPassword, EPC.SourceCodePath + '/scripts/iperf_server_' + self.testCase_id + '_' + device_id + '.log', '.') # fromdos has to be called on the python executor not on ADB server - cmd = 'fromdos -o iperf_server_' + self.testCase_id + '_' + device_id + '.log 2>&1 > /dev/null' + cmd = 'fromdos -o iperf_server_' + self.testCase_id + '_' + device_id + '.log > /dev/null 2>&1' try: subprocess.run(cmd, shell=True) except: pass - cmd = 'dos2unix -o iperf_server_' + self.testCase_id + '_' + device_id + '.log 2>&1 > /dev/null' + cmd = 'dos2unix -o iperf_server_' + self.testCase_id + '_' + device_id + '.log > /dev/null 2>&1' try: subprocess.run(cmd, shell=True) except: @@ -2995,7 +2995,7 @@ class OaiCiTest(): #special quick and dirty treatment for modules, iperf to be restructured if self.ue_id!="": #is module device_id = Module_UE.ID + "-" + Module_UE.Kind - p = Process(target = self.Iperf_Module ,args = (lock, UE_IPAddress, device_id, i, ue_num, status_queue, EPC, Module_UE,)) + p = Process(target = self.Iperf_Module ,args = (lock, UE_IPAddress, device_id, i, ue_num, status_queue, EPC, Module_UE, RAN, )) else: #legacy code p = Process(target = self.Iperf_common, args = (lock, UE_IPAddress, device_id, i, ue_num, status_queue, EPC, )) p.daemon = True diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py index 3b32a75542..f95ce90c66 100644 --- a/ci-scripts/ran.py +++ b/ci-scripts/ran.py @@ -756,11 +756,11 @@ class RANManagement(): mySSH.command('echo ' + self.eNBPassword + ' | sudo -S mv /tmp/enb_*.pcap .','\$',20) mySSH.command('echo ' + self.eNBPassword + ' | sudo -S mv /tmp/gnb_*.pcap .','\$',20) mySSH.command('echo ' + self.eNBPassword + ' | sudo -S rm -f enb.log.zip', '\$', 5) - mySSH.command('echo ' + self.eNBPassword + ' | sudo -S zip enb.log.zip enb*.log enb_*record.raw enb_*.pcap gnb_*.pcap enb_*txt physim_*.log *stats.log *monitor.pickle *monitor*.png ping*.log.png log/*/*.log log/*/*.pcap', '\$', 60) + mySSH.command('echo ' + self.eNBPassword + ' | sudo -S zip enb.log.zip enb*.log enb_*record.raw enb_*.pcap gnb_*.pcap enb_*txt physim_*.log *stats.log *monitor.pickle *monitor*.png ping*.log* iperf*.log log/*/*.log log/*/*.pcap', '\$', 60) result = re.search('core.\d+', mySSH.getBefore()) if result is not None: mySSH.command('echo ' + self.eNBPassword + ' | sudo -S zip enb.log.zip core* ran_build/build/{lte,nr}-softmodem', '\$', 60) # add core and executable to zip - mySSH.command('echo ' + self.eNBPassword + ' | sudo -S rm enb*.log core* enb_*record.raw enb_*.pcap gnb_*.pcap enb_*txt physim_*.log *stats.log *monitor.pickle *monitor*.png ping*.log.png log/*/*.log log/*/*.pcap', '\$', 15) + mySSH.command('echo ' + self.eNBPassword + ' | sudo -S rm enb*.log core* enb_*record.raw enb_*.pcap gnb_*.pcap enb_*txt physim_*.log *stats.log *monitor.pickle *monitor*.png ping*.log* iperf*.log log/*/*.log log/*/*.pcap', '\$', 15) mySSH.close() def AnalyzeLogFile_eNB(self, eNBlogFile, HTML, checkers={}): diff --git a/ci-scripts/xml_files/container_nsa_b200_quectel.xml b/ci-scripts/xml_files/container_nsa_b200_quectel.xml index 55f8b8638d..610f0b019a 100644 --- a/ci-scripts/xml_files/container_nsa_b200_quectel.xml +++ b/ci-scripts/xml_files/container_nsa_b200_quectel.xml @@ -39,8 +39,9 @@ 050001 070001 070000 - 050000 - 050001 + 070002 + 050002 + 050003 010002 000001 030202 @@ -117,10 +118,28 @@ 15
+ + Ping + Ping: 20pings in 20sec + idefix + -c 20 + 1 + 15 + + + + Ping + Ping: 100pings in 20sec + idefix + -c 100 -i 0.2 + 1 + 15 + + Iperf iperf (DL/40Mbps/UDP)(60 sec)(single-ue profile) - -u -b 40M -t 60 + -u -b 40M -t 60 -i 1 -fm DL idefix 20 @@ -131,7 +150,7 @@ Iperf iperf (UL/3Mbps/UDP)(60 sec)(single-ue profile) - -u -b 3M -t 60 + -u -b 3M -t 60 -i 1 -fm UL idefix 1 @@ -139,6 +158,15 @@ single-ue + + Iperf + iperf (BIDIR TCP)(10 sec)(single-ue profile) + -t 10 --bidir + BIDIR + idefix + single-ue + + Undeploy_Object Undeploy eNB From dab954d71d4effbd9e204a6bf81f3657739b581b Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Mon, 28 Mar 2022 12:08:26 +0200 Subject: [PATCH 59/67] feat(ci): cppcheck stage updates * using focal instead of xenial (new cppcheck version) * detecting the difference in stats with latest develop stats Signed-off-by: Raphael Defosseux --- ci-scripts/cls_static_code_analysis.py | 85 ++++++++++++++++++++------ 1 file changed, 66 insertions(+), 19 deletions(-) diff --git a/ci-scripts/cls_static_code_analysis.py b/ci-scripts/cls_static_code_analysis.py index c899a9aabd..d6796ad414 100644 --- a/ci-scripts/cls_static_code_analysis.py +++ b/ci-scripts/cls_static_code_analysis.py @@ -35,6 +35,7 @@ import sys # arg import re # reg import logging import os +from pathlib import Path import time #----------------------------------------------------------- @@ -51,7 +52,7 @@ class CppCheckResults(): def __init__(self): - self.variants = ['xenial', 'bionic'] + self.variants = ['bionic', 'focal'] self.versions = ['',''] self.nbErrors = [0,0] self.nbWarnings = [0,0] @@ -116,12 +117,22 @@ class StaticCodeAnalysis(): # if the commit ID is provided use it to point to it if self.ranCommitID != '': mySSH.command('git checkout -f ' + self.ranCommitID, '\$', 30) + # if the branch is not develop, then it is a merge request and we need to do + # the potential merge. Note that merge conflicts should already been checked earlier + if (self.ranAllowMerge): + if self.ranTargetBranch == '': + if (self.ranBranch != 'develop') and (self.ranBranch != 'origin/develop'): + mySSH.command('git merge --ff origin/develop -m "Temporary merge for CI"', '\$', 5) + else: + logging.debug('Merging with the target branch: ' + self.ranTargetBranch) + mySSH.command('git merge --ff origin/' + self.ranTargetBranch + ' -m "Temporary merge for CI"', '\$', 5) - mySSH.command('docker image rm oai-cppcheck:bionic oai-cppcheck:xenial || true', '\$', 60) - mySSH.command('docker build --tag oai-cppcheck:xenial --file ci-scripts/docker/Dockerfile.cppcheck.xenial . > cmake_targets/log/cppcheck-xenial.txt 2>&1', '\$', 600) + mySSH.command('docker image rm oai-cppcheck:bionic oai-cppcheck:focal || true', '\$', 60) mySSH.command('sed -e "s@xenial@bionic@" ci-scripts/docker/Dockerfile.cppcheck.xenial > ci-scripts/docker/Dockerfile.cppcheck.bionic', '\$', 6) mySSH.command('docker build --tag oai-cppcheck:bionic --file ci-scripts/docker/Dockerfile.cppcheck.bionic . > cmake_targets/log/cppcheck-bionic.txt 2>&1', '\$', 600) - mySSH.command('docker image rm oai-cppcheck:bionic oai-cppcheck:xenial || true', '\$', 30) + mySSH.command('sed -e "s@xenial@focal@" ci-scripts/docker/Dockerfile.cppcheck.xenial > ci-scripts/docker/Dockerfile.cppcheck.focal', '\$', 6) + mySSH.command('docker build --tag oai-cppcheck:focal --file ci-scripts/docker/Dockerfile.cppcheck.focal . > cmake_targets/log/cppcheck-focal.txt 2>&1', '\$', 600) + mySSH.command('docker image rm oai-cppcheck:bionic oai-cppcheck:focal || true', '\$', 30) # Analyzing the logs mySSH.command('cd ' + lSourcePath + '/cmake_targets', '\$', 5) @@ -131,8 +142,22 @@ class StaticCodeAnalysis(): mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/build_log_' + self.testCase_id + '/*', '.') CCR = CppCheckResults() + CCR_ref = CppCheckResults() vId = 0 for variant in CCR.variants: + refAvailable = False + if self.ranAllowMerge: + refFolder = str(Path.home()) + '/cppcheck-references' + if (os.path.isfile(refFolder + '/cppcheck-'+ variant + '.txt')): + refAvailable = True + with open(refFolder + '/cppcheck-'+ variant + '.txt', 'r') as refFile: + for line in refFile: + ret = re.search(' (?P[0-9\.]+) errors', str(line)) + if ret is not None: + CCR_ref.nbErrors[vId] = int(ret.group('nb_errors')) + ret = re.search(' (?P[0-9\.]+) warnings', str(line)) + if ret is not None: + CCR_ref.nbWarnings[vId] = int(ret.group('nb_warnings')) if (os.path.isfile('./cppcheck-'+ variant + '.txt')): xmlStart = False with open('./cppcheck-'+ variant + '.txt', 'r') as logfile: @@ -167,21 +192,43 @@ class StaticCodeAnalysis(): CCR.nbPtrAddNotNull[vId] += 1 if re.search('id="oppositeInnerCondition"', str(line)) is not None: CCR.nbOppoInnerCondition[vId] += 1 - logging.debug('======== Variant ' + variant + ' - ' + CCR.versions[vId] + ' ========') - logging.debug(' ' + str(CCR.nbErrors[vId]) + ' errors') - logging.debug(' ' + str(CCR.nbWarnings[vId]) + ' warnings') - logging.debug(' -- Details --') - logging.debug(' Memory leak: ' + str(CCR.nbMemLeaks[vId])) - logging.debug(' Possible null pointer deference: ' + str(CCR.nbNullPtrs[vId])) - logging.debug(' Uninitialized variable: ' + str(CCR.nbUninitVars[vId])) - logging.debug(' Undefined behaviour shifting: ' + str(CCR.nbTooManyBitsShift[vId])) - logging.debug(' Signed integer overflow: ' + str(CCR.nbIntegerOverflow[vId])) - logging.debug('') - logging.debug(' Printf formatting issue: ' + str(CCR.nbInvalidPrintf[vId])) - logging.debug(' Modulo result is predetermined: ' + str(CCR.nbModuloAlways[vId])) - logging.debug(' Opposite Condition -> dead code: ' + str(CCR.nbOppoInnerCondition[vId])) - logging.debug(' Wrong Scanf Nb Args: ' + str(CCR.nbWrongScanfArg[vId])) - logging.debug('') + vMsg = '' + vMsg += '======== Variant ' + variant + ' - ' + CCR.versions[vId] + ' ========\n' + vMsg += ' ' + str(CCR.nbErrors[vId]) + ' errors\n' + vMsg += ' ' + str(CCR.nbWarnings[vId]) + ' warnings\n' + vMsg += ' -- Details --\n' + vMsg += ' Memory leak: ' + str(CCR.nbMemLeaks[vId]) + '\n' + vMsg += ' Possible null pointer deference: ' + str(CCR.nbNullPtrs[vId]) + '\n' + vMsg += ' Uninitialized variable: ' + str(CCR.nbUninitVars[vId]) + '\n' + vMsg += ' Undefined behaviour shifting: ' + str(CCR.nbTooManyBitsShift[vId]) + '\n' + vMsg += ' Signed integer overflow: ' + str(CCR.nbIntegerOverflow[vId]) + '\n' + vMsg += '\n' + vMsg += ' Printf formatting issue: ' + str(CCR.nbInvalidPrintf[vId]) + '\n' + vMsg += ' Modulo result is predetermined: ' + str(CCR.nbModuloAlways[vId]) + '\n' + vMsg += ' Opposite Condition -> dead code: ' + str(CCR.nbOppoInnerCondition[vId]) + '\n' + vMsg += ' Wrong Scanf Nb Args: ' + str(CCR.nbWrongScanfArg[vId]) + '\n' + for vLine in vMsg.split('\n'): + logging.debug(vLine) + if self.ranAllowMerge and refAvailable: + if CCR_ref.nbErrors[vId] == CCR.nbErrors[vId]: + logging.debug(' No change in number of errors') + elif CCR_ref.nbErrors[vId] > CCR.nbErrors[vId]: + logging.debug(' Good! Decrease in number of errors') + else: + logging.debug(' Bad! increase in number of errors') + if CCR_ref.nbWarnings[vId] == CCR.nbWarnings[vId]: + logging.debug(' No change in number of warnings') + elif CCR_ref.nbWarnings[vId] > CCR.nbWarnings[vId]: + logging.debug(' Good! Decrease in number of warnings') + else: + logging.debug(' Bad! increase in number of warnings') + # Create new reference file + if not self.ranAllowMerge: + refFolder = str(Path.home()) + '/cppcheck-references' + if not os.path.isdir(refFolder): + os.mkdir(refFolder) + with open(refFolder + '/cppcheck-'+ variant + '.txt', 'w') as refFile: + refFile.write(vMsg) vId += 1 HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) From a02adbdcb482cc85be0253cf68dba20a78d54339 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Mon, 28 Mar 2022 12:16:39 +0200 Subject: [PATCH 60/67] feat(ci): mechanism to create multiple unique tags per week -- In case we do multiple merges per week -- Also use the proper week numbering (ISO week number, with Monday as first day of week (01..53)) Signed-off-by: Raphael Defosseux --- ci-scripts/Jenkinsfile-push-registry | 4 ++- ci-scripts/provideUniqueImageTag.py | 54 ++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 ci-scripts/provideUniqueImageTag.py diff --git a/ci-scripts/Jenkinsfile-push-registry b/ci-scripts/Jenkinsfile-push-registry index 91d6136e0a..f5847ff0aa 100644 --- a/ci-scripts/Jenkinsfile-push-registry +++ b/ci-scripts/Jenkinsfile-push-registry @@ -55,7 +55,9 @@ pipeline { stage ("Push to DockerHub") { steps { script { - WEEK_TAG = sh returnStdout: true, script: 'date +"%Y.w%U"' + WEEK_REF = sh returnStdout: true, script: 'date +"%Y.w%V"' + WEEK_REF = WEEK_REF.trim() + WEEK_TAG = sh returnStdout: true, script: 'python3 ./ci-scripts/provideUniqueImageTag.py --start_tag ' + WEEK_REF WEEK_TAG = WEEK_TAG.trim() withCredentials([ diff --git a/ci-scripts/provideUniqueImageTag.py b/ci-scripts/provideUniqueImageTag.py new file mode 100644 index 0000000000..ee8306402f --- /dev/null +++ b/ci-scripts/provideUniqueImageTag.py @@ -0,0 +1,54 @@ +import argparse +import os +import re +import subprocess +import sys + +AUTH_SERVICE = 'registry.docker.io' +AUTH_SCOPE = 'repository:rdefosseoai/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"' + 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 .' + listOfTags = subprocess.check_output(cmd, shell=True, universal_newlines=True) + + foundTag = False + for tag in listOfTags.split('\n'): + if re.search('"' + args.start_tag + '"', tag) is not None: + foundTag = True + + if not foundTag: + print (args.start_tag) + sys.exit(0) + + proposedVariants = ['a', 'b', 'c', 'd'] + for variant in proposedVariants: + foundTag = False + currentVariant = variant + for tag in listOfTags.split('\n'): + if re.search('"' + args.start_tag + variant + '"', tag) is not None: + foundTag = True + break + if not foundTag: + break + + if not foundTag: + print (args.start_tag + currentVariant) + +def _parse_args() -> argparse.Namespace: + parser = argparse.ArgumentParser(description='Provides an unique new image tag for DockerHub') + + parser.add_argument( + '--start_tag', '-st', + action='store', + required=True, + help='Proposed Starting Tag', + ) + return parser.parse_args() + +if __name__ == '__main__': + main() From 426ded6e31a449e0da30c0656df6c69166b72c8a Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Wed, 30 Mar 2022 16:42:12 +0200 Subject: [PATCH 61/67] fix(build): fix warnings on circular dependency Signed-off-by: Raphael Defosseux --- openair2/PHY_INTERFACE/queue_t.h | 5 ++++- openair2/RRC/LTE/MESSAGES/asn1_msg.h | 5 +++++ openair2/RRC/NR/MESSAGES/asn1_msg.h | 4 +++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/openair2/PHY_INTERFACE/queue_t.h b/openair2/PHY_INTERFACE/queue_t.h index 4678e31030..5c644a320c 100644 --- a/openair2/PHY_INTERFACE/queue_t.h +++ b/openair2/PHY_INTERFACE/queue_t.h @@ -24,7 +24,8 @@ } */ -#pragma once +#ifndef __OPENAIR2_PHY_INTERFACE_QUEUE_T__H__ +#define __OPENAIR2_PHY_INTERFACE_QUEUE_T__H__ #include #include @@ -62,3 +63,5 @@ typedef bool queue_matcher_t(void *wanted, void *candidate); Look only at the last `max_depth` items on the queue, at most. Returns the candidate item, or NULL if none matches */ void *unqueue_matching(queue_t *q, size_t max_depth, queue_matcher_t *matcher, void *wanted); + +#endif /* __OPENAIR2_PHY_INTERFACE_QUEUE_T__H__ */ diff --git a/openair2/RRC/LTE/MESSAGES/asn1_msg.h b/openair2/RRC/LTE/MESSAGES/asn1_msg.h index d1d1d3febe..8373bb53f3 100644 --- a/openair2/RRC/LTE/MESSAGES/asn1_msg.h +++ b/openair2/RRC/LTE/MESSAGES/asn1_msg.h @@ -28,6 +28,9 @@ * \email: raymond.knopp@eurecom.fr and navid.nikaein@eurecom.fr */ +#ifndef __RRC_LTE_MESSAGES_ASN1_MSG__H__ +#define __RRC_LTE_MESSAGES_ASN1_MSG__H__ + #include #include #include /* for atoi(3) */ @@ -405,3 +408,5 @@ uint8_t do_SecurityModeCommand( const uint8_t Transaction_id, const uint8_t cipheringAlgorithm, const uint8_t integrityProtAlgorithm); + +#endif /* __RRC_LTE_MESSAGES_ASN1_MSG__H__ */ diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.h b/openair2/RRC/NR/MESSAGES/asn1_msg.h index befe83b141..52efba6f45 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.h +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.h @@ -28,7 +28,8 @@ * \email: raymond.knopp@eurecom.fr and navid.nikaein@eurecom.fr, kroempa@gmail.com */ -#pragma once +#ifndef __RRC_NR_MESSAGES_ASN1_MSG__H__ +#define __RRC_NR_MESSAGES_ASN1_MSG__H__ #include #include @@ -207,3 +208,4 @@ do_RRCReestablishmentComplete( uint8_t *buffer, size_t buffer_size, int64_t rrc_TransactionIdentifier); +#endif /* __RRC_NR_MESSAGES_ASN1_MSG__H__ */ From aca240e9e31d541ed015189b7be1407fa401e158 Mon Sep 17 00:00:00 2001 From: hardy Date: Wed, 30 Mar 2022 16:56:49 +0200 Subject: [PATCH 62/67] fix ttyUSBx for quectel nrmodule2 --- ci-scripts/ci_ueinfra.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci-scripts/ci_ueinfra.yaml b/ci-scripts/ci_ueinfra.yaml index 51acb75968..91ae36559c 100644 --- a/ci-scripts/ci_ueinfra.yaml +++ b/ci-scripts/ci_ueinfra.yaml @@ -27,8 +27,8 @@ nrmodule2_quectel: Apn : OAICN5G : oai OAI-Rel14-Docker : oai.ipv4 - WakeupScript : ci_ctl_qtel.py /dev/ttyUSB7 wup - DetachScript : ci_ctl_qtel.py /dev/ttyUSB7 detach + WakeupScript : ci_ctl_qtel.py /dev/ttyUSB2 wup + DetachScript : ci_ctl_qtel.py /dev/ttyUSB2 detach LogStore : /media/ci_qlogs PLMN : 20897 UENetwork : wwan1 From 100832b111c9e8d35fb12b8769dc2dd99a024eeb Mon Sep 17 00:00:00 2001 From: hardy Date: Thu, 31 Mar 2022 09:26:15 +0200 Subject: [PATCH 63/67] fix nrmodule2 network interface --- ci-scripts/ci_ueinfra.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/ci_ueinfra.yaml b/ci-scripts/ci_ueinfra.yaml index 91ae36559c..0a915740f2 100644 --- a/ci-scripts/ci_ueinfra.yaml +++ b/ci-scripts/ci_ueinfra.yaml @@ -31,7 +31,7 @@ nrmodule2_quectel: DetachScript : ci_ctl_qtel.py /dev/ttyUSB2 detach LogStore : /media/ci_qlogs PLMN : 20897 - UENetwork : wwan1 + UENetwork : wwan0 HostIPAddress : 192.168.18.189 HostUsername : nrmodule2 HostPassword : linux From e0befd2a8f3ffd96e0ad09e23df771f32620e3ef Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Thu, 31 Mar 2022 10:15:47 +0200 Subject: [PATCH 64/67] fix(ci): 2 little typos - The GitLab pipeline reporting for the 5G RF sim container was the same as 4G RF - Calling a sudo command without providing password Signed-off-by: Raphael Defosseux --- ci-scripts/Jenkinsfile-GitLab-Container | 2 +- ci-scripts/cls_module_ue.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ci-scripts/Jenkinsfile-GitLab-Container b/ci-scripts/Jenkinsfile-GitLab-Container index f5852bace5..57738a3183 100644 --- a/ci-scripts/Jenkinsfile-GitLab-Container +++ b/ci-scripts/Jenkinsfile-GitLab-Container @@ -222,7 +222,7 @@ pipeline { when { expression {doMandatoryTests} } steps { script { - triggerSlaveJob ('RAN-RF-Sim-Test-5G', 'Test-RF-Sim-Container-4G') + triggerSlaveJob ('RAN-RF-Sim-Test-5G', 'Test-RF-Sim-Container-5G') } } post { diff --git a/ci-scripts/cls_module_ue.py b/ci-scripts/cls_module_ue.py index 4e2efaeda5..fb10700798 100644 --- a/ci-scripts/cls_module_ue.py +++ b/ci-scripts/cls_module_ue.py @@ -76,7 +76,7 @@ class Module_UE: logging.debug('Starting ' + self.Process['Name']) mySSH = sshconnection.SSHConnection() mySSH.open(self.HostIPAddress, self.HostUsername, self.HostPassword) - mySSH.command('sudo rm -f /tmp/quectel-cm.log','\$',5) + mySSH.command('echo ' + self.HostPassword + ' | sudo -S rm -f /tmp/quectel-cm.log','\$',5) mySSH.command('echo $USER; echo ' + self.HostPassword + ' | nohup sudo -S stdbuf -o0 ' + self.Process['Cmd'] + ' ' + self.Process['Apn'][CNType] + ' > /tmp/quectel-cm.log 2>&1 &','\$',5) mySSH.close() #checking the process From 120194e5e672b89c0e17f3ca83eabe9b075004ae Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 31 Mar 2022 14:16:28 +0200 Subject: [PATCH 65/67] Fix caracal USRP address --- ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf index d21cf90cd9..6d05fee692 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf @@ -221,8 +221,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 = "addr=192.168.30.2,mgmt_addr=192.168.30.2,second_addr=192.168.50.2"; - clock_src = "external"; + sdr_addrs = "addr=192.168.20.2"; } ); From d91ed6fa80e67345753e3fd5be668f02d7af468a Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 31 Mar 2022 15:10:42 +0200 Subject: [PATCH 66/67] Update USRP IP address in CI XML file --- ci-scripts/xml_files/gnb_phytest_usrp_run.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/xml_files/gnb_phytest_usrp_run.xml b/ci-scripts/xml_files/gnb_phytest_usrp_run.xml index f1185c08c9..5705533ab4 100644 --- a/ci-scripts/xml_files/gnb_phytest_usrp_run.xml +++ b/ci-scripts/xml_files/gnb_phytest_usrp_run.xml @@ -35,7 +35,7 @@ Initialize gNB USRP -O ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf --phy-test -q -U 787200 -T 106 -t 28 -D 130175 -m 28 -M 106 --log_config.global_log_options level,nocolor,time NR - 192.168.30.2 + 192.168.20.2 From db00707e66b38a987f848b27043d4c57cbda3ef5 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Sat, 2 Apr 2022 20:45:43 +0200 Subject: [PATCH 67/67] CI scripts: correct asterix USRP IP address --- ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml | 2 +- ci-scripts/xml_files/fr1_nsa_2x2_quectel_attach_detach.xml | 2 +- ci-scripts/xml_files/fr1_sa_oaiue_b200.xml | 2 +- ci-scripts/xml_files/fr1_sa_oaiue_n310.xml | 2 +- ci-scripts/xml_files/fr1_sa_oaiue_x300.xml | 2 +- ci-scripts/xml_files/fr1_sa_quectel.xml | 2 +- ci-scripts/xml_files/fr1_sa_quectel_162prb.xml | 2 +- ci-scripts/xml_files/fr1_sa_quectel_stages.xml | 2 +- ci-scripts/xml_files/fr1_sa_quectel_stages_162prb.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml index 5dbd36f00d..56694920ba 100644 --- a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml +++ b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml @@ -81,7 +81,7 @@ nr yes datalog_rt_stats.2x2.yaml - 192.168.18.240 + 192.168.18.252 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 02544f273b..840521481e 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 @@ -100,7 +100,7 @@ nr yes datalog_rt_stats.2x2.yaml - 192.168.18.240 + 192.168.18.252 diff --git a/ci-scripts/xml_files/fr1_sa_oaiue_b200.xml b/ci-scripts/xml_files/fr1_sa_oaiue_b200.xml index 774d5751c5..55268b909d 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.240 + 192.168.18.252 diff --git a/ci-scripts/xml_files/fr1_sa_oaiue_n310.xml b/ci-scripts/xml_files/fr1_sa_oaiue_n310.xml index bfa2208d3d..53b696c6eb 100644 --- a/ci-scripts/xml_files/fr1_sa_oaiue_n310.xml +++ b/ci-scripts/xml_files/fr1_sa_oaiue_n310.xml @@ -60,7 +60,7 @@ nr yes yes - 192.168.18.240 + 192.168.18.252 diff --git a/ci-scripts/xml_files/fr1_sa_oaiue_x300.xml b/ci-scripts/xml_files/fr1_sa_oaiue_x300.xml index c43bdd2a7c..8c2f7052e4 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.240 + 192.168.18.252 diff --git a/ci-scripts/xml_files/fr1_sa_quectel.xml b/ci-scripts/xml_files/fr1_sa_quectel.xml index 8d15015c07..576456ebc9 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.240 + 192.168.18.252 diff --git a/ci-scripts/xml_files/fr1_sa_quectel_162prb.xml b/ci-scripts/xml_files/fr1_sa_quectel_162prb.xml index f756083ea6..c5f2ddad5f 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.240 + 192.168.18.252 diff --git a/ci-scripts/xml_files/fr1_sa_quectel_stages.xml b/ci-scripts/xml_files/fr1_sa_quectel_stages.xml index 0ab8bf6b08..2707fd4ebf 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.240 + 192.168.18.252 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 5feed75586..661bcb32fe 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.240 + 192.168.18.252